From cfeac0b6a71c592b61c53fad192eb22bb24b0f54 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 7 Sep 2022 05:09:48 +0200 Subject: 0.7 (#2) * code cleanup * Option to hide the Skyblock Level from the chat messages, Option to change the way the Skyblock Level gets displayed in the chat * change version to 0.6.1 * add highlight the voidling extremist in pink color * add highlight corrupted mobs in purple color * fixed highlight corrupted mobs in purple color in the private island * another minor fix for highlight corrupted mobs in purple color * created EntityHealthUpdateEvent and fixing CorruptedMobHighlight * using EntityHealthUpdateEvent everywhere * added marking a player with yellow color * highlight slayer miniboss in blue color * /copyentities now shows health correctly for every entity * infer fix * fixing bazaar message filter * changelog * hides the death messages of other players, except for players who are close to the player. * hiding tip messages * highlight deathmites in dungeon in red color * code cleanup * code cleanup * hide tnt laying around in dungeon * fix infer * remove debug * Added hide Blessings laying around in dungeon. Added hide Revive Stones laying around in dungeon. * Hide Premium Flesh laying around in dungeon. * edited LorenzTest * Added dungeon copilot and separate filter for hiding dungeon key and door messages. * Added hide Journal Entry pages laying around in dungeon. * Added hide Skeleton Skulls laying around in dungeon. * credits * Added highlight Skeleton Skulls when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull) * Added highlight Skeleton Skulls when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull) * fix wording * clarification * small fixes * Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying) * better/more readability for CopyNearbyEntitiesCommand * make version 0.7 --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 26 ++- .../at/hannibal2/skyhanni/config/Features.java | 5 + .../hannibal2/skyhanni/config/features/Chat.java | 45 ++++- .../skyhanni/config/features/Dungeon.java | 81 ++++++++- .../hannibal2/skyhanni/config/features/Misc.java | 20 ++ .../skyhanni/config/gui/commands/Commands.java | 21 +++ .../java/at/hannibal2/skyhanni/data/EntityData.kt | 46 +++++ .../skyhanni/data/EntityMovementHelper.kt | 47 +++++ .../at/hannibal2/skyhanni/data/repo/RepoManager.kt | 2 +- .../skyhanni/events/DungeonBossRoomEnterEvent.kt | 3 + .../hannibal2/skyhanni/events/DungeonEnterEvent.kt | 3 + .../skyhanni/events/EntityHealthUpdateEvent.kt | 5 + .../hannibal2/skyhanni/events/EntityMoveEvent.kt | 5 + .../skyhanni/events/PlayerSendChatEvent.kt | 2 +- .../skyhanni/events/ResetEntityHurtEvent.kt | 8 + .../skyhanni/events/ResetEntityHurtTimeEvent.kt | 8 - .../skyhanni/features/CorruptedMobHighlight.kt | 61 +++++++ .../at/hannibal2/skyhanni/features/PlayerMarker.kt | 90 +++++++++ .../skyhanni/features/SummoningMobManager.kt | 5 +- .../skyhanni/features/SummoningSoulsName.kt | 16 +- .../hannibal2/skyhanni/features/chat/ChatFilter.kt | 27 +-- .../skyhanni/features/chat/HideFarDeathMessages.kt | 64 +++++++ .../skyhanni/features/chat/PlayerChatFilter.kt | 30 ++- .../features/chat/SkyBlockLevelChatMessage.kt | 49 +++++ .../skyhanni/features/damageindicator/BossType.kt | 1 - .../damageindicator/DamageIndicatorManager.kt | 4 + .../skyhanni/features/damageindicator/MobFinder.kt | 2 +- .../skyhanni/features/dungeon/DungeonChatFilter.kt | 16 +- .../skyhanni/features/dungeon/DungeonCleanEnd.kt | 27 +-- .../skyhanni/features/dungeon/DungeonCopilot.kt | 134 ++++++++++++++ .../skyhanni/features/dungeon/DungeonData.kt | 12 +- .../skyhanni/features/dungeon/DungeonHideItems.kt | 202 +++++++++++++++++++++ .../features/dungeon/HighlightDungeonDeathmite.kt | 65 +++++++ .../features/end/VoidlingExtremistColor.kt | 65 +++++++ .../hannibal2/skyhanni/features/items/ItemStars.kt | 2 +- .../skyhanni/features/items/RngMeterInventory.kt | 5 - .../items/abilitycooldown/ItemAbilityCooldown.kt | 1 - .../skyhanni/features/minion/MinionFeatures.kt | 6 - .../features/nether/ashfang/AshfangBlazes.kt | 24 +-- .../features/slayer/EndermanSlayerBeacon.kt | 134 ++++++++++++++ .../features/slayer/HighlightSlayerMiniboss.kt | 92 ++++++++++ .../renderer/MixinRendererLivingEntity.java | 4 +- .../hannibal2/skyhanni/test/GriffinJavaUtils.java | 3 +- .../java/at/hannibal2/skyhanni/test/LorenzTest.kt | 94 ++++++---- .../test/command/CopyNearbyEntitiesCommand.kt | 116 ++++++++---- .../java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 2 +- .../at/hannibal2/skyhanni/utils/LorenzUtils.kt | 3 + .../at/hannibal2/skyhanni/utils/RenderUtils.kt | 9 +- 48 files changed, 1498 insertions(+), 194 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/data/EntityData.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/DungeonBossRoomEnterEvent.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/DungeonEnterEvent.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/EntityHealthUpdateEvent.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtTimeEvent.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/CorruptedMobHighlight.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/PlayerMarker.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/chat/HideFarDeathMessages.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/chat/SkyBlockLevelChatMessage.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index e7ca8c882..353a00614 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -3,22 +3,18 @@ package at.hannibal2.skyhanni; import at.hannibal2.skyhanni.config.ConfigManager; import at.hannibal2.skyhanni.config.Features; import at.hannibal2.skyhanni.config.gui.commands.Commands; -import at.hannibal2.skyhanni.data.ApiKeyGrabber; -import at.hannibal2.skyhanni.data.HypixelData; -import at.hannibal2.skyhanni.data.ItemRenderBackground; -import at.hannibal2.skyhanni.data.ScoreboardData; +import at.hannibal2.skyhanni.data.*; import at.hannibal2.skyhanni.data.repo.RepoManager; import at.hannibal2.skyhanni.features.*; import at.hannibal2.skyhanni.features.anvil.AnvilCombineHelper; import at.hannibal2.skyhanni.features.bazaar.BazaarApi; import at.hannibal2.skyhanni.features.bazaar.BazaarBestSellMethod; import at.hannibal2.skyhanni.features.bazaar.BazaarOrderHelper; -import at.hannibal2.skyhanni.features.chat.ChatFilter; -import at.hannibal2.skyhanni.features.chat.ChatManager; -import at.hannibal2.skyhanni.features.chat.PlayerChatFilter; +import at.hannibal2.skyhanni.features.chat.*; 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.end.VoidlingExtremistColor; import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager; import at.hannibal2.skyhanni.features.fishing.SeaCreatureMessageShortener; import at.hannibal2.skyhanni.features.fishing.TrophyFishMessages; @@ -29,6 +25,8 @@ import at.hannibal2.skyhanni.features.items.RngMeterInventory; import at.hannibal2.skyhanni.features.items.abilitycooldown.ItemAbilityCooldown; import at.hannibal2.skyhanni.features.minion.MinionFeatures; import at.hannibal2.skyhanni.features.nether.ashfang.*; +import at.hannibal2.skyhanni.features.slayer.EndermanSlayerBeacon; +import at.hannibal2.skyhanni.features.slayer.HighlightSlayerMiniboss; import at.hannibal2.skyhanni.test.LorenzTest; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -43,7 +41,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; public class SkyHanniMod { public static final String MODID = "skyhanni"; - public static final String VERSION = "0.6"; + public static final String VERSION = "0.7"; public static Features feature; @@ -61,10 +59,13 @@ public class SkyHanniMod { registerEvent(new ApiKeyGrabber()); registerEvent(new SeaCreatureManager()); registerEvent(new ItemRenderBackground()); + registerEvent(new EntityData()); + registerEvent(new EntityMovementHelper()); registerEvent(new BazaarOrderHelper()); registerEvent(new ChatFilter()); registerEvent(new PlayerChatFilter()); + registerEvent(new SkyBlockLevelChatMessage()); registerEvent(new DungeonChatFilter()); registerEvent(new HideNotClickableItems()); registerEvent(new ItemDisplayOverlayFeatures()); @@ -97,6 +98,15 @@ public class SkyHanniMod { registerEvent(new RngMeterInventory()); registerEvent(new WikiCommand()); registerEvent(new SummoningMobManager()); + registerEvent(new VoidlingExtremistColor()); + registerEvent(new CorruptedMobHighlight()); + registerEvent(new PlayerMarker()); + registerEvent(new HighlightSlayerMiniboss()); + registerEvent(new HideFarDeathMessages()); + registerEvent(new HighlightDungeonDeathmite()); + registerEvent(new DungeonHideItems()); + registerEvent(new DungeonCopilot()); + registerEvent(new EndermanSlayerBeacon()); Commands.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 16e2b42f0..fa2cf6ac1 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -76,6 +76,11 @@ public class Features { editOverlay(activeConfigCategory, 200, 16, abilities.summoningMobDisplayPos); return; } + + if (runnableId.equals("dungeonCopilot")) { + editOverlay(activeConfigCategory, 200, 16, dungeon.copilotPos); + return; + } } @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java index c7bfa2973..3fe253cc0 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java @@ -1,9 +1,6 @@ package at.hannibal2.skyhanni.config.features; -import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigAccordionId; -import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigEditorAccordion; -import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigEditorBoolean; -import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigOption; +import at.hannibal2.skyhanni.config.gui.core.config.annotations.*; import com.google.gson.annotations.Expose; public class Chat { @@ -45,17 +42,49 @@ public class Chat { public boolean others = false; @Expose - @ConfigOption(name = "Player Messages", desc = "Add a fancy new chat format for player messages.") - @ConfigEditorBoolean + @ConfigOption(name = "Player Messages", desc = "") + @ConfigEditorAccordion(id = 1) public boolean playerMessages = false; @Expose - @ConfigOption(name = "Dungeon Filter", desc = "Hide annoying messages inside dungeon.") + @ConfigOption(name = "Player Messages Format", desc = "Add a fancy new chat format for player messages.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean playerMessagesFormat = false; + + @Expose + @ConfigOption(name = "Hide SkyBlock Level", desc = "Hiding the Skyblock Level from the chat messages") + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean hideSkyblockLevel = false; + + @Expose + @ConfigOption( + name = "SkyBlock Level Design", + desc = "Change the way the Skyblock Level gets displayed in the chat\n" + + "§cRequires SkyBlock Level and player messages format both enabled" + ) + @ConfigEditorDropdown( + values = {"§8[§6123§8] §bname §fmsg", + "§6§l123 §bname §fmsg", + "§bname §8[§6123§8]§f: msg"} + ) + @ConfigAccordionId(id = 1) + public int skyblockLevelDesign = 0; + + @Expose + @ConfigOption(name = "Dungeon Filter", desc = "Hide annoying messages in the dungeon.") @ConfigEditorBoolean public boolean dungeonMessages = false; @Expose - @ConfigOption(name = "Dungeon Boss Messages", desc = "Hide messages from watcher and bosses inside dungeon.") + @ConfigOption(name = "Dungeon Boss Messages", desc = "Hide messages from watcher and bosses in the dungeon.") @ConfigEditorBoolean public boolean dungeonBossMessages = false; + + @Expose + @ConfigOption(name = "Hide Far Deaths", desc = "Hide the death messages of other players, " + + "except for players who are close to the player, inside dungeon or doing a Kuudra fight.") + @ConfigEditorBoolean + public boolean hideFarDeathMessages = false; } 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 67b61d737..75fd777fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java @@ -16,7 +16,7 @@ public class Dungeon { public boolean showMilestone = false; @Expose - @ConfigOption(name = "Milestones Display", desc = "Show the current milestone inside Dungeons.") + @ConfigOption(name = "Milestones Display", desc = "Show the current milestone in the Dungeon.") @ConfigEditorBoolean @ConfigAccordionId(id = 0) public boolean showMilestonesDisplay = false; @@ -61,7 +61,84 @@ public class Dungeon { public boolean cleanEndF3IgnoreGuardians = false; @Expose - @ConfigOption(name = "Boss Damage Splash", desc = "Hiding damage splashes while inside the boss room (fixing Skytils feature)") + @ConfigOption(name = "Boss Damage Splash", desc = "Hiding damage splashes while inside the boss room. (fixing Skytils feature)") @ConfigEditorBoolean public boolean damageSplashBoss = false; + + @Expose + @ConfigOption(name = "Highlight Deathmites", desc = "Highlight deathmites in dungeon in red color.") + @ConfigEditorBoolean + public boolean highlightDeathmites = false; + + @ConfigOption(name = "Item Hider", desc = "") + @ConfigEditorAccordion(id = 3) + public boolean itemHider = false; + + @Expose + @ConfigOption(name = "Hide Superboom TNT", desc = "Hide Superboom TNT laying around in dungeon.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean hideSuperboomTNT = false; + + @Expose + @ConfigOption(name = "Hide Blessings", desc = "Hide Blessings laying around in dungeon.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean hideBlessing = false; + + @Expose + @ConfigOption(name = "Hide Revive Stones", desc = "Hide Revive Stones laying around in dungeon.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean hideReviveStone = false; + + @Expose + @ConfigOption(name = "Hide Premium Flesh", desc = "Hide Premium Flesh laying around in dungeon.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean hidePremiumFlesh = false; + + @Expose + @ConfigOption(name = "Hide Journal Entry", desc = "Hide Journal Entry pages laying around in dungeon.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean hideJournalEntry = false; + + @Expose + @ConfigOption(name = "Hide Skeleton Skull", desc = "Hide Skeleton Skulls laying around in dungeon.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean hideSkeletonSkull = false; + + @ConfigOption(name = "Message Filter", desc = "") + @ConfigEditorAccordion(id = 4) + public boolean messageFilter = false; + + @Expose + @ConfigOption(name = "Keys and Doors", desc = "Hides the chat message when picking up keys or opening doors in dungeon.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 4) + public boolean messageFilterKeysAndDoors = false; + + @ConfigOption(name = "Dungeon Copilot", desc = "") + @ConfigEditorAccordion(id = 5) + public boolean dungeonCopilot = false; + + @Expose + @ConfigOption(name = "Copilot Enabled", desc = "Suggests what to do next in dungeon.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 5) + public boolean copilotEnabled = false; + + @Expose + @ConfigOption(name = "Copilot Pos", desc = "") + @ConfigEditorButton(runnableId = "dungeonCopilot", buttonText = "Edit") + @ConfigAccordionId(id = 5) + public Position copilotPos = new Position(10, 10, false, true); + + @Expose + @ConfigOption(name = "Moving Skeleton Skulls", desc = "Highlight Skeleton Skulls when combining into a " + + "Skeletor in orange color (not useful combined with feature Hide Skeleton Skull)") + @ConfigEditorBoolean + public boolean highlightSkeletonSkull = false; } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 64b5e0630..d8ad7886e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -48,4 +48,24 @@ public class Misc { @ConfigOption(name = "Real Time Position", desc = "") @ConfigEditorButton(runnableId = "realTime", buttonText = "Edit") public Position realTimePos = new Position(10, 10, false, true); + + @Expose + @ConfigOption(name = "Voidling Extremist Color", desc = "Highlight the voidling extremist in pink color") + @ConfigEditorBoolean + public boolean voidlingExtremistColor = false; + + @Expose + @ConfigOption(name = "Corrupted Mob Highlight", desc = "Highlight corrupted mobs in purple color") + @ConfigEditorBoolean + public boolean corruptedMobHighlight = false; + + @Expose + @ConfigOption(name = "Slayer Miniboss Highlight", desc = "Highlight slayer miniboss in blue color") + @ConfigEditorBoolean + public boolean slayerMinibossHighlight = false; + + @Expose + @ConfigOption(name = "Slayer Enderman Beacon", desc = "Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying)") + @ConfigEditorBoolean + public boolean slayerEndermanBeacon = false; } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/config/gui/commands/Commands.java b/src/main/java/at/hannibal2/skyhanni/config/gui/commands/Commands.java index 9aca72ec3..e2bfad8f2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/gui/commands/Commands.java +++ b/src/main/java/at/hannibal2/skyhanni/config/gui/commands/Commands.java @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.config.gui.commands; import at.hannibal2.skyhanni.SkyHanniMod; import at.hannibal2.skyhanni.config.gui.config.ConfigEditor; import at.hannibal2.skyhanni.config.gui.core.GuiScreenElementWrapper; +import at.hannibal2.skyhanni.features.PlayerMarker; import at.hannibal2.skyhanni.test.LorenzTest; import at.hannibal2.skyhanni.test.command.CopyItemCommand; import at.hannibal2.skyhanni.test.command.CopyNearbyEntitiesCommand; @@ -87,5 +88,25 @@ public class Commands { } ) ); + ClientCommandHandler.instance.registerCommand( + new SimpleCommand( + "shmarkplayer", + new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + PlayerMarker.Companion.command(args); + } + } + ) + ); + ClientCommandHandler.instance.registerCommand( + new SimpleCommand( + "togglepacketlog", + new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + LorenzTest.Companion.togglePacketLog(); + } + } + ) + ); } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt new file mode 100644 index 000000000..79d0107c7 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -0,0 +1,46 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent +import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.Minecraft +import net.minecraft.entity.EntityLivingBase +import net.minecraft.network.play.server.S1CPacketEntityMetadata +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class EntityData { + + @SubscribeEvent + fun onHealthUpdatePacket(event: PacketEvent.ReceiveEvent) { + val packet = event.packet + if (packet !is S1CPacketEntityMetadata) return + + if (packet == null) { + LorenzUtils.debug("packet is null in CorruptedMobHigh light!") + return + } + + val watchableObjects = packet.func_149376_c() ?: return + for (watchableObject in watchableObjects) { + if (watchableObject.dataValueId != 6) continue + + val theWorld = Minecraft.getMinecraft().theWorld + if (theWorld == null) { + LorenzUtils.debug("theWorld is null in CorruptedMobHighlight!") + continue + } + val entityId = packet.entityId + if (entityId == null) { + LorenzUtils.debug("entityId is null in CorruptedMobHighlight!") + continue + } + + val entity = theWorld.getEntityByID(entityId) ?: continue + if (entity !is EntityLivingBase) continue + + val health = watchableObject.`object` as Float + EntityHealthUpdateEvent(entity, health).postAndCatch() + return + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt new file mode 100644 index 000000000..908aae388 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementHelper.kt @@ -0,0 +1,47 @@ +package at.hannibal2.skyhanni.data + +import at.hannibal2.skyhanni.events.EntityMoveEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.entity.Entity +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class EntityMovementHelper { + + companion object { + private val entityLocation = mutableMapOf() + + fun addToTrack(entity: Entity) { + if (entity !in entityLocation) { + entityLocation[entity] = entity.getLorenzVec() + } + } + } + + var tick = 0 + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!LorenzUtils.inSkyblock) return + + for (entity in entityLocation.keys) { + if (entity.isDead) continue + + val newLocation = entity.getLorenzVec() + val oldLocation = entityLocation[entity]!! + val distance = newLocation.distance(oldLocation) + if (distance > 0.01) { + entityLocation[entity] = newLocation + EntityMoveEvent(entity).postAndCatch() + } + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + entityLocation.clear() + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index 8351991ab..a9fbcb04a 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -28,7 +28,7 @@ class RepoManager(private val configLocation: File) { } } - private val atomicShouldManuallyReload = AtomicBoolean(false)//TODO FIX + private val atomicShouldManuallyReload = AtomicBoolean(false)//TODO remove the workaround fun updateRepo() { atomicShouldManuallyReload.set(true) diff --git a/src/main/java/at/hannibal2/skyhanni/events/DungeonBossRoomEnterEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/DungeonBossRoomEnterEvent.kt new file mode 100644 index 000000000..872e6fe3f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/DungeonBossRoomEnterEvent.kt @@ -0,0 +1,3 @@ +package at.hannibal2.skyhanni.events + +class DungeonBossRoomEnterEvent: LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/DungeonEnterEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/DungeonEnterEvent.kt new file mode 100644 index 000000000..819ae8c71 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/DungeonEnterEvent.kt @@ -0,0 +1,3 @@ +package at.hannibal2.skyhanni.events + +class DungeonEnterEvent(dungeonFloor: String): LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityHealthUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityHealthUpdateEvent.kt new file mode 100644 index 000000000..3b0284cf6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityHealthUpdateEvent.kt @@ -0,0 +1,5 @@ +package at.hannibal2.skyhanni.events + +import net.minecraft.entity.EntityLivingBase + +class EntityHealthUpdateEvent(val entity: EntityLivingBase, val health: Float) : LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt new file mode 100644 index 000000000..fdb50bfb0 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt @@ -0,0 +1,5 @@ +package at.hannibal2.skyhanni.events + +import net.minecraft.entity.Entity + +class EntityMoveEvent(val entity: Entity) : LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt index 49f56bdb4..2b051add9 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/PlayerSendChatEvent.kt @@ -6,5 +6,5 @@ class PlayerSendChatEvent( val channel: PlayerMessageChannel, val playerName: String, var message: String, - var cancelledReason: String = "" + var cancelledReason: String = "", ) : LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt new file mode 100644 index 000000000..47af03f38 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt @@ -0,0 +1,8 @@ +package at.hannibal2.skyhanni.events + +import net.minecraft.entity.EntityLivingBase +import java.awt.Color + +class ResetEntityHurtEvent(val entity: EntityLivingBase, var shouldReset: Boolean) : LorenzEvent() + +fun Color.withAlpha(alpha: Int): Int = (alpha.coerceIn(0, 255) shl 24) or (this.rgb and 0x00ffffff) \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtTimeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtTimeEvent.kt deleted file mode 100644 index ea644e680..000000000 --- a/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtTimeEvent.kt +++ /dev/null @@ -1,8 +0,0 @@ -package at.hannibal2.skyhanni.events - -import net.minecraft.entity.EntityLivingBase -import java.awt.Color - -class ResetEntityHurtTimeEvent(val entity: EntityLivingBase, var shouldReset: Boolean) : LorenzEvent() - -fun Color.withAlpha(alpha: Int): Int = (alpha.coerceIn(0, 255) shl 24) or (this.rgb and 0x00ffffff) \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/CorruptedMobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/CorruptedMobHighlight.kt new file mode 100644 index 000000000..cbad9c0e7 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/CorruptedMobHighlight.kt @@ -0,0 +1,61 @@ +package at.hannibal2.skyhanni.features + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent +import at.hannibal2.skyhanni.events.RenderMobColoredEvent +import at.hannibal2.skyhanni.events.ResetEntityHurtEvent +import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth +import net.minecraft.entity.EntityLivingBase +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class CorruptedMobHighlight { + + private val corruptedMobs = mutableListOf() + + @SubscribeEvent + fun onHealthUpdateEvent(event: EntityHealthUpdateEvent) { + if (!LorenzUtils.inSkyblock) return + + val entity = event.entity + if (entity in corruptedMobs) return + + val baseMaxHealth = entity.baseMaxHealth.toFloat() + if (event.health == baseMaxHealth * 3) { + corruptedMobs.add(entity) + } + } + + @SubscribeEvent + fun onRenderMobColored(event: RenderMobColoredEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in corruptedMobs) { + event.color = LorenzColor.DARK_PURPLE.toColor().withAlpha(127) + } + } + + @SubscribeEvent + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in corruptedMobs) { + event.shouldReset = true + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + corruptedMobs.clear() + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.corruptedMobHighlight && + LorenzUtils.skyBlockIsland != "Private Island" + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/PlayerMarker.kt b/src/main/java/at/hannibal2/skyhanni/features/PlayerMarker.kt new file mode 100644 index 000000000..e8a12a743 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/PlayerMarker.kt @@ -0,0 +1,90 @@ +package at.hannibal2.skyhanni.features + +import at.hannibal2.skyhanni.events.RenderMobColoredEvent +import at.hannibal2.skyhanni.events.ResetEntityHurtEvent +import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityOtherPlayerMP +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class PlayerMarker { + + companion object { + private val playerNamesToMark = mutableListOf() + private val markedPlayers = mutableMapOf() + + fun command(args: Array) { + if (args.size != 1) { + LorenzUtils.chat("§cUsage: /shmarkplayer ") + return + } + + val displayName = args[0] + val name = displayName.lowercase() + if (name !in playerNamesToMark) { + playerNamesToMark.add(name) + findPlayers() + LorenzUtils.chat("§e[SkyHanni] §amarked §eplayer §b$displayName!") + } else { + playerNamesToMark.remove(name) + markedPlayers.remove(name) + LorenzUtils.chat("§e[SkyHanni] §cunmarked §eplayer §b$displayName!") + } + } + + private fun findPlayers() { + for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { + if (entity is EntityOtherPlayerMP) { + if (entity in markedPlayers.values) continue + + val name = entity.name.lowercase() + if (name in playerNamesToMark) { + markedPlayers[name] = entity + } + } + } + } + } + + var tick = 0 + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + + if (tick++ % 20 == 0) { + findPlayers() + } + } + + @SubscribeEvent + fun onRenderMobColored(event: RenderMobColoredEvent) { + if (!isEnabled()) return + val entity = event.entity + if (entity in markedPlayers.values) { + event.color = LorenzColor.YELLOW.toColor().withAlpha(127) + } + } + + @SubscribeEvent + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { + if (!isEnabled()) return + val entity = event.entity + if (entity in markedPlayers.values) { + event.shouldReset = true + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + markedPlayers.clear() + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt index 74cf7847b..36dbab9ed 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/SummoningMobManager.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.RenderMobColoredEvent -import at.hannibal2.skyhanni.events.ResetEntityHurtTimeEvent +import at.hannibal2.skyhanni.events.ResetEntityHurtEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth @@ -177,7 +177,7 @@ class SummoningMobManager { } @SubscribeEvent - fun onResetEntityHurtTime(event: ResetEntityHurtTimeEvent) { + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { val entity = event.entity if (SkyHanniMod.feature.abilities.summoningMobColored && entity in summoningMobs.keys) { event.shouldReset = true @@ -190,7 +190,6 @@ class SummoningMobManager { summoningsSpawned = 0 searchArmorStands = false searchMobs = false - println("despawning") } private fun isEnabled(): Boolean { diff --git a/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt index 1a659f171..ec813395a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/SummoningSoulsName.kt @@ -12,22 +12,23 @@ import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLiving import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent class SummoningSoulsName { var tick = 0 - val texture = + private val texture = "ewogICJ0aW1lc3RhbXAiIDogMTYwMTQ3OTI2NjczMywKICAicHJvZmlsZUlkIiA6ICJmMzA1ZjA5NDI0NTg0ZjU" + "4YmEyYjY0ZjAyZDcyNDYyYyIsCiAgInByb2ZpbGVOYW1lIiA6ICJqcm9ja2EzMyIsCiAgInNpZ25hdH" + "VyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgI" + "nVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81YWY0MDM1ZWMwZGMx" + "NjkxNzc4ZDVlOTU4NDAxNzAyMjdlYjllM2UyOTQzYmVhODUzOTI5Y2U5MjNjNTk4OWFkIgogICAgfQogIH0KfQ" - val souls = mutableMapOf() - val mobsLastLocation = mutableMapOf() - val mobsName = mutableMapOf() + private val souls = mutableMapOf() + private val mobsLastLocation = mutableMapOf() + private val mobsName = mutableMapOf() @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { @@ -103,6 +104,13 @@ class SummoningSoulsName { } } + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + souls.clear() + mobsLastLocation.clear() + mobsName.clear() + } + private fun isSoul(entity: EntityArmorStand): Boolean { for (stack in entity.inventory) { if (stack != null) { 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 4dc106249..412114c58 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -72,13 +72,13 @@ class ChatFilter { } private fun uselessNotification(message: String): Boolean { - return when { - message == "§eYour previous §r§6Plasmaflux Power Orb §r§ewas removed!" -> true - - message == "§aYou used your §r§6Mining Speed Boost §r§aPickaxe Ability!" -> true - message == "§cYour Mining Speed Boost has expired!" -> true - message == "§a§r§6Mining Speed Boost §r§ais now available!" -> true + if (message.matchRegex("§aYou tipped (\\d) (player|players)!")) return true + return when (message) { + "§eYour previous §r§6Plasmaflux Power Orb §r§ewas removed!" -> true + "§aYou used your §r§6Mining Speed Boost §r§aPickaxe Ability!" -> true + "§cYour Mining Speed Boost has expired!" -> true + "§a§r§6Mining Speed Boost §r§ais now available!" -> true else -> false } } @@ -92,7 +92,7 @@ class ChatFilter { message == "§cPlace a Dungeon weapon or armor piece above the anvil to salvage it!" -> true message == "§cWhoa! Slow down there!" -> true message == "§cWait a moment before confirming!" -> true - message == "§cYou need to be out of combat for 3 seconds before opening the SkyBlock Menu!" -> true//TODO prevent in the future + message == "§cYou cannot open the SkyBlock menu while in combat!" -> true else -> false } @@ -206,21 +206,22 @@ class ChatFilter { private fun bazaarAndAHMiniMessages(message: String): Boolean = when (message) { "§7Putting item in escrow...", - "§7Putting goods in escrow...", "§7Putting coins in escrow...", //Auction House "§7Setting up the auction...", "§7Processing purchase...", - "§7Claiming order...", "§7Processing bid...", "§7Claiming BIN auction...", //Bazaar - "§7Submitting sell offer...", - "§7Submitting buy order...", - "§7Executing instant sell...", - "§7Executing instant buy...", + "§6[Bazaar] §r§7Submitting sell offer...", + "§6[Bazaar] §r§7Submitting buy order...", + "§6[Bazaar] §r§7Executing instant sell...", + "§6[Bazaar] §r§7Executing instant buy...", + "§6[Bazaar] §r§7Cancelling order...", + "§6[Bazaar] §r§7Claiming order...", + "§6[Bazaar] §r§7Putting goods in escrow...", //Bank "§8Depositing coins...", diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/HideFarDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/HideFarDeathMessages.kt new file mode 100644 index 000000000..0a3ead47d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/HideFarDeathMessages.kt @@ -0,0 +1,64 @@ +package at.hannibal2.skyhanni.features.chat + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.LocationUtils +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityOtherPlayerMP +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent +import java.util.regex.Pattern + +class HideFarDeathMessages { + + private var tick = 0 + private val lastTimePlayerSeen = mutableMapOf() + + //§c ☠ §r§7§r§bZeroHazel§r§7 was killed by §r§8§lAshfang§r§7§r§7. + private val pattern = Pattern.compile("§c ☠ §r§7§r§.(.+)§r§7 (.+)") + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + + if (tick++ % 20 == 0) { + checkOtherPlayers() + } + } + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!isEnabled()) return + + val message = event.message + val matcher = pattern.matcher(message) + if (matcher.matches()) { + val name = matcher.group(1) + if (System.currentTimeMillis() > lastTimePlayerSeen.getOrDefault(name, 0) + 30_000) { + event.blockedReason = "far_away_player_death" + } + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + HypixelData.skyblock = false + } + + private fun checkOtherPlayers() { + val location = LocationUtils.playerLocation() + for (otherPlayer in Minecraft.getMinecraft().theWorld.loadedEntityList + .filterIsInstance() + .filter { it.getLorenzVec().distance(location) < 25 }) { + lastTimePlayerSeen[otherPlayer.name] = System.currentTimeMillis() + } + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.chat.hideFarDeathMessages && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt index ac6b9fbbe..a96997ba6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt @@ -7,15 +7,18 @@ import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern class PlayerChatFilter { private val loggerPlayerChat = LorenzLogger("chat/player") + //§8[§9109§8] §b[MVP§c+§b] 4Apex§f§r§f: omg selling + private val patternSkyBlockLevel = Pattern.compile("§8\\[§(.)(\\d+)§8] (.+)") + @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!LorenzUtils.isOnHypixel) return - if (!SkyHanniMod.feature.chat.playerMessages) return if (shouldBlock(event.message)) { event.blockedReason = "player_chat" @@ -23,10 +26,19 @@ class PlayerChatFilter { } private fun shouldBlock(originalMessage: String): Boolean { - val split = if (originalMessage.contains("§7§r§7: ")) { - originalMessage.split("§7§r§7: ") - } else if (originalMessage.contains("§f: ")) { - originalMessage.split("§f: ") + //since hypixel sends own chat messages really weird " §r§8[§r§d205§r§8] §r§6[MVP§r§c++§r§6] hannibal2" + var rawMessage = originalMessage.replace("§r", "").trim() + + val matcher = patternSkyBlockLevel.matcher(rawMessage) + if (matcher.matches()) { + SkyBlockLevelChatMessage.setData(matcher.group(2).toInt(), matcher.group(1)) + rawMessage = matcher.group(3) + } + + val split = if (rawMessage.contains("§7§7: ")) { + rawMessage.split("§7§7: ") + } else if (rawMessage.contains("§f: ")) { + rawMessage.split("§f: ") } else { return false } @@ -37,6 +49,14 @@ class PlayerChatFilter { rawName = rawName.substring(channel.originalPrefix.length) val name = grabName(rawName) ?: return false + if (!SkyHanniMod.feature.chat.playerMessagesFormat) { + if (SkyHanniMod.feature.chat.hideSkyblockLevel) { + LorenzUtils.chat(rawMessage) + return true + } + return false + } + val message = split[1] send(channel, name.removeColor(), message.removeColor()) return true diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/SkyBlockLevelChatMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/SkyBlockLevelChatMessage.kt new file mode 100644 index 000000000..deacc0de6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/SkyBlockLevelChatMessage.kt @@ -0,0 +1,49 @@ +package at.hannibal2.skyhanni.features.chat + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.PlayerSendChatEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class SkyBlockLevelChatMessage { + + companion object { + var level = -1 + var levelColor = "" + + fun setData(level: Int, levelColor: String) { + this.level = level + this.levelColor = levelColor + } + } + + @SubscribeEvent + fun onChatMessage(event: PlayerSendChatEvent) { + if (level == -1) return + event.cancelledReason = "skyblock level" + + val finalMessage = event.message + val name = event.playerName + val prefix = event.channel.prefix + + if (SkyHanniMod.feature.chat.hideSkyblockLevel) { + LorenzUtils.chat("$prefix §b$name §f$finalMessage") + } else { + + when (SkyHanniMod.feature.chat.skyblockLevelDesign) { + 0 -> { + LorenzUtils.chat("$prefix §8[§${levelColor}${level}§8] §b$name §f$finalMessage") + } + + 1 -> { + LorenzUtils.chat("$prefix §${levelColor}§l${level} §b$name §f$finalMessage") + } + + 2 -> { + LorenzUtils.chat("$prefix §b$name §8[§${levelColor}${level}§8]§f: $finalMessage") + } + } + } + level = -1 + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt index 109bfa9bc..c77738605 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt @@ -62,7 +62,6 @@ enum class BossType(val fullName: String, val bossTypeToggle: Int, val shortName * lost adventurer * frozen adventurer * king midas - * silverfish 2b one tap - deathmite outside trap * in blood room: bonzo, scarf, ?? * f7 blood room giants * 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 3f9c88dac..a6fff41ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -42,6 +42,10 @@ class DamageIndicatorManager { private var data = mutableMapOf() private val damagePattern: Pattern = Pattern.compile("✧?(\\d+[⚔+✧❤♞☄✷ﬗ]*)") + fun isBoss(entity: EntityLivingBase): Boolean { + return data.values.any { it.entity == entity } + } + fun isDamageSplash(entity: EntityLivingBase): Boolean { if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return false if (!entity.hasCustomName()) return false 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 537a9850f..aa0af27b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt @@ -237,7 +237,7 @@ class MobFinder { } } if (entity is EntityDragon) { - //TODO testing and make right and so + //TODO testing and use sidebar data return EntityResult(bossType = BossType.END_ENDER_DRAGON) } if (entity is EntityIronGolem) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt index 0d3dcb77f..031cf41f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonChatFilter.kt @@ -29,8 +29,7 @@ class DungeonChatFilter { if (!LorenzUtils.inDungeons) return "" return when { - isKey(message) -> "key" - isDoor(message) -> "door" + isUnsortedBlockedMessage(message) -> "unsorted" isPickup(message) -> "pickup" isReminder(message) -> "reminder" isBuff(message) -> "buff" @@ -44,8 +43,6 @@ class DungeonChatFilter { } } - private fun isDoor(message: String): Boolean = message == "§cThe §r§c§lBLOOD DOOR§r§c has been opened!" - private fun isEnd(message: String): Boolean = when { message.matchRegex("(.*) §r§eunlocked §r§d(.*) Essence §r§8x(.*)§r§e!") -> true message.matchRegex(" §r§d(.*) Essence §r§8x(.*)") -> true @@ -58,6 +55,7 @@ class DungeonChatFilter { message.matchRegex("§7Your Guided Sheep hit §r§c(.*) §r§7enemy for §r§c(.*) §r§7damage.") -> true message == "§6Rapid Fire§r§a is ready to use! Press §r§6§lDROP§r§a to activate it!" -> true message == "§6Castle of Stone§r§a is ready to use! Press §r§6§lDROP§r§a to activate it!" -> true + message == "§6Ragnarok§r§a is ready to use! Press §r§6§lDROP§r§a to activate it!" -> true message.matchRegex("§a§lBUFF! §fYou were splashed by (.*) §fwith §r§cHealing VIII§r§f!") -> true @@ -159,14 +157,10 @@ class DungeonChatFilter { else -> false } - private fun isKey(message: String): Boolean = when { - message.matchRegex("(.*) §r§ehas obtained §r§a§r§6§r§8Wither Key§r§e!") -> true - message.matchRegex("(.*) opened a §r§8§lWITHER §r§adoor!") -> true - message.matchRegex("(.*) §r§ehas obtained §r§a§r§c§r§cBlood Key§r§e!") -> true + //TODO sort out and filter separately + private fun isUnsortedBlockedMessage(message: String): Boolean = when { message.matchRegex("(.*) §r§ehas obtained §r§a§r§9Beating Heart§r§e!") -> true message == "§5A shiver runs down your spine..." -> true - message == "§eA §r§a§r§6§r§8Wither Key§r§e was picked up!" -> true - message == "§eA §r§a§r§c§r§cBlood Key§r§e was picked up!" -> true else -> false } @@ -216,7 +210,7 @@ class DungeonChatFilter { message == "§aYour active Potion Effects have been paused and stored. They will be restored when you leave Dungeons! You are not allowed to use existing Potion Effects while in Dungeons." -> true message.matchRegex("(.*) has started the dungeon countdown. The dungeon will begin in 1 minute.") -> true message.matchRegex("§e[NPC] §bMort§f: §rTalk to me to change your class and ready up.") -> true - message.matchRegex("(.*) §a is now ready!") -> true + message.matchRegex("(.*)§a is now ready!") -> true message.matchRegex("§aDungeon starts in (.*) seconds.") -> true message == "§aDungeon starts in 1 second." -> true message == "§aYou can no longer consume or splash any potions during the remainder of this Dungeon run!" -> true diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt index bdaebc3f7..7222d080d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -1,17 +1,13 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.CheckRenderEntityEvent -import at.hannibal2.skyhanni.events.DamageIndicatorFinalBossEvent -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityGuardian -import net.minecraft.network.play.server.S1CPacketEntityMetadata import net.minecraft.network.play.server.S2APacketParticles import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -61,26 +57,17 @@ class DungeonCleanEnd { } @SubscribeEvent - fun onHealthUpdatePacket(event: PacketEvent.ReceiveEvent) { + fun onHealthUpdateEvent(event: EntityHealthUpdateEvent) { if (!LorenzUtils.inDungeons) return if (!SkyHanniMod.feature.dungeon.cleanEndToggle) return - if (bossDone) return if (lastBossId == -1) return + if (event.entity.entityId != lastBossId) return - val packet = event.packet - if (packet !is S1CPacketEntityMetadata) return - if (packet.entityId != lastBossId) return - - for (watchableObject in packet.func_149376_c()) { - if (watchableObject.dataValueId == 6) { - val health = watchableObject.`object` as Float - if (health < 1) { - val dungeonFloor = DungeonData.dungeonFloor - LorenzUtils.chat("§eFloor $dungeonFloor done!") - bossDone = true - } - } + if (event.health < 1) { + val dungeonFloor = DungeonData.dungeonFloor + LorenzUtils.chat("§eFloor $dungeonFloor done!") + bossDone = true } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt new file mode 100644 index 000000000..79c00619b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt @@ -0,0 +1,134 @@ +package at.hannibal2.skyhanni.features.dungeon + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.* +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import net.minecraft.client.Minecraft +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class DungeonCopilot { + + var nextStep = "" + var searchForKey = false + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!LorenzUtils.inDungeons) return + + val message = event.message + + if (message.matchRegex("(.*) has started the dungeon countdown. The dungeon will begin in 1 minute.")) { + changeNextStep("Ready up") + } + if (message.endsWith("§a is now ready!")) { + var name = Minecraft.getMinecraft().thePlayer.name + if (message.contains(name)) { + changeNextStep("Wait for the dungeon to start!") + } + } + + var foundKeyOrDoor = false + + //key pickup + if (message.matchRegex("(.*) §r§ehas obtained §r§a§r§6§r§8Wither Key§r§e!") || + message == "§eA §r§a§r§6§r§8Wither Key§r§e was picked up!" + ) { + changeNextStep("Open Wither Door") + foundKeyOrDoor = true + + } + if (message.matchRegex("(.*) §r§ehas obtained §r§a§r§c§r§cBlood Key§r§e!") || + message == "§eA §r§a§r§c§r§cBlood Key§r§e was picked up!" + ) { + changeNextStep("Open Blood Door") + foundKeyOrDoor = true + } + + + if (message.matchRegex("(.*) opened a §r§8§lWITHER §r§adoor!")) { + changeNextStep("Clear next room") + searchForKey = true + foundKeyOrDoor = true + } + + if (message == "§cThe §r§c§lBLOOD DOOR§r§c has been opened!") { + changeNextStep("Wait for Blood Room to fully spawn") + foundKeyOrDoor = true + } + + if (foundKeyOrDoor && SkyHanniMod.feature.dungeon.messageFilterKeysAndDoors) { + event.blockedReason = "dungeon_keys_and_doors" + } + + + if (message == "§c[BOSS] The Watcher§r§f: That will be enough for now.") { + changeNextStep("Clear Blood Room") + } + + if (message == "§c[BOSS] The Watcher§r§f: You have proven yourself. You may pass.") { + changeNextStep("Enter Boss Room") + } + } + + private fun changeNextStep(step: String) { + nextStep = step + } + + @SubscribeEvent + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (!LorenzUtils.inDungeons) return + + val entity = event.entity + if (entity !is EntityArmorStand) return + + if (!searchForKey) return + + if (entity.name == "§6§8Wither Key") { + changeNextStep("Pick up Wither Key") + searchForKey = false + } + if (entity.name == "§c§cBlood Key") { + changeNextStep("Pick up Blood Key") + searchForKey = false + } + } + + @SubscribeEvent + fun onDungeonStart(event: DungeonStartEvent) { + changeNextStep("Clear first room") + searchForKey = true + } + + @SubscribeEvent + fun onDungeonStart(event: DungeonEnterEvent) { + changeNextStep("Talk to Mort") + searchForKey = true + } + + @SubscribeEvent + fun onDungeonBossRoomEnter(event: DungeonBossRoomEnterEvent) { + changeNextStep("Defeat the boss! Good luck :)") + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + changeNextStep("") + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inDungeons && SkyHanniMod.feature.dungeon.copilotEnabled + } + + @SubscribeEvent + fun renderOverlay(event: RenderGameOverlayEvent.Post) { + if (!LorenzUtils.inDungeons) return + if (!SkyHanniMod.feature.dungeon.copilotEnabled) return + + SkyHanniMod.feature.dungeon.copilotPos.renderString(nextStep) + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt index 93f8c659a..b14bf4b4a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.events.DungeonBossRoomEnterEvent +import at.hannibal2.skyhanni.events.DungeonEnterEvent import at.hannibal2.skyhanni.events.DungeonStartEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -32,7 +34,10 @@ class DungeonData { val message = rawMessage.removeColor() val bossName = message.substringAfter("[BOSS] ").substringBefore(":").trim() if (bossName != "The Watcher" && dungeonFloor != null && checkBossName(dungeonFloor!!, bossName)) { - inBossRoom = true + if (!inBossRoom) { + DungeonBossRoomEnterEvent().postAndCatch() + inBossRoom = true + } } } @@ -59,8 +64,11 @@ class DungeonData { if (event.phase != TickEvent.Phase.START) return if (dungeonFloor == null) { for (line in ScoreboardData.sidebarLines) { + //TODO mixins if (line.contains("The Catacombs (")) { - dungeonFloor = line.substringAfter("(").substringBefore(")") + val floor = line.substringAfter("(").substringBefore(")") + dungeonFloor = floor + DungeonEnterEvent(floor).postAndCatch() break } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt new file mode 100644 index 000000000..faf48e95c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -0,0 +1,202 @@ +package at.hannibal2.skyhanni.features.dungeon + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.EntityMovementHelper +import at.hannibal2.skyhanni.events.* +import at.hannibal2.skyhanni.utils.ItemUtils.cleanName +import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.entity.item.EntityArmorStand +import net.minecraft.entity.item.EntityItem +import net.minecraft.network.play.server.S2APacketParticles +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +