diff options
Diffstat (limited to 'src/main/java')
116 files changed, 1499 insertions, 272 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index b407fda6b..cc0711452 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -13,18 +13,21 @@ import at.hannibal2.skyhanni.features.bazaar.BazaarBestSellMethod import at.hannibal2.skyhanni.features.bazaar.BazaarCancelledBuyOrderClipboard import at.hannibal2.skyhanni.features.bazaar.BazaarOrderHelper import at.hannibal2.skyhanni.features.bingo.* -import at.hannibal2.skyhanni.features.chat.ArachneChatMessageHider -import at.hannibal2.skyhanni.features.chat.ChatFilter -import at.hannibal2.skyhanni.features.chat.PlayerDeathMessages +import at.hannibal2.skyhanni.features.chat.* import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatModifier import at.hannibal2.skyhanni.features.commands.PartyTransferCommand import at.hannibal2.skyhanni.features.commands.SendCoordinatedCommand +import at.hannibal2.skyhanni.features.commands.WarpIsCommand import at.hannibal2.skyhanni.features.commands.WikiCommand import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.features.dungeon.* import at.hannibal2.skyhanni.features.event.diana.* import at.hannibal2.skyhanni.features.fishing.* +import at.hannibal2.skyhanni.features.fishing.trophy.OdgerWaypoint +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishFillet +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishMessages import at.hannibal2.skyhanni.features.garden.* import at.hannibal2.skyhanni.features.garden.composter.ComposterDisplay import at.hannibal2.skyhanni.features.garden.composter.ComposterInventoryNumbers @@ -42,6 +45,7 @@ import at.hannibal2.skyhanni.features.inventory.* import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown import at.hannibal2.skyhanni.features.mining.HighlightMiningCommissionMobs +import at.hannibal2.skyhanni.features.mining.KingTalismanHelper import at.hannibal2.skyhanni.features.minion.MinionCollectLogic import at.hannibal2.skyhanni.features.minion.MinionFeatures import at.hannibal2.skyhanni.features.misc.* @@ -63,9 +67,7 @@ import at.hannibal2.skyhanni.features.mobs.AshfangMinisNametagHider import at.hannibal2.skyhanni.features.mobs.MobHighlight import at.hannibal2.skyhanni.features.nether.ashfang.* import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper -import at.hannibal2.skyhanni.features.rift.RiftTimer -import at.hannibal2.skyhanni.features.rift.ShowMotesNpcSellPrice -import at.hannibal2.skyhanni.features.rift.VampireSlayerFeatures +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.features.rift.area.RiftLarva import at.hannibal2.skyhanni.features.rift.area.colosseum.BlobbercystsHighlight import at.hannibal2.skyhanni.features.rift.area.dreadfarm.RiftAgaricusCap @@ -83,6 +85,8 @@ import at.hannibal2.skyhanni.features.rift.area.westvillage.KloonHacking import at.hannibal2.skyhanni.features.rift.area.wyldwoods.RiftOdonata import at.hannibal2.skyhanni.features.rift.area.wyldwoods.ShyCruxWarnings import at.hannibal2.skyhanni.features.rift.everywhere.* +import at.hannibal2.skyhanni.features.rift.everywhere.motes.RiftMotesOrb +import at.hannibal2.skyhanni.features.rift.everywhere.motes.ShowMotesNpcSellPrice import at.hannibal2.skyhanni.features.slayer.* import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerClearView import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerDaggerHelper @@ -119,7 +123,7 @@ import org.apache.logging.log4j.Logger clientSideOnly = true, useMetadata = true, guiFactory = "at.hannibal2.skyhanni.config.ConfigGuiForgeInterop", - version = "0.19.Beta.18", + version = "0.20.Beta.2", ) class SkyHanniMod { @Mod.EventHandler @@ -128,7 +132,7 @@ class SkyHanniMod { // utils loadModule(this) - loadModule(ChatManager()) + loadModule(ChatManager) loadModule(HypixelData()) loadModule(DungeonData()) loadModule(ScoreboardData()) @@ -212,6 +216,7 @@ class SkyHanniMod { loadModule(RngMeterInventory()) loadModule(WikiCommand()) loadModule(SendCoordinatedCommand()) + loadModule(WarpIsCommand()) loadModule(PartyTransferCommand()) loadModule(SummoningMobManager()) loadModule(AreaMiniBossFeatures()) @@ -363,8 +368,11 @@ class SkyHanniMod { loadModule(RiftWiltedBerberisHelper()) loadModule(RiftHorsezookaHider()) loadModule(GriffinPetWarning()) - // - + loadModule(KingTalismanHelper()) + loadModule(HarpKeybinds()) + loadModule(EnderNodeTracker()) + loadModule(CompactBestiaryChatMessage()) + loadModule(WatchdogHider()) init() @@ -375,6 +383,7 @@ class SkyHanniMod { loadModule(PacketTest()) loadModule(TestBingo) loadModule(TestCopyRngMeterValues) + loadModule(TestCopyBestiaryValues) loadModule(HighlightMissingRepoItems()) loadModule(ParkourWaypointSaver()) } diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt index 7b3fbc7d5..9e0cad6c0 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.api import at.hannibal2.skyhanni.events.CollectionUpdateEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_new @@ -43,7 +43,7 @@ class CollectionAPI { } @SubscribeEvent - fun onTick(event: InventoryOpenEvent) { + fun onTick(event: InventoryFullyOpenedEvent) { val inventoryName = event.inventoryName if (inventoryName.endsWith(" Collection")) { val stack = event.inventoryItems[4] ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index da971355d..f46e0e194 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.config import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.features.fishing.TrophyRarity +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.misc.update.UpdateManager import at.hannibal2.skyhanni.utils.LorenzLogger diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index c8bfc3d1f..2f2de9fc5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -1,7 +1,30 @@ package at.hannibal2.skyhanni.config; import at.hannibal2.skyhanni.SkyHanniMod; -import at.hannibal2.skyhanni.config.features.*; +import at.hannibal2.skyhanni.config.features.About; +import at.hannibal2.skyhanni.config.features.Ashfang; +import at.hannibal2.skyhanni.config.features.Bazaar; +import at.hannibal2.skyhanni.config.features.Bingo; +import at.hannibal2.skyhanni.config.features.ChatConfig; +import at.hannibal2.skyhanni.config.features.CommandsFeatures; +import at.hannibal2.skyhanni.config.features.DamageIndicatorConfig; +import at.hannibal2.skyhanni.config.features.DevConfig; +import at.hannibal2.skyhanni.config.features.DianaConfig; +import at.hannibal2.skyhanni.config.features.Dungeon; +import at.hannibal2.skyhanni.config.features.Fishing; +import at.hannibal2.skyhanni.config.features.GUI; +import at.hannibal2.skyhanni.config.features.Garden; +import at.hannibal2.skyhanni.config.features.GhostCounterConfig; +import at.hannibal2.skyhanni.config.features.Inventory; +import at.hannibal2.skyhanni.config.features.ItemAbilities; +import at.hannibal2.skyhanni.config.features.MarkedPlayers; +import at.hannibal2.skyhanni.config.features.Minions; +import at.hannibal2.skyhanni.config.features.MiscConfig; +import at.hannibal2.skyhanni.config.features.Mobs; +import at.hannibal2.skyhanni.config.features.OldHidden; +import at.hannibal2.skyhanni.config.features.RiftConfig; +import at.hannibal2.skyhanni.config.features.SlayerConfig; +import at.hannibal2.skyhanni.config.features.Summonings; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.Config; import io.github.moulberry.moulconfig.Social; @@ -49,7 +72,7 @@ public class Features extends Config { @Expose @Category(name = "Chat", desc = "Change how the chat looks.") - public Chat chat = new Chat(); + public ChatConfig chat = new ChatConfig(); @Expose @Category(name = "Dungeon", desc = "Features that change the dungeon experience in catacombs.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index 7da36ec1f..080b77ce8 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -1,11 +1,12 @@ package at.hannibal2.skyhanni.config; import at.hannibal2.skyhanni.data.model.ComposterUpgrade; -import at.hannibal2.skyhanni.features.fishing.TrophyRarity; +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity; import at.hannibal2.skyhanni.features.garden.CropAccessory; import at.hannibal2.skyhanni.features.garden.CropType; import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems; import at.hannibal2.skyhanni.features.garden.visitor.VisitorReward; +import at.hannibal2.skyhanni.features.misc.EnderNode; import at.hannibal2.skyhanni.features.misc.FrozenTreasure; import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData; import at.hannibal2.skyhanni.features.rift.area.westvillage.KloonTerminal; @@ -13,7 +14,11 @@ import at.hannibal2.skyhanni.utils.LorenzVec; import com.google.gson.annotations.Expose; import net.minecraft.item.ItemStack; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; public class Storage { @@ -263,6 +268,20 @@ public class Storage { } @Expose + public EnderNodeTracker enderNodeTracker = new EnderNodeTracker(); + + public static class EnderNodeTracker { + @Expose + public int totalNodesMined = 0; + + @Expose + public int totalEndermiteNests = 0; + + @Expose + public Map<EnderNode, Integer> lootCount = new HashMap<>(); + } + + @Expose public RiftStorage rift = new RiftStorage(); public static class RiftStorage { @@ -348,5 +367,14 @@ public class Storage { '}'; } } + + @Expose + public MiningConfig mining = new MiningConfig(); + + public static class MiningConfig { + + @Expose + public List<String> kingsTalkedTo = new ArrayList<>(); + } } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 4c8c455fd..e83a14c5c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -4,9 +4,11 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigGuiManager import at.hannibal2.skyhanni.config.commands.SimpleCommand.ProcessCommandRunnable import at.hannibal2.skyhanni.data.ApiDataLoader +import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.data.GuiEditManager import at.hannibal2.skyhanni.features.bingo.BingoCardDisplay import at.hannibal2.skyhanni.features.bingo.BingoNextStepHelper +import at.hannibal2.skyhanni.features.chat.ChatFilterGui import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper import at.hannibal2.skyhanni.features.event.diana.InquisitorWaypointShare import at.hannibal2.skyhanni.features.garden.GardenAPI @@ -48,6 +50,7 @@ object Commands { ConfigGuiManager.openConfigGui(it.joinToString(" ")) } } else { + val arr = mutableListOf<String>() ConfigGuiManager.openConfigGui() } } @@ -133,6 +136,7 @@ object Commands { "Clear farming items saved for the Farming Fortune Guide" ) { clearFarmingItems() } registerCommand("shresetghostcounter", "Resets the ghost counter stats") { GhostUtil.reset() } + registerCommand("shbingotoggle", "Toggle the bingo card display mode") { BingoCardDisplay.toggleCommand() } } private fun usersBugFix() { @@ -185,6 +189,7 @@ object Commands { private fun developersCodingHelp() { registerCommand("shtest", "Unused test command.") { SkyHanniTestCommand.testCommand(it) } registerCommand("shreloadlocalrepo", "Reloading the local repo data") { SkyHanniMod.repo.reloadLocalRepo() } + registerCommand("shchathistory", "Show the unfiltered chat history") { ChatManager.openChatFilterGUI() } registerCommand( "shstoplisteners", "Unregistering all loaded forge event listeners" diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Bingo.java b/src/main/java/at/hannibal2/skyhanni/config/features/Bingo.java index b9270b03c..f777fc903 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Bingo.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Bingo.java @@ -16,9 +16,13 @@ public class Bingo { public static class BingoCard { @Expose - @ConfigOption(name = "Enable", desc = "Displays the bingo card. Toggle by sneaking with SkyBlock menu in hand.") + @ConfigOption(name = "Enable", desc = "Displays the bingo card.") @ConfigEditorBoolean public boolean enabled = true; + @Expose + @ConfigOption(name = "Quick Toggle", desc = "Quickly toggle the bingo card or the step helper by sneaking with SkyBlock menu in hand.") + @ConfigEditorBoolean + public boolean quickToggle = true; @Expose @ConfigOption(name = "Bingo Steps", desc = "Show help with the next step in bingo instead of the bingo card. " + diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java b/src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java index f149fc624..1723db1be 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java @@ -1,10 +1,14 @@ package at.hannibal2.skyhanni.config.features; import com.google.gson.annotations.Expose; -import io.github.moulberry.moulconfig.annotations.*; +import io.github.moulberry.moulconfig.annotations.ConfigAccordionId; +import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion; +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; +import io.github.moulberry.moulconfig.annotations.ConfigOption; import org.lwjgl.input.Keyboard; -public class Chat { +public class ChatConfig { @Expose @ConfigOption(name = "Peek Chat", desc = "Hold this key to keep the chat open.") @@ -130,6 +134,11 @@ public class Chat { public boolean compactPotionMessage = true; @Expose + @ConfigOption(name = "Compact Bestiary Message", desc = "Shorten the bestiary level up message, showing additional information when hovering.") + @ConfigEditorBoolean + public boolean compactBestiaryMessage = true; + + @Expose @ConfigOption(name = "Arachne Hider", desc = "Hide chat messages about the Arachne Fight while outside of §eArachne's Sanctuary§7.") @ConfigEditorBoolean public boolean hideArachneMessages = false; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/CommandsFeatures.java b/src/main/java/at/hannibal2/skyhanni/config/features/CommandsFeatures.java index 14b915b4b..c5be4a03b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/CommandsFeatures.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/CommandsFeatures.java @@ -16,4 +16,9 @@ public class CommandsFeatures { "§7SkyBlock command §e/pt §7to check the play time still works.") @ConfigEditorBoolean public boolean usePartyTransferAlias = true; + + @Expose + @ConfigOption(name = "Replace Warp Is", desc = "Replaces §e/warp is §7with §e/is§7. Idk why. Ask §cKaeso") + @ConfigEditorBoolean + public boolean replaceWarpIs = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java index 08f9fe4e2..459eb65a6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java @@ -2,7 +2,12 @@ package at.hannibal2.skyhanni.config.features; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; -import io.github.moulberry.moulconfig.annotations.*; +import io.github.moulberry.moulconfig.annotations.Accordion; +import io.github.moulberry.moulconfig.annotations.ConfigAccordionId; +import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion; +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; +import io.github.moulberry.moulconfig.annotations.ConfigOption; import org.lwjgl.input.Keyboard; public class DevConfig { @@ -65,11 +70,22 @@ public class DevConfig { public boolean copyRngMeter = false; @Expose + @ConfigOption(name = "Copy Bestiary Data", desc = "Copies the besiary data from the inventory as json in clipboard.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean copyBestiaryData = false; + + @Expose @ConfigOption(name = "Highlight Missing Repo Items", desc = "Highlights each item in the current inventory that is not in your current NEU repo.") @ConfigEditorBoolean @ConfigAccordionId(id = 0) public boolean highlightMissingRepo = false; + @Expose + @ConfigOption(name = "Slot Number", desc = "Show slot number in inventory while pressing this key.") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) + public int showSlotNumberKey = Keyboard.KEY_NONE; + @ConfigOption(name = "Parkour Waypoints", desc = "") @Accordion @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java index 323b2446e..b3021a63f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java @@ -150,7 +150,7 @@ public class Dungeon { public boolean highlightSkeletonSkull = true; @Expose - @ConfigOption(name = "Croesus Unopened Chest Tracker", desc = "Adds a visual highlight to the Croesus inventory that " + + @ConfigOption(name = "Croesus Chest", desc = "Adds a visual highlight to the Croesus inventory that " + "shows unopened chests.") @ConfigEditorBoolean public boolean croesusUnopenedChestTracker = true; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java b/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java index 2374a9e2f..8ff337693 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java @@ -2,7 +2,14 @@ package at.hannibal2.skyhanni.config.features; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; -import io.github.moulberry.moulconfig.annotations.*; +import io.github.moulberry.moulconfig.annotations.Accordion; +import io.github.moulberry.moulconfig.annotations.ConfigAccordionId; +import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion; +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; +import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; +import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; +import io.github.moulberry.moulconfig.annotations.ConfigOption; import io.github.moulberry.moulconfig.observer.Property; public class Fishing { @@ -106,6 +113,15 @@ public class Fishing { public Position barnTimerPos = new Position(10, 10, false, true); @Expose + @ConfigOption( + name = "Worm Fishing", + desc = "Show the barn fishing timer even for worms or other sea creatures in the crystal hollows." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 2) + public boolean barnTimerCrystalHollows = true; + + @Expose @ConfigOption(name = "Fishing Timer Alert", desc = "Change the amount of time in seconds until the timer dings.") @ConfigEditorSlider( minValue = 240, diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 07f7c249a..a1741affb 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -2,7 +2,15 @@ package at.hannibal2.skyhanni.config.features; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; -import io.github.moulberry.moulconfig.annotations.*; +import io.github.moulberry.moulconfig.annotations.Accordion; +import io.github.moulberry.moulconfig.annotations.ConfigAccordionId; +import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion; +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; +import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; +import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; +import io.github.moulberry.moulconfig.annotations.ConfigEditorText; +import io.github.moulberry.moulconfig.annotations.ConfigOption; import io.github.moulberry.moulconfig.observer.Property; import org.lwjgl.input.Keyboard; @@ -104,6 +112,19 @@ public class MiscConfig { public boolean crimsonIsleReputationHelper = true; @Expose + @ConfigOption(name = "Use Hotkey", desc = "Only show the reputation helper while pressing the hotkey.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean reputationHelperUseHotkey = false; + + @Expose + @ConfigOption(name = "Hotkey", desc = "Press this hotkey to show the reputation helper.") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) + @ConfigAccordionId(id = 6) + public int reputationHelperHotkey = Keyboard.KEY_NONE; + + + @Expose public Position crimsonIsleReputationHelperPos = new Position(10, 10, false, true); @Expose @@ -559,6 +580,61 @@ public class MiscConfig { } @Expose + @ConfigOption(name = "Ender Node Tracker", desc = "") + @Accordion + public EnderNodeTracker enderNodeTracker = new EnderNodeTracker(); + + public static class EnderNodeTracker { + @Expose + @ConfigOption( + name = "Enabled", + desc = "Tracks all of your drops from mining Ender Nodes in the End.\n" + + "Also tracks drops from Endermen." + ) + @ConfigEditorBoolean + public boolean enabled = false; + + @Expose + @ConfigOption( + name = "Text Format", + desc = "Drag text to change the appearance of the overlay." + ) + @ConfigEditorDraggableList( + exampleText = { + "§5§lEnder Node Tracker", + "§d1,303 Ender Nodes Mined", + "§615.3M Coins Made", + " ", + "§b123 §cEndermite Nest", + "§b832 §aEnchanted End Stone", + "§b230 §aEnchanted Obsidian", + "§b1630 §aEnchanted Ender Pearl", + "§b85 §aGrand Experience Bottle", + "§b4 §9Titanic Experience Bottle", + "§b15 §9End Stone Shulker", + "§b53 §9End Stone Geode", + "§b10 §d◆ Magical Rune I", + "§b24 §5Ender Gauntlet", + "§b357 §5Mite Gel", + "§b2 §cShrimp The Fish", + " ", + "§b200 §5Ender Armor", + "§b24 §5Ender Helmet", + "§b24 §5Ender Chestplate", + "§b24 §5Ender Leggings", + "§b24 §5Ender Boots", + "§b24 §5Ender Necklace", + "§f10§7-§a8§7-§93§7-§52§7-§61 §fEnderman Pet", + " " + } + ) + public List<Integer> textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 14, 15, 16, 17, 23)); + + @Expose + public Position position = new Position(10, 80, false, true); + } + + @Expose @ConfigOption(name = "Custom Text box", desc = "") @Accordion public TextBox textBox = new TextBox(); @@ -592,6 +668,13 @@ public class MiscConfig { @ConfigEditorBoolean public boolean highlightCommissionMobs = false; + @Expose + @ConfigOption(name = "King Talisman Helper", desc = "Show kings you have not talked to yet, and when the next missing king will appear.") + @ConfigEditorBoolean + public boolean kingTalismanHelper = false; + + @Expose + public Position kingTalismanHelperPos = new Position(-400, 220, false, true); } @Expose @@ -666,6 +749,11 @@ public class MiscConfig { public boolean patcherSendCoordWaypoint = false; @Expose + @ConfigOption(name = "Harp Keybinds", desc = "In Melodys Harp, press buttons with your number row on the keyboard instead of clicking.") + @ConfigEditorBoolean + public boolean harpKeybinds = false; + + @Expose @ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.") @ConfigEditorBoolean public boolean configButtonOnPause = true; diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt index 643ef46ff..8b6330f6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt @@ -1,26 +1,67 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzActionBarEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.SeaCreatureFishEvent +import at.hannibal2.skyhanni.features.chat.ChatFilterGui import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager +import at.hannibal2.skyhanni.utils.IdentityCharacteristics import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.ChatLine +import net.minecraft.client.gui.GuiNewChat import net.minecraft.event.HoverEvent import net.minecraft.network.play.server.S02PacketChat +import net.minecraft.util.EnumChatFormatting import net.minecraft.util.IChatComponent import net.minecraftforge.client.event.ClientChatReceivedEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.relauncher.ReflectionHelper +import java.lang.invoke.MethodHandles -class ChatManager { +object ChatManager { private val loggerAll = LorenzLogger("chat/all") private val loggerFiltered = LorenzLogger("chat/blocked") private val loggerAllowed = LorenzLogger("chat/allowed") private val loggerModified = LorenzLogger("chat/modified") private val loggerFilteredTypes = mutableMapOf<String, LorenzLogger>() + private val messageHistory = + object : LinkedHashMap<IdentityCharacteristics<IChatComponent>, MessageFilteringResult>() { + override fun removeEldestEntry(eldest: MutableMap.MutableEntry<IdentityCharacteristics<IChatComponent>, MessageFilteringResult>?): Boolean { + return size > 100 + } + } + + fun getRecentMessageHistory(): List<MessageFilteringResult> = messageHistory.toList().map { it.second } + + enum class ActionKind(format: Any) { + BLOCKED(EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD), + RETRACTED(EnumChatFormatting.DARK_PURPLE.toString() + EnumChatFormatting.BOLD), + MODIFIED(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD), + ALLOWED(EnumChatFormatting.GREEN), + ; + + val renderedString = "$format$name" + + companion object { + val maxLength by lazy { + entries.maxOf { Minecraft.getMinecraft().fontRendererObj.getStringWidth(it.renderedString) } + } + } + } + + data class MessageFilteringResult( + val message: IChatComponent, + var actionKind: ActionKind, + var actionReason: String?, + val modified: IChatComponent? + ) @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) fun onActionBarPacket(event: PacketEvent.ReceiveEvent) { @@ -43,7 +84,7 @@ class ChatManager { val message = LorenzUtils.stripVanillaMessage(original.formattedText) if (message.startsWith("§f{\"server\":\"")) return - + val key = IdentityCharacteristics(original) val chatEvent = LorenzChatEvent(message, original) if (!isSoopyMessage(event.message)) { chatEvent.postAndCatch() @@ -56,6 +97,7 @@ class ChatManager { loggerAll.log("[$blockReason] $message") loggerFilteredTypes.getOrPut(blockReason) { LorenzLogger("chat/filter_blocked/$blockReason") } .log(message) + messageHistory.put(key, MessageFilteringResult(original, ActionKind.BLOCKED, blockReason, null)) return } @@ -67,6 +109,9 @@ class ChatManager { loggerModified.log(" ") loggerModified.log("[original] " + original.formattedText) loggerModified.log("[modified] " + modified.formattedText) + messageHistory.put(key, MessageFilteringResult(original, ActionKind.MODIFIED, null, modified)) + } else { + messageHistory.put(key, MessageFilteringResult(original, ActionKind.ALLOWED, null, null)) } } @@ -104,4 +149,28 @@ class ChatManager { val seaCreature = SeaCreatureManager.getSeaCreature(chatEvent.message) ?: return SeaCreatureFishEvent(seaCreature, chatEvent).postAndCatch() } + + fun openChatFilterGUI() { + SkyHanniMod.screenToOpen = ChatFilterGui(getRecentMessageHistory()) + } + + val chatLinesField by lazy { + MethodHandles.publicLookup().unreflectGetter( + ReflectionHelper.findField(GuiNewChat::class.java, "chatLines", "field_146252_h", "h") + .makeAccessible() + ) + } + + fun retractMessage(message: IChatComponent?, reason: String) { + if (message == null) return + val chatGUI = Minecraft.getMinecraft().ingameGUI.chatGUI + @Suppress("UNCHECKED_CAST") + val chatLines = chatLinesField.invokeExact(chatGUI) as MutableList<ChatLine> + if (!chatLines.removeIf { it.chatComponent === message }) return + chatGUI.refreshChat() + + val history = messageHistory[IdentityCharacteristics(message)] ?: return + history.actionKind = ActionKind.RETRACTED + history.actionReason = reason.uppercase() + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt index c0561d83a..23352deee 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt @@ -45,7 +45,7 @@ class CropAccessoryData { // Handle accessory bag detection @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { // handling accessory bags with only one page if (event.inventoryName == "Accessory Bag") { diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt index 0bc742198..dad4a1bf3 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -21,8 +21,7 @@ class EntityData { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - val entities = EntityUtils.getEntitiesOrNull<EntityLivingBase>() ?: return - for (entity in entities) { + for (entity in EntityUtils.getEntities<EntityLivingBase>()) { val maxHealth = entity.baseMaxHealth val oldMaxHealth = maxHealthMap.getOrDefault(entity, -1) if (oldMaxHealth != maxHealth) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenComposterUpgradesData.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenComposterUpgradesData.kt index 1cf65578d..14651f900 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenComposterUpgradesData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenComposterUpgradesData.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.data.model.ComposterUpgrade -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.composter.ComposterAPI import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -11,7 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenComposterUpgradesData { @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!GardenAPI.inGarden()) return if (event.inventoryName != "Composter Upgrades") return for (item in event.inventoryItems.values) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt index 7d5b6cd5c..0742fae1e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -26,7 +26,7 @@ class GardenCropMilestones { // } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (event.inventoryName != "Crop Milestones") return for ((_, stack) in event.inventoryItems) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt index aa797add1..b1d1d3bf6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.CropUpgradeUpdateEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.CropType.Companion.getByNameOrNull @@ -26,7 +26,7 @@ class GardenCropUpgrades { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (event.inventoryName != "Crop Upgrades") return event.inventoryItems.forEach { (_, item) -> val crop = item.name?.removeColor()?.let { CropType.getByNameOrNull(it) } ?: return@forEach diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt index a0b8ae9bc..92f7bebb3 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MayorElection.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.APIUtil import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.put import at.hannibal2.skyhanni.utils.jsonobjects.MayorJson import io.github.moulberry.notenoughupdates.util.SkyBlockTime import kotlinx.coroutines.Dispatchers @@ -74,8 +75,4 @@ class MayorElection { private fun MayorJson.Election.getPairs() = year + 1 to candidates.bestCandidate() private fun List<MayorJson.Candidate>.bestCandidate() = maxBy { it.votes } - - private infix fun <K, V> MutableMap<K, V>.put(pairs: Pair<K, V>) { - this[pairs.first] = pairs.second - } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index b9e2b45dc..db000fb25 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -74,6 +74,11 @@ class MinecraftData { val newItem = hand?.getInternalName() ?: "" if (newItem != InventoryUtils.itemInHandId) { ItemInHandChangeEvent(newItem, hand).postAndCatch() + + InventoryUtils.recentItemsInHand.keys.removeIf { it + 30_000 > System.currentTimeMillis() } + if (newItem != "") { + InventoryUtils.recentItemsInHand[System.currentTimeMillis()] = newItem + } InventoryUtils.itemInHandId = newItem InventoryUtils.latestItemInHand = hand } @@ -82,5 +87,6 @@ class MinecraftData { @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { InventoryUtils.itemInHandId = "" + InventoryUtils.recentItemsInHand.clear() } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt index 77921029b..b6dab180a 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt @@ -10,7 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object OtherInventoryData { private var currentInventory: Inventory? = null private var acceptItems = false - private var lateEvent: LateInventoryOpenEvent? = null + private var lateEvent: InventoryUpdatedEvent? = null @SubscribeEvent fun onCloseWindow(event: GuiContainerEvent.CloseWindowEvent) { @@ -60,7 +60,7 @@ object OtherInventoryData { val itemStack = packet.func_149174_e() if (itemStack != null) { it.items[slot] = itemStack - lateEvent = LateInventoryOpenEvent(it) + lateEvent = InventoryUpdatedEvent(it) } } } @@ -88,7 +88,8 @@ object OtherInventoryData { } private fun done(inventory: Inventory) { - InventoryOpenEvent(inventory).postAndCatch() + InventoryFullyOpenedEvent(inventory).postAndCatch() + InventoryUpdatedEvent(inventory).postAndCatch() acceptItems = false } diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt index 2928c84f2..e91019ff6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.data -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzActionBarEvent import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent @@ -49,7 +49,7 @@ class SkillExperience { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (event.inventoryName != "Your Skills") return for ((_, stack) in event.inventoryItems) { @@ -74,7 +74,6 @@ class SkillExperience { val overflow = rawNumber.formatNumber() val experience = baseExp + overflow skillExp[skillName] = experience - println("skill exp: $skillName -> $experience") } next = false } diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt index 9719c70ff..db4735aeb 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data.repo +import at.hannibal2.skyhanni.test.command.CopyErrorCommand import com.google.gson.Gson import java.io.* import java.nio.charset.StandardCharsets @@ -79,6 +80,10 @@ object RepoUtils { fun <T> getConstant(repo: File, constant: String, gson: Gson, clazz: Class<T>?): T? { if (repo.exists()) { val jsonFile = File(repo, "constants/$constant.json") + if (!jsonFile.isFile) { + CopyErrorCommand.logError(Error("File '$jsonFile' not found!"), "File in repo missing! ($jsonFile). Try §e/shupdaterepo") + return null + } BufferedReader( InputStreamReader( FileInputStream(jsonFile), diff --git a/src/main/java/at/hannibal2/skyhanni/events/InventoryOpenEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt index a528e27c5..2cd5a88f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/InventoryOpenEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt @@ -3,14 +3,13 @@ package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.data.OtherInventoryData import net.minecraft.item.ItemStack -open class InventoryEvent(inventory: OtherInventoryData.Inventory): LorenzEvent() { +open class InventoryOpenEvent(inventory: OtherInventoryData.Inventory): LorenzEvent() { val inventoryId: Int by lazy { inventory.windowId } val inventoryName: String by lazy {inventory.title } val inventorySize: Int by lazy {inventory.slotCount } val inventoryItems: Map<Int, ItemStack> by lazy {inventory.items } } -class InventoryOpenEvent(inventory: OtherInventoryData.Inventory): InventoryEvent(inventory) +class InventoryFullyOpenedEvent(inventory: OtherInventoryData.Inventory): InventoryOpenEvent(inventory) -// Firing with items that are added later -class LateInventoryOpenEvent(inventory: OtherInventoryData.Inventory): InventoryEvent(inventory)
\ No newline at end of file +class InventoryUpdatedEvent(inventory: OtherInventoryData.Inventory): InventoryOpenEvent(inventory)
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt index 1d9c20dea..de8a29e96 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt @@ -53,7 +53,7 @@ class BazaarApi { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { inBazaarInventory = checkIfInBazaar(event) } @@ -100,7 +100,7 @@ class BazaarApi { } } - private fun checkIfInBazaar(event: InventoryOpenEvent): Boolean { + private fun checkIfInBazaar(event: InventoryFullyOpenedEvent): Boolean { val returnItem = event.inventorySize - 5 for ((slot, item) in event.inventoryItems) { if (slot == returnItem) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt index c6d31cede..043e8c3ac 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.bazaar import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.APIUtil import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt index 7332c6571..f37aeb7f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.bingo.card.CommunityGoal import at.hannibal2.skyhanni.features.bingo.card.PersonalGoal @@ -21,7 +21,6 @@ import net.minecraft.client.gui.GuiChat import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BingoCardDisplay { - private val config get() = SkyHanniMod.feature.bingo.bingoCard private val MAX_PERSONAL_GOALS = 20 private val MAX_COMMUNITY_GOALS = 5 @@ -34,6 +33,8 @@ class BingoCardDisplay { } companion object { + private val config get() = SkyHanniMod.feature.bingo.bingoCard + private var displayMode = 0 val personalGoals = mutableListOf<PersonalGoal>() private val communityGoals = mutableListOf<CommunityGoal>() @@ -45,10 +46,29 @@ class BingoCardDisplay { personalGoals.clear() communityGoals.clear() } + + fun toggleCommand() { + if (!LorenzUtils.isBingoProfile) { + LorenzUtils.chat("§cThis command only works on a bingo profile!") + return + } + if (!config.enabled) { + LorenzUtils.chat("§cBingo Card is disabled in the config!") + return + } + toggleMode() + } + + private fun toggleMode() { + displayMode++ + if (displayMode == 3) { + displayMode = 0 + } + } } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.isBingoProfile) return if (!config.enabled) return if (event.inventoryName != "Bingo Card") return @@ -116,21 +136,19 @@ class BingoCardDisplay { } private var lastSneak = false - private var displayMode = 0 @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.isBingoProfile) return if (!config.enabled) return - if (ItemUtils.isSkyBlockMenuItem(InventoryUtils.getItemInHand())) { - val sneaking = Minecraft.getMinecraft().thePlayer.isSneaking - if (lastSneak != sneaking) { - lastSneak = sneaking - if (sneaking) { - displayMode++ - if (displayMode == 3) { - displayMode = 0 + if (config.quickToggle) { + if (ItemUtils.isSkyBlockMenuItem(InventoryUtils.getItemInHand())) { + val sneaking = Minecraft.getMinecraft().thePlayer.isSneaking + if (lastSneak != sneaking) { + lastSneak = sneaking + if (sneaking) { + toggleMode() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index 1a1d8043f..211fd94e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -261,7 +261,7 @@ class MinionCraftHelper { private fun isMinionName(itemName: String) = itemName.contains(" Minion ") && !itemName.contains(" Minion Skin") @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.isBingoProfile) return if (event.inventoryName != "Crafted Minions") return diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index 84acf124e..a8733abff 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -27,7 +27,6 @@ class ChatFilter { isGuildExp(message) && config.guildExp -> "guild_exp" friendJoin(message) && config.friendJoinLeft -> "friend_join" killCombo(message) && config.killCombo -> "kill_combo" - watchdogAnnouncement(message) && config.watchDog -> "watchdog" profileJoin(message) && config.profileJoin -> "profile_join" bazaarAndAHMiniMessages(message) && config.others -> "bz_ah_minis" @@ -219,14 +218,6 @@ class ChatFilter { return false } - private fun watchdogAnnouncement(message: String) = when { - message == "§4[WATCHDOG ANNOUNCEMENT]" -> true - message.matchRegex("§fWatchdog has banned §r§c§l(.*)§r§f players in the last 7 days.") -> true - message.matchRegex("§fStaff have banned an additional §r§c§l(.*)§r§f in the last 7 days.") -> true - message == "§cBlacklisted modifications are a bannable offense!" -> true - else -> false - } - private fun profileJoin(message: String) = when { message.startsWith("§aYou are playing on profile: §e") -> true message.startsWith("§8Profile ID: ") -> true diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt new file mode 100644 index 000000000..971878306 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt @@ -0,0 +1,119 @@ +package at.hannibal2.skyhanni.features.chat + +import at.hannibal2.skyhanni.data.ChatManager +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.OSUtils +import io.github.moulberry.moulconfig.internal.GlScissorStack +import io.github.moulberry.moulconfig.internal.RenderUtils +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.GuiScreen +import net.minecraft.client.gui.GuiUtilRenderComponents +import net.minecraft.client.gui.ScaledResolution +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.util.IChatComponent +import org.lwjgl.input.Mouse + +class ChatFilterGui(private val history: List<ChatManager.MessageFilteringResult>) : GuiScreen() { + private var scroll = -1.0 + private val w = 500 + private var wasMouseButtonDown = false + private val h = 300 + private val reasonMaxLength = + history.maxOf { it.actionReason?.let { Minecraft.getMinecraft().fontRendererObj.getStringWidth(it) } ?: 0 } + private val historySize by lazy { + history.sumOf { splitLine(it.message).size * 10 + if (it.modified != null) splitLine(it.modified).size * 10 else 0 } + } + + override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) { + super.drawScreen(mouseX, mouseY, partialTicks) + drawDefaultBackground() + GlStateManager.pushMatrix() + val l = (width / 2.0 - w / 2.0).toInt() + val t = (height / 2.0 - h / 2.0).toInt() + GlStateManager.translate(l + 0.0, t + 0.0, 0.0) + RenderUtils.drawFloatingRectDark(0, 0, w, h) + GlStateManager.translate(5.0, 5.0 - scroll, 0.0) + var mouseX = mouseX - l + val isMouseButtonDown = if (mouseX in 0..w && mouseY in t..(t + h)) Mouse.isButtonDown(0) else false + var mouseY = mouseY - (t - scroll).toInt() + val sr = ScaledResolution(mc) + GlScissorStack.push(l + 5, t + 5, w + l - 5, h + t - 5, sr) + + for (msg in history) { + drawString(mc.fontRendererObj, msg.actionKind.renderedString, 0, 0, -1) + drawString(mc.fontRendererObj, msg.actionReason, ChatManager.ActionKind.maxLength + 5, 0, -1) + var size = drawMultiLineText( + msg.message, + ChatManager.ActionKind.maxLength + reasonMaxLength + 10, + ) + if (msg.modified != null) { + drawString( + mc.fontRendererObj, + "§e§lNEW TEXT", + 0, 0, -1 + ) + size += drawMultiLineText( + msg.modified, + ChatManager.ActionKind.maxLength + reasonMaxLength + 10, + ) + } + if (mouseX in 0..w && mouseY in 0..(size * 10) && (isMouseButtonDown && !wasMouseButtonDown)) { + if (LorenzUtils.isShiftKeyDown()) { + OSUtils.copyToClipboard(IChatComponent.Serializer.componentToJson(msg.message)) + LorenzUtils.chat("Copied structured chat line to clipboard") + } else { + OSUtils.copyToClipboard(msg.message.formattedText) + LorenzUtils.chat("Copied chat line to clipboard") + } + } + mouseY -= size * 10 + } + GlScissorStack.pop(sr) + wasMouseButtonDown = isMouseButtonDown + GlStateManager.popMatrix() + GlStateManager.color(1f, 1f, 1f, 1f) + } + + fun splitLine(comp: IChatComponent): List<IChatComponent> { + return GuiUtilRenderComponents.splitText( + comp, + w - (ChatManager.ActionKind.maxLength + reasonMaxLength + 10 + 10), + mc.fontRendererObj, + false, + true + ) + } + + override fun initGui() { + super.initGui() + if (this.scroll < 0) { + setScroll(1000000000.0) + } + } + + fun setScroll(newScroll: Double) { + this.scroll = newScroll.coerceAtMost(historySize - h + 10.0).coerceAtLeast(0.0) + } + + fun drawMultiLineText(comp: IChatComponent, xPos: Int): Int { + val modifiedSplitText = splitLine(comp) + for (line in modifiedSplitText) { + drawString( + mc.fontRendererObj, + line.formattedText, + xPos, + 0, + -1 + ) + GlStateManager.translate(0F, 10F, 0F) + } + return modifiedSplitText.size + } + + + override fun handleMouseInput() { + super.handleMouseInput() + setScroll(scroll - Mouse.getEventDWheel()) + } + +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt new file mode 100644 index 000000000..d36f8ba35 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/CompactBestiaryChatMessage.kt @@ -0,0 +1,86 @@ +package at.hannibal2.skyhanni.features.chat + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.ChatManager +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.util.IChatComponent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class CompactBestiaryChatMessage { + + var inBestiary = false + var bestiaryDescription = mutableListOf<String>() + var acceptMoreDescription = true + var command = "" + private var blockedLines = 0 + + var lastBorder: IChatComponent? = null + var lastEmpty: IChatComponent? = null + + var milestoneMessage: String? = null + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!SkyHanniMod.feature.chat.compactBestiaryMessage) return + + val titleMessage = " §6§lBESTIARY" + val border = "§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬" + + val message = event.message + + if (message == border) { + lastBorder = event.chatComponent + } + if (message == " ") { + lastEmpty = event.chatComponent + } + + if (message == titleMessage) { + event.blockedReason = "bestiary" + ChatManager.retractMessage(lastBorder, "bestiary") + ChatManager.retractMessage(lastEmpty, "bestiary") + + lastBorder = null + lastEmpty = null + + for (sibling in event.chatComponent.siblings) { + sibling.chatStyle?.chatClickEvent?.let { + command = it.value + } + } + inBestiary = true + blockedLines = 0 + bestiaryDescription.add(message.trim()) + } else if (inBestiary) { + event.blockedReason = "bestiary" + blockedLines++ + if (blockedLines > 10) { + blockedLines = 0 + inBestiary = false + } + if (message == border) { + inBestiary = false + + val title = bestiaryDescription[1] + LorenzUtils.hoverableChat("§6§lBESTIARY §r$title", bestiaryDescription.dropLast(1), command) + bestiaryDescription.clear() + acceptMoreDescription = true + + } else { + milestoneMessage?.let { + LorenzUtils.chat("§6§lBESTIARY MILESTONE $it") + milestoneMessage = null + } + if (message.endsWith("§6§lBESTIARY MILESTONE")) { + acceptMoreDescription = false + milestoneMessage = message + } + if (acceptMoreDescription) { + bestiaryDescription.add(message.trim()) + } + } + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt new file mode 100644 index 000000000..099d52067 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt @@ -0,0 +1,53 @@ +package at.hannibal2.skyhanni.features.chat + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.ChatManager +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.util.IChatComponent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class WatchdogHider { + + private var inWatchdog = false + private var blockedLines = 0 + private var startLineComponent: IChatComponent? = null + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!LorenzUtils.onHypixel || !SkyHanniMod.feature.chat.watchDog) return + + when (event.message) { + watchdogStartLine -> { + startLineComponent = event.chatComponent + blockedLines = 0 + } + watchdogAnnouncementLine -> { + ChatManager.retractMessage(startLineComponent, "watchdog") + startLineComponent = null + inWatchdog = true + } + watchdogEndLine -> { + event.blockedReason = "watchdog" + inWatchdog = false + } + } + + if (inWatchdog) { + event.blockedReason = "watchdog" + blockedLines++ + if (blockedLines > 10) { + blockedLines = 0 + inWatchdog = false + } + } + } + + companion object { + private const val watchdogStartLine = "§f" + private const val watchdogAnnouncementLine = "§4[WATCHDOG ANNOUNCEMENT]" + private const val watchdogEndLine = "§c" + } +} + + diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt new file mode 100644 index 000000000..73e772b73 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt @@ -0,0 +1,24 @@ +package at.hannibal2.skyhanni.features.commands + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.network.play.client.C01PacketChatMessage +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class WarpIsCommand { + + @SubscribeEvent + fun onSendPacket(event: PacketEvent.SendEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!SkyHanniMod.feature.commands.replaceWarpIs) return + + val packet = event.packet + if (packet is C01PacketChatMessage) { + if (packet.message.lowercase() == "/warp is") { + event.isCanceled = true + LorenzUtils.sendMessageToServer("/is") + } + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index d46bae435..83a2abbec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.LorenzUtils.between import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy +import at.hannibal2.skyhanni.utils.LorenzUtils.put import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText @@ -297,15 +298,15 @@ class DamageIndicatorManager { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!LorenzUtils.inSkyBlock) return - for (entity in EntityUtils.getEntities<EntityLivingBase>()) { - checkEntity(entity) + if (!isEnabled()) return + data = data.editCopy { + EntityUtils.getEntities<EntityLivingBase>().mapNotNull(::checkEntity).forEach { this put it } } } - private fun checkEntity(entity: EntityLivingBase) { + private fun checkEntity(entity: EntityLivingBase): Pair<UUID, EntityData>? { try { - val entityData = grabData(entity) ?: return + val entityData = grabData(entity) ?: return null if (LorenzUtils.inDungeons) { checkFinalBoss(entityData.finalDungeonBoss, entity.entityId) } @@ -331,7 +332,7 @@ class DamageIndicatorManager { } "§cDead" } else { - getCustomHealth(entityData, health, entity, maxHealth) ?: return + getCustomHealth(entityData, health, entity, maxHealth) ?: return null } if (data.containsKey(entity.uniqueID)) { @@ -350,11 +351,10 @@ class DamageIndicatorManager { entityData.healthText = color.getChatColor() + NumberUtil.format(health) } entityData.timeLastTick = System.currentTimeMillis() - data = data.editCopy { this[entity.uniqueID] = entityData } - - + return entity.uniqueID to entityData } catch (e: Throwable) { e.printStackTrace() + return null } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt index bde581543..f151c6bd5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.dungeon.DungeonData import at.hannibal2.skyhanni.features.dungeon.DungeonLividFinder -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.EntityUtils.hasBossHealth diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt index 20d7207f0..c27b1a447 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusUnopenedChestTracker.kt @@ -23,13 +23,12 @@ class CroesusUnopenedChestTracker { for (slot in InventoryUtils.getItemsInOpenChest()) { val stack = slot.stack val lore = stack.getLore() - if (lore.any { it.contains("Click to view") }) { - if (!lore.any { it.contains("Chests have been opened!") }) { + if ("§eClick to view chests!" in lore) { + if ("§aNo more Chests to open!" !in lore) { slot highlight LorenzColor.DARK_PURPLE } } } } - } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt index b1879691d..ed2321058 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt @@ -5,25 +5,28 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BarnFishingTimer { - + private val config get() = SkyHanniMod.feature.fishing private val barnLocation = LorenzVec(108, 89, -252) private var rightLocation = false private var currentCount = 0 private var startTime = 0L + private var inHollows = false @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.fishing.barnTimer) return + if (!config.barnTimer) return - if (event.repeatSeconds(3)) checkIsland() + if (event.repeatSeconds(3)) { + rightLocation = isRightLocation() + } if (!rightLocation) return @@ -35,14 +38,15 @@ class BarnFishingTimer { if (currentCount == 0) return val duration = System.currentTimeMillis() - startTime - val barnTimerAlertTime = SkyHanniMod.feature.fishing.barnTimerAlertTime * 1_000 + val barnTimerAlertTime = config.barnTimerAlertTime * 1_000 if (duration > barnTimerAlertTime && duration < barnTimerAlertTime + 3_000) { SoundUtils.playBeepSound() } } private fun checkMobs() { - val newCount = countMobs() + val newCount = if (inHollows) countHollowsMobs() else countMobs() + if (currentCount == 0) { if (newCount > 0) { startTime = System.currentTimeMillis() @@ -55,33 +59,43 @@ class BarnFishingTimer { } } + private fun countHollowsMobs() = EntityUtils.getEntitiesNextToPlayer<EntityArmorStand>(10.0) + .count { entity -> SeaCreatureManager.allFishingMobNames.any { entity.name.contains(it) } } + private fun countMobs() = EntityUtils.getEntities<EntityArmorStand>() .map { it.name } .count { it.endsWith("§c❤") } - private fun checkIsland() { - if (LorenzUtils.skyBlockIsland == IslandType.THE_FARMING_ISLANDS) { - rightLocation = false - return + private fun isRightLocation(): Boolean { + if (config.barnTimerCrystalHollows) { + if (IslandType.CRYSTAL_HOLLOWS.isInIsland()) { + inHollows = true + return true + } + } + inHollows = false + + if (IslandType.THE_FARMING_ISLANDS.isInIsland()) { + return LocationUtils.playerLocation().distance(barnLocation) < 50 } - rightLocation = LocationUtils.playerLocation().distance(barnLocation) < 50 + return false } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.fishing.barnTimer) return + if (!config.barnTimer) return if (!rightLocation) return if (currentCount == 0) return val duration = System.currentTimeMillis() - startTime - val barnTimerAlertTime = SkyHanniMod.feature.fishing.barnTimerAlertTime * 1_000 + val barnTimerAlertTime = config.barnTimerAlertTime * 1_000 val color = if (duration > barnTimerAlertTime) "§c" else "§e" val timeFormat = TimeUtils.formatDuration(duration, biggestUnit = TimeUnit.MINUTE) val name = if (currentCount == 1) "sea creature" else "sea creatures" val text = "$color$timeFormat §8(§e$currentCount §b$name§8)" - SkyHanniMod.feature.fishing.barnTimerPos.renderString(text, posLabel = "BarnTimer") + config.barnTimerPos.renderString(text, posLabel = "BarnTimer") } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt index 9f6527148..73a358e69 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt @@ -14,6 +14,7 @@ class SeaCreatureManager { try { val data = event.getConstant("SeaCreatures") ?: return + val fishingMobNames = mutableListOf<String>() for (variant in data.entrySet().map { it.value.asJsonObject }) { val chatColor = variant["chat_color"].asString for ((displayName, value) in variant["sea_creatures"].asJsonObject.entrySet()) { @@ -26,9 +27,11 @@ class SeaCreatureManager { } else false seaCreatureMap[chatMessage] = SeaCreature(displayName, fishingExperience, chatColor, rare) + fishingMobNames.add(displayName) counter++ } } + allFishingMobNames = fishingMobNames LorenzUtils.debug("Loaded $counter sea creatures from repo") } catch (e: Exception) { @@ -39,6 +42,7 @@ class SeaCreatureManager { companion object { private val seaCreatureMap = mutableMapOf<String, SeaCreature>() + var allFishingMobNames = emptyList<String>() fun getSeaCreature(message: String): SeaCreature? { return seaCreatureMap.getOrDefault(message, null) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt index bfcb94908..4202d2600 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt @@ -1,4 +1,4 @@ -package at.hannibal2.skyhanni.features.fishing +package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt index 69e1a0efc..69c65aa15 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishFillet.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt @@ -1,4 +1,4 @@ -package at.hannibal2.skyhanni.features.fishing +package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzToolTipEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishInfo.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishInfo.kt index 395fea310..8fd402fee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishInfo.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishInfo.kt @@ -1,4 +1,4 @@ -package at.hannibal2.skyhanni.features.fishing +package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.test.command.CopyErrorCommand import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt index df8c95d57..c2f8c508d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt @@ -1,4 +1,4 @@ -package at.hannibal2.skyhanni.features.fishing +package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt index b655c9893..423a393f1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt @@ -1,8 +1,8 @@ -package at.hannibal2.skyhanni.features.fishing +package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.features.fishing.TrophyFishManager.Companion.fishes +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.Companion.fishes import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyRarity.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt index d4df5f2eb..2e61e1e80 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyRarity.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt @@ -1,4 +1,4 @@ -package at.hannibal2.skyhanni.features.fishing +package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index 28b7797a5..4c5f30ad3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorFeatures import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -40,7 +40,7 @@ class AnitaMedalProfit { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!config.anitaMedalProfitEnabled) return if (event.inventoryName != "Anita") return if (GardenVisitorFeatures.inVisitorInventory) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index d50ec8094..72d1d1dc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -118,6 +118,8 @@ object GardenAPI { if (internalName.startsWith("ROOKIE_HOE")) return true + if (internalName.startsWith("BINGHOE")) return true + return false } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index 30d2a4cbb..5f2b50e82 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -58,7 +58,7 @@ class GardenLevelDisplay { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!GardenAPI.inGarden()) return if (event.inventoryName != "Desk") return val item = event.inventoryItems[4]!! diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index 3a7e2bc15..1525a2209 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -81,7 +81,7 @@ class GardenNextJacobContest { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!config.nextJacobContestDisplay) return val backItem = event.inventoryItems[48] ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 8fe0f2272..8943a2092 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -107,7 +107,7 @@ class ComposterOverlay { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!GardenAPI.inGarden()) return if (!config.composterOverlay) return inComposter = event.inventoryName == "Composter" @@ -361,7 +361,7 @@ class ComposterOverlay { bigList: MutableList<List<Any>>, factors: Map<String, Double>, missing: Double, - testOffset: Int = 0, + testOffset_: Int = 0, onClick: (String) -> Unit, ): String { val map = mutableMapOf<String, Double>() @@ -369,6 +369,12 @@ class ComposterOverlay { map[internalName] = factor / getPrice(internalName) } + val testOffset = if (testOffset_ > map.size) { + LorenzUtils.chat("§cSkyHanni] Invalid Composter Overlay Offset! $testOffset cannot be greather than ${map.size}!") + ComposterOverlay.testOffset = 0 + 0 + } else testOffset_ + var i = 0 var first: String? = null for (internalName in map.sortedDesc().keys) { @@ -384,6 +390,9 @@ class ComposterOverlay { val totalPrice = itemsNeeded * price val list = mutableListOf<Any>() + if (testOffset != 0) { + list.add("#$i ") + } list.add(item) val format = NumberUtil.format(totalPrice) val selected = @@ -402,8 +411,14 @@ class ComposterOverlay { if (i == 10 + testOffset) break } + if (testOffset != 0) { + bigList.addAsSingletonList(Renderable.link("testOffset = $testOffset") { + ComposterOverlay.testOffset = 0 + update() + }) + } - return first!! + return first ?: error("First is empty!") } private fun getPrice(internalName: String): Double { @@ -447,6 +462,7 @@ class ComposterOverlay { if (internalName.endsWith("_CHESTPLATE")) continue if (internalName.endsWith("_LEGGINGS")) continue if (internalName == "SPEED_TALISMAN") continue + if (internalName == "SIMPLE_CARROT_CANDY") continue val (newId, amount) = NEUItems.getMultiplier(internalName) if (amount <= 9) continue val finalAmount = diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt index b88bc6bed..d0a22dc25 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt @@ -69,7 +69,7 @@ object FarmingContestAPI { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (event.inventoryName == "Your Contests") { inInventory = true } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt index a45378994..09167dd76 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.garden.contest import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.LateInventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay.Companion.getLatestTrueFarmingFortune import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getLatestBlocksPerSecond @@ -25,7 +25,7 @@ class JacobContestTimeNeeded { private var currentBracket = ContestBracket.GOLD @SubscribeEvent(priority = EventPriority.LOW) - fun onLateInventoryOpen(event: LateInventoryOpenEvent) { + fun onLateInventoryOpen(event: InventoryUpdatedEvent) { if (FarmingContestAPI.inInventory) { update() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt index 5efe01d9e..61bd56198 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.garden.contest import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.events.LateInventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -37,7 +37,7 @@ class JacobFarmingContestsInventory { } @SubscribeEvent - fun onLateInventoryOpen(event: LateInventoryOpenEvent) { + fun onLateInventoryOpen(event: InventoryUpdatedEvent) { if (!LorenzUtils.inSkyBlock) return if (event.inventoryName != "Your Contests") return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index f39826a9a..f72bf42cc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -111,8 +111,8 @@ object CropMoneyDisplay { if (GardenAPI.mushroomCowPet && it != CropType.MUSHROOM) { val (redPrice, brownPrice) = if (LorenzUtils.noTradeMode) { - val redPrice = BazaarApi.getBazaarDataByInternalName("ENCHANTED_RED_MUSHROOM")?.npcPrice ?: 160.0 / 160 - val brownPrice = BazaarApi.getBazaarDataByInternalName("ENCHANTED_BROWN_MUSHROOM")?.npcPrice ?: 160.0 / 160 + val redPrice = (BazaarApi.getBazaarDataByInternalName("ENCHANTED_RED_MUSHROOM")?.npcPrice ?: 160.0) / 160 + val brownPrice = (BazaarApi.getBazaarDataByInternalName("ENCHANTED_BROWN_MUSHROOM")?.npcPrice ?: 160.0) / 160 redPrice to brownPrice } else { val redPrice = NEUItems.getPrice("ENCHANTED_RED_MUSHROOM") / 160 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index 9f675fe15..424bec2a6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.garden.fortuneguide import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.GardenToolChangeEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay import at.hannibal2.skyhanni.features.garden.GardenAPI @@ -85,7 +85,7 @@ class CaptureFarmingGear { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.inSkyBlock) return val hidden = GardenAPI.config?.fortune ?: return val farmingItems = farmingItems ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt index 0bf96463a..cc48a01f1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems @@ -24,7 +24,7 @@ class GardenDeskInSBMenu { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { showItem = GardenAPI.inGarden() && config.deskInSkyBlockMenu && event.inventoryName == "SkyBlock Menu" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt index 4d86c7a35..1f7330eb9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -37,7 +37,7 @@ object GardenPlotIcon { fun isEnabled() = GardenAPI.inGarden() && config.enabled && inInventory @SubscribeEvent(priority = EventPriority.HIGHEST) - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { inInventory = event.inventoryName == "Configure Plots" if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt index 131e5d484..5073f4d95 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -26,7 +26,7 @@ class SkyMartCopperPrice { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!isEnabled()) return if (event.inventoryName != "SkyMart") return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index fcac2e663..2040b479d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -67,7 +67,7 @@ class GardenVisitorFeatures { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!GardenAPI.inGarden()) return val npcItem = event.inventoryItems[13] ?: return val lore = npcItem.getLore() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index 462414dea..64779d644 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -8,8 +8,8 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorFeatures -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI.motesNpcPrice +import at.hannibal2.skyhanni.features.rift.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI.motesNpcPrice import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils.cleanName diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt index 346e51c93..2b24ab1f1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt @@ -3,10 +3,10 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi -import at.hannibal2.skyhanni.features.fishing.TrophyFishManager -import at.hannibal2.skyhanni.features.fishing.TrophyRarity +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -287,7 +287,7 @@ class SackDisplay { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!isEnabled()) return val inventoryName = event.inventoryName if (!isRuneDisplayEnabled() && inventoryName == "Runes Sack") return diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index afb1210aa..e15395d16 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.features.itemabilities.abilitycooldown import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background import at.hannibal2.skyhanni.events.* -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.cleanName @@ -12,6 +11,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.between import at.hannibal2.skyhanni.utils.LorenzUtils.equalsOneOf +import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAbilityScrolls import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraft.client.Minecraft @@ -91,9 +91,11 @@ class ItemAbilityCooldown { } if (event.soundName == "mob.wolf.howl") { if (event.volume == 0.5f) { - if (!RiftAPI.inRift()) { + val recentItems = InventoryUtils.recentItemsInHand.values + if ("WEIRD_TUBA" in recentItems) { ItemAbility.WEIRD_TUBA.sound() - } else { + } + if ("WEIRDER_TUBA" in recentItems) { ItemAbility.WEIRDER_TUBA.sound() } } @@ -134,7 +136,7 @@ class ItemAbilityCooldown { } } if (event.soundName == "random.drink") { - if (event.pitch == 1.8888888f && event.volume == 1.0f) { + if (event.pitch.round(1).toDouble() == 1.8 && event.volume == 1.0f) { ItemAbility.HOLY_ICE.sound() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt new file mode 100644 index 000000000..1d8f62d4f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt @@ -0,0 +1,147 @@ +package at.hannibal2.skyhanni.features.mining + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.LorenzUtils.sorted +import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings +import at.hannibal2.skyhanni.utils.TimeUtils +import io.github.moulberry.notenoughupdates.util.SkyBlockTime +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.* + +class KingTalismanHelper { + private val config get() = SkyHanniMod.feature.misc.mining + + private val kingLocation = LorenzVec(129.6, 196.5, 194.1) + private val kingCircles = listOf( + "Brammor", + "Emkam", + "Redros", + "Erren", + "Thormyr", + "Emmor", + "Grandan", + ) + + private var allKingsDisplay = emptyList<String>() + private var farDisplay = "" + private var display = emptyList<String>() + + fun isNearby() = LorenzUtils.skyBlockArea == "Royal Palace" && kingLocation.distanceToPlayer() < 10 + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!event.isMod(20)) return + + if (!isEnabled()) { + display = emptyList() + return + } + + update() + display = if (isNearby()) allKingsDisplay else Collections.singletonList(farDisplay) + } + + fun isEnabled() = config.kingTalismanHelper && IslandType.DWARVEN_MINES.isInIsland() + + @SubscribeEvent + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { + if (event.inventoryName != "Commissions") return + if (!isEnabled()) return + if (!isNearby()) return + val profileSpecific = ProfileStorageData.profileSpecific ?: return + + val currentKing = getCurrentKing() + val kingsTalkedTo = profileSpecific.mining.kingsTalkedTo + if (currentKing !in kingsTalkedTo) { + LorenzUtils.debug("Found new king!") + kingsTalkedTo.add(currentKing) + update() + display = allKingsDisplay + } + } + + private fun update() { + val profileSpecific = ProfileStorageData.profileSpecific ?: return + val kingsTalkedTo = profileSpecific.mining.kingsTalkedTo + if (kingsTalkedTo.size == kingCircles.size) { + allKingsDisplay = Collections.singletonList("§eAll Kings found.") + farDisplay = "" + return + } + + allKingsDisplay = buildList { + var farDisplay_: String? = null + + val currentKing = getCurrentKing() + for ((king, timeUntil) in getKingTimes()) { + val missing = king !in kingsTalkedTo + val missingString = if (missing) "" else " §aDone" + + val current = king == currentKing + + val missingTimeFormat = if (current) { + val time = TimeUtils.formatDuration(timeUntil - 1000 * 60 * 20 * (kingCircles.size - 1)) + "§7(§b$time remaining§7)" + } else { + val time = TimeUtils.formatDuration(timeUntil, maxUnits = 2) + "§7(§bin $time§7)" + } + + val currentString = if (current) "§6King " else "" + if (missing && current) { + farDisplay_ = "§cNext missing king: §7$king §eNow $missingTimeFormat" + } + + val timeString = if (missing) " §cMissing " + missingTimeFormat else "" + + add("§7$currentString$king$missingString$timeString") + } + farDisplay = farDisplay_ ?: nextMissingText() + } + } + + private fun nextMissingText(): String { + val profileSpecific = ProfileStorageData.profileSpecific ?: error("profileSpecific is null") + val kingsTalkedTo = profileSpecific.mining.kingsTalkedTo + val (nextKing, until) = getKingTimes().filter { it.key !in kingsTalkedTo }.sorted().firstNotNullOf { it } + val time = TimeUtils.formatDuration(until, maxUnits = 2) + + return "§cNext missing king: §7$nextKing §7(§bin $time§7)" + } + + private fun getKingTimes(): MutableMap<String, Long> { + val oneSbDay = 1000 * 60 * 20 + val oneCircleTime = oneSbDay * kingCircles.size + val kingTime = mutableMapOf<String, Long>() + for ((index, king) in kingCircles.reversed().withIndex()) { + + val startTime = SkyBlockTime(day = index + 1) + var timeNext = startTime.toMillis() + while (timeNext < System.currentTimeMillis()) { + timeNext += oneCircleTime + } + val timeUntil = timeNext - System.currentTimeMillis() + kingTime[king] = timeUntil + } + return kingTime + } + + private fun getCurrentKing() = getKingTimes().sortedDesc().firstNotNullOf { it.key } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { + if (!config.kingTalismanHelper) return + + config.kingTalismanHelperPos.renderStrings(display, posLabel = "King Talisman Helper") + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 6180185d4..c06235daf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -83,7 +83,7 @@ class MinionFeatures { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return if (!event.inventoryName.contains(" Minion ")) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt index dcfa2c6c5..d76bc538f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt @@ -70,7 +70,7 @@ class CityProjectFeatures { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.inSkyBlock) return val lore = event.inventoryItems[4]?.getLore() ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt index 328a4aa37..c747e5e28 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt @@ -3,9 +3,9 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.between @@ -43,7 +43,7 @@ class CurrentPetDisplay { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { val config = ProfileStorageData.profileSpecific ?: return val inventoryNamePattern = "(?:\\(\\d+/\\d+\\))? Pets".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNode.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNode.kt new file mode 100644 index 000000000..e9d374f91 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNode.kt @@ -0,0 +1,30 @@ +package at.hannibal2.skyhanni.features.misc + +enum class EnderNode( + val internalName: String, + val displayName: String, + ) { + + ENCHANTED_ENDSTONE("ENCHANTED_ENDSTONE","§aEnchanted End Stone"), + ENCHANTED_OBSIDIAN("ENCHANTED_OBSIDIAN","§aEnchanted Obsidian"), + ENCHANTED_ENDER_PEARL("ENCHANTED_ENDER_PEARL","§aEnchanted Ender Pearl"), + GRAND_EXP_BOTTLE("GRAND_EXP_BOTTLE","§aGrand Experience Bottle"), + TITANIC_EXP_BOTTLE("TITANIC_EXP_BOTTLE", "§9Titanic Experience Bottle"), + END_STONE_SHULKER("END_STONE_SHULKER","§9End Stone Shulker"), + ENDSTONE_GEODE("ENDSTONE_GEODE","§9End Stone Geode"), + MAGIC_RUNE("MAGIC_RUNE;1", "§d◆ Magical Rune I"), + ENDER_GAUNTLET("ENDER_GAUNTLET","§5Ender Gauntlet"), + MITE_GEL("MITE_GEL", "§5Mite Gel"), + SHRIMP_THE_FISH("SHRIMP_THE_FISH", "§cShrimp the Fish"), + + END_HELMET("END_HELMET", "§5Ender Helmet"), + END_CHESTPLATE("END_CHESTPLATE", "§5Ender Chestplate"), + END_LEGGINGS("END_LEGGINGS", "§5Ender Leggings"), + END_BOOTS("END_BOOTS", "§5Ender Boots"), + ENDER_NECKLACE("ENDER_NECKLACE", "§5Ender Necklace"), + COMMON_ENDERMAN_PET("ENDERMAN;0", "§fEnderman"), + UNCOMMON_ENDERMAN_PET("ENDERMAN;1", "§aEnderman"), + RARE_ENDERMAN_PET("ENDERMAN;2", "§9Enderman"), + EPIC_ENDERMAN_PET("ENDERMAN;3", "§5Enderman"), + LEGENDARY_ENDERMAN_PET("ENDERMAN;4", "§6Enderman") +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt new file mode 100644 index 000000000..90c00bdad --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt @@ -0,0 +1,199 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.events.ConfigLoadEvent +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.PlaySoundEvent +import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy +import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class EnderNodeTracker { + private val config get() = SkyHanniMod.feature.misc.enderNodeTracker; + + private var totalNodesMined = 0 + private var totalEndermiteNests = 0 + private var totalEnderArmor = 0 + private var display = emptyList<List<Any>>() + private var lootCount = mapOf<EnderNode, Int>() + private var lootProfit = mapOf<EnderNode, Double>() + + private val enderNodeRegex = Regex("""ENDER NODE!.+You found (\d+x )?§r(.+)§r§f!""") + private val endermanRegex = Regex("""(RARE|PET) DROP! §r(.+) §r§b\(""") + + private var lastEndermiteTime = 0L + + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!ProfileStorageData.loaded) return + if (!isInTheEnd()) return + + // don't call removeColor because we want to distinguish enderman pet rarity + val message = event.message.trim() + var item: String? = null + var amount = 1 + + // check whether the loot is from an ender node or an enderman + enderNodeRegex.find(message)?.let { + totalNodesMined++ + amount = it.groups[1]?.value?.substringBefore("x")?.toIntOrNull() ?: 1 + item = it.groups[2]?.value + } ?: endermanRegex.find(message)?.let { + amount = 1 + item = it.groups[2]?.value + } + + when { + item == null -> return + isEnderArmor(item) -> totalEnderArmor++ + item == "§cEndermite Nest" -> { + lastEndermiteTime = System.currentTimeMillis() + totalEndermiteNests++ + } + } + + // increment the count of the specific item found + EnderNode.entries.find { it.displayName == item }?.let { + val old = lootCount[it] ?: 0 + lootCount = lootCount.editCopy { + this[it] = old + amount + } + } + saveAndUpdate() + } + + @SubscribeEvent + fun onSoundPlay(event: PlaySoundEvent) { + if (!isInTheEnd()) return + if (event.soundName != "mob.silverfish.kill") return + if (event.distanceToPlayer > 15) return + if (System.currentTimeMillis() - lastEndermiteTime > 7500) return + + // listen for nearby endermite death sounds within 7.5s of mining an endermite nest + // this is a fairly accurate approximation for mite gel drops + val oldEndStone = lootCount[EnderNode.ENCHANTED_ENDSTONE] ?: 0 + val oldMiteGel = lootCount[EnderNode.MITE_GEL] ?: 0 + lootCount = lootCount.editCopy { + this[EnderNode.ENCHANTED_ENDSTONE] = oldEndStone + (1 + Math.random() * 2).toInt() + this[EnderNode.MITE_GEL] = oldMiteGel + (1 + Math.random() * 2).toInt() + } + saveAndUpdate() + } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { + if (!config.enabled) return + if (!isInTheEnd()) return + config.position.renderStringsAndItems(display, posLabel = "Ender Node Tracker") + } + + @SubscribeEvent + fun onConfigLoad(event: ConfigLoadEvent) { + val hidden = ProfileStorageData.profileSpecific?.enderNodeTracker ?: return + totalNodesMined = hidden.totalNodesMined + totalEndermiteNests = hidden.totalEndermiteNests + lootCount = hidden.lootCount + totalEnderArmor = hidden.lootCount.filter { isEnderArmor(it.key.displayName) }.map { it.value }.sum() + saveAndUpdate() + } + + private fun calculateProfit(): Map<EnderNode, Double> { + val newProfit = mutableMapOf<EnderNode, Double>() + lootCount.forEach { + val price = if (isEnderArmor(it.key.displayName)) { + 10_000.0 + } else { + val bzData = BazaarApi.getBazaarDataByInternalName(it.key.internalName) + if (LorenzUtils.noTradeMode) { + bzData?.npcPrice ?: georgePrice(it.key) ?: 0.0 + } else { + + bzData?.npcPrice + ?.coerceAtLeast(bzData.sellPrice) + ?.coerceAtLeast(georgePrice(it.key) ?: 0.0) + ?: NEUItems.getPrice(it.key.internalName) + + } + + } + newProfit[it.key] = price * (lootCount[it.key] ?: 0) + } + return newProfit + } + + private fun saveAndUpdate() { + val hidden = ProfileStorageData.profileSpecific?.enderNodeTracker ?: return + hidden.totalNodesMined = totalNodesMined + hidden.totalEndermiteNests = totalEndermiteNests + hidden.lootCount = lootCount + + lootProfit = calculateProfit() + display = formatDisplay(drawDisplay()) + } + + private fun isInTheEnd() = LorenzUtils.inIsland(IslandType.THE_END) + && ScoreboardData.sidebarLines.any { it.contains("The End") } + + private fun isEnderArmor(displayName: String?) = when (displayName) { + "§5Ender Helmet", + "§5Ender Chestplate", + "§5Ender Leggings", + "§5Ender Boots", + "§5Ender Necklace", + "§5Ender Gauntlet" -> true + else -> false + } + + private fun georgePrice(petRarity: EnderNode): Double? = when (petRarity) { + EnderNode.COMMON_ENDERMAN_PET -> 100.0 + EnderNode.UNCOMMON_ENDERMAN_PET -> 500.0 + EnderNode.RARE_ENDERMAN_PET -> 2_000.0 + EnderNode.EPIC_ENDERMAN_PET -> 10_000.0 + EnderNode.LEGENDARY_ENDERMAN_PET -> 1_000_000.0 + else -> null + } + + private fun drawDisplay() = buildList<List<Any>> { + addAsSingletonList("§5§lEnder Node Tracker") + addAsSingletonList("§d${totalNodesMined.addSeparators()} Ender Nodes Mined") + addAsSingletonList("§6${format(lootProfit.values.sum())} Coins Made") + addAsSingletonList(" ") + addAsSingletonList("§b${totalEndermiteNests.addSeparators()} §cEndermite Nest") + + for (item in EnderNode.entries.subList(0, 11)) { + val count = (lootCount[item] ?: 0).addSeparators() + val profit = format(lootProfit[item] ?: 0.0) + addAsSingletonList("§b$count ${item.displayName} §7(§6$profit§7)") + } + addAsSingletonList(" ") + addAsSingletonList("§b${totalEnderArmor.addSeparators()} §5Ender Armor " + + "§7(§6${format(totalEnderArmor * 10_000)}§7)") + for (item in EnderNode.entries.subList(11, 16)) { + val count = (lootCount[item] ?: 0).addSeparators() + val profit = format(lootProfit[item] ?: 0.0) + addAsSingletonList("§b$count ${item.displayName} §7(§6$profit§7)") + } + // enderman pet rarities + val (c, u, r, e, l) = EnderNode.entries.subList(16, 21).map { (lootCount[it] ?: 0).addSeparators() } + val profit = format(EnderNode.entries.subList(16, 21).sumOf { lootProfit[it] ?: 0.0 }) + addAsSingletonList("§f$c§7-§a$u§7-§9$r§7-§5$e§7-§6$l §fEnderman Pet §7(§6$profit§7)") + } + + private fun formatDisplay(map: List<List<Any>>): List<List<Any>> { + val newList = mutableListOf<List<Any>>() + for (index in config.textFormat) { + newList.add(map[index]) + } + return newList + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HarpKeybinds.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HarpKeybinds.kt new file mode 100644 index 000000000..5ca0e6239 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HarpKeybinds.kt @@ -0,0 +1,51 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.InventoryUtils.openInventoryName +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.inventory.GuiChest +import net.minecraftforge.client.event.GuiScreenEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import org.lwjgl.input.Keyboard +import kotlin.time.Duration.Companion.milliseconds + +// Delaying key presses by 300ms comes from NotEnoughUpdates +class HarpKeybinds { + private var lastClick = SimpleTimeMark.farPast() + + private val keys = listOf( + Keyboard.KEY_1, + Keyboard.KEY_2, + Keyboard.KEY_3, + Keyboard.KEY_4, + Keyboard.KEY_5, + Keyboard.KEY_6, + Keyboard.KEY_7 + ) + + @SubscribeEvent + fun onGui(event: GuiScreenEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!SkyHanniMod.feature.misc.harpKeybinds) return + if (!openInventoryName().startsWith("Harp")) return + val chest = event.gui as? GuiChest ?: return + + for (key in keys) { + if (Keyboard.isKeyDown(key)) { + if (lastClick.passedSince() > 200.milliseconds) { + Minecraft.getMinecraft().playerController.windowClick( + chest.inventorySlots.windowId, + 35 + key, + 2, + 3, + Minecraft.getMinecraft().thePlayer + ) // middle clicks > left clicks + lastClick = SimpleTimeMark.now() + } + break + } + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index 736c14dec..6477d7c36 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.* -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.command.CopyErrorCommand import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -139,7 +139,7 @@ class NonGodPotEffectDisplay { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.inSkyBlock) return if (!event.inventoryName.endsWith("Active Effects")) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt index f9caf4146..e2a25b219 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt @@ -3,16 +3,12 @@ package at.hannibal2.skyhanni.features.misc.discordrpc // SkyblockAddons code, adapted for SkyHanni with some additions and fixes import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.ActionBarStatsData +import at.hannibal2.skyhanni.data.* import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getTierForCrops import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.progressToNextLevel -import at.hannibal2.skyhanni.data.HypixelData -import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.data.ProfileStorageData -import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.colorCodeToRarity diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt index e3bfb8cfc..d301fdf6f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt @@ -427,7 +427,7 @@ object GhostCounter { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.inSkyBlock) return val inventoryName = event.inventoryName if (inventoryName != "Bestiary ➜ Dwarven Mines") return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt index 7ff1949ee..3227edf69 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.misc.items import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull @@ -45,7 +45,7 @@ class EstimatedWardrobePrice { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.estimatedIemValueArmor) return if (!event.inventoryName.startsWith("Wardrobe")) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt index ba9c78321..5fd1a9116 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.misc.teleportpad import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -62,7 +62,7 @@ class TeleportPadInventoryNumber { private val pattern = "§.(?<number>.*) teleport pad".toPattern() @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { inTeleportPad = event.inventoryName == "Set Destination" && SkyHanniMod.feature.misc.teleportPad.inventoryNumbers } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt index d0363480b..6400348a8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt @@ -45,19 +45,22 @@ object TrevorSolver { fun findMob() { var canSee = false - val entities = EntityUtils.getAllEntitiesOrNull() ?: return - for (entity in entities) { + Minecraft.getMinecraft().theWorld ?: return + for (entity in EntityUtils.getAllEntities()) { if (entity is EntityOtherPlayerMP) continue val name = entity.name val entityHealth = if (entity is EntityLivingBase) entity.baseMaxHealth else 0 - currentMob = TrevorMobs.values().firstOrNull {it.mobName.contains(name)} - if (animalHealths.any { it == entityHealth } ) { + currentMob = TrevorMobs.values().firstOrNull { it.mobName.contains(name) } + if (animalHealths.any { it == entityHealth }) { if (currentMob != null) { if (foundID == entity.entityId) { val dist = entity.position.toLorenzVec().distanceToPlayer() if ((currentMob == TrevorMobs.RABBIT || currentMob == TrevorMobs.SHEEP) && mobLocation == CurrentMobArea.OASIS) { println("This is unfortunate") - } else canSee = LocationUtils.canSee(LocationUtils.playerEyeLocation(), entity.position.toLorenzVec().add(0.0, 0.5, 0.0)) && dist < currentMob!!.renderDistance + } else canSee = LocationUtils.canSee( + LocationUtils.playerEyeLocation(), + entity.position.toLorenzVec().add(0.0, 0.5, 0.0) + ) && dist < currentMob!!.renderDistance if (!canSee) { val nameTagEntity = Minecraft.getMinecraft().theWorld.getEntityByID(foundID + 1) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt index 012570add..2efc657bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt @@ -18,8 +18,10 @@ import at.hannibal2.skyhanni.utils.TabListData import com.google.gson.JsonObject import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import org.lwjgl.input.Keyboard class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { + val config get() = SkyHanniMod.feature.misc val questHelper = DailyQuestHelper(this) val miniBossHelper = DailyMiniBossHelper(this) @@ -62,7 +64,10 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return - if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return + if (!config.crimsonIsleReputationHelper) return + if (!dirty && display.isEmpty()) { + dirty = true + } if (dirty) { dirty = false updateRender() @@ -101,12 +106,21 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { @SubscribeEvent(priority = EventPriority.LOWEST) fun renderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { - if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return + if (!config.crimsonIsleReputationHelper) return if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return - SkyHanniMod.feature.misc.crimsonIsleReputationHelperPos.renderStringsAndItems(display, posLabel = "Crimson Isle Reputation Helper") + if (config.reputationHelperUseHotkey) { + if (!Keyboard.isKeyDown(config.reputationHelperHotkey)) { + return + } + } + + config.crimsonIsleReputationHelperPos.renderStringsAndItems( + display, + posLabel = "Crimson Isle Reputation Helper" + ) } fun update() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt index 5c0b7bf83..6c9692a18 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt @@ -34,7 +34,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!isEnabled()) return questLoader.checkInventory(event) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt index 394f92383..1d4947b98 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest import at.hannibal2.skyhanni.config.Storage -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.* import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils @@ -110,7 +110,7 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { return dailyQuestHelper.quests.firstOrNull { it.internalName == name } } - fun checkInventory(event: InventoryOpenEvent) { + fun checkInventory(event: InventoryFullyOpenedEvent) { val inMageRegion = LorenzUtils.skyBlockArea == "Community Center" val inBarbarianRegion = LorenzUtils.skyBlockArea == "Dragontail" if (!inMageRegion && !inBarbarianRegion) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt index 4e500d21f..15ff1c658 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt @@ -1,4 +1,4 @@ -package at.hannibal2.skyhanni.features.rift.everywhere +package at.hannibal2.skyhanni.features.rift import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.features.RiftConfig diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/RiftLarva.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/RiftLarva.kt index 0b2b868d9..8c7ca46a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/RiftLarva.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/RiftLarva.kt @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.rift.area import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.withAlpha -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper -import at.hannibal2.skyhanni.utils.EntityUtils +import at.hannibal2.skyhanni.utils.EntityUtils.getEntities import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -35,8 +35,7 @@ class RiftLarva { } private fun findLarvas() { - val list = EntityUtils.getEntitiesOrNull<EntityArmorStand>() ?: return - for (stand in list) { + for (stand in getEntities<EntityArmorStand>()) { if (stand.hasSkullTexture(larvaSkullTexture)) { RenderLivingEntityHelper.setEntityColor( stand, diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt index b012f46d4..ceb8b5931 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.withAlpha -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzUtils diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt index d7bbf541d..1df1ea82f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.rift.area.dreadfarm import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.BlockUtils.getBlockStateAt import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt index 2ee5ab31f..fae8f61ce 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.rift.area.dreadfarm import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt index a54e8f7da..38c9ceb7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt @@ -1,13 +1,17 @@ package at.hannibal2.skyhanni.features.rift.area.dreadfarm import at.hannibal2.skyhanni.events.EntityEquipmentChangeEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper -import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.EntityUtils.getEntities import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy +import at.hannibal2.skyhanni.utils.RenderUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.SpecialColour +import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraft.client.Minecraft import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase @@ -44,8 +48,7 @@ class VoltHighlighter { @SubscribeEvent fun onRender(event: RenderWorldLastEvent) { if (!RiftAPI.inRift() || !(config.voltRange || config.voltMoodMeter)) return - val list = EntityUtils.getEntitiesOrNull<EntityLivingBase>() ?: return - for (entity in list) { + for (entity in getEntities<EntityLivingBase>()) { val state = getVoltState(entity) if (state == VoltState.NO_VOLT) continue diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt index 78c4dbfb7..8d09c1e3e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.events.ServerBlockChangeEvent import at.hannibal2.skyhanni.events.withAlpha -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.EntityUtils diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt index 032ce3746..8f49d189a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveLivingMetalHelper.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.events.BlockClickEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.events.ServerBlockChangeEvent import at.hannibal2.skyhanni.events.TitleReceivedEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt index 5b2eb4562..e9671a3a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.rift.area.livingcave import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt index 5b9b0cd8f..6e848ab8d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.rift.area.mirrorverse import at.hannibal2.skyhanni.events.* -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt index 7bbcca209..61bfd6a9c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.ParkourHelper diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt index bcf697a07..a4d550815 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import at.hannibal2.skyhanni.utils.ParkourHelper diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt index a25c91cd8..cacf34d3f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.rift.area.mirrorverse import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt index 2ee87320b..c613aa3a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.ScoreboardRawChangeEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt index bc9a4f5b0..aeb73b42d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.rift.area.westvillage import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.* -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -38,7 +38,7 @@ class KloonHacking { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { inTerminalInventory = false inColourInventory = false nearestTerminal = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt index 591476665..b7728663f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.rift.area.wyldwoods import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.withAlpha -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper -import at.hannibal2.skyhanni.utils.EntityUtils +import at.hannibal2.skyhanni.utils.EntityUtils.getEntities import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -35,8 +35,7 @@ class RiftOdonata { } private fun findOdonatas() { - val list = EntityUtils.getEntitiesOrNull<EntityArmorStand>() ?: return - for (stand in list) { + for (stand in getEntities<EntityArmorStand>()) { if (stand.hasSkullTexture(odonataSkullTexture)) { RenderLivingEntityHelper.setEntityColor( stand, diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt index da34eeda4..ad38e3cfe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/ShyCruxWarnings.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.rift.area.wyldwoods import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -20,8 +20,7 @@ class ShyCruxWarnings { } private fun checkForShy() { - val list = EntityUtils.getAllEntitiesOrNull() ?: return - if (list.any { it.name in shyNames && it.distanceToPlayer() < 8 }) { + if (EntityUtils.getAllEntities().any { it.name in shyNames && it.distanceToPlayer() < 8 }) { TitleUtils.sendTitle("§eLook away!", 150) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt index 6531194b1..310f22b80 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/CruxTalismanDisplay.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.rift.everywhere import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt index fa71103c2..e30b167a6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.rift.everywhere import at.hannibal2.skyhanni.events.* +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer @@ -52,7 +53,7 @@ object EnigmaSoulWaypoints { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { inInventory = false if (!event.inventoryName.contains("Enigma Souls")) return inInventory = true diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt index b338e33e6..81def7af1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt @@ -2,7 +2,8 @@ package at.hannibal2.skyhanni.features.rift.everywhere import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor @@ -15,7 +16,7 @@ class HighlightRiftGuide { private var highlightedItems = emptyList<Int>() @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { inInventory = false if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt index cab024462..0ef0110ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.rift.everywhere import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.CheckRenderEntityEvent +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.InventoryUtils import net.minecraft.entity.passive.EntityHorse import net.minecraftforge.fml.common.eventhandler.SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt index e9aa4726e..eedd0b38d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftTimer.kt @@ -1,9 +1,9 @@ -package at.hannibal2.skyhanni.features.rift +package at.hannibal2.skyhanni.features.rift.everywhere import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzActionBarEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftMotesOrb.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt index d7bd89eb4..df7e0832d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftMotesOrb.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/RiftMotesOrb.kt @@ -1,7 +1,8 @@ -package at.hannibal2.skyhanni.features.rift.everywhere +package at.hannibal2.skyhanni.features.rift.everywhere.motes import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt index 36229aeb8..1f88a4ad1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/ShowMotesNpcSellPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt @@ -1,8 +1,8 @@ -package at.hannibal2.skyhanni.features.rift +package at.hannibal2.skyhanni.features.rift.everywhere.motes import at.hannibal2.skyhanni.events.* -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI.motesNpcPrice +import at.hannibal2.skyhanni.features.rift.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI.motesNpcPrice import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzColor @@ -76,7 +76,7 @@ class ShowMotesNpcSellPrice { } @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { reset() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt index 38471c117..fb72cc33d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt @@ -109,7 +109,7 @@ class SlayerRngMeterDisplay { private fun getCurrentSlayer() = SlayerAPI.latestSlayerCategory.removeWordsAtEnd(1).removeColor() @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!isEnabled()) return val name = inventoryNamePattern.matchMatcher(event.inventoryName) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt index c4ab2bac4..0caa2f3be 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -1,10 +1,10 @@ -package at.hannibal2.skyhanni.features.rift +package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.* -import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.* @@ -43,7 +43,7 @@ object VampireSlayerFeatures { private val entityList = mutableListOf<EntityLivingBase>() private val taggedEntityList = mutableListOf<Int>() - private val standList = mutableMapOf<EntityArmorStand, EntityOtherPlayerMP>() + private var standList = mapOf<EntityArmorStand, EntityOtherPlayerMP>() private val username get() = LorenzUtils.getPlayerName() private val bloodIchorTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzAzNDA5MjNhNmRlNDgyNWExNzY4MTNkMTMzNTAzZWZmMTg2ZGIwODk2ZTMyYjY3MDQ5MjhjMmEyYmY2ODQyMiJ9fX0=" @@ -285,26 +285,13 @@ object VampireSlayerFeatures { } } } - - if (configBloodIcor.renderBeam) { - entityList.filterIsInstance<EntityArmorStand>().forEach { - if (it.hasSkullTexture(bloodIchorTexture)) { - if (it.isEntityAlive) { - event.drawWaypointFilled( - it.position.toLorenzVec().add(0, -2, 0), configBloodIcor.color.toChromaColor(), - beacon = true - ) - } - } - } - } if (configBloodIcor.highlight || configKillerSpring.highlight) { Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityArmorStand>().forEach { stand -> val vec = stand.position.toLorenzVec() val distance = start.distance(vec) val isIchor = stand.hasSkullTexture(bloodIchorTexture) val isSpring = stand.hasSkullTexture(killerSpringTexture) - if (isIchor || isSpring) { + if ((isIchor && config.bloodIchor.highlight) || (isSpring && config.killerSpring.highlight)) { val color = (if (isIchor) configBloodIcor.color else configKillerSpring.color) .toChromaColor().withAlpha(config.withAlpha) if (distance <= 15) { @@ -318,16 +305,25 @@ object VampireSlayerFeatures { event.drawColor(stand.position.toLorenzVec().add(0.0, 2.0, 0.0), LorenzColor.DARK_RED, alpha = 1f) event.drawDynamicText(stand.position.toLorenzVec().add(0.5, 2.5, 0.5), text, 1.5, ignoreBlocks = false) for ((player, stand2) in standList) { - if (configBloodIcor.showLines || configKillerSpring.showLines) + if ((configBloodIcor.showLines && isIchor) || (configKillerSpring.showLines && isSpring)) event.draw3DLine( event.exactLocation(player).add(0.0, 1.5, 0.0), event.exactLocation(stand2).add(0.0, 1.5, 0.0), - // stand2.position.toLorenzVec().add(0.0, 1.5, 0.0), + // stand2.position.toLorenzVec().add(0.0, 1.5, 0.0), linesColorStart, 3, true) } } + if (configBloodIcor.renderBeam && isIchor) { + if (stand.isEntityAlive) { + event.drawWaypointFilled( + event.exactLocation(stand).add(0, -2, 0), + configBloodIcor.color.toChromaColor(), + beacon = true + ) + } + } } } } @@ -338,7 +334,7 @@ object VampireSlayerFeatures { fun onWorldChange(event: LorenzWorldChangeEvent) { entityList.clear() taggedEntityList.clear() - standList.clear() + standList = mutableMapOf() } @@ -351,7 +347,7 @@ object VampireSlayerFeatures { if (event.type == EnumParticleTypes.ENCHANTMENT_TABLE) { EntityUtils.getEntitiesNearby<EntityArmorStand>(event.location, 3.0).forEach { stand -> if (stand.hasSkullTexture(killerSpringTexture) || stand.hasSkullTexture(bloodIchorTexture)) { - standList[stand] = it + standList = standList.editCopy { this[stand] = it } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt index d6ae27f3b..58ef50f08 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt @@ -20,7 +20,7 @@ class EndermanSlayerHideParticles { fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return - endermanLocations = EntityUtils.getEntities<EntityEnderman>().map { it.getLorenzVec() } + endermanLocations = EntityUtils.getEntities<EntityEnderman>().map { it.getLorenzVec() }.toList() } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt new file mode 100644 index 000000000..870752a25 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt @@ -0,0 +1,117 @@ +package at.hannibal2.skyhanni.test + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.InventoryUpdatedEvent +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.getSkullOwner +import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter +import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber +import at.hannibal2.skyhanni.utils.OSUtils +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import com.google.gson.GsonBuilder +import com.google.gson.annotations.Expose +import net.minecraft.item.ItemStack +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +object TestCopyBestiaryValues { + + class BestiarityObject { + @Expose + var name: String = "" + + @Expose + var skullOwner: String = "" + + @Expose + var texture: String = "" + + @Expose + var cap: Int = 0 + + @Expose + var mobs: Array<String> = emptyArray() + + @Expose + var bracket: Int = 0 + } + + val pattern = "\\[Lv(?<lvl>.*)] (?<text>.*)".toPattern() + + @SubscribeEvent(priority = EventPriority.LOW) + fun onLateInventoryOpen(event: InventoryUpdatedEvent) { + if (!SkyHanniMod.feature.dev.copyBestiaryData) return + SkyHanniTestCommand.displayLine = "" + + val backItem = event.inventoryItems[3 + 9 * 5 + 3] + if (backItem == null) { +// println("first is null!") + return + } + if (backItem.getLore().none { it.contains("Bestiary Milestone") }) { +// println("wrong first: ${backItem.getLore()}") + return + } + + val rankingItem = event.inventoryItems[3 + 9 * 5 + 2] + if (rankingItem == null) { +// println("second is null!") + return + } + if (rankingItem.getLore().none { it.contains("Ranking") }) { +// println("wrong second: ${rankingItem.getLore()}") + return + } + + val titleItem = event.inventoryItems[4] ?: return + copy(titleItem, event.inventoryItems) + } + + private fun copy(titleItem: ItemStack, inventoryItems: Map<Int, ItemStack>) { + val name = titleItem.name ?: return + val titleName = name.split(" ").dropLast(1).joinToString(" ") + + val obj: BestiarityObject = BestiarityObject() + obj.name = titleName + obj.texture = titleItem.getSkullTexture() ?: "no texture found" + obj.skullOwner = titleItem.getSkullOwner() ?: "no skullOwner found" + + val lore = titleItem.getLore() + val overallProgress = lore.find { it.contains("Overall Progress") } + if (overallProgress == null) { + println("overallProgress not found!") + return + } + val capLine = lore.nextAfter(overallProgress) ?: return + val rawCap = capLine.substringAfter("/").removeColor().formatNumber() + obj.cap = rawCap.toInt() + + val mobs = mutableListOf<String>() + for (i in 10..43) { + val stack = inventoryItems[i] ?: continue + val stackName = stack.name ?: continue + pattern.matchMatcher(stackName.removeColor()) { + val lvl = group("lvl").toInt() + var text = group("text").lowercase().replace(" ", "_") + + val master = text.endsWith("(master)") + val masterText = if (master) "master_" else "" + if (master) { + text = text.split("_").dropLast(1).joinToString("_") + } + val result = "$masterText${text}_$lvl" + mobs.add(result) + } + } + obj.mobs = mobs.toTypedArray() + + val gson = GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create() + val text = gson.toJson(obj) + OSUtils.copyToClipboard(text) + + SkyHanniTestCommand.displayLine = "Bestiary for $titleName" + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt index 7c858df7f..23b5d45ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyRngMeterValues.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager -import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils @@ -14,7 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object TestCopyRngMeterValues { @SubscribeEvent - fun onInventoryOpen(event: InventoryOpenEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!SkyHanniMod.feature.dev.copyRngMeter) return val map = mutableMapOf<String, Long>() diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt b/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt new file mode 100644 index 000000000..be202e20d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt @@ -0,0 +1,17 @@ +package at.hannibal2.skyhanni.test + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import org.lwjgl.input.Keyboard + +class TestShowSlotNumber { + + @SubscribeEvent + fun onRenderItemTip(event: RenderInventoryItemTipEvent) { + if (Keyboard.isKeyDown(SkyHanniMod.feature.dev.showSlotNumberKey)) { + val slotIndex = event.slot.slotIndex + event.stackTip = "$slotIndex" + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt index 1ae398e4c..69288a896 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils +import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.common.cache.CacheBuilder import net.minecraft.client.Minecraft import java.util.* @@ -51,9 +52,10 @@ object CopyErrorCommand { val stackTrace = throwable.getExactStackTrace(false).joinToString("\n").removeSpam() val randomId = UUID.randomUUID().toString() - errorMessages[randomId] = "```\nSkyHanni ${SkyHanniMod.version}: $message\n \n$stackTrace\n```" + val rawMessage = message.removeColor() + errorMessages[randomId] = "```\nSkyHanni ${SkyHanniMod.version}: $rawMessage\n \n$stackTrace\n```" fullErrorMessages[randomId] = - "```\nSkyHanni ${SkyHanniMod.version}: $message\n(full stack trace)\n \n$fullStackTrace\n```" + "```\nSkyHanni ${SkyHanniMod.version}: $rawMessage\n(full stack trace)\n \n$fullStackTrace\n```" LorenzUtils.clickableChat( "§c[SkyHanni ${SkyHanniMod.version}]: $message§c. Click here to copy the error into the clipboard.", diff --git a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt index e1763f7d5..6b4bb40f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.test.command.CopyErrorCommand import com.google.gson.JsonObject import com.google.gson.JsonParser import com.google.gson.JsonSyntaxException @@ -59,10 +60,7 @@ object APIUtil { e.printStackTrace() } else { - println("JsonSyntaxException at getJSONResponse '$urlString'") - LorenzUtils.error("[SkyHanni] JsonSyntaxException at getJSONResponse!") - println("result: '$retSrc'") - e.printStackTrace() + CopyErrorCommand.logError(Error("Hypixel API error for url: '$urlString'", e), "Failed to load data from Hypixel API") } } } @@ -71,8 +69,7 @@ object APIUtil { if (silentError) { throw throwable } else { - throwable.printStackTrace() - LorenzUtils.error("SkyHanni ran into an ${throwable::class.simpleName ?: "error"} whilst fetching a resource. See logs for more details.") + CopyErrorCommand.logError(Error("Hypixel API error for url: '$urlString'", throwable), "Failed to load data from Hypixel API") } } finally { client.close() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index 9bfb9e1bb..a31e3e7c1 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -126,10 +126,10 @@ object EntityUtils { ?.value } - inline fun <reified T : Entity> getEntitiesNextToPlayer(radius: Double): List<T> = + inline fun <reified T : Entity> getEntitiesNextToPlayer(radius: Double): Sequence<T> = getEntitiesNearby<T>(LocationUtils.playerLocation(), radius) - inline fun <reified T : Entity> getEntitiesNearby(location: LorenzVec, radius: Double): List<T> = + inline fun <reified T : Entity> getEntitiesNearby(location: LorenzVec, radius: Double): Sequence<T> = getEntities<T>().filter { it.distanceTo(location) < radius } fun EntityLivingBase.isAtFullHealth() = baseMaxHealth == health.toInt() @@ -156,11 +156,9 @@ object EntityUtils { fun EntityEnderman.getBlockInHand(): IBlockState? = heldBlockState - inline fun <reified R : Entity> getEntities(): List<R> = getAllEntities().filterIsInstance<R>() + inline fun <reified R : Entity> getEntities(): Sequence<R> = getAllEntities().filterIsInstance<R>() - inline fun <reified R : Entity> getEntitiesOrNull(): List<R>? = getAllEntitiesOrNull()?.filterIsInstance<R>() - - fun getAllEntities(): List<Entity> = getAllEntitiesOrNull() ?: error("minecraft.world.loadedEntityList is null.") - - fun getAllEntitiesOrNull(): List<Entity>? = Minecraft.getMinecraft()?.theWorld?.loadedEntityList?.toMutableList() + fun getAllEntities(): Sequence<Entity> = Minecraft.getMinecraft()?.theWorld?.loadedEntityList?.let { + if (Minecraft.getMinecraft().isCallingFromMinecraftThread) it else it.toMutableList() + }?.asSequence() ?: emptySequence<Entity>() }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/IdentityCharacteristics.kt b/src/main/java/at/hannibal2/skyhanni/utils/IdentityCharacteristics.kt new file mode 100644 index 000000000..5b1399f73 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/IdentityCharacteristics.kt @@ -0,0 +1,12 @@ +package at.hannibal2.skyhanni.utils + +class IdentityCharacteristics<T>(val value: T) { + override fun equals(other: Any?): Boolean { + if (other !is IdentityCharacteristics<*>) return false + return this.value === other.value + } + + override fun hashCode(): Int { + return System.identityHashCode(value) + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt index dd4a264ac..3f81df1a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt @@ -3,15 +3,16 @@ package at.hannibal2.skyhanni.utils import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest +import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack object InventoryUtils { - var itemInHandId = "" + var recentItemsInHand = mutableMapOf<Long, String>() var latestItemInHand: ItemStack? = null - fun getItemsInOpenChest() = buildList { - val guiChest = Minecraft.getMinecraft().currentScreen as GuiChest + fun getItemsInOpenChest() = buildList<Slot> { + val guiChest = Minecraft.getMinecraft().currentScreen as? GuiChest ?: return emptyList<Slot>() val inventorySlots = guiChest.inventorySlots.inventorySlots val skipAt = inventorySlots.size - 9 * 4 var i = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 1683f90e0..3df9e4673 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -141,6 +141,14 @@ object ItemUtils { .getTagList("textures", Constants.NBT.TAG_COMPOUND).getCompoundTagAt(0).getString("Value") } + fun ItemStack.getSkullOwner(): String? { + if (item != Items.skull) return null + if (tagCompound == null) return null + val nbt = tagCompound + if (!nbt.hasKey("SkullOwner")) return null + return nbt.getCompoundTag("SkullOwner").getString("Id") + } + fun ItemStack.getItemRarity(): Int { //todo make into an enum in future return when (this.getLore().lastOrNull()?.take(4)) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index f84d135ef..94d8dd10f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -22,6 +22,7 @@ import net.minecraft.util.ChatComponentText import org.lwjgl.input.Keyboard import java.awt.Color import java.lang.reflect.Field +import java.lang.reflect.Modifier import java.text.DecimalFormat import java.text.NumberFormat import java.text.SimpleDateFormat @@ -116,6 +117,12 @@ object LorenzUtils { return kotlin.math.round(this * multiplier) / multiplier } + fun Float.round(decimals: Int): Double { + var multiplier = 1.0 + repeat(decimals) { multiplier *= 10 } + return kotlin.math.round(this * multiplier) / multiplier + } + // TODO replace all calls with regex fun String.between(start: String, end: String): String = this.split(start, end)[1] @@ -216,9 +223,21 @@ object LorenzUtils { fun clickableChat(message: String, command: String) { val text = ChatComponentText(message) - text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/$command") + text.chatStyle.chatClickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/${command.removePrefix("/")}") text.chatStyle.chatHoverEvent = - HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText("§eExecute /$command")) + HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText("§eExecute /${command.removePrefix("/")}")) + Minecraft.getMinecraft().thePlayer.addChatMessage(text) + } + + fun hoverableChat(message: String, hover: List<String>, command: String? = null) { + val text = ChatComponentText(message) + 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("/")}") + } + Minecraft.getMinecraft().thePlayer.addChatMessage(text) } @@ -296,22 +315,22 @@ object LorenzUtils { isCurrent: (T) -> Boolean, onChange: (T) -> Unit, ) { - val newList = mutableListOf<Any>() - newList.add(prefix) - for (entry in values) { - val display = getName(entry) - if (isCurrent(entry)) { - newList.add("§a[$display]") - } else { - newList.add("§e[") - newList.add(Renderable.link("§e$display") { - onChange(entry) - }) - newList.add("§e]") + add(buildList { + add(prefix) + for (entry in values) { + val display = getName(entry) + if (isCurrent(entry)) { + add("§a[$display]") + } else { + add("§e[") + add(Renderable.link("§e$display") { + onChange(entry) + }) + add("§e]") + } + add(" ") } - newList.add(" ") - } - add(newList) + }) } // TODO nea? @@ -422,4 +441,13 @@ object LorenzUtils { } return false } + + infix fun <K, V> MutableMap<K, V>.put(pairs: Pair<K, V>) { + this[pairs.first] = pairs.second + } + + fun Field.removeFinal(): Field { + javaClass.getDeclaredField("modifiers").makeAccessible().set(this, modifiers and (Modifier.FINAL.inv())) + return this + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/TrophyFishJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/TrophyFishJson.java index 48d0908a9..719c0db2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/TrophyFishJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/TrophyFishJson.java @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.utils.jsonobjects; -import at.hannibal2.skyhanni.features.fishing.TrophyFishInfo; +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishInfo; import com.google.gson.annotations.Expose; import java.util.Map; |