aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-16 12:11:17 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-16 12:11:17 +0200
commit2c66b795277876addffe1386e498fd1c0131218f (patch)
treedeccbe9e7fced46506a44873aa9adb02b9fcd8f1 /src/main/java
parent560cdada4b3577fb83c39c5cac62409093055103 (diff)
downloadskyhanni-2c66b795277876addffe1386e498fd1c0131218f.tar.gz
skyhanni-2c66b795277876addffe1386e498fd1c0131218f.tar.bz2
skyhanni-2c66b795277876addffe1386e498fd1c0131218f.zip
code cleanup
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt16
3 files changed, 16 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java
index c1456d770..bacdcd0d5 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java
@@ -71,14 +71,14 @@ public class DevConfig {
public boolean showItemUuid = false;
@Expose
- @ConfigOption(name = "Copy NBT Data", desc = "Copies NBT data on key press in a GUI")
+ @ConfigOption(name = "Copy Item Data", desc = "Copies item NBT data on key press in a GUI to clipboard.")
@ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE)
- public int copyNBTData = Keyboard.KEY_NONE;
+ public int copyItemData = Keyboard.KEY_NONE;
@Expose
- @ConfigOption(name = "Copy Compressed NBT Data", desc = "Copies compressed NBT data on key press in a GUI")
+ @ConfigOption(name = "Copy Compressed Item Data", desc = "Copies compressed item NBT data on key press in a GUI to clipboard.")
@ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE)
- public int copyNBTDataCompressed = Keyboard.KEY_NONE;
+ public int copyItemDataCompressed = Keyboard.KEY_NONE;
@Expose
@ConfigOption(name = "Copy RNG Meter", desc = "Copies internal names and maxed XP needed from RNG meter inventories as json to clipboard.")
diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt
index 3f14885c3..f682c1a61 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt
@@ -1,8 +1,8 @@
package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.test.command.CopyItemCommand.copyItemToClipboard
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
+import at.hannibal2.skyhanni.test.command.CopyItemCommand.copyItemToClipboard
import at.hannibal2.skyhanni.utils.ItemStackTypeAdapterFactory
import at.hannibal2.skyhanni.utils.KSerializable
import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
@@ -52,17 +52,16 @@ object TestExportTools {
@SubscribeEvent
fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent.Post) {
- if (!config.copyNBTDataCompressed.isKeyHeld() && !config.copyNBTData.isKeyHeld()) return
+ if (!config.copyItemDataCompressed.isKeyHeld() && !config.copyItemData.isKeyHeld()) return
val gui = event.gui as? GuiContainer ?: return
- val focussedSlot = gui.slotUnderMouse ?: return
- val stack = focussedSlot.stack ?: return
- if (config.copyNBTData.isKeyHeld()) {
+ val stack = gui.slotUnderMouse?.stack ?: return
+ if (config.copyItemData.isKeyHeld()) {
copyItemToClipboard(stack)
return
}
val json = toJson(Item, stack)
OSUtils.copyToClipboard(json)
- LorenzUtils.chat("Copied test importable to clipboard")
+ LorenzUtils.chat("§e[SkyHanni] Compressed item info copied into 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 f3d0d80ef..f0b2c8ae1 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
@@ -1,7 +1,7 @@
package at.hannibal2.skyhanni.test.command
import at.hannibal2.skyhanni.utils.InventoryUtils
-import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
@@ -12,12 +12,12 @@ import net.minecraft.nbt.NBTTagCompound
object CopyItemCommand {
fun command() {
- try {
- val itemStack = InventoryUtils.getItemInHand() ?: throw Exception()
- copyItemToClipboard(itemStack)
- } catch (_: Throwable) {
+ val itemStack = InventoryUtils.getItemInHand()
+ if (itemStack == null) {
LorenzUtils.chat("§c[SkyHanni] No item in hand!")
+ return
}
+ copyItemToClipboard(itemStack)
}
private fun recurseTag(compound: NBTTagCompound, text: String, list: MutableList<String>) {
@@ -35,12 +35,10 @@ object CopyItemCommand {
}
}
- fun copyItemToClipboard(itemStack: ItemStack){
+ fun copyItemToClipboard(itemStack: ItemStack) {
val resultList = mutableListOf<String>()
- resultList.add("ITEM LORE")
+ resultList.add(itemStack.getInternalName().toString())
resultList.add("display name: '" + itemStack.displayName.toString() + "'")
- val itemID = itemStack.getInternalName_old()
- resultList.add("internalName: '$itemID'")
resultList.add("minecraft id: '" + itemStack.getMinecraftId() + "'")
resultList.add("lore:")
for (line in itemStack.getLore()) {