From 9d690cc976046e6d5defc404eb73386a1990e2db Mon Sep 17 00:00:00 2001 From: Lorenz Date: Mon, 12 Sep 2022 00:01:31 +0200 Subject: edited features order and made better wording --- CHANGELOG.md | 12 +- FEATURES.md | 29 +- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 13 +- .../at/hannibal2/skyhanni/config/Features.java | 14 +- .../skyhanni/config/features/Abilities.java | 73 ---- .../skyhanni/config/features/Inventory.java | 3 +- .../skyhanni/config/features/ItemAbilities.java | 37 ++ .../hannibal2/skyhanni/config/features/Misc.java | 10 - .../hannibal2/skyhanni/config/features/Slayer.java | 18 + .../skyhanni/config/features/Summonings.java | 43 +++ .../hannibal2/skyhanni/data/VanillaItemManager.kt | 53 +++ .../skyhanni/features/FireVeilWandParticles.kt | 64 ---- .../skyhanni/features/SummoningMobManager.kt | 209 ---------- .../skyhanni/features/SummoningSoulsName.kt | 132 ------- .../features/inventory/HideNotClickableItems.kt | 419 +++++++++++++++++++++ .../inventory/ItemDisplayOverlayFeatures.kt | 120 ++++++ .../skyhanni/features/inventory/ItemStars.kt | 150 ++++++++ .../features/inventory/RngMeterInventory.kt | 91 +++++ .../itemabilities/FireVeilWandParticles.kt | 64 ++++ .../abilitycooldown/ItemAbilityCooldown.kt | 214 +++++++++++ .../abilitycooldown/WitherImpactDetection.kt | 74 ++++ .../features/items/HideNotClickableItems.kt | 418 -------------------- .../features/items/ItemDisplayOverlayFeatures.kt | 120 ------ .../hannibal2/skyhanni/features/items/ItemStars.kt | 150 -------- .../skyhanni/features/items/RngMeterInventory.kt | 91 ----- .../skyhanni/features/items/VanillaItemManager.kt | 53 --- .../items/abilitycooldown/ItemAbilityCooldown.kt | 214 ----------- .../items/abilitycooldown/WitherImpactDetection.kt | 74 ---- .../features/slayer/EndermanSlayerBeacon.kt | 2 +- .../features/slayer/HighlightSlayerMiniboss.kt | 2 +- .../features/summonings/SummoningMobManager.kt | 209 ++++++++++ .../features/summonings/SummoningSoulsName.kt | 132 +++++++ 32 files changed, 1667 insertions(+), 1640 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/ItemAbilities.java create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/Summonings.java create mode 100644 src/main/java/at/hannibal2/skyhanni/data/VanillaItemManager.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/WitherImpactDetection.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/items/HideNotClickableItems.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/items/ItemDisplayOverlayFeatures.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/items/ItemStars.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/items/VanillaItemManager.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/ItemAbilityCooldown.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/WitherImpactDetection.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index e83c7c1fe..73dcd5fd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,14 +24,14 @@ ### New Dungeon Features - Added highlight deathmites in dungeon in red color -- Added hide Superboom TNT laying around in dungeon -- Added hide Blessings laying around in dungeon -- Added hide Revive Stones laying around in dungeon -- Added hide Premium Flesh laying around in dungeon +- Added hide Superboom TNT lying around in dungeon +- Added hide Blessings lying around in dungeon +- Added hide Revive Stones lying around in dungeon +- Added hide Premium Flesh lying around in dungeon - Added Dungeon Copilot (Suggests to you what to do next in dungeon) - Added separate option to hide dungeon key pickup and door open messages -- Added hide Journal Entry pages laying around in dungeon. -- Added hide Skeleton Skulls laying around in dungeon. +- Added hide Journal Entry pages lying around in dungeon. +- Added hide Skeleton Skulls lying around in dungeon. - Added highlight Skeleton Skulls in dungeon when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull) diff --git a/FEATURES.md b/FEATURES.md index 91d0df789..6f958e7f3 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -1,7 +1,8 @@ # SkyHanni - List of all Features +> Use '/skyhanni or /sh to open the SkyHanni config in game + ## Commands -- /skyhanni or /sh (opening the SkyHanni config in game) - /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki) - /shmarkplayer (marking a player with yellow color) @@ -13,13 +14,11 @@ - Many other messages (Not separated into own categories yet) ## Chat -- Options to change the player chat format (show all channel prefix, hide player rank, hide colon after player name, hide/change elite position format, channel prefix design +- Options to change the player chat format (show prefix for channel 'all', hide player rank color, hide colon after player name, hide/change SkyBlock level format, hide/change elite position format, edit channel prefix design) - Using a clean chat format for player messages (removing the rank prefix, every player writes in the same color) - Dungeon Filter (Removing annoying messages from in the dungeon) - Dungeon Boss Message hider (includes The Watcher as well) -- Option to hide the Skyblock Level from the chat messages. -- Option to change the way the Skyblock Level gets displayed in the chat (only working when skyblock level and fancy player message format are enabled) -- Option to hide the death messages of other players, except for players who are close to the player, inside dungeon or during a Kuudra fight. +- Option to hide the death messages of other players, except for players who are close to the player, inside the dungeon or during a Kuudra fight. ## Dungeon - Clicked Blocks (Showing the block behind walls AFTER clicked on a chest, wither essence or a lever) @@ -29,15 +28,15 @@ - Option to exclude guardians in F3 and M3 from the clean end feature (only when sneaking) - Hiding damage splashes while inside the boss room (replacing a broken feature from Skytils) - Highlight deathmites in red color. -- Hide Superboom TNT laying around in dungeon. -- Hide Blessings laying around in dungeon. -- Hide Revive Stones laying around in dungeon. -- Hide Premium Flesh laying around in dungeon. -- Hide Journal Entry pages laying around in dungeon. +- Hide Superboom TNT lying around in dungeon. +- Hide Blessings lying around in dungeon. +- Hide Revive Stones lying around in dungeon. +- Hide Premium Flesh lying around in dungeon. +- Hide Journal Entry pages lying around in dungeon. - Dungeon Copilot (Suggests to you what to do next in dungeon) - Option to hide key pickup and door open messages in dungeon. -- Hide Skeleton Skulls laying around in dungeon. -- Highlight Skeleton Skulls in dungeon when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull) +- Hide Skeleton Skulls lying around in dungeon. +- Highlight Skeleton Skulls in the dungeon when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull) ## Inventory - Not Clickable Items: Mark items gray in your inventory when they are not supposed to be moved in certain GUIs (in NPC sell inventories, ender chests and backpacks, salvaging in dungeon hub, player trade, bazaar, action house, accessory bag, sack of sacks, fishing bag, potion bag, chests on the private island, attribute fusion and equipment GUI) @@ -52,10 +51,10 @@ - Show the cooldown of items in the inventory. - Option to change the item background according to the cooldown. - Hiding the flame particles when using the Fire Veil Wand ability. -- Circle around the player when having the Fire Veil Wand ability is running. +- Circle around the player when having the Fire Veil Wand ability active. ## Summoning Mobs -- Summoning Soul Display (Show the name of dropped soul laying on the ground, not working in dungeon when Skytils' "Hide Non-Starred Mobs Nametags" is enabled) +- Summoning Soul Display (Show the name of dropped soul lying on the ground, not working in dungeon when Skytils' "Hide Non-Starred Mobs Nametags" is enabled) - Option to hide the nametag of your spawned summoning mobs. - Option to mark the own summoning mobs in green. - Summoning Mob Display (Show the health of your spawned summoning mobs listed in an extra GUI element and hiding the corresponding spawning/despawning chat messages) @@ -63,7 +62,7 @@ ## Ashfang - Show a cooldown when the player gets an ability block effect during the ashfang fight. -- Show a timer until ashfang is going to pull his minions back to him. +- Display a timer until Ashfang brings his underlings back to him. - Ashfang Gravity Orbs display. - Ashfang Blazing Souls display. - Highlight the different ashfang blazes in their respective color. diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index f44020e4b..b545c7c22 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -18,15 +18,18 @@ import at.hannibal2.skyhanni.features.end.VoidlingExtremistColor; import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager; import at.hannibal2.skyhanni.features.fishing.SeaCreatureMessageShortener; import at.hannibal2.skyhanni.features.fishing.TrophyFishMessages; -import at.hannibal2.skyhanni.features.items.HideNotClickableItems; -import at.hannibal2.skyhanni.features.items.ItemDisplayOverlayFeatures; -import at.hannibal2.skyhanni.features.items.ItemStars; -import at.hannibal2.skyhanni.features.items.RngMeterInventory; -import at.hannibal2.skyhanni.features.items.abilitycooldown.ItemAbilityCooldown; +import at.hannibal2.skyhanni.features.inventory.HideNotClickableItems; +import at.hannibal2.skyhanni.features.inventory.ItemDisplayOverlayFeatures; +import at.hannibal2.skyhanni.features.inventory.ItemStars; +import at.hannibal2.skyhanni.features.inventory.RngMeterInventory; +import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles; +import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown; import at.hannibal2.skyhanni.features.minion.MinionFeatures; import at.hannibal2.skyhanni.features.nether.ashfang.*; import at.hannibal2.skyhanni.features.slayer.EndermanSlayerBeacon; import at.hannibal2.skyhanni.features.slayer.HighlightSlayerMiniboss; +import at.hannibal2.skyhanni.features.summonings.SummoningMobManager; +import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName; import at.hannibal2.skyhanni.test.LorenzTest; import at.hannibal2.skyhanni.utils.MinecraftConsoleFilter; import net.minecraft.client.Minecraft; diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 8688ab603..3495e4d96 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -77,7 +77,7 @@ public class Features extends Config { } if (runnableId.equals("summoningMobDisplay")) { - editOverlay(activeConfigCategory, 200, 16, abilities.summoningMobDisplayPos); + editOverlay(activeConfigCategory, 200, 16, summonings.summoningMobDisplayPos); return; } @@ -110,8 +110,12 @@ public class Features extends Config { public Inventory inventory = new Inventory(); @Expose - @Category(name = "Abilities", desc = "Stuff about abilities") - public Abilities abilities = new Abilities(); + @Category(name = "Item Abilities", desc = "Stuff about item abilities") + public ItemAbilities itemAbilities = new ItemAbilities(); + + @Expose + @Category(name = "Summonings", desc = "Ashfang fight in Crimson Isle") + public Summonings summonings = new Summonings(); @Expose @Category(name = "Ashfang", desc = "Ashfang fight in Crimson Isle") @@ -133,6 +137,10 @@ public class Features extends Config { @Category(name = "Damage Indicator", desc = "Better damage overview in combat with bosses of all sorts.") public DamageIndicator damageIndicator = new DamageIndicator(); + @Expose + @Category(name = "Slayer", desc = "Slayer Features.") + public Slayer slayer = new Slayer(); + @Expose @Category(name = "Misc", desc = "Settings without a category.") public Misc misc = new Misc(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java b/src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java deleted file mode 100644 index feaf50a60..000000000 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java +++ /dev/null @@ -1,73 +0,0 @@ -package at.hannibal2.skyhanni.config.features; - -import at.hannibal2.skyhanni.config.core.config.Position; -import at.hannibal2.skyhanni.config.core.config.annotations.*; -import com.google.gson.annotations.Expose; - -public class Abilities { - - @Expose - @ConfigOption(name = "Ability Cooldown", desc = "Show the cooldown of item abilities.") - @ConfigEditorBoolean - public boolean itemAbilityCooldown = false; - - @Expose - @ConfigOption(name = "Ability Cooldown Background", desc = "Show the cooldown color of item abilities in the background.") - @ConfigEditorBoolean - public boolean itemAbilityCooldownBackground = false; - - @Expose - @ConfigOption(name = "Summoning Soul Display", desc = "Show the name of dropped summoning souls laying on the ground. " + - "§cNot working in Dungeon if Skytils' 'Hide Non-Starred Mobs Nametags' feature is enabled!") - @ConfigEditorBoolean - public boolean summoningSoulDisplay = false; - - @Expose - @ConfigOption(name = "Summoning Mob", desc = "") - @ConfigEditorAccordion(id = 0) - public boolean summoningMob = false; - - @Expose - @ConfigOption(name = "Summoning Mob Display", desc = "Show the health of your spawned summoning mobs") - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean summoningMobDisplay = false; - - @Expose - @ConfigOption(name = "Summoning Mob Display Position", desc = "") - @ConfigEditorButton(runnableId = "summoningMobDisplay", buttonText = "Edit") - @ConfigAccordionId(id = 0) - public Position summoningMobDisplayPos = new Position(10, 10, false, true); - - @Expose - @ConfigOption(name = "Summoning Mob Nametag", desc = "Hide the nametag of your spawned summoning mobs") - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean summoningMobHideNametag = false; - - @Expose - @ConfigOption(name = "Summoning Mob Color", desc = "Marks own summoning mobs green") - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean summoningMobColored = false; - - @Expose - @ConfigOption(name = "Fire Veil", desc = "") - @ConfigEditorAccordion(id = 1) - public boolean fireVeilWand = false; - - @Expose - @ConfigOption(name = "Fire Veil Design", desc = "Changes the flame particles of the Fire Veil Wand ability") - @ConfigEditorDropdown(values = {"Particles", "Line", "Off"}) - @ConfigAccordionId(id = 1) - public int fireVeilWandDisplay = 0; - - @Expose - @ConfigOption( - name = "Line Color", - desc = "Changes the color of the Fire Veil Wand line" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 1) - public String fireVeilWandDisplayColor = "0:245:255:85:85"; -} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java index 0aa24cb28..ad0a32b74 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.config.core.config.annotations.*; import com.google.gson.annotations.Expose; import java.util.ArrayList; +import java.util.Collections; import java.util.List; public class Inventory { @@ -47,7 +48,7 @@ public class Inventory { "\u00a7bCrimson Armor", } ) - public List itemNumberAsStackSize = new ArrayList<>(3); + public List itemNumberAsStackSize = new ArrayList<>(Collections.singletonList(3)); @Expose @ConfigOption(name = "Sack Name", desc = "Show an abbreviation of the Sack name.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/ItemAbilities.java b/src/main/java/at/hannibal2/skyhanni/config/features/ItemAbilities.java new file mode 100644 index 000000000..38cb20940 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/ItemAbilities.java @@ -0,0 +1,37 @@ +package at.hannibal2.skyhanni.config.features; + +import at.hannibal2.skyhanni.config.core.config.annotations.*; +import com.google.gson.annotations.Expose; + +public class ItemAbilities { + + @Expose + @ConfigOption(name = "Ability Cooldown", desc = "Show the cooldown of item abilities.") + @ConfigEditorBoolean + public boolean itemAbilityCooldown = false; + + @Expose + @ConfigOption(name = "Ability Cooldown Background", desc = "Show the cooldown color of item abilities in the background.") + @ConfigEditorBoolean + public boolean itemAbilityCooldownBackground = false; + + @Expose + @ConfigOption(name = "Fire Veil", desc = "") + @ConfigEditorAccordion(id = 1) + public boolean fireVeilWand = false; + + @Expose + @ConfigOption(name = "Fire Veil Design", desc = "Changes the flame particles of the Fire Veil Wand ability") + @ConfigEditorDropdown(values = {"Particles", "Line", "Off"}) + @ConfigAccordionId(id = 1) + public int fireVeilWandDisplay = 0; + + @Expose + @ConfigOption( + name = "Line Color", + desc = "Changes the color of the Fire Veil Wand line" + ) + @ConfigEditorColour + @ConfigAccordionId(id = 1) + public String fireVeilWandDisplayColor = "0:245:255:85:85"; +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index cb9071510..6fa5b8b2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -52,14 +52,4 @@ public class Misc { @ConfigOption(name = "Corrupted Mob Highlight", desc = "Highlight corrupted mobs in purple color") @ConfigEditorBoolean public boolean corruptedMobHighlight = false; - - @Expose - @ConfigOption(name = "Slayer Miniboss Highlight", desc = "Highlight slayer miniboss in blue color") - @ConfigEditorBoolean - public boolean slayerMinibossHighlight = false; - - @Expose - @ConfigOption(name = "Slayer Enderman Beacon", desc = "Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying)") - @ConfigEditorBoolean - public boolean slayerEndermanBeacon = false; } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java new file mode 100644 index 000000000..cac13b109 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java @@ -0,0 +1,18 @@ +package at.hannibal2.skyhanni.config.features; + +import at.hannibal2.skyhanni.config.core.config.annotations.ConfigEditorBoolean; +import at.hannibal2.skyhanni.config.core.config.annotations.ConfigOption; +import com.google.gson.annotations.Expose; + +public class Slayer { + + @Expose + @ConfigOption(name = "Slayer Miniboss Highlight", desc = "Highlight slayer miniboss in blue color") + @ConfigEditorBoolean + public boolean slayerMinibossHighlight = false; + + @Expose + @ConfigOption(name = "Slayer Enderman Beacon", desc = "Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying)") + @ConfigEditorBoolean + public boolean slayerEndermanBeacon = false; +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Summonings.java b/src/main/java/at/hannibal2/skyhanni/config/features/Summonings.java new file mode 100644 index 000000000..88253fb0a --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Summonings.java @@ -0,0 +1,43 @@ +package at.hannibal2.skyhanni.config.features; + +import at.hannibal2.skyhanni.config.core.config.Position; +import at.hannibal2.skyhanni.config.core.config.annotations.*; +import com.google.gson.annotations.Expose; + +public class Summonings { + + @Expose + @ConfigOption(name = "Summoning Soul Display", desc = "Show the name of dropped summoning souls laying on the ground. " + + "§cNot working in Dungeon if Skytils' 'Hide Non-Starred Mobs Nametags' feature is enabled!") + @ConfigEditorBoolean + public boolean summoningSoulDisplay = false; + + @Expose + @ConfigOption(name = "Summoning Mob", desc = "") + @ConfigEditorAccordion(id = 0) + public boolean summoningMob = false; + + @Expose + @ConfigOption(name = "Summoning Mob Display", desc = "Show the health of your spawned summoning mobs") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean summoningMobDisplay = false; + + @Expose + @ConfigOption(name = "Summoning Mob Display Position", desc = "") + @ConfigEditorButton(runnableId = "summoningMobDisplay", buttonText = "Edit") + @ConfigAccordionId(id = 0) + public Position summoningMobDisplayPos = new Position(10, 10, false, true); + + @Expose + @ConfigOption(name = "Summoning Mob Nametag", desc = "Hide the nametag of your spawned summoning mobs") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean summoningMobHideNametag = false; + + @Expose + @ConfigOption(name = "Summoning Mob Color", desc = "Marks own summoning mobs green") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean summoningMobColored = false; +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/VanillaItemManager.kt b/src/main/java/at/hannibal2/skyhanni/data/VanillaItemManager.kt new file mode 100644 index 000000000..a61548309 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/VanillaItemManager.kt @@ -0,0 +1,53 @@ +package at.hannibal2.skyhanni.data + +import com.google.gson.GsonBuilder +import com.google.gson.JsonObject +import java.io.BufferedReader +import java.io.File +import java.io.FileInputStream +import java.io.InputStreamReader +import java.nio.charset.StandardCharsets + +class VanillaItemManager { + private val gson = GsonBuilder().setPrettyPrinting().create() + + companion object { + private val vanillaItems: MutableList = ArrayList() + + fun isVanillaItem(internalName: String): Boolean { + return vanillaItems.contains(internalName) + } + } + + init { + load() + } + + private fun load() { + vanillaItems.clear() + val itemDirectory = File("config/notenoughupdates/repo/items") + if (!itemDirectory.isDirectory) return + val files = itemDirectory.listFiles() ?: return + for (file in files) { + val jsonObject = getJsonFromFile(file) + if (jsonObject != null) { + if (jsonObject.has("vanilla") && jsonObject["vanilla"].asBoolean) { + val name = file.name + val internalName = name.split(".")[0] + vanillaItems.add(internalName) + } + } + } + + } + + private fun getJsonFromFile(file: File): JsonObject? { + try { + BufferedReader(InputStreamReader(FileInputStream(file), + StandardCharsets.UTF_8 + )).use { reader -> return gson.fromJson(reader, JsonObject::class.java) } + } catch (e: Exception) { + return null + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt deleted file mode 100644 index d7af6d6c3..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/FireVeilWandParticles.kt +++ /dev/null @@ -1,64 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.ItemClickInHandEvent -import at.hannibal2.skyhanni.events.PacketEvent -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils -import at.hannibal2.skyhanni.utils.SpecialColour -import net.minecraft.client.Minecraft -import net.minecraft.network.play.server.S2APacketParticles -import net.minecraft.util.EnumParticleTypes -import net.minecraftforge.client.event.RenderWorldLastEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.awt.Color - -class FireVeilWandParticles { - - var lastClick = 0L - - @SubscribeEvent - fun onChatPacket(event: PacketEvent.ReceiveEvent) { - if (!LorenzUtils.inSkyblock) return - if (SkyHanniMod.feature.abilities.fireVeilWandDisplay == 0) return - if (System.currentTimeMillis() > lastClick + 5_500) return - - val packet = event.packet - if (packet !is S2APacketParticles) return - - - if (packet.particleType == EnumParticleTypes.FLAME && packet.particleCount == 1 && packet.particleSpeed == 0f && - packet.xOffset == 0f && - packet.yOffset == 0f && - packet.zOffset == 0f - ) { - event.isCanceled = true - } - } - - @SubscribeEvent - fun onItemClick(event: ItemClickInHandEvent) { - if (!LorenzUtils.inSkyblock) return - if (event.clickType != ItemClickInHandEvent.ClickType.RIGHT_CLICK) return - - val itemInHand = event.itemInHand ?: return - - val internalName = itemInHand.getInternalName() - if (internalName == "FIRE_VEIL_WAND") { - lastClick = System.currentTimeMillis() - } - } - - @SubscribeEvent - fun onRenderWorld(event: RenderWorldLastEvent) { - if (!LorenzUtils.inSkyblock) return - if (SkyHanniMod.feature.abilities.fireVeilWandDisplay != 1) return - if (System.currentTimeMillis() > lastClick + 5_500) return - - val color = - Color(SpecialColour.specialToChromaRGB(SkyHanniMod.feature.abilities.fireVeilWandDisplayColor), true) - - RenderUtils.drawCircle(Minecraft.getMinecraft().thePlayer, event.partialTicks, 3.5, color) - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt deleted file mode 100644 index 0d272771d..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt +++ /dev/null @@ -1,209 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.RenderMobColoredEvent -import at.hannibal2.skyhanni.events.ResetEntityHurtEvent -import at.hannibal2.skyhanni.events.withAlpha -import at.hannibal2.skyhanni.utils.* -import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth -import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings -import net.minecraft.client.Minecraft -import net.minecraft.entity.EntityLiving -import net.minecraft.entity.EntityLivingBase -import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.client.event.RenderGameOverlayEvent -import net.minecraftforge.client.event.RenderLivingEvent -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.EventPriority -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent -import java.util.regex.Pattern - -class SummoningMobManager { - - - private val summoningMobs = mutableMapOf() - private val summoningMobNametags = mutableListOf() - private var summoningsSpawned = 0 - private var searchArmorStands = false - private var searchMobs = false - - //§aYou have spawned your Tank Zombie §r§asoul! §r§d(249 Mana) - private val spawnPatter = Pattern.compile("§aYou have spawned your (.+) §r§asoul! §r§d\\((\\d+) Mana\\)") - private val despawnPatter = Pattern.compile("§cYou have despawned your (monster|monsters)!") - - //§a§ohannibal2's Tank Zombie§r §a160k§c❤ - private val healthPattern = Pattern.compile("§a§o(.+)'s (.+)§r §[ae]([\\dkm]+)§c❤") - - //§cThe Seraph recalled your 3 summoned allies! - private val seraphRecallPattern = Pattern.compile("§cThe Seraph recalled your (\\d) summoned allies!") - - @SubscribeEvent - fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.isOnHypixel) return - - val message = event.message - val matcher = spawnPatter.matcher(message) - if (matcher.matches()) { - if (SkyHanniMod.feature.abilities.summoningMobDisplay) { - event.blockedReason = "summoning_soul" - } - summoningsSpawned++ - searchArmorStands = true - searchMobs = true - } - - if (despawnPatter.matcher(message).matches() || message.startsWith("§c ☠ §r§7You ")) { - despawned() - if (SkyHanniMod.feature.abilities.summoningMobDisplay && !message.contains("☠")) { - event.blockedReason = "summoning_soul" - } - } - if (message == "§cThe Seraph recalled your summoned ally!" || seraphRecallPattern.matcher(message).matches()) { - despawned() - if (SkyHanniMod.feature.abilities.summoningMobDisplay) { - event.blockedReason = "summoning_soul" - } - } - } - - var tick = 0 - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (!isEnabled()) return - - if (SkyHanniMod.feature.abilities.summoningMobDisplay) { - if (tick++ % 20 == 0) { - updateData() - } - } - - if (searchArmorStands) { - Minecraft.getMinecraft().theWorld.loadedEntityList.filter { it is EntityArmorStand && it !in summoningMobNametags } - .forEach { - val name = it.displayName.unformattedText - val matcher = healthPattern.matcher(name) - if (matcher.matches()) { - val playerName = Minecraft.getMinecraft().thePlayer.name - if (name.contains(playerName)) { - summoningMobNametags.add(it as EntityArmorStand) - if (summoningMobNametags.size == summoningsSpawned) { - searchArmorStands = false - } - } - } - } - } - - if (searchMobs) { - val playerLocation = LocationUtils.playerLocation() - Minecraft.getMinecraft().theWorld.loadedEntityList.filter { - it is EntityLiving && it !in summoningMobs.keys && it.getLorenzVec() - .distance(playerLocation) < 10 && it.ticksExisted < 2 - }.forEach { - summoningMobs[it as EntityLiving] = SummoningMob(System.currentTimeMillis(), name = "Mob") - updateData() - if (summoningMobs.size == summoningsSpawned) { - searchMobs = false - } - } - } - } - - private fun updateData() { - if (summoningMobs.isEmpty()) return - - for (entry in HashMap(summoningMobs)) { - val entityLiving = entry.key - val summoningMob = entry.value - - val currentHealth = entityLiving.health.toInt() - val name = summoningMob.name - if (currentHealth == 0) { - summoningMobs.remove(entityLiving) - LorenzUtils.chat("§e[SkyHanni] Your Summoning Mob just §cdied!") - continue - } - - val maxHealth = entityLiving.baseMaxHealth - val color = NumberUtil.percentageColor(currentHealth.toLong(), maxHealth.toLong()).getChatColor() - - val currentFormat = NumberUtil.format(currentHealth) - val maxFormat = NumberUtil.format(maxHealth) - summoningMob.lastDisplayName = "§a$name $color$currentFormat/$maxFormat" - } - } - - @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { - if (!SkyHanniMod.feature.abilities.summoningMobDisplay) return - if (summoningMobs.isEmpty()) return - - val list = mutableListOf() - list.add("Summoning mobs: " + summoningMobs.size) - var id = 1 - for (mob in summoningMobs) { - val name = mob.value.lastDisplayName - list.add("#$id $name") - id++ - } - - SkyHanniMod.feature.abilities.summoningMobDisplayPos.renderStrings(list) - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - despawned() - } - - @SubscribeEvent(priority = EventPriority.HIGH) - fun onRenderLiving(event: RenderLivingEvent.Specials.Pre) { - if (!LorenzUtils.inSkyblock) return - if (!SkyHanniMod.feature.abilities.summoningMobHideNametag) return - - val entity = event.entity - if (entity !is EntityArmorStand) return - if (!entity.hasCustomName()) return - if (entity.isDead) return - - event.isCanceled = entity in summoningMobNametags - } - - @SubscribeEvent - fun onRenderMobColored(event: RenderMobColoredEvent) { - if (SkyHanniMod.feature.abilities.summoningMobColored) { - val entity = event.entity - if (entity is EntityLiving && entity in summoningMobs.keys) { - event.color = LorenzColor.GREEN.toColor().withAlpha(127) - } - } - } - - @SubscribeEvent - fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { - val entity = event.entity - if (SkyHanniMod.feature.abilities.summoningMobColored && entity in summoningMobs.keys) { - event.shouldReset = true - } - } - - private fun despawned() { - summoningMobs.clear() - summoningMobNametags.clear() - summoningsSpawned = 0 - searchArmorStands = false - searchMobs = false - } - - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && (SkyHanniMod.feature.abilities.summoningMobDisplay || SkyHanniMod.feature.abilities.summoningMobHideNametag) - } - - class SummoningMob( - val spawnTime: Long, - var name: String = "", - var lastDisplayName: String = "", - ) -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt deleted file mode 100644 index 59784f027..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt +++ /dev/null @@ -1,132 +0,0 @@ -package at.hannibal2.skyhanni.features - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.test.GriffinJavaUtils -import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith -import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.RenderUtils.drawString -import at.hannibal2.skyhanni.utils.getLorenzVec -import net.minecraft.client.Minecraft -import net.minecraft.entity.EntityLiving -import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.client.event.RenderWorldLastEvent -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent - -class SummoningSoulsName { - - var tick = 0 - private val texture = - "ewogICJ0aW1lc3RhbXAiIDogMTYwMTQ3OTI2NjczMywKICAicHJvZmlsZUlkIiA6ICJmMzA1ZjA5NDI0NTg0ZjU" + - "4YmEyYjY0ZjAyZDcyNDYyYyIsCiAgInByb2ZpbGVOYW1lIiA6ICJqcm9ja2EzMyIsCiAgInNpZ25hdH" + - "VyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgI" + - "nVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81YWY0MDM1ZWMwZGMx" + - "NjkxNzc4ZDVlOTU4NDAxNzAyMjdlYjllM2UyOTQzYmVhODUzOTI5Y2U5MjNjNTk4OWFkIgogICAgfQogIH0KfQ" - - private val souls = mutableMapOf() - private val mobsLastLocation = mutableMapOf() - private val mobsName = mutableMapOf() - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (!isEnabled()) return - - tick++ - //TODO use packets instead of this - if (tick % 1 == 0) { - check() - } - } - - private fun check() { - val minecraft = Minecraft.getMinecraft() - val world = minecraft.theWorld - for (entity in world.loadedEntityList) { - if (souls.contains(entity)) continue - - if (entity is EntityArmorStand) { - if (isSoul(entity)) { - val soulLocation = entity.getLorenzVec() - - val map = mutableMapOf() - for ((mob, loc) in mobsLastLocation) { - val distance = loc.distance(soulLocation) - map[mob] = distance - } - - val nearestMob = GriffinJavaUtils.sortByValueAsc(map).firstNotNullOfOrNull { it.key } - if (nearestMob != null) { -// val mobDistance = nearestMob.getLorenzVec().add(0.0, -1.4375, 0.0) -// val distance = mobDistance.distance(soulLocation) -// val diff = mobDistance.add(soulLocation.multiply(-1)) - -// println(" ") -// println("mobDistance: $mobDistance") -// println("soulLocation: $soulLocation") -// println("diff: $diff") -// LorenzUtils.chat("distance: $distance") - val name = mobsName[nearestMob]!! -// LorenzUtils.chat("maybe its $name") - souls[entity] = name - } - - } - } - } - - for (entity in world.loadedEntityList) { - if (entity is EntityLiving) { - val consumer = entity.getNameTagWith(2, "§c❤") - if (consumer != null) { - if (!consumer.name.contains("§e0")) { - mobsLastLocation[entity] = entity.getLorenzVec() - mobsName[entity] = consumer.name - } - } - } - } - - souls.keys.removeIf { it !in world.loadedEntityList } - //TODO fix overhead! -// mobs.keys.removeIf { it !in world.loadedEntityList } - } - - @SubscribeEvent - fun onWorldRender(event: RenderWorldLastEvent) { - if (!isEnabled()) return - - for ((entity, name) in souls) { - val vec = entity.getLorenzVec() - event.drawString(vec.add(0.0, 2.5, 0.0), name) - } - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - souls.clear() - mobsLastLocation.clear() - mobsName.clear() - } - - private fun isSoul(entity: EntityArmorStand): Boolean { - for (stack in entity.inventory) { - if (stack != null) { - val skullTexture = stack.getSkullTexture() - if (skullTexture != null) { - if (skullTexture == texture) { - return true - } - } - } - } - - return false - } - - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.abilities.summoningSoulDisplay - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt new file mode 100644 index 000000000..c9a27eac6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -0,0 +1,419 @@ +package at.hannibal2.skyhanni.features.inventory + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background +import at.hannibal2.skyhanni.data.VanillaItemManager +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.ItemUtils.cleanName +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import com.google.gson.JsonObject +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.inventory.ContainerChest +import net.minecraft.item.ItemStack +import net.minecraftforge.event.entity.player.ItemTooltipEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class HideNotClickableItems { + + private var hideReason = "" + + private var lastClickTime = 0L + private var bypassUntil = 0L + + private val hideNpcSellFilter = MultiFilter() + private val hideInStorageFilter = MultiFilter() + private val tradeNpcFilter = MultiFilter() + private val itemsToSalvage = mutableListOf() + private val hidePlayerTradeFilter = MultiFilter() + private val notAuctionableFilter = MultiFilter() + + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + try { + val hideNotClickableItems = event.getConstant("HideNotClickableItems")!! + hideNpcSellFilter.load(hideNotClickableItems["hide_npc_sell"].asJsonObject) + hideInStorageFilter.load(hideNotClickableItems["hide_in_storage"].asJsonObject) + tradeNpcFilter.load(event.getConstant("TradeNpcs")!!) + updateSalvageList(hideNotClickableItems) + hidePlayerTradeFilter.load(hideNotClickableItems["hide_player_trade"].asJsonObject) + notAuctionableFilter.load(hideNotClickableItems["not_auctionable"].asJsonObject) + + } catch (e: Exception) { + e.printStackTrace() + LorenzUtils.error("error in RepositoryReloadEvent") + } + } + + private fun updateSalvageList(hideNotClickableItems: JsonObject) { + itemsToSalvage.clear() + val salvage = hideNotClickableItems["salvage"].asJsonObject + itemsToSalvage.addAll(salvage.asJsonObject["items"].asJsonArray.map { it.asString }) + for (armor in salvage.asJsonObject["armor"].asJsonArray.map { it.asString }) { + itemsToSalvage.add("$armor Helmet") + itemsToSalvage.add("$armor Chestplate") + itemsToSalvage.add("$armor Leggings") + itemsToSalvage.add("$armor Boots") + } + } + + @SubscribeEvent + fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { + if (!LorenzUtils.inSkyblock) return + if (isDisabled()) return + if (event.gui !is GuiChest) return + val guiChest = event.gui + val chest = guiChest.inventorySlots as ContainerChest + val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + + for (slot in chest.inventorySlots) { + if (slot == null) continue + + if (slot.slotNumber == slot.slotIndex) continue + if (slot.stack == null) continue + + if (hide(chestName, slot.stack)) { +// val color = LorenzColor.DARK_GRAY.addOpacity(160) +// val color = LorenzColor.DARK_GRAY.addOpacity(LorenzTest.a.toInt()) + val opacity = SkyHanniMod.feature.inventory.hideNotClickableOpacity + val color = LorenzColor.DARK_GRAY.addOpacity(opacity) + slot.stack.background = color.rgb + } + } + } + + @SubscribeEvent(priority = EventPriority.LOWEST) + fun onTooltip(event: ItemTooltipEvent) { + if (isDisabled()) return + if (event.toolTip == null) return + val guiChest = Minecraft.getMinecraft().currentScreen + if (guiChest !is GuiChest) return + val chest = guiChest.inventorySlots as ContainerChest + val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + + val stack = event.itemStack + if (InventoryUtils.getItemsInOpenChest().map { it.stack }.contains(stack)) return + if (!ItemUtils.getItemsInInventory().contains(stack)) return + + if (hide(chestName, stack)) { + val first = event.toolTip[0] + event.toolTip.clear() + event.toolTip.add("§7" + first.removeColor()) + event.toolTip.add("") + if (hideReason == "") { + event.toolTip.add("§4No hide reason!") + LorenzUtils.warning("No hide reason for not clickable item!") + } else { + event.toolTip.add("§c$hideReason") + } + } + } + + @SubscribeEvent + fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { + if (isDisabled()) return + if (event.gui !is GuiChest) return + val guiChest = event.gui + val chest = guiChest.inventorySlots as ContainerChest + val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + + val slot = event.slot ?: return + + if (slot.slotNumber == slot.slotIndex) return + if (slot.stack == null) return + + val stack = slot.stack + + if (hide(chestName, stack)) { + event.isCanceled = true + + if (System.currentTimeMillis() > lastClickTime + 5_000) { + lastClickTime = System.currentTimeMillis() + } + return + } + } + + private fun isDisabled(): Boolean { + if (bypassUntil > System.currentTimeMillis()) return true + + return !SkyHanniMod.feature.inventory.hideNotClickableItems + } + + private fun hide(chestName: String, stack: ItemStack): Boolean { + hideReason = "" + return when { + hideNpcSell(chestName, stack) -> true + hideInStorage(chestName, stack) -> true + hideSalvage(chestName, stack) -> true + hidePlayerTrade(chestName, stack) -> true + hideBazaarOrAH(chestName, stack) -> true + hideAccessoryBag(chestName, stack) -> true + hideSackOfSacks(chestName, stack) -> true + hideFishingBag(chestName, stack) -> true + hidePotionBag(chestName, stack) -> true + hidePrivateIslandChest(chestName, stack) -> true + hideAttributeFusion(chestName, stack) -> true + hideYourEquipment(chestName, stack) -> true + else -> false + } + } + + private fun hideYourEquipment(chestName: String, stack: ItemStack): Boolean { + if (!chestName.startsWith("Your Equipment")) return false + + val list = listOf( + "HELMET", + "CHESTPLATE", + "LEGGINGS", + "BOOTS", + + "NECKLACE", + "CLOAK", + "BELT", + "GLOVES", + "BRACELET" + ) + for (type in list) { + if (stack.getLore().any { it.contains("§l") && it.contains(type) }) {//todo use item api + return false + } + } + + if (isSkyBlockMenuItem(stack)) { + hideReason = "The SkyBlock Menu cannot be put into the potion bag!" + return true + } + + hideReason = "This item cannot be put into your equipment!" + return true + } + + private fun hideAttributeFusion(chestName: String, stack: ItemStack): Boolean { + if (!chestName.startsWith("Attribute Fusion")) return false + + if (ItemUtils.hasAttributes(stack)) return false + + hideReason = "This item has no attributes!" + return true + } + + private fun hidePrivateIslandChest(chestName: String, stack: ItemStack): Boolean { + if (chestName != "Chest" && chestName != "Large Chest") return false + //TODO make check if player is on private island + + if (!ItemUtils.isSoulBound(stack)) return false + + hideReason = "This item cannot be stored into a chest!" + return true + } + + private fun hidePotionBag(chestName: String, stack: ItemStack): Boolean { + if (!chestName.startsWith("Potion Bag")) return false + + if (isSkyBlockMenuItem(stack)) { + hideReason = "The SkyBlock Menu cannot be put into the potion bag!" + return true + } + + if (stack.cleanName().endsWith(" Potion")) return false + + hideReason = "This item is not a potion!" + return true + } + + private fun hideFishingBag(chestName: String, stack: ItemStack): Boolean { + if (!chestName.startsWith("Fishing Bag")) return false + + if (isSkyBlockMenuItem(stack)) { + hideReason = "The SkyBlock Menu cannot be put into the fishing bag!" + return true + } + + if (stack.getLore().any { it.removeColor() == "Fishing Bait" }) { + return false + } + hideReason = "This item is not a fishing bait!" + return true + } + + private fun hideSackOfSacks(chestName: String, stack: ItemStack): Boolean { + if (!chestName.startsWith("Sack of Sacks")) return false + + val name = stack.cleanName() + if (ItemUtils.isSack(name)) return false + if (isSkyBlockMenuItem(stack)) return false + + hideReason = "This item is not a sack!" + return true + } + + private fun hideAccessoryBag(chestName: String, stack: ItemStack): Boolean { + if (!chestName.startsWith("Accessory Bag")) return false + + if (stack.getLore().any { it.contains("ACCESSORY") }) return false + if (isSkyBlockMenuItem(stack)) return false + + hideReason = "This item is not an accessory!" + return true + } + + private fun hidePlayerTrade(chestName: String, stack: ItemStack): Boolean { + if (!chestName.startsWith("You ")) return false + + if (ItemUtils.isCoopSoulBound(stack)) { + hideReason = "Soulbound items cannot be traded!" + return true + } + + if (isSkyBlockMenuItem(stack)) { + hideReason = "The SkyBlock Menu cannot be traded!" + return true + } + + val name = stack.cleanName() + + if (ItemUtils.isSack(name)) { + hideReason = "Sacks cannot be traded!" + return true + } + + val result = hidePlayerTradeFilter.match(name) + LorenzDebug.log("hidePlayerTradeList filter result for '$name': $result") + + if (result) hideReason = "This item cannot be traded!" + return result + } + + private fun hideNpcSell(chestName: String, stack: ItemStack): Boolean { + if (!tradeNpcFilter.match(chestName)) return false + + var name = stack.cleanName() + val size = stack.stackSize + val amountText = " x$size" + if (name.endsWith(amountText)) { + name = name.substring(0, name.length - amountText.length) + } + + if (isSkyBlockMenuItem(stack)) { + hideReason = "The SkyBlock Menu cannot be sold at the NPC!" + return true + } + + if (!ItemUtils.isRecombobulated(stack)) { + if (hideNpcSellFilter.match(name)) return false + + val id = stack.getInternalName() + if (VanillaItemManager.isVanillaItem(id) && !stack.isItemEnchanted) { + return false + } + } + + hideReason = "This item should not be sold at the NPC!" + return true + } + + private fun hideInStorage(chestName: String, stack: ItemStack): Boolean { + if (!chestName.contains("Ender Chest") && !chestName.contains("Backpack") && chestName != "Storage") return false + + if (isSkyBlockMenuItem(stack)) { + hideReason = "The SkyBlock Menu cannot be put into the storage!" + return true + } + + val name = stack.cleanName() + + if (ItemUtils.isSack(name)) { + hideReason = "Sacks cannot be put into the storage!" + return true + } + + val result = hideInStorageFilter.match(name) + + if (result) hideReason = "Bags cannot be put into the storage!" + return result + } + + private fun hideSalvage(chestName: String, stack: ItemStack): Boolean { + if (chestName != "Salvage Item") return false + + if (ItemUtils.isRecombobulated(stack)) { + hideReason = "This item should not be salvaged! (Recombobulated)" + return true + } + for (line in stack.getLore()) { + if (line.contains("LEGENDARY DUNGEON")) { + hideReason = "This item should not be salvaged! (Legendary)" + return true + } + } + + if (isSkyBlockMenuItem(stack)) { + hideReason = "The SkyBlock Menu cannot be salvaged!" + return true + } + + val name = stack.cleanName() + for (item in itemsToSalvage) { + if (name.endsWith(item)) { + return false + } + } + + hideReason = "This item cannot be salvaged!" + return true + } + + private fun hideBazaarOrAH(chestName: String, stack: ItemStack): Boolean { + val bazaarInventory = BazaarApi.isBazaarInventory(chestName) + + val auctionHouseInventory = + chestName == "Co-op Auction House" || chestName == "Auction House" || chestName == "Create BIN Auction" || chestName == "Create Auction" + if (!bazaarInventory && !auctionHouseInventory) return false + + + + if (isSkyBlockMenuItem(stack)) { + if (bazaarInventory) hideReason = "The SkyBlock Menu is not a Bazaar Product!" + if (auctionHouseInventory) hideReason = "The SkyBlock Menu cannot be auctioned!" + return true + } + + if (bazaarInventory != BazaarApi.isBazaarItem(stack)) { + if (bazaarInventory) hideReason = "This item is not a Bazaar Product!" + if (auctionHouseInventory) hideReason = "Bazaar Products cannot be auctioned!" + + return true + } + + if (isNotAuctionable(stack)) return true + + return false + } + + private fun isNotAuctionable(stack: ItemStack): Boolean { + if (ItemUtils.isCoopSoulBound(stack)) { + hideReason = "Soulbound items cannot be auctioned!" + return true + } + + val name = stack.cleanName() + + if (ItemUtils.isSack(name)) { + hideReason = "Sacks cannot be auctioned!" + return true + } + + val result = notAuctionableFilter.match(name) + if (result) hideReason = "This item cannot be auctioned!" + return result + } + + private fun isSkyBlockMenuItem(stack: ItemStack): Boolean = stack.getInternalName() == "SKYBLOCK_MENU" +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt new file mode 100644 index 000000000..650d68a17 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -0,0 +1,120 @@ +package at.hannibal2.skyhanni.features.inventory + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderItemEvent +import at.hannibal2.skyhanni.utils.ItemUtils +import at.hannibal2.skyhanni.utils.ItemUtils.cleanName +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.between +import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex +import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.item.ItemStack +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class ItemDisplayOverlayFeatures { + + @SubscribeEvent + fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.Post) { + val stack = event.stack ?: return + + if (!LorenzUtils.inSkyblock || stack.stackSize != 1) return + + val stackTip = getStackTip(stack) + + if (stackTip.isNotEmpty()) { + GlStateManager.disableLighting() + GlStateManager.disableDepth() + GlStateManager.disableBlend() + event.fontRenderer.drawStringWithShadow( + stackTip, + (event.x + 17 - event.fontRenderer.getStringWidth(stackTip)).toFloat(), + (event.y + 9).toFloat(), + 16777215 + ) + GlStateManager.enableLighting() + GlStateManager.enableDepth() + } + } + + private fun getStackTip(item: ItemStack): String { + val name = item.cleanName() + + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(0)) { + when (name) { + "First Master Star" -> return "1" + "Second Master Star" -> return "2" + "Third Master Star" -> return "3" + "Fourth Master Star" -> return "4" + "Fifth Master Star" -> return "5" + } + } + + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(1)) { + if (name.matchRegex("(.*)Master Skull - Tier .")) { + return name.substring(name.length - 1) + } + } + + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(2)) { + if (name.contains("Golden ") || name.contains("Diamond ")) { + when { + name.contains("Bonzo") -> return "1" + name.contains("Scarf") -> return "2" + name.contains("Professor") -> return "3" + name.contains("Thorn") -> return "4" + name.contains("Livid") -> return "5" + name.contains("Sadan") -> return "6" + name.contains("Necron") -> return "7" + } + } + } + + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(3)) { + if (name.startsWith("New Year Cake (")) { + return "§b" + name.between("(Year ", ")") + } + } + + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(4)) { + if (ItemUtils.isPet(name)) { + val level = name.between("Lvl ", "] ").toInt() + if (level != ItemUtils.maxPetLevel(name)) { + return "$level" + } + } + } + + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(5)) { + if (name.contains(" Minion ")) { + if (item.getLore().any { it.contains("Place this minion") }) { + val array = name.split(" ") + val last = array[array.size - 1] + return last.romanToDecimal().toString() + } + } + } + + if (SkyHanniMod.feature.inventory.displaySackName) { + if (ItemUtils.isSack(name)) { + //TODO fix this and replace other +// val sackName = grabSackName(name) + val split = name.split(" ") + val sackName = split[split.size - 2] + return (if (name.contains("Enchanted")) "§5" else "") + sackName.substring(0, 2) + } + } + + return "" + } + +// private fun grabSackName(name: String): String { +// val split = name.split(" ") +// val text = split[0] +// for (line in arrayOf("Large", "Medium", "Small", "Enchanted")) { +// if (text == line) return grabSackName(name.substring(text.length + 1)) +// } +// return text +// } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt new file mode 100644 index 000000000..0e503c052 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt @@ -0,0 +1,150 @@ +package at.hannibal2.skyhanni.features.inventory + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderItemEvent +import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.renderer.GlStateManager +import net.minecraftforge.event.entity.player.ItemTooltipEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern + +class ItemStars { + + private val armorNames = mutableListOf() + private val tiers = mutableMapOf() + private val STAR_FIND_PATCHER = Pattern.compile("(.*)§.✪(.*)") + private val armorParts = listOf("Helmet", "Chestplate", "Leggings", "Boots") + + @SubscribeEvent(priority = EventPriority.LOW) + fun onTooltip(event: ItemTooltipEvent) { + if (!LorenzUtils.inSkyblock) return + + val stack = event.itemStack ?: return + if (stack.stackSize != 1) return + if (!SkyHanniMod.feature.inventory.itemStars) return + + val itemName = stack.name ?: return + val stars = getStars(itemName) + + if (stars > 0) { + var name = itemName + while (STAR_FIND_PATCHER.matcher(name).matches()) { + name = name.replaceFirst("§.✪".toRegex(), "") + } + name = name.trim() + event.toolTip[0] = "$name §c$stars✪" + } + } + + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + try { + val items = event.getConstant("Items")!! + if (items.has("crimson_armors")) { + armorNames.clear() + armorNames.addAll(items.getAsJsonArray("crimson_armors").map { it.asString }) + } + +