From 245e1303b1d29ca373509d8190ae20366d5cf2ff Mon Sep 17 00:00:00 2001 From: Lorenz Date: Fri, 15 Jul 2022 23:59:52 +0200 Subject: added /ii item info command --- .../java/at/hannibal2/skyhanni/test/LorenzTest.kt | 78 +++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2/skyhanni/test') diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index 9cde01cc6..ad6a29443 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -1,10 +1,16 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import at.hannibal2.skyhanni.utils.GuiRender.renderString +import at.hannibal2.skyhanni.utils.ItemUtil +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.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class LorenzTest { @@ -15,6 +21,76 @@ class LorenzTest { var text = "" 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 = ItemUtil.getSkyBlockItemID(itemStack) + print("itemID: '$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) { + val element = compound.getCompoundTag(s) + runn(element, "$text ") + } + } + + private fun print(text: String) { + LorenzDebug.log(text) + } } @SubscribeEvent -- cgit