diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a3e2564619f..0628286b1374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # SkyHanni - Change Log +## Version 0.7 - Dungeon and Colored Highlight + +## New Dungeon Features +- Added highlight deathmites in dungeon in red color +- Added hide Superboom TNT laying around in dungeon +- Added hide Blessings laying around in dungeon +- Added hide Revive Stones laying around in dungeon +- Added hide Premium Flesh laying around in dungeon +- Added Dungeon Copilot (Suggests to you what to do next in dungeon) +- Added separate option to hide dungeon key pickup and door open messages +- Added hide Journal Entry pages laying around in dungeon. +- Added hide Skeleton Skulls laying around in dungeon. +- Added highlight Skeleton Skulls in dungeon when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull) + + +### Other Misc Features +- Added option to hide the Skyblock Level from the chat messages (alpha only atm) +- Added option to change the way the Skyblock Level gets displayed in the chat (only working when skyblock level and fancy player message format are enabled) +- Added highlight the voidling extremist in pink color +- Added highlight corrupted mobs in purple color +- Added command /shmarkplayer (marking a player with yellow color) +- Added highlight slayer miniboss in blue color +- Added option to hide the death messages of other players, except for players who are close to the player, inside dungeon or doing a Kuudra fight. +- Added highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying) + +### Fixes +- Fixed message filter for small bazaar messages + ## Version 0.6 - Ashfang and Summoning Mobs ### New Features diff --git a/FEATURES.md b/FEATURES.md index 428e1e1aad11..32d9f7acf2d4 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -1,7 +1,9 @@ # SkyHanni - List of all Features ## Commands +- /skyhanni or /sh (opening the SkyHanni config in game) - /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki) +- /shmarkplayer (marking a player with yellow color) ## Chat Filter - Hiding annoying messages in the Hub of Hypixel (MVP player joins, other player loot boxes, prototype message, radiating generosity, HyPixel tournaments) @@ -12,8 +14,11 @@ ## Chat + Using a clean chat format for player messages (removing the rank prefix, every player writes in the same color) -+ Dungeon Filter (Removing annoying messages from inside dungeon) ++ Dungeon Filter (Removing annoying messages from in the dungeon) + Dungeon Boss Message hider (includes The Watcher as well) +- Option to hide the Skyblock Level from the chat messages, +- Option to change the way the Skyblock Level gets displayed in the chat (only working when skyblock level and fancy player message format are enabled) +- Option to hide the death messages of other players, except for players who are close to the player, inside dungeon or doing a Kuudra fight. ## Dungeon - Clicked Blocks (Showing the block behind walls AFTER clicked on a chest, wither essence or a lever) @@ -22,6 +27,16 @@ - Clean End (Hiding all entities and particles from displaying after the last dungeon boss dies, showing dungeon chests, still) - Option to exclude guardians in F3 and M3 from the clean end feature (only when sneaking) - Hiding damage splashes while inside the boss room (replacing a broken feature from Skytils) +- Highlight deathmites in red color +- Hide Superboom TNT laying around in dungeon +- Hide Blessings laying around in dungeon +- Hide Revive Stones laying around in dungeon +- Hide Premium Flesh laying around in dungeon +- Hide Journal Entry pages laying around in dungeon. +- Dungeon Copilot (Suggests to you what to do next in dungeon) +- Option to hide key pickup and door open messages in dungeon. +- Hide Skeleton Skulls laying around in dungeon. +- Highlight Skeleton Skulls in dungeon when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull) ## Inventory - Not Clickable Items: Mark items gray in your inventory when they are not supposed to be moved in certain GUIs (in NPC sell inventories, ender chests and backpacks, salvaging in dungeon hub, player trade, bazaar, action house, accessory bag, sack of sacks, fishing bag, potion bag, chests on the private island, attribute fusion and equipment GUI) @@ -87,3 +102,7 @@ - Summon Soul Display (show the name of a dropped soul, not working in dungeon when Skytils' "Hide Non-Starred Mobs Nametags" is enabled) - Fixing Skytils custom Damage Splash - Gui element showing the real time +- Highlight the voidling extremist in pink color +- Highlight corrupted mobs in purple color +- Highlight slayer miniboss in blue color +- Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying) diff --git a/build.gradle.kts b/build.gradle.kts index 9c2c803c9aa9..3f6cc51a9221 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { } group = "at.hannibal2.skyhanni" -version = "0.6" +version = "0.7" // Toolchains: java { diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index e7ca8c882748..353a0061482e 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -3,22 +3,18 @@ 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.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 @@ 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 void preInit(FMLPreInitializationEvent event) { 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 void preInit(FMLPreInitializationEvent event) { 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 16e2b42f00c4..fa2cf6ac1dec 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 void executeRunnable(String runnableId) { 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 c7bfa29737f3..3fe253cc067d 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 67b61d7377d6..75fd777fc8ef 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 64b5e0630445..d8ad7886e89d 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 9aca72ec3fdd..e2bfad8f2452 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 @@ 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 void processCommand(ICommandSender sender, String[] args) { } ) ); + 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 000000000000..79d0107c74e7 --- /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 000000000000..908aae3884ea --- /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 8351991ab47b..a9fbcb04adf2 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 000000000000..872e6fe3f782 --- /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 000000000000..819ae8c71a28 --- /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 000000000000..3b0284cf659a --- /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 000000000000..fdb50bfb02bd --- /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 49f56bdb4166..2b051add9b52 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/ResetEntityHurtTimeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt similarity index 66% rename from src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtTimeEvent.kt rename to src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt index ea644e6806cb..47af03f38bae 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtTimeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ResetEntityHurtEvent.kt @@ -3,6 +3,6 @@ package at.hannibal2.skyhanni.events import net.minecraft.entity.EntityLivingBase import java.awt.Color -class ResetEntityHurtTimeEvent(val entity: EntityLivingBase, var shouldReset: Boolean) : LorenzEvent() +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/features/CorruptedMobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/CorruptedMobHighlight.kt new file mode 100644 index 000000000000..cbad9c0e78d9 --- /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 000000000000..e8a12a743646 --- /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 74cf7847b7df..36dbab9ed225 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 1a659f1713b2..ec813395a573 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 4dc106249768..412114c58a44 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 000000000000..0a3ead47de9c --- /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 ac6b9fbbe741..a96997ba648e 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 000000000000..deacc0de6879 --- /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 109bfa9bc647..c77738605fc6 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 3f9c88dac5f9..a6fff41ca3b2 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 537a9850fa80..aa0af27b5964 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 0d3dcb77f50b..031cf41f510b 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 bdaebc3f7ad5..7222d080de7f 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 000000000000..79c00619ba7e --- /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 93f8c659af1e..b14bf4b4a229 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 000000000000..faf48e95c437 --- /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 + +class DungeonHideItems { + + private val hideParticles = mutableMapOf() + private val movingSkeletonSkulls = mutableMapOf() + + private val blessingTexture = + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZT" + + "kzZTIwNjg2MTc4NzJjNTQyZWNkYTFkMjdkZjRlY2U5MWM2OTk5MDdiZjMyN2M0ZGRiODUzMDk0MTJkMzkzOSJ9fX0=" + + private val reviveStoneTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJ" + + "lcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjZhNzZjYzIyZTdjMmFiOWM1NDBkMTI0NGVhZGJhNTgxZ" + + "jVkZDllMThmOWFkYWNmMDUyODBhNWI0OGI4ZjYxOCJ9fX0K" + + private val premiumFleshTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0" + + "L3RleHR1cmUvMWE3NWU4YjA0NGM3MjAxYTRiMmU4NTZiZTRmYzMxNmE1YWFlYzY2NTc2MTY5YmFiNTg3MmE4ODUzNGI4MDI1NiJ9fX0K" + + private fun isSkeletonSkull(entity: EntityArmorStand): Boolean { + val itemStack = entity.inventory[4] + if (itemStack != null) { + if (itemStack.cleanName() == "Skeleton Skull") { + return true + } + } + + return false + } + + @SubscribeEvent + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (!LorenzUtils.inDungeons) return + + val entity = event.entity + + if (entity is EntityItem) { + val stack = entity.entityItem + if (SkyHanniMod.feature.dungeon.hideReviveStone) { + if (stack.cleanName() == "Revive Stone") { + event.isCanceled = true + } + } + + if (SkyHanniMod.feature.dungeon.hideJournalEntry) { + if (stack.cleanName() == "Journal Entry") { + event.isCanceled = true + } + } + } + + if (entity !is EntityArmorStand) return + + if (SkyHanniMod.feature.dungeon.hideSuperboomTNT) { + if (entity.name.startsWith("§9Superboom TNT")) { + event.isCanceled = true + } + + val itemStack = entity.inventory[4] + if (itemStack != null) { + if (itemStack.cleanName() == "Superboom TNT") { + event.isCanceled = true + hideParticles[entity] = System.currentTimeMillis() + } + } + } + + if (SkyHanniMod.feature.dungeon.hideBlessing) { + if (entity.name.startsWith("§dBlessing of ")) { + event.isCanceled = true + } + + val itemStack = entity.inventory[4] + if (itemStack != null) { + if (itemStack.getSkullTexture() == blessingTexture) { + event.isCanceled = true + } + } + } + + if (SkyHanniMod.feature.dungeon.hideReviveStone) { + if (entity.name == "§6Revive Stone") { + event.isCanceled = true + } + + val itemStack = entity.inventory[4] + if (itemStack != null) { + if (itemStack.getSkullTexture() == reviveStoneTexture) { + event.isCanceled = true + hideParticles[entity] = System.currentTimeMillis() + } + } + } + + if (SkyHanniMod.feature.dungeon.hidePremiumFlesh) { + if (entity.name == "§9Premium Flesh") { + event.isCanceled = true + hideParticles[entity] = System.currentTimeMillis() + } + + val itemStack = entity.inventory[4] + if (itemStack != null) { + if (itemStack.getSkullTexture() == premiumFleshTexture) { + event.isCanceled = true + } + } + } + + if (isSkeletonSkull(entity)) { + EntityMovementHelper.addToTrack(entity) + if (SkyHanniMod.feature.dungeon.hideSkeletonSkull) { + val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) + if (lastMove + 100 > System.currentTimeMillis()) { + return + } + event.isCanceled = true + } + } + } + + @SubscribeEvent + fun onReceivePacket(event: PacketEvent.ReceiveEvent) { + if (!LorenzUtils.inDungeons) return + if (!SkyHanniMod.feature.dungeon.hideSuperboomTNT && !SkyHanniMod.feature.dungeon.hideReviveStone) return + + val packet = event.packet + if (packet is S2APacketParticles) { + val packetLocation = LorenzVec(packet.xCoordinate, packet.yCoordinate, packet.zCoordinate) + for (armorStand in hideParticles.filter { it.value + 100 > System.currentTimeMillis() }.map { it.key }) { + val distance = packetLocation.distance(armorStand.getLorenzVec()) + if (distance < 2) { + //only hiding white "sparkling" particles + if (packet.particleType.particleID == 3) { + event.isCanceled = true + } + } + } + } + } + + @SubscribeEvent + fun onEntityMove(event: EntityMoveEvent) { + if (!LorenzUtils.inDungeons) return + + val entity = event.entity + if (entity !is EntityArmorStand) return + + if (isSkeletonSkull(entity)) { + movingSkeletonSkulls[entity] = System.currentTimeMillis() + } + } + + @SubscribeEvent + fun onRenderMobColored(event: RenderMobColoredEvent) { + if (!LorenzUtils.inDungeons) return + if (!SkyHanniMod.feature.dungeon.highlightSkeletonSkull) return + val entity = event.entity + if (entity is EntityArmorStand) { + if (isSkeletonSkull(entity)) { + val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) + if (lastMove + 100 > System.currentTimeMillis()) { + event.color = LorenzColor.GOLD.toColor().withAlpha(60) + } + } + } + } + + @SubscribeEvent + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { + if (!LorenzUtils.inDungeons) return + if (!SkyHanniMod.feature.dungeon.highlightSkeletonSkull) return + val entity = event.entity + if (entity is EntityArmorStand) { + if (isSkeletonSkull(entity)) { + val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) + if (lastMove + 100 > System.currentTimeMillis()) { + event.shouldReset = true + } + } + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + hideParticles.clear() + movingSkeletonSkulls.clear() + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt new file mode 100644 index 000000000000..1ce2e315b425 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt @@ -0,0 +1,65 @@ +package at.hannibal2.skyhanni.features.dungeon + +import at.hannibal2.skyhanni.SkyHanniMod +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.client.Minecraft +import net.minecraft.entity.monster.EntitySilverfish +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class HighlightDungeonDeathmite { + + private var tick = 0 + private val deathmites = mutableListOf() + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + + if (tick++ % 20 == 0) { + find() + } + } + + @SubscribeEvent + fun onRenderMobColored(event: RenderMobColoredEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in deathmites) { + event.color = LorenzColor.DARK_RED.toColor().withAlpha(20) + } + } + + @SubscribeEvent + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in deathmites) { + event.shouldReset = true + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + deathmites.clear() + } + + private fun find() { + Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance() + .filter { it !in deathmites && it.baseMaxHealth >= 1_000_000_000 } + .forEach(deathmites::add) + } + + private fun isEnabled(): Boolean { + + return LorenzUtils.inDungeons && SkyHanniMod.feature.dungeon.highlightDeathmites + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt new file mode 100644 index 000000000000..f2dcaed8971a --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt @@ -0,0 +1,65 @@ +package at.hannibal2.skyhanni.features.end + +import at.hannibal2.skyhanni.SkyHanniMod +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.client.Minecraft +import net.minecraft.entity.monster.EntityEnderman +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class VoidlingExtremistColor { + + private var tick = 0 + private val extremists = mutableListOf() + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + + if (tick++ % 20 == 0) { + find() + } + } + + @SubscribeEvent + fun onRenderMobColored(event: RenderMobColoredEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in extremists) { + event.color = LorenzColor.LIGHT_PURPLE.toColor().withAlpha(127) + } + } + + @SubscribeEvent + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in extremists) { + event.shouldReset = true + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + extremists.clear() + } + + private fun find() { + Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance() + .filter { it !in extremists && it.baseMaxHealth % 8_000_000 == 0.0 }.forEach { extremists.add(it) } + } + + private fun isEnabled(): Boolean { + + return LorenzUtils.inSkyblock && LorenzUtils.skyBlockIsland == "The End" && + SkyHanniMod.feature.misc.voidlingExtremistColor + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/items/ItemStars.kt index 5d45e39088d6..0301ddb53345 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/items/ItemStars.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/items/ItemStars.kt @@ -77,7 +77,7 @@ class ItemStars { GlStateManager.disableBlend() event.fontRenderer.drawStringWithShadow( stackTip, - (event.x + 17 - event.fontRenderer.getStringWidth(stackTip)).toFloat(), + (event.x + 17 - event.fontRenderer.getStringWidth(stackTip)).toFloat(),//TODO search for this line and replace all other methods into an api (event.y + 9).toFloat(), 16777215 ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt index 13ba0a34f2a0..19c4ea2499e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/items/RngMeterInventory.kt @@ -72,9 +72,6 @@ class RngMeterInventory { val stack = slot.stack if (stack.getLore().any { it.contains("You don't have an RNG drop") }) { slot highlight LorenzColor.RED -// val color = LorenzColor.RED.addOpacity(160) -// slot.stack.background = color.rgb - //TODO use other coloring logic } } } @@ -86,8 +83,6 @@ class RngMeterInventory { val stack = slot.stack if (stack.getLore().any { it.contains("§aSELECTED") }) { slot highlight LorenzColor.YELLOW -// val color = LorenzColor.YELLOW.addOpacity(160) -// slot.stack.background = color.rgb } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/ItemAbilityCooldown.kt index 0d094c4b46a4..b2974837b144 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/items/abilitycooldown/ItemAbilityCooldown.kt @@ -123,7 +123,6 @@ class ItemAbilityCooldown { GlStateManager.disableLighting() GlStateManager.disableDepth() GlStateManager.disableBlend() - //TODO add option to change the size event.fontRenderer.drawStringWithShadow( stackTip, (event.x + 17 - event.fontRenderer.getStringWidth(stackTip)).toFloat(), 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 87fc2eb49fd0..756b2b2851e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -147,12 +147,7 @@ class MinionFeatures { //§7Held Coins: §b151,389 val coins = line.split(": §b")[1].replace(",", "").toDouble() - println(" ") - println("coins: $coins") - println("duration: $duration") - val coinsPerDay = (coins / (duration.toDouble())) * 1000 * 60 * 60 * 24 - println("coinsPerDay: $coinsPerDay") val format = formatInteger(coinsPerDay.toInt()) val hopperName = stack.name @@ -186,7 +181,6 @@ class MinionFeatures { lastCoinsRecived = System.currentTimeMillis() } if (event.message.startsWith("§aYou picked up a minion!")) { - println("pick up minion message") lastMinionPickedUp = System.currentTimeMillis() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt index bd0a72e7e4d9..b628593a2ab5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent 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.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager @@ -14,7 +14,6 @@ import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityBlaze -import net.minecraft.network.play.server.S1CPacketEntityMetadata import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.EventPriority @@ -59,20 +58,14 @@ class AshfangBlazes { } @SubscribeEvent - fun onHealthUpdatePacket(event: PacketEvent.ReceiveEvent) { + fun onHealthUpdateEvent(event: EntityHealthUpdateEvent) { if (!isEnabled()) return - val packet = event.packet - if (packet !is S1CPacketEntityMetadata) return - if (packet.entityId !in blazeArmorStand.keys.map { it.entityId }) return + val entityId = event.entity.entityId + if (entityId !in blazeArmorStand.keys.map { it.entityId }) return - for (watchableObject in packet.func_149376_c()) { - if (watchableObject.dataValueId == 6) { - val health = watchableObject.`object` as Float - if (health % 10_000_000 != 0F) { - blazeArmorStand.keys.removeIf { it.entityId == packet.entityId } - } - } + if (event.health % 10_000_000 != 0F) { + blazeArmorStand.keys.removeIf { it.entityId == entityId } } } @@ -90,14 +83,13 @@ class AshfangBlazes { } @SubscribeEvent - fun onResetEntityHurtTime(event: ResetEntityHurtTimeEvent) { + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { if (!isEnabled()) return if (!SkyHanniMod.feature.ashfang.highlightBlazes) return val entity = event.entity if (entity in blazeColor) { event.shouldReset = true } - } @SubscribeEvent(priority = EventPriority.HIGH) diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt new file mode 100644 index 000000000000..f2cf90190f70 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt @@ -0,0 +1,134 @@ +package at.hannibal2.skyhanni.features.slayer + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.CheckRenderEntityEvent +import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.RenderMobColoredEvent +import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.features.damageindicator.BossType +import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.test.LorenzTest +import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.RenderUtils.drawColor +import at.hannibal2.skyhanni.utils.RenderUtils.drawString +import net.minecraft.entity.Entity +import net.minecraft.entity.item.EntityArmorStand +import net.minecraft.entity.monster.EntityEnderman +import net.minecraft.init.Blocks +import net.minecraft.network.play.server.S23PacketBlockChange +import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class EndermanSlayerBeacon { + + private val endermans = mutableListOf() + private val armorStands = mutableListOf() + private val blocks = mutableListOf() + + @SubscribeEvent + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (isEnabled()) { + findEntities(event.entity) + } + } + + private fun hasBeaconInHand(entity: EntityEnderman): Boolean { + val heldBlockState = entity.heldBlockState + if (heldBlockState != null) { + val block = heldBlockState.block + if (block != null) { + if (block == Blocks.beacon) { + return true + } + } + } + + return false + } + + private fun findEntities(entity: Entity) { + if (entity in endermans) return + if (entity in armorStands) return + + if (entity is EntityEnderman) { + if (hasBeaconInHand(entity)) { + if (LocationUtils.canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) { + endermans.add(entity) + } + } + } + + if (entity is EntityArmorStand) { + val stack = entity.inventory[4] ?: return + if (stack.name == "Beacon") { + if (LocationUtils.canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) { + armorStands.add(entity) + } + } + } + } + + @SubscribeEvent + fun onRenderMobColored(event: RenderMobColoredEvent) { + if (!isEnabled()) return + + if (event.entity in armorStands) { + event.color = LorenzColor.DARK_RED.toColor().withAlpha(LorenzTest.a.toInt()) + } + } + + @SubscribeEvent + fun onWorldRender(event: RenderWorldLastEvent) { + if (!isEnabled()) return + + endermans.removeIf { it.isDead || !hasBeaconInHand(it) } + + for (enderman in endermans) { + val location = enderman.getLorenzVec().add(-0.5, 0.2, -0.5) + event.drawColor(location, LorenzColor.DARK_RED, alpha = 1f) + } + + for (location in blocks) { + event.drawColor(location, LorenzColor.DARK_RED, alpha = 1f) + event.drawString(location.add(0.5, -0.5, 0.5), "Beacon", true) + } + } + + @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) + fun onChatPacket(event: PacketEvent.ReceiveEvent) { + if (!isEnabled()) return + + val packet = event.packet + if (packet is S23PacketBlockChange) { + val vec = packet.blockPosition.toLorenzVec() + val block = packet.blockState.block + if (block == Blocks.beacon) { + if (armorStands.any { vec.distance(it.getLorenzVec()) < 3 }) { + blocks.add(vec) + } + } else { + if (vec in blocks) { + blocks.remove(vec) + } + } + } + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.slayerEndermanBeacon && + LorenzUtils.skyBlockIsland == "The End" && + (DamageIndicatorManager.isBossSpawned(BossType.SLAYER_ENDERMAN_2) || + DamageIndicatorManager.isBossSpawned(BossType.SLAYER_ENDERMAN_3) || + DamageIndicatorManager.isBossSpawned(BossType.SLAYER_ENDERMAN_4)) + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + endermans.clear() + armorStands.clear() + blocks.clear() + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt new file mode 100644 index 000000000000..e2fb2719aedb --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HighlightSlayerMiniboss.kt @@ -0,0 +1,92 @@ +package at.hannibal2.skyhanni.features.slayer + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RenderMobColoredEvent +import at.hannibal2.skyhanni.events.ResetEntityHurtEvent +import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth +import net.minecraft.client.Minecraft +import net.minecraft.entity.Entity +import net.minecraft.entity.EntityLivingBase +import net.minecraft.entity.monster.EntityBlaze +import net.minecraft.entity.monster.EntityEnderman +import net.minecraft.entity.monster.EntitySpider +import net.minecraft.entity.monster.EntityZombie +import net.minecraft.entity.passive.EntityWolf +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class HighlightSlayerMiniboss { + + private var tick = 0 + private val miniBosses = mutableListOf() + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + + if (tick++ % 20 == 0) { + find() + } + } + + private fun find() { + val entityList = Minecraft.getMinecraft().theWorld.loadedEntityList + val list = mutableListOf() + + list.addAll(entityList.filterIsInstance().filter { + it.baseMaxHealth % 24_000 == 0.0 || it.baseMaxHealth % 90_000 == 0.0 || it.baseMaxHealth % 360_000 == 0.0 || it.baseMaxHealth % 600_000 == 0.0 || it.baseMaxHealth % 2_400_000 == 0.0 + }) + + list.addAll(entityList.filterIsInstance().filter { + it.baseMaxHealth % 54_000 == 0.0 || it.baseMaxHealth % 144_000 == 0.0 || it.baseMaxHealth % 576_000 == 0.0 + }) + + list.addAll(entityList.filterIsInstance().filter { + it.baseMaxHealth % 45_000 == 0.0 || it.baseMaxHealth % 120_000 == 0.0 || it.baseMaxHealth % 450_000 == 0.0 + }) + + list.addAll(entityList.filterIsInstance().filter { + it.baseMaxHealth % 12_000_000 == 0.0 || it.baseMaxHealth % 25_000_000 == 0.0 + }) + + list.addAll(entityList.filterIsInstance().filter { + it.baseMaxHealth % 12_000_000 == 0.0 || it.baseMaxHealth % 25_000_000 == 0.0 + }) + + list.filter { it !in miniBosses && !DamageIndicatorManager.isBoss(it) }.forEach(miniBosses::add) + } + + @SubscribeEvent + fun onRenderMobColored(event: RenderMobColoredEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in miniBosses) { + event.color = LorenzColor.AQUA.toColor().withAlpha(127) + } + } + + @SubscribeEvent + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in miniBosses) { + event.shouldReset = true + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + miniBosses.clear() + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.slayerMinibossHighlight && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java index 98eb386fa9c7..657636e87132 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.mixins.transformers.renderer; import at.hannibal2.skyhanni.events.RenderMobColoredEvent; -import at.hannibal2.skyhanni.events.ResetEntityHurtTimeEvent; +import at.hannibal2.skyhanni.events.ResetEntityHurtEvent; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RendererLivingEntity; @@ -28,7 +28,7 @@ private void setColorMultiplier(T entity, float lightBrightness, float partialTi @Redirect(method = "setBrightness", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/EntityLivingBase;hurtTime:I", opcode = Opcodes.GETFIELD)) private int changeHurtTime(EntityLivingBase entity) { - ResetEntityHurtTimeEvent event = new ResetEntityHurtTimeEvent(entity, false); + ResetEntityHurtEvent event = new ResetEntityHurtEvent(entity, false); event.postAndCatch(); return event.getShouldReset() ? 0 : entity.hurtTime; } diff --git a/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java b/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java index 431cfbe6f6bd..688923f65299 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java +++ b/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java @@ -15,10 +15,11 @@ import java.awt.*; import java.text.DecimalFormat; -import java.util.*; import java.util.List; +import java.util.*; import java.util.function.Function; +//TODO delte this class after next diana mayor public class GriffinJavaUtils { public static void permute(ArrayList> result, T[] a, int k) { if (k == a.length) { diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index 851a8c207176..416034a97592 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -7,8 +7,6 @@ import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.nbt.NBTTagCompound import net.minecraft.network.play.server.S0EPacketSpawnObject -import net.minecraft.network.play.server.S0FPacketSpawnMob -import net.minecraft.network.play.server.S1CPacketEntityMetadata import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -18,10 +16,14 @@ class LorenzTest { var packetLog = LorenzLogger("debug/packets") companion object { - var enabled = false - var togglePacketLog = false + private var shouldLogPackets = false var text = "" + // var a = 127.0 + var a = 2.0 + var b = 0.0 + var c = 0.0 + val debugLogger = LorenzLogger("debug/test") fun runn(compound: NBTTagCompound, text: String) { @@ -37,6 +39,11 @@ class LorenzTest { } fun testCommand(args: Array) { + + a = args[0].toDouble() + b = args[1].toDouble() + c = args[2].toDouble() + // togglePacketLog = !togglePacketLog // for (line in (Minecraft.getMinecraft().ingameGUI.tabList as AccessorGuiPlayerTabOverlay).footer.unformattedText @@ -49,51 +56,72 @@ class LorenzTest { // println("tablist: '$line'") // } } + + fun togglePacketLog() { + shouldLogPackets = !shouldLogPackets + } } @SubscribeEvent fun renderOverlay(event: RenderGameOverlayEvent.Post) { if (!SkyHanniMod.feature.debug.enabled) return - if (enabled) { - SkyHanniMod.feature.debug.testPos.renderString(text) - } + SkyHanniMod.feature.debug.testPos.renderString(text) } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) fun onChatPacket(event: PacketEvent.ReceiveEvent) { val packet = event.packet val name = packet.javaClass.simpleName - if (!togglePacketLog) return + if (!shouldLogPackets) return packetLog.log(name) - if (packet is S0FPacketSpawnMob) { - packetLog.log("") - packetLog.log("Spawn Mob!") - for (watchableObject in packet.func_149027_c()) { - val any = watchableObject.`object` - val simpleName = any.javaClass.simpleName +// if (packet is S18PacketEntityTeleport) { +// val entityId = packet.entityId +// packetLog.log("entityId: $entityId") +// val entity = Minecraft.getMinecraft().theWorld.loadedEntityList.find { it.entityId == entityId } +// val className = entity?.javaClass?.name ?: "null" +// packetLog.log("className: $className") +// +// if (Minecraft.getMinecraft().thePlayer.isSneaking) { +// if (entity is EntityArmorStand) { +// event.isCanceled = true +// } +// } +// } + + +// if (packet is S0FPacketSpawnMob) { +// packetLog.log("") +// packetLog.log("Spawn Mob!") +// for (watchableObject in packet.func_149027_c()) { +// val any = watchableObject.`object` +// val simpleName = any.javaClass.simpleName +// +// packetLog.log("javaClass: $simpleName") +// packetLog.log("object: $any") +// packetLog.log(" ") +// } +// packetLog.log(" ") +// } + + +// if (packet is S1CPacketEntityMetadata) { +// packetLog.log("") +// packetLog.log("Entity Metadata") +// for (watchableObject in packet.func_149376_c()) { +// val any = watchableObject.`object` +// val simpleName = any.javaClass.simpleName +// +// packetLog.log("javaClass: $simpleName") +// packetLog.log("object: $any") +// packetLog.log(" ") +// } +// packetLog.log(" ") +// } + - packetLog.log("javaClass: $simpleName") - packetLog.log("object: $any") - packetLog.log(" ") - } - packetLog.log(" ") - } - if (packet is S1CPacketEntityMetadata) { - packetLog.log("") - packetLog.log("Entity Metadata") - for (watchableObject in packet.func_149376_c()) { - val any = watchableObject.`object` - val simpleName = any.javaClass.simpleName - - packetLog.log("javaClass: $simpleName") - packetLog.log("object: $any") - packetLog.log(" ") - } - packetLog.log(" ") - } // if (packet is S20PacketEntityProperties) { // packetLog.log("") // packetLog.log("Entity Properties") diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt index 291000c77db0..1467f2b85f79 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth @@ -10,8 +11,10 @@ import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand +import net.minecraft.entity.item.EntityItem import net.minecraft.entity.monster.EntityEnderman import net.minecraft.entity.monster.EntityMagmaCube +import net.minecraft.item.ItemStack object CopyNearbyEntitiesCommand { @@ -33,18 +36,19 @@ object CopyNearbyEntitiesCommand { val vec = position.toLorenzVec() val distance = start.distance(vec) if (distance < searchRadius) { - resultList.add("found entity: '" + entity.name + "'") + val simpleName = entity.javaClass.simpleName + resultList.add("entity: $simpleName") val displayName = entity.displayName + resultList.add("name: '" + entity.name + "'") resultList.add("displayName: '${displayName.formattedText}'") - val simpleName = entity.javaClass.simpleName - resultList.add("simpleName: $simpleName") - resultList.add("vec: $vec") - resultList.add("distance: $distance") + resultList.add("location data:") + resultList.add("- vec: $vec") + resultList.add("- distance: $distance") val rotationYaw = entity.rotationYaw val rotationPitch = entity.rotationPitch - resultList.add("rotationYaw: $rotationYaw") - resultList.add("rotationPitch: $rotationPitch") + resultList.add("- rotationYaw: $rotationYaw") + resultList.add("- rotationPitch: $rotationPitch") val riddenByEntity = entity.riddenByEntity resultList.add("riddenByEntity: $riddenByEntity") @@ -52,46 +56,66 @@ object CopyNearbyEntitiesCommand { resultList.add("ridingEntity: $ridingEntity") - if (entity is EntityArmorStand) { - resultList.add("armor stand data:") - val headRotation = entity.headRotation.toLorenzVec() - val bodyRotation = entity.bodyRotation.toLorenzVec() - resultList.add("headRotation: $headRotation") - resultList.add("bodyRotation: $bodyRotation") - - for ((id, stack) in entity.inventory.withIndex()) { - resultList.add("id $id = $stack") - if (stack != null) { - val skullTexture = stack.getSkullTexture() - if (skullTexture != null) { - resultList.add("skullTexture: $skullTexture") - } - val cleanName = stack.cleanName() - val type = stack.javaClass.name - resultList.add("cleanName: $cleanName") - resultList.add("type: $type") + when (entity) { + is EntityArmorStand -> { + resultList.add("EntityArmorStand:") + val headRotation = entity.headRotation.toLorenzVec() + val bodyRotation = entity.bodyRotation.toLorenzVec() + resultList.add("- headRotation: $headRotation") + resultList.add("- bodyRotation: $bodyRotation") + resultList.add("- inventory:") + for ((id, stack) in entity.inventory.withIndex()) { + resultList.add("- id $id ($stack)") + printItemStackData(stack, resultList) } } - } else if (entity is EntityEnderman) { - val enderman = entity as EntityEnderman - val heldItem = enderman.heldItem - resultList.add("enderman heldItem: $heldItem") - } else { - if (entity is EntityLivingBase) { - val baseMaxHealth = entity.baseMaxHealth - val health = entity.health.toInt() - resultList.add("baseMaxHealth: $baseMaxHealth") - resultList.add("health: $health") + + is EntityEnderman -> { + resultList.add("EntityEnderman:") + val heldBlockState = entity.heldBlockState + resultList.add("- heldBlockState: $heldBlockState") + if (heldBlockState != null) { + val block = heldBlockState.block + resultList.add("- block: $block") + } } - if (entity is EntityMagmaCube) { + + is EntityMagmaCube -> { + resultList.add("EntityMagmaCube:") val squishFactor = entity.squishFactor val slimeSize = entity.slimeSize - resultList.add("factor: $squishFactor") - resultList.add("slimeSize: $slimeSize") + resultList.add("- factor: $squishFactor") + resultList.add("- slimeSize: $slimeSize") + } + + is EntityItem -> { + resultList.add("EntityItem:") + val stack = entity.entityItem + val stackName = stack.name + val stackDisplayName = stack.displayName + val cleanName = stack.cleanName() + val itemEnchanted = stack.isItemEnchanted + val itemDamage = stack.itemDamage + val stackSize = stack.stackSize + val maxStackSize = stack.maxStackSize + resultList.add("- name: '$stackName'") + resultList.add("- stackDisplayName: '$stackDisplayName'") + resultList.add("- cleanName: '$cleanName'") + resultList.add("- itemEnchanted: '$itemEnchanted'") + resultList.add("- itemDamage: '$itemDamage'") + resultList.add("- stackSize: '$stackSize'") + resultList.add("- maxStackSize: '$maxStackSize'") } } + if (entity is EntityLivingBase) { + resultList.add("EntityLivingBase:") + val baseMaxHealth = entity.baseMaxHealth.toInt() + val health = entity.health.toInt() + resultList.add("- baseMaxHealth: $baseMaxHealth") + resultList.add("- health: $health") + } resultList.add("") resultList.add("") counter++ @@ -106,4 +130,20 @@ object CopyNearbyEntitiesCommand { LorenzUtils.chat("§e[SkyHanni] No entities found in a search radius of $searchRadius!") } } + + private fun printItemStackData(stack: ItemStack?, resultList: MutableList) { + if (stack != null) { + val skullTexture = stack.getSkullTexture() + if (skullTexture != null) { + resultList.add("- skullTexture:") + resultList.add("- $skullTexture") + } + val cleanName = stack.cleanName() + val stackName = stack.name + val type = stack.javaClass.name + resultList.add("- name: '$stackName'") + resultList.add("- cleanName: '$cleanName'") + resultList.add("- type: $type") + } + } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index b1d3ef7a7394..3b38bd84a2bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -15,7 +15,7 @@ object ItemUtils { fun ItemStack.cleanName() = this.displayName.removeColor() - fun isSack(name: String): Boolean = name.endsWith(" Sack")//TODO change + fun isSack(name: String): Boolean = name.endsWith(" Sack")//TODO use item id or api or something? or dont, its working fine now fun ItemStack.getLore(): List { val tagCompound = this.tagCompound ?: return emptyList() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 322fc2b44407..602dbad19b36 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -24,6 +24,9 @@ object LorenzUtils { val skyBlockIsland: String get() = HypixelData.mode + val inKuudraFight: Boolean + get() = skyBlockIsland == "Instanced" + const val DEBUG_PREFIX = "[Debug] §7" private val log = LorenzLogger("chat/mod_sent") diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 39c7217f626a..5ce94c031462 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -47,18 +47,23 @@ object RenderUtils { if (lightingState) GlStateManager.enableLighting() } - fun RenderWorldLastEvent.drawColor(location: LorenzVec, color: LorenzColor, beacon: Boolean = false) { + fun RenderWorldLastEvent.drawColor(location: LorenzVec, color: LorenzColor, beacon: Boolean = false, alpha: Float = -1f) { val (viewerX, viewerY, viewerZ) = getViewerPos(partialTicks) val x = location.x - viewerX val y = location.y - viewerY val z = location.z - viewerZ val distSq = x * x + y * y + z * z + val realAlpha = if (alpha == -1f) { + (0.1f + 0.005f * distSq.toFloat()).coerceAtLeast(0.2f) + } else { + alpha + } GlStateManager.disableDepth() GlStateManager.disableCull() drawFilledBoundingBox( AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1).expandBlock(), color.toColor(), - (0.1f + 0.005f * distSq.toFloat()).coerceAtLeast(0.2f) + realAlpha ) GlStateManager.disableTexture2D() if (distSq > 5 * 5 && beacon) renderBeaconBeam(x, y + 1, z, color.toColor().rgb, 1.0f, partialTicks)