diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/Features.java | 10 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java (renamed from src/main/java/at/hannibal2/skyhanni/config/features/Items.java) | 7 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/inventory/anvil/AnvilCombineHelper.kt | 83 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/items/HideNotClickableItems.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/items/ItemDisplayOverlayFeatures.kt | 14 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/ItemAbilityCooldown.kt | 2 |
7 files changed, 102 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 1f63c54ac..2e5aa8cff 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.config.gui.commands.Commands; import at.hannibal2.skyhanni.dungeon.*; import at.hannibal2.skyhanni.dungeon.damageindicator.DungeonBossDamageIndicator; import at.hannibal2.skyhanni.fishing.TrophyFishMessages; +import at.hannibal2.skyhanni.inventory.anvil.AnvilCombineHelper; import at.hannibal2.skyhanni.items.HideNotClickableItems; import at.hannibal2.skyhanni.items.ItemDisplayOverlayFeatures; import at.hannibal2.skyhanni.items.abilitycooldown.ItemAbilityCooldown; @@ -71,6 +72,7 @@ public class SkyHanniMod { MinecraftForge.EVENT_BUS.register(new DungeonBossMessages()); MinecraftForge.EVENT_BUS.register(new TrophyFishMessages()); MinecraftForge.EVENT_BUS.register(new BazaarBestSellMethod()); + MinecraftForge.EVENT_BUS.register(new AnvilCombineHelper()); Commands.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 990bbae5c..a45ad3abd 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -62,8 +62,8 @@ public class Features { public Dungeon dungeon = new Dungeon(); @Expose - @Category(name = "Items", desc = "Changing the behavior around items and the inventory.") - public Items items = new Items(); + @Category(name = "Inventory", desc = "Changing the behavior around items and the inventory.") + public Inventory inventory = new Inventory(); @Expose @Category(name = "Bazaar", desc = "Bazaar settings.") @@ -84,10 +84,4 @@ public class Features { @Expose @Category(name = "Debug", desc = "Debug and test stuff.") public Debug debug = new Debug(); - - - - - - } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Items.java b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java index 2c172aa9f..eddb9fe15 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Items.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigEditorBool import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigOption; import com.google.gson.annotations.Expose; -public class Items { +public class Inventory { @Expose @ConfigOption(name = "Not Clickable Items", desc = "Hide items that are not clickable in " + "the current inventory: ah, bz, accessory bag, etc") @@ -63,4 +63,9 @@ public class Items { @ConfigOption(name = "Ability Cooldown", desc = "Show the cooldown of item abilities.") @ConfigEditorBoolean public boolean itemAbilityCooldown = false; + + @Expose + @ConfigOption(name = "Anvil Combine Helper", desc = "Suggests the same item in the inventory when trying to combine two items in the anvil.") + @ConfigEditorBoolean + public boolean anvilCombineHelper = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/inventory/anvil/AnvilCombineHelper.kt b/src/main/java/at/hannibal2/skyhanni/inventory/anvil/AnvilCombineHelper.kt new file mode 100644 index 000000000..03405090b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/inventory/anvil/AnvilCombineHelper.kt @@ -0,0 +1,83 @@ +package at.hannibal2.skyhanni.inventory.anvil + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.highlight +import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.inventory.ContainerChest +import net.minecraft.item.ItemStack +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import org.lwjgl.opengl.GL11 + +class AnvilCombineHelper { + + @SubscribeEvent + fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { + if (!LorenzUtils.inSkyblock) return + if (!SkyHanniMod.feature.inventory.anvilCombineHelper) return + + if (event.gui !is GuiChest) return + val guiChest = event.gui + val chest = guiChest.inventorySlots as ContainerChest + val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + + if (chestName != "Anvil") return + + val matchLore = mutableListOf<String>() +// var compareItem: ItemStack? = null + + for (slot in chest.inventorySlots) { + if (slot == null) continue + + if (slot.slotNumber != slot.slotIndex) continue + if (slot.stack == null) continue + + if (slot.slotNumber == 29) { +// slot highlight LorenzColor.GREEN + val lore = slot.stack.getLore() +// compareItem = slot.stack + matchLore.addAll(lore) + break +// } else if (slot.slotIndex == 29) { +// slot highlight LorenzColor.YELLOW + } + } + + val lightingState = GL11.glIsEnabled(GL11.GL_LIGHTING) + GlStateManager.disableLighting() + GlStateManager.color(1f, 1f, 1f, 1f) + + if (matchLore.isEmpty()) return + + for (slot in chest.inventorySlots) { + if (slot == null) continue + + if (slot.slotNumber == slot.slotIndex) continue + if (slot.stack == null) continue + + + if (matchLore == slot.stack.getLore()) { + slot highlight LorenzColor.GREEN + } + +// if (compareItem == slot.stack) { +// slot highlight LorenzColor.GREEN +// } else if (compareItem.metadata == slot.stack.metadata) { +// slot highlight LorenzColor.YELLOW +// } + +// if (slot.slotNumber == 3) { +//// slot highlight LorenzColor.GREEN +//// } else if (slot.slotIndex == 4) { +//// slot highlight LorenzColor.YELLOW +//// } +// } + + if (lightingState) GlStateManager.enableLighting() + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/items/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/items/HideNotClickableItems.kt index 97eefe1ab..57b727791 100644 --- a/src/main/java/at/hannibal2/skyhanni/items/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/items/HideNotClickableItems.kt @@ -164,7 +164,7 @@ class HideNotClickableItems { private fun isDisabled(): Boolean { if (bypassUntil > System.currentTimeMillis()) return true - return !SkyHanniMod.feature.items.hideNotClickableItems + return !SkyHanniMod.feature.inventory.hideNotClickableItems } private fun hide(chestName: String, stack: ItemStack): Boolean { diff --git a/src/main/java/at/hannibal2/skyhanni/items/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/items/ItemDisplayOverlayFeatures.kt index d5054ae47..6a3f7688c 100644 --- a/src/main/java/at/hannibal2/skyhanni/items/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/items/ItemDisplayOverlayFeatures.kt @@ -42,7 +42,7 @@ class ItemDisplayOverlayFeatures { private fun getStackTip(item: ItemStack): String { val name = item.cleanName() - if (SkyHanniMod.feature.items.displayMasterStarNumber) { + if (SkyHanniMod.feature.inventory.displayMasterStarNumber) { when (name) { "First Master Star" -> return "1" "Second Master Star" -> return "2" @@ -52,13 +52,13 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.items.displayMasterSkullNumber) { + if (SkyHanniMod.feature.inventory.displayMasterSkullNumber) { if (name.matchRegex("(.*)Master Skull - Tier .")) { return name.substring(name.length - 1) } } - if (SkyHanniMod.feature.items.displayDungeonHeadFloor) { + if (SkyHanniMod.feature.inventory.displayDungeonHeadFloor) { if (name.contains("Golden ") || name.contains("Diamond ")) { when { name.contains("Bonzo") -> return "1" @@ -72,13 +72,13 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.items.displayNewYearCakeNumber) { + if (SkyHanniMod.feature.inventory.displayNewYearCakeNumber) { if (name.startsWith("New Year Cake (")) { return "§b" + name.between("(Year ", ")") } } - if (SkyHanniMod.feature.items.displayPetLevel) { + if (SkyHanniMod.feature.inventory.displayPetLevel) { if (ItemUtils.isPet(name)) { val level = name.between("Lvl ", "] ").toInt() if (level != ItemUtils.maxPetLevel(name)) { @@ -87,7 +87,7 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.items.displaySackName) { + if (SkyHanniMod.feature.inventory.displaySackName) { if (ItemUtils.isSack(name)) { //TODO fix this and replace other // val sackName = grabSackName(name) @@ -97,7 +97,7 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.items.displayMinionTier) { + if (SkyHanniMod.feature.inventory.displayMinionTier) { if (name.contains(" Minion ")) { if (item.getLore().any { it.contains("Place this minion") }) { val array = name.split(" ") diff --git a/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/ItemAbilityCooldown.kt index 708b81693..726c3172f 100644 --- a/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/ItemAbilityCooldown.kt @@ -53,7 +53,7 @@ class ItemAbilityCooldown { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.items.itemAbilityCooldown + return LorenzUtils.inSkyblock && SkyHanniMod.feature.inventory.itemAbilityCooldown } private fun click(ability: Ability) { |