aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt4
3 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index e93a42228..30164d8b1 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -244,7 +244,7 @@ object Commands {
registerCommand(
"shcopyitem",
"Copies information about the item in hand to the clipboard"
- ) { CopyItemCommand.command(it) }
+ ) { CopyItemCommand.command() }
registerCommand(
"shcopyparticles",
"Copied information about the particles that spawn in the next 50ms to the clipboard"
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
index cb7031f4b..06496036d 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
@@ -5,13 +5,12 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
-import net.minecraft.item.Item
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getMinecraftId
import net.minecraft.nbt.NBTTagCompound
-import net.minecraft.util.ResourceLocation
object CopyItemCommand {
- fun command(args: Array<String>) {
+ fun command() {
try {
val resultList = mutableListOf<String>()
val itemStack = InventoryUtils.getItemInHand() ?: return
@@ -19,10 +18,10 @@ object CopyItemCommand {
resultList.add("display name: '" + itemStack.displayName.toString() + "'")
val itemID = itemStack.getInternalName_old()
resultList.add("internalName: '$itemID'")
- resultList.add("minecraft id: '" + (Item.itemRegistry.getNameForObject(itemStack.item) as ResourceLocation) + "'")
- resultList.add("")
+ resultList.add("minecraft id: '" + itemStack.getMinecraftId() + "'")
+ resultList.add("lore:")
for (line in itemStack.getLore()) {
- resultList.add("'$line'")
+ resultList.add(" '$line'")
}
resultList.add("")
resultList.add("getTagCompound")
@@ -41,6 +40,7 @@ object CopyItemCommand {
private fun recurseTag(compound: NBTTagCompound, text: String, list: MutableList<String>) {
for (s in compound.keySet) {
+ if (s == "Lore") continue
val tag = compound.getTag(s)
if (tag !is NBTTagCompound) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
index 4be6dd30a..0dcc728c2 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
@@ -8,7 +8,9 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import com.google.gson.JsonObject
+import net.minecraft.item.Item
import net.minecraft.item.ItemStack
+import net.minecraft.util.ResourceLocation
import java.util.Locale
object SkyBlockItemModifierUtils {
@@ -180,6 +182,8 @@ object SkyBlockItemModifierUtils {
fun ItemStack.getItemId() = getAttributeString("id")
+ fun ItemStack.getMinecraftId() = Item.itemRegistry.getNameForObject(item) as ResourceLocation
+
fun ItemStack.getGemstones() = getExtraAttributes()?.let {
val list = mutableListOf<GemstoneSlot>()
for (attributes in it.keySet) {