diff options
author | HiZe_ <superhize@hotmail.com> | 2023-08-15 14:09:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-15 14:09:57 +0200 |
commit | 0f14d871c5202d4a5f43d1da6ce5e49d3aeadd2b (patch) | |
tree | 2700b683eec34951bda41ec0010536b8e3a7d246 /src/main/java/at | |
parent | 092373eac695c883207bfe04d72f209481d0ade9 (diff) | |
download | skyhanni-0f14d871c5202d4a5f43d1da6ce5e49d3aeadd2b.tar.gz skyhanni-0f14d871c5202d4a5f43d1da6ce5e49d3aeadd2b.tar.bz2 skyhanni-0f14d871c5202d4a5f43d1da6ce5e49d3aeadd2b.zip |
Merge pull request #386
* support for backpack and enderchest
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt index c89c28136..cced77692 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt @@ -1,7 +1,9 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.OtherMod import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue import at.hannibal2.skyhanni.utils.* @@ -21,6 +23,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color +import java.io.File class ChestValue { @@ -218,10 +221,20 @@ class ChestValue { COMPACT("Aligned") } - private fun String.isValidStorage() = Minecraft.getMinecraft().currentScreen is GuiChest && ((this == "Chest" || - this == "Large Chest") || + private fun String.isValidStorage() = Minecraft.getMinecraft().currentScreen is GuiChest && (( + this == "Chest" || + this == "Large Chest") || (contains("Minion") && !contains("Recipe") && LorenzUtils.skyBlockIsland == IslandType.PRIVATE_ISLAND) || - this == "Personal Vault") + this == "Personal Vault") || + ((contains("Backpack") && contains("Slot #") || startsWith("Ender Chest (")) + && !isNeuStorageEnabled()) + + private fun isNeuStorageEnabled(): Boolean { + val file = File(OtherMod.NEU.configPath) + if (!file.exists()) return false + return ConfigManager.gson.fromJson(APIUtil.readFile(File(OtherMod.NEU.configPath)), + com.google.gson.JsonObject::class.java)["storageGUI"].asJsonObject["enableStorageGUI3"].asBoolean + } private fun String.reduceStringLength(targetLength: Int, char: Char): String { @@ -247,7 +260,6 @@ class ChestValue { return currentString } - data class Item( val index: MutableList<Int>, var amount: Int, |