aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-27 13:19:09 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-27 13:19:09 +0200
commit33235af9cb859e2f52672d6b5f2ac5104a6046d5 (patch)
tree9936c269bef0380173072ffb00367714bf63dd41 /src/main/java
parenta44214f2d62ef45b44f6da057be37a276ccdce76 (diff)
downloadskyhanni-33235af9cb859e2f52672d6b5f2ac5104a6046d5.tar.gz
skyhanni-33235af9cb859e2f52672d6b5f2ac5104a6046d5.tar.bz2
skyhanni-33235af9cb859e2f52672d6b5f2ac5104a6046d5.zip
code cleanup
Diffstat (limited to 'src/main/java')
-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) {