aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-22 02:32:27 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-22 02:32:27 +0200
commit1021280302d684071a9bde3cf274a16913eb48ec (patch)
tree43acec5e4ef3eab725ef11ee3ad39dfe673cf8a5
parentad946bccdb1dd666f2648434ed3653eaf0b137a1 (diff)
downloadskyhanni-1021280302d684071a9bde3cf274a16913eb48ec.tar.gz
skyhanni-1021280302d684071a9bde3cf274a16913eb48ec.tar.bz2
skyhanni-1021280302d684071a9bde3cf274a16913eb48ec.zip
removed /ii and created /copyitem
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/gui/commands/Commands.java16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/gui/utils/Utils.java71
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt62
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt48
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt (renamed from src/main/java/at/hannibal2/skyhanni/test/CopyNearbyEntitiesCommand.kt)6
5 files changed, 68 insertions, 135 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/gui/commands/Commands.java b/src/main/java/at/hannibal2/skyhanni/config/gui/commands/Commands.java
index cf2271eb9..17609296e 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/gui/commands/Commands.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/gui/commands/Commands.java
@@ -3,8 +3,9 @@ package at.hannibal2.skyhanni.config.gui.commands;
import at.hannibal2.skyhanni.SkyHanniMod;
import at.hannibal2.skyhanni.config.gui.config.ConfigEditor;
import at.hannibal2.skyhanni.config.gui.core.GuiScreenElementWrapper;
-import at.hannibal2.skyhanni.test.CopyNearbyEntitiesCommand;
import at.hannibal2.skyhanni.test.LorenzTest;
+import at.hannibal2.skyhanni.test.command.CopyItemCommand;
+import at.hannibal2.skyhanni.test.command.CopyNearbyEntitiesCommand;
import net.minecraft.command.ICommandSender;
import net.minecraftforge.client.ClientCommandHandler;
import org.apache.commons.lang3.StringUtils;
@@ -46,33 +47,32 @@ public class Commands {
}
)
);
-
ClientCommandHandler.instance.registerCommand(
new SimpleCommand(
- "ii",
+ "testhanni",
new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
- LorenzTest.Companion.printLore();
+ LorenzTest.Companion.testCommand(args);
}
}
)
);
ClientCommandHandler.instance.registerCommand(
new SimpleCommand(
- "testhanni",
+ "copyentities",
new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
- LorenzTest.Companion.testCommand(args);
+ CopyNearbyEntitiesCommand.INSTANCE.command(args);
}
}
)
);
ClientCommandHandler.instance.registerCommand(
new SimpleCommand(
- "copyentities",
+ "copyitem",
new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
- CopyNearbyEntitiesCommand.INSTANCE.command(args);
+ CopyItemCommand.INSTANCE.command(args);
}
}
)
diff --git a/src/main/java/at/hannibal2/skyhanni/config/gui/utils/Utils.java b/src/main/java/at/hannibal2/skyhanni/config/gui/utils/Utils.java
index 6b5bb8097..51ffd0c8d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/gui/utils/Utils.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/gui/utils/Utils.java
@@ -1,13 +1,5 @@
package at.hannibal2.skyhanni.config.gui.utils;
-import java.awt.*;
-import java.awt.datatransfer.StringSelection;
-import java.math.RoundingMode;
-import java.nio.FloatBuffer;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.util.LinkedList;
-import java.util.Locale;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
@@ -26,6 +18,15 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
+import java.awt.*;
+import java.awt.datatransfer.StringSelection;
+import java.math.RoundingMode;
+import java.nio.FloatBuffer;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.LinkedList;
+import java.util.Locale;
+
public class Utils {
private static final LinkedList<Integer> guiScales = new LinkedList<>();
@@ -70,60 +71,6 @@ public class Utils {
return tag != null && tag.hasKey("drill_fuel");
}
- public static int whatRomanNumeral(String roman) {
- switch (roman.toLowerCase()) {
- case "i":
- return 1;
- case "ii":
- return 2;
- case "iii":
- return 3;
- case "iv":
- return 4;
- case "v":
- return 5;
- case "vi":
- return 6;
- case "vii":
- return 7;
- case "viii":
- return 8;
- case "ix":
- return 9;
- case "x":
- return 10;
- default:
- return 0;
- }
- }
-
- public static String intToRomanNumeral(int i) {
- switch (i) {
- case 1:
- return "I";
- case 2:
- return "II";
- case 3:
- return "III";
- case 4:
- return "IV";
- case 5:
- return "V";
- case 6:
- return "VI";
- case 7:
- return "VII";
- case 8:
- return "VIII";
- case 9:
- return "IX";
- case 10:
- return "X";
- default:
- return "";
- }
- }
-
public static boolean overlayShouldRender(RenderGameOverlayEvent.ElementType type, boolean... booleans) {
return overlayShouldRender(false, type, RenderGameOverlayEvent.ElementType.HOTBAR, booleans);
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
index d6f90d7b0..e628ec124 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
@@ -3,12 +3,8 @@ package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.utils.GuiRender.renderString
-import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
-import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzDebug
import at.hannibal2.skyhanni.utils.LorenzLogger
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import net.minecraft.client.Minecraft
import net.minecraft.nbt.NBTTagCompound
import net.minecraft.network.play.server.S0EPacketSpawnObject
import net.minecraft.network.play.server.S0FPacketSpawnMob
@@ -28,64 +24,6 @@ class LorenzTest {
val debugLogger = LorenzLogger("debug/test")
- fun printLore() {
- try {
- val itemStack = Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem()!!
- print("===")
- print("ITEM LORE")
- print("display name: '" + itemStack.displayName.toString() + "'")
- val itemID = itemStack.getInternalName()
- print("internalName: '$itemID'")
-// val rarity: ItemRarityOld = ItemUtils.getRarity(itemStack)
-// print("rarity: '$rarity'")
- print("")
- for (line in itemStack.getLore()) {
- print("'$line'")
- println(line)
- }
- print("")
- print("getTagCompound")
- if (itemStack.hasTagCompound()) {
- val tagCompound = itemStack.tagCompound
- for (s in tagCompound.keySet) {
- print(" '$s'")
- }
- if (tagCompound.hasKey("ExtraAttributes")) {
- print("")
- print("ExtraAttributes")
- val extraAttributes = tagCompound.getCompoundTag("ExtraAttributes")
-// for (s in extraAttributes.keySet) {
-// print(" '$s'")
-// }
-// if (extraAttributes.hasKey("enchantments")) {
-// print("")
-// print("enchantments")
-// val enchantments = extraAttributes.getCompoundTag("enchantments")
-// for (s in enchantments.keySet) {
-// val level = enchantments.getInteger(s)
-// print(" '$s' = $level")
-// }
-// }
-// if (extraAttributes.hasKey("modifier")) {
-// print("")
-// print("modifier")
-// val enchantments = extraAttributes.getCompoundTag("modifier")
-// for (s in enchantments.keySet) {
-// print(" '$s'")
-// }
-// }
-
- runn(extraAttributes, " . ")
- }
- }
- print("")
- print("===")
- LorenzUtils.debug("item info printed!")
- } catch (_: Throwable) {
- LorenzUtils.error("Hold an item in the hand to see its item infos!")
- }
- }
-
fun runn(compound: NBTTagCompound, text: String) {
print("$text'$compound'")
for (s in compound.keySet) {
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
new file mode 100644
index 000000000..854ab26eb
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
@@ -0,0 +1,48 @@
+package at.hannibal2.skyhanni.test.command
+
+import at.hannibal2.skyhanni.config.gui.utils.Utils
+import at.hannibal2.skyhanni.test.LorenzTest
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.client.Minecraft
+
+object CopyItemCommand {
+
+ fun command(args: Array<String>) {
+ try {
+ val resultList = mutableListOf<String>()
+ val itemStack = Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem()!!
+ resultList.add("ITEM LORE")
+ resultList.add("display name: '" + itemStack.displayName.toString() + "'")
+ val itemID = itemStack.getInternalName()
+ resultList.add("internalName: '$itemID'")
+ resultList.add("")
+ for (line in itemStack.getLore()) {
+ resultList.add("'$line'")
+ println(line)
+ }
+ resultList.add("")
+ resultList.add("getTagCompound")
+ if (itemStack.hasTagCompound()) {
+ val tagCompound = itemStack.tagCompound
+ for (s in tagCompound.keySet) {
+ resultList.add(" '$s'")
+ }
+ if (tagCompound.hasKey("ExtraAttributes")) {
+ resultList.add("")
+ resultList.add("ExtraAttributes")
+ val extraAttributes = tagCompound.getCompoundTag("ExtraAttributes")
+ LorenzTest.runn(extraAttributes, " . ")
+ }
+ }
+
+ val string = resultList.joinToString("\n")
+ Utils.copyToClipboard(string)
+ LorenzUtils.debug("item info printed!")
+ LorenzUtils.chat("§e[SkyHanni] item info copied into the clipboard!")
+ } catch (_: Throwable) {
+ LorenzUtils.chat("§c[SkyHanni] No item in hand!")
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/test/CopyNearbyEntitiesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt
index 262d5892e..c5a05d94a 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/CopyNearbyEntitiesCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt
@@ -1,4 +1,4 @@
-package at.hannibal2.skyhanni.test
+package at.hannibal2.skyhanni.test.command
import at.hannibal2.skyhanni.config.gui.utils.Utils
import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
@@ -96,9 +96,9 @@ object CopyNearbyEntitiesCommand {
if (counter != 0) {
val string = resultList.joinToString("\n")
Utils.copyToClipboard(string)
- LorenzUtils.chat("§e$counter entities copied into the clipboard!")
+ LorenzUtils.chat("§e[SkyHanni] $counter entities copied into the clipboard!")
} else {
- LorenzUtils.chat("§eNo entities found in a search radius of $searchRadius!")
+ LorenzUtils.chat("§e[SkyHanni] No entities found in a search radius of $searchRadius!")
}
}
} \ No newline at end of file