diff options
author | Lorenz <ESs95s3P5z8Pheb> | 2022-07-23 14:13:50 +0200 |
---|---|---|
committer | Lorenz <ESs95s3P5z8Pheb> | 2022-07-23 14:13:50 +0200 |
commit | 1dda2149ffbfb4e57caca8830edbb59dd3801631 (patch) | |
tree | 9496aad84ba698a6a13dc7c4f4aacaeb8b8fe559 | |
parent | ed493ed013e30897ce08506ebec1949fa8f814db (diff) | |
download | skyhanni-1dda2149ffbfb4e57caca8830edbb59dd3801631.tar.gz skyhanni-1dda2149ffbfb4e57caca8830edbb59dd3801631.tar.bz2 skyhanni-1dda2149ffbfb4e57caca8830edbb59dd3801631.zip |
fixed that the "hide not clickable items" feature modifies the lore of the item list from neu
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/items/HideNotClickableItems.kt | 1 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/items/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/items/HideNotClickableItems.kt index 57b727791..8a8088c34 100644 --- a/src/main/java/at/hannibal2/skyhanni/items/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/items/HideNotClickableItems.kt @@ -121,6 +121,7 @@ class HideNotClickableItems { val stack = event.itemStack if (ItemUtils.getItemsInOpenChest().contains(stack)) return + if (!ItemUtils.getItemsInInventory().contains(stack)) return if (hide(chestName, stack)) { val first = event.toolTip[0] diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index d97148242..8a822d7b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -7,6 +7,7 @@ import com.google.gson.JsonObject import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.item.ItemStack +import java.util.LinkedList object ItemUtils { @@ -54,6 +55,30 @@ object ItemUtils { fun maxPetLevel(name: String) = if (name.contains("Golden Dragon")) 200 else 100 + fun getItemsInInventory(withCursorItem: Boolean = false): List<ItemStack> { + val list: LinkedList<ItemStack> = LinkedList() + val player = Minecraft.getMinecraft().thePlayer + if (player == null) { + LorenzUtils.warning("getItemsInInventoryWithSlots: player is null!") + return list + } + for (slot in player.openContainer.inventorySlots) { + if (slot.hasStack) { + list.add(slot.stack) + } + } + + if (withCursorItem) { + if (player.inventory != null) { + if (player.inventory.itemStack != null) { + list.add(player.inventory.itemStack) + } + } + } + + return list + } + fun getItemsInInventoryWithSlots(withCursorItem: Boolean = false): Map<ItemStack, Int> { val map: LinkedHashMap<ItemStack, Int> = LinkedHashMap() val player = Minecraft.getMinecraft().thePlayer |