diff options
Diffstat (limited to 'src/main')
5 files changed, 10 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt index be6672d78..397231258 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt @@ -46,17 +46,15 @@ class GardenComposterInventoryFeatures { if (next) { if (line.endsWith(" Copper")) continue if (line == "") break - val pair = ItemUtils.readItemAmount(line) - if (pair == null) { + val (itemName, amount) = ItemUtils.readItemAmount(line) ?: run { LorenzUtils.error("Could not read item '$line'") continue } - val (itemName, amount) = pair val internalName = NEUItems.getInternalNameOrNull(itemName) if (internalName == null) { LorenzUtils.error( "Error reading internal name for item '$itemName§c' " + - "(in GardenComposterInventoryFeatures)" + "(in GardenComposterInventoryFeatures)" ) continue } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt index 20ce1a1b3..29fe278ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt @@ -9,7 +9,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName -import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.SoundUtils import io.github.moulberry.notenoughupdates.util.MinecraftExecutor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -30,19 +29,20 @@ class WildStrawberryDyeNotification { if (!GardenAPI.inGarden()) return if (!SkyHanniMod.feature.garden.wildStrawberryDyeNotification) return + val itemStack = event.itemStack MinecraftExecutor.OnThread.execute { // Prevent false positives when buying the item in ah or moving it from a storage val diff = System.currentTimeMillis() - lastCloseTime if (diff < 1_000) return@execute - val internalName = event.itemStack.getInternalName() + val internalName = itemStack.getInternalName() if (internalName == item) { - val name = event.itemStack.name!! + val name = itemStack.name!! LorenzUtils.sendTitle(name, 5.seconds) LorenzUtils.chat("You found a $name§e!") SoundUtils.playBeepSound() - ItemBlink.setBlink(NEUItems.getItemStackOrNull("DYE_WILD_STRAWBERRY"), 5_000) + ItemBlink.setBlink(itemStack, 5_000) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt index 49b5982de..a60b0f0d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt @@ -11,6 +11,7 @@ object TestChatCommand { LorenzUtils.userError("Specify a chat message to test!") return } + val hidden = args.last() == "-s" var rawMessage = args.toList().joinToString(" ") if (!hidden) LorenzUtils.chat("Testing message: §7$rawMessage", prefixColor = "§a") diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 0028b8e38..205726743 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -75,7 +75,7 @@ object ItemUtils { } if (withCursorItem && player.inventory != null && player.inventory.itemStack != null) { - list.add(player.inventory.itemStack) + list.add(player.inventory.itemStack) } return list } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 683b64c3a..52175ec56 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -335,8 +335,8 @@ object LorenzUtils { text.chatStyle.chatHoverEvent = HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText(hover.joinToString("\n"))) - if (command != null) { - text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/${command.removePrefix("/")}") + command?.let { + text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/${it.removePrefix("/")}") } Minecraft.getMinecraft().thePlayer.addChatMessage(text) |