From 2d1f231fec0e5be2b3e5f009893b3021cf28e5b0 Mon Sep 17 00:00:00 2001 From: Cal Date: Fri, 18 Oct 2024 09:49:23 +1100 Subject: [PATCH 1/7] Backend: Migrate some events to be GenericSkyHanniEvent --- .../skyhanni/events/CheckRenderEntityEvent.kt | 5 ++--- .../skyhanni/features/dungeon/DungeonCleanEnd.kt | 7 +++++-- .../skyhanni/features/dungeon/DungeonCopilot.kt | 8 +++----- .../skyhanni/features/dungeon/DungeonHideItems.kt | 10 +++++----- .../skyhanni/features/dungeon/DungeonLividFinder.kt | 10 ++++++---- .../skyhanni/features/fishing/ChumBucketHider.kt | 7 +++---- .../skyhanni/features/fishing/FishingHookDisplay.kt | 4 ++-- .../features/garden/visitor/VisitorListener.kt | 7 +++---- .../skyhanni/features/misc/ExpOrbsOnGroundHider.kt | 13 ++++--------- .../skyhanni/features/misc/FixGhostEntities.kt | 8 +++----- .../skyhanni/features/misc/HideFarEntities.kt | 9 ++++++--- .../skyhanni/features/misc/LesserOrbHider.kt | 5 +++-- .../skyhanni/features/misc/trevor/TrevorFeatures.kt | 7 ++++--- .../features/nether/ashfang/AshfangHider.kt | 9 +++++---- .../area/mirrorverse/CraftRoomHolographicMob.kt | 10 ++++++---- .../rift/area/mirrorverse/DanceRoomHelper.kt | 13 ++++++------- .../rift/area/mirrorverse/RiftLavaMazeParkour.kt | 6 ++++-- .../rift/area/mirrorverse/RiftUpsideDownParkour.kt | 6 ++++-- .../rift/area/mirrorverse/TubulatorParkour.kt | 6 ++++-- .../rift/area/westvillage/RiftGunthersRace.kt | 6 ++++-- .../features/rift/everywhere/RiftHorsezookaHider.kt | 11 +++++------ .../features/slayer/blaze/BlazeSlayerClearView.kt | 10 ++++------ .../slayer/enderman/EndermanSlayerFeatures.kt | 7 ++++--- .../mixins/transformers/MixinRenderManager.java | 2 +- 24 files changed, 96 insertions(+), 90 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt index 13da59c430d9..b8f0e16c9b36 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/CheckRenderEntityEvent.kt @@ -1,14 +1,13 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.GenericSkyHanniEvent import net.minecraft.client.renderer.culling.ICamera import net.minecraft.entity.Entity -import net.minecraftforge.fml.common.eventhandler.Cancelable -@Cancelable data class CheckRenderEntityEvent( val entity: T, val camera: ICamera, val camX: Double, val camY: Double, val camZ: Double, -) : LorenzEvent() +) : GenericSkyHanniEvent(entity.javaClass) 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 308a5b14438f..cde1c93b9f4b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -1,7 +1,9 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.DamageIndicatorFinalBossEvent import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent @@ -15,6 +17,7 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP +import net.minecraft.entity.Entity import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityGuardian import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -91,8 +94,8 @@ object DungeonCleanEnd { } } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent(onlyOnIsland = IslandType.CATACOMBS) + fun onCheckRender(event: CheckRenderEntityEvent) { if (!shouldBlock()) return val entity = event.entity diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt index e4bc9b0fc838..9cee203850ef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.DungeonBossRoomEnterEvent import at.hannibal2.skyhanni.events.DungeonEnterEvent @@ -103,12 +104,9 @@ object DungeonCopilot { nextStep = step } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!DungeonAPI.inDungeon()) return - + @HandleEvent(onlyOnIsland = IslandType.CATACOMBS) + fun onCheckRender(event: CheckRenderEntityEvent) { val entity = event.entity - if (entity !is EntityArmorStand) return if (!searchForKey) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt index 967af0dd3d4b..32ab949ed718 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -1,8 +1,10 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.EntityMovementData +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.EntityMoveEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -63,10 +65,8 @@ object DungeonHideItems { return itemStack != null && itemStack.cleanName() == "Skeleton Skull" } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!DungeonAPI.inDungeon()) return - + @HandleEvent(onlyOnIsland = IslandType.CATACOMBS) + fun onCheckRender(event: CheckRenderEntityEvent) { val entity = event.entity if (entity is EntityItem) { @@ -158,7 +158,7 @@ object DungeonHideItems { } if (config.hideHealerFairy) { - // Healer Fairy texture is stored in id 0, not id 4 for some reasons. + // Healer Fairy texture is stored in id 0, not id 4 for some reason. if (entity.inventory[0]?.getSkullTexture() == HEALER_FAIRY_TEXTURE) { event.cancel() return diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt index 2a8595af9e8e..03b0a1ded283 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -16,13 +18,14 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzColor.Companion.toLorenzColor import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText -import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye +import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import net.minecraft.block.BlockStainedGlass import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.client.entity.EntityPlayerSP +import net.minecraft.entity.Entity import net.minecraft.entity.item.EntityArmorStand import net.minecraft.potion.Potion import net.minecraft.util.AxisAlignedBB @@ -106,9 +109,8 @@ object DungeonLividFinder { if (!it.isDead && it.health > 0.5) it else null } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!inDungeon()) return + @HandleEvent(onlyOnIsland = IslandType.CATACOMBS) + fun onCheckRender(event: CheckRenderEntityEvent) { if (!config.hideWrong) return if (!config.enabled) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt index 3eac15fc675f..443f12824b62 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.fishing import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -27,13 +28,11 @@ object ChumBucketHider { reset() } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!LorenzUtils.inSkyBlock) return + @HandleEvent(onlyOnSkyblock = true) + fun onCheckRender(event: CheckRenderEntityEvent) { if (!config.enabled.get()) return val entity = event.entity - if (entity !is EntityArmorStand) return if (entity in hiddenEntities) { event.cancel() diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt index b4a7e5804b4b..d1f005ae490c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt @@ -55,8 +55,8 @@ object FishingHookDisplay { potentialArmorStands.add(event.entity) } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent + fun onCheckRender(event: CheckRenderEntityEvent) { if (!isEnabled()) return if (!config.hideArmorStand) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt index 66d03745f372..5e65bc581f73 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt @@ -144,14 +144,13 @@ object VisitorListener { GardenVisitorFeatures.onTooltip(visitor, event.itemStack, event.toolTip) } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!GardenAPI.inGarden()) return + @HandleEvent(onlyOnIsland = IslandType.GARDEN) + fun onCheckRender(event: CheckRenderEntityEvent) { if (!GardenAPI.onBarnPlot) return if (config.highlightStatus != VisitorConfig.HighlightMode.NAME && config.highlightStatus != VisitorConfig.HighlightMode.BOTH) return val entity = event.entity - if (entity is EntityArmorStand && entity.name == "§e§lCLICK") { + if (entity.name == "§e§lCLICK") { event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ExpOrbsOnGroundHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ExpOrbsOnGroundHider.kt index 6fad15f8dff8..2660a6d41d16 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ExpOrbsOnGroundHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ExpOrbsOnGroundHider.kt @@ -1,22 +1,17 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.entity.item.EntityXPOrb -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object ExpOrbsOnGroundHider { - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!LorenzUtils.inSkyBlock) return + @HandleEvent(onlyOnSkyblock = true) + fun onCheckRender(event: CheckRenderEntityEvent) { if (!SkyHanniMod.feature.misc.hideExpBottles) return - - if (event.entity is EntityXPOrb) { - event.cancel() - } + event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt index a5b3a97b8b3a..ae0b54c13e88 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FixGhostEntities.kt @@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.minecraft.packet.PacketReceivedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.MobUtils.isDefaultValue import net.minecraft.entity.item.EntityArmorStand import net.minecraft.network.play.server.S0CPacketSpawnPlayer @@ -61,10 +60,9 @@ object FixGhostEntities { } } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!LorenzUtils.inSkyBlock || !config.hideTemporaryArmorstands) return - if (event.entity !is EntityArmorStand) return + @HandleEvent(onlyOnSkyblock = true) + fun onCheckRender(event: CheckRenderEntityEvent) { + if (!config.hideTemporaryArmorstands) return with(event.entity) { if (ticksExisted < 10 && isDefaultValue() && inventory.all { it == null }) event.cancel() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt index 8a47da6f72e5..d135a1f59100 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HideFarEntities.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI @@ -9,6 +10,7 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.entity.Entity import net.minecraft.entity.boss.EntityWither import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -32,11 +34,12 @@ object HideFarEntities { .map { it.first }.toSet() } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent(onlyOnSkyblock = true) + fun onCheckRender(event: CheckRenderEntityEvent) { + if (!isEnabled()) return val entity = event.entity if (entity is EntityWither && entity.entityId < 0) return - if (isEnabled() && entity.entityId in ignored) { + if (entity.entityId in ignored) { event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt index c07ab7de45fc..bb14c5a3e6a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.EntityEquipmentChangeEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent @@ -34,8 +35,8 @@ object LesserOrbHider { } } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent + fun onCheckRender(event: CheckRenderEntityEvent) { if (!isEnabled()) return if (event.entity in hiddenEntities) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 6ca32d610db6..9806c6485754 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.trevor import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry import at.hannibal2.skyhanni.data.IslandType @@ -309,12 +310,12 @@ object TrevorFeatures { } } - @SubscribeEvent(priority = EventPriority.HIGHEST) - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent(priority = HandleEvent.HIGHEST, onlyOnIsland = IslandType.THE_FARMING_ISLANDS) + fun onCheckRender(event: CheckRenderEntityEvent) { if (!inTrapperDen) return if (!config.trapperTalkCooldown) return val entity = event.entity - if (entity is EntityArmorStand && entity.name == "§e§lCLICK") { + if (entity.name == "§e§lCLICK") { event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt index 4e40ed77cc64..bba784dbfcbb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHider.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.nether.ashfang +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent @@ -31,11 +33,10 @@ object AshfangHider { event.cancel() } - @SubscribeEvent(priority = EventPriority.HIGH) - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent(priority = HandleEvent.HIGH, onlyOnIsland = IslandType.CRIMSON_ISLE) + fun onCheckRender(event: CheckRenderEntityEvent) { if (!AshfangManager.active || !config.particles) return - val entity = event.entity as? EntityArmorStand ?: return - if (entity.inventory.any { it?.name == "Glowstone" }) event.cancel() + if (event.entity.inventory.any { it?.name == "Glowstone" }) event.cancel() } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/CraftRoomHolographicMob.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/CraftRoomHolographicMob.kt index ab5060be3a2b..d65385b4692b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/CraftRoomHolographicMob.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/CraftRoomHolographicMob.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.rift.area.mirrorverse import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -85,12 +87,12 @@ object CraftRoomHolographicMob { } } - @SubscribeEvent(receiveCanceled = true) - fun onPlayerRender(event: CheckRenderEntityEvent<*>) { - if (!RiftAPI.inRift() || !config.hidePlayers) return + @HandleEvent(receiveCancelled = true, onlyOnIsland = IslandType.THE_RIFT) + fun onPlayerRender(event: CheckRenderEntityEvent) { + if (!config.hidePlayers) return val entity = event.entity - if (entity is EntityOtherPlayerMP && craftRoomArea.isInside(entity.getLorenzVec())) { + if (craftRoomArea.isInside(entity.getLorenzVec())) { event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt index ec382a5d42ac..d884c6e1efc4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt @@ -1,7 +1,9 @@ package at.hannibal2.skyhanni.features.rift.area.mirrorverse import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.jsonobjects.repo.DanceRoomInstructionsJson import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -157,13 +159,10 @@ object DanceRoomHelper { } } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (RiftAPI.inRift() && config.hidePlayers) { - val entity = event.entity - if (entity is EntityOtherPlayerMP && inRoom) { - event.cancel() - } + @HandleEvent(onlyOnIsland = IslandType.THE_RIFT) + fun onCheckRender(event: CheckRenderEntityEvent) { + if (config.enabled && inRoom) { + event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt index d61331c23df1..d6441687616b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftLavaMazeParkour.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.mirrorverse +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -12,6 +13,7 @@ import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.ParkourHelper +import net.minecraft.entity.Entity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule @@ -32,8 +34,8 @@ object RiftLavaMazeParkour { updateConfig() } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent + fun onCheckRender(event: CheckRenderEntityEvent) { if (!isEnabled()) return if (!config.hidePlayers) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt index 2ff0eac9931d..4b58ce9f238f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/RiftUpsideDownParkour.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.mirrorverse +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -12,6 +13,7 @@ import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.ParkourHelper +import net.minecraft.entity.Entity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule @@ -32,8 +34,8 @@ object RiftUpsideDownParkour { updateConfig() } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent + fun onCheckRender(event: CheckRenderEntityEvent) { if (!isEnabled()) return if (!config.hidePlayers) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt index e835e3846cb9..a2ed78328bd3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/TubulatorParkour.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.mirrorverse +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -12,6 +13,7 @@ import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.ParkourHelper +import net.minecraft.entity.Entity import net.minecraft.util.AxisAlignedBB import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -34,8 +36,8 @@ object TubulatorParkour { updateConfig() } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent + fun onCheckRender(event: CheckRenderEntityEvent) { if (!isEnabled()) return if (!config.hidePlayers) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt index 5a3638101a71..1178714cadd4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.westvillage +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -17,6 +18,7 @@ import at.hannibal2.skyhanni.utils.ParkourHelper import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.entity.EntityOtherPlayerMP +import net.minecraft.entity.Entity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule @@ -108,8 +110,8 @@ object RiftGunthersRace { } } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent + fun onCheckRender(event: CheckRenderEntityEvent) { if (!isEnabled()) return if (!config.hidePlayers) return if (!RiftAPI.inRiftRace) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt index d708ca5775c6..3ee8b9fe6c94 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt @@ -1,22 +1,21 @@ package at.hannibal2.skyhanni.features.rift.everywhere import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent -import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.InventoryUtils import net.minecraft.entity.passive.EntityHorse -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object RiftHorsezookaHider { - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!RiftAPI.inRift()) return + @HandleEvent(onlyOnIsland = IslandType.THE_RIFT) + fun onCheckRender(event: CheckRenderEntityEvent) { if (!SkyHanniMod.feature.rift.horsezookaHider) return - if (event.entity is EntityHorse && InventoryUtils.itemInHandId.equals("HORSEZOOKA")) { + if (InventoryUtils.itemInHandId.equals("HORSEZOOKA")) { event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt index b7d97adf4877..065331ec2939 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent @@ -44,13 +45,10 @@ object BlazeSlayerClearView { } } - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { + @HandleEvent(onlyOnSkyblock = true) + fun onCheckRender(event: CheckRenderEntityEvent) { if (isEnabled()) { - val entity = event.entity - if (entity is EntityFireball) { - event.cancel() - } + event.cancel() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt index 9b03ebbeb2f5..9c65173f3ebb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.enderman import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent @@ -32,6 +33,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.entity.Entity import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityEnderman import net.minecraft.init.Blocks @@ -54,9 +56,8 @@ object EndermanSlayerFeatures { private const val NUKEKUBI_SKULL_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0=" - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!IslandType.THE_END.isInIsland()) return + @HandleEvent(onlyOnIsland = IslandType.THE_END) + fun onCheckRender(event: CheckRenderEntityEvent) { val entity = event.entity if (entity in endermenWithBeacons || entity in flyingBeacons) return diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java index d9c530bfb8f6..08638b4d8c78 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderManager.java @@ -14,7 +14,7 @@ public class MixinRenderManager { @Inject(method = "shouldRender", at = @At("HEAD"), cancellable = true) private void shouldRender(Entity entity, ICamera camera, double camX, double camY, double camZ, CallbackInfoReturnable cir) { - if (new CheckRenderEntityEvent<>(entity, camera, camX, camY, camZ).postAndCatch()) { + if (new CheckRenderEntityEvent<>(entity, camera, camX, camY, camZ).post()) { cir.setReturnValue(false); } } From 9d1920207287654018cb6ff538e612e9b2f1d1cc Mon Sep 17 00:00:00 2001 From: Cal Date: Fri, 18 Oct 2024 10:02:44 +1100 Subject: [PATCH 2/7] EntityMoveEvent --- .../hannibal2/skyhanni/data/EntityMovementData.kt | 12 +++++++----- .../java/at/hannibal2/skyhanni/data/IslandGraphs.kt | 7 ++++--- .../at/hannibal2/skyhanni/events/EntityMoveEvent.kt | 10 +++++++--- .../skyhanni/features/dungeon/DungeonHideItems.kt | 7 ++----- .../features/event/diana/GriffinBurrowHelper.kt | 7 ++++--- .../hannibal2/skyhanni/features/misc/IslandAreas.kt | 13 ++++++------- 6 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt index db9044ef2e35..a25dd92f2a67 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -1,11 +1,12 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.EntityMoveEvent import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.SkyHanniWarpEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.SkyHanniWarpEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LorenzUtils @@ -16,6 +17,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.getLorenzVec import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityPlayerSP import net.minecraft.entity.Entity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds @@ -63,9 +65,9 @@ object EntityMovementData { nextTeleport = null } - @SubscribeEvent - fun onPlayerMove(event: EntityMoveEvent) { - if (!LorenzUtils.inSkyBlock || event.entity != Minecraft.getMinecraft().thePlayer) return + @HandleEvent(onlyOnSkyblock = true) + fun onPlayerMove(event: EntityMoveEvent) { + if (!event.isPlayer) return val nextData = nextTeleport ?: return @@ -94,7 +96,7 @@ object EntityMovementData { val distance = newLocation.distance(oldLocation) if (distance > 0.01) { entityLocation[entity] = newLocation - EntityMoveEvent(entity, oldLocation, newLocation, distance).postAndCatch() + EntityMoveEvent(entity, oldLocation, newLocation, distance).post() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt index 386fb8bbf489..44f8eacefb7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt @@ -35,6 +35,7 @@ import at.hannibal2.skyhanni.utils.chat.Text.onClick import at.hannibal2.skyhanni.utils.chat.Text.send import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityPlayerSP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color import java.io.File @@ -327,9 +328,9 @@ object IslandGraphs { } } - @SubscribeEvent - fun onPlayerMove(event: EntityMoveEvent) { - if (LorenzUtils.inSkyBlock && event.entity == Minecraft.getMinecraft().thePlayer) { + @HandleEvent(onlyOnSkyblock = true) + fun onPlayerMove(event: EntityMoveEvent) { + if (event.isPlayer) { hasMoved = true } } diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt index 68c913c1fda1..5d1e43cd2d3a 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt @@ -1,11 +1,15 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.GenericSkyHanniEvent import at.hannibal2.skyhanni.utils.LorenzVec +import net.minecraft.client.Minecraft import net.minecraft.entity.Entity -class EntityMoveEvent( - val entity: Entity, +class EntityMoveEvent( + val entity: T, val oldLocation: LorenzVec, val newLocation: LorenzVec, val distance: Double, -) : LorenzEvent() +) : GenericSkyHanniEvent(entity.javaClass) { + val isPlayer by lazy { entity == Minecraft.getMinecraft().thePlayer } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt index 32ab949ed718..f4fdf020e51a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -192,12 +192,9 @@ object DungeonHideItems { } } - @SubscribeEvent - fun onEntityMove(event: EntityMoveEvent) { - if (!DungeonAPI.inDungeon()) return - + @HandleEvent(onlyOnIsland = IslandType.CATACOMBS) + fun onEntityMove(event: EntityMoveEvent) { val entity = event.entity - if (entity !is EntityArmorStand) return if (isSkeletonSkull(entity)) { movingSkeletonSkulls[entity] = System.currentTimeMillis() diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index 64b33c93418f..2c4db28ff860 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -39,6 +39,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityPlayerSP import net.minecraft.init.Blocks import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard @@ -180,10 +181,10 @@ object GriffinBurrowHelper { update() } - @SubscribeEvent - fun onPlayerMove(event: EntityMoveEvent) { + @HandleEvent + fun onPlayerMove(event: EntityMoveEvent) { if (!isEnabled()) return - if (event.distance > 10 && event.entity == Minecraft.getMinecraft().thePlayer) { + if (event.distance > 10 && event.isPlayer) { update() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt index dfa60478a6c2..20de072367ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.IslandGraphs import at.hannibal2.skyhanni.data.IslandGraphs.pathFind import at.hannibal2.skyhanni.data.model.Graph @@ -30,7 +31,7 @@ import at.hannibal2.skyhanni.utils.renderables.Searchable import at.hannibal2.skyhanni.utils.renderables.buildSearchBox import at.hannibal2.skyhanni.utils.renderables.toSearchable import kotlinx.coroutines.launch -import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityPlayerSP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @@ -93,12 +94,10 @@ object IslandAreas { } } - @SubscribeEvent - fun onPlayerMove(event: EntityMoveEvent) { - if (isEnabled()) { - if (event.entity == Minecraft.getMinecraft().thePlayer) { - hasMoved = true - } + @HandleEvent(onlyOnSkyblock = true) + fun onPlayerMove(event: EntityMoveEvent) { + if (event.isPlayer) { + hasMoved = true } } From 94c574ec6078a07a1f9732d8f9b5a1052a9407bd Mon Sep 17 00:00:00 2001 From: Cal Date: Fri, 18 Oct 2024 10:08:11 +1100 Subject: [PATCH 3/7] wrongly removed --- .../at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt index 03b0a1ded283..828a58071ff3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt @@ -111,6 +111,7 @@ object DungeonLividFinder { @HandleEvent(onlyOnIsland = IslandType.CATACOMBS) fun onCheckRender(event: CheckRenderEntityEvent) { + if (!inDungeon()) return if (!config.hideWrong) return if (!config.enabled) return From 99e7dbe586ff899d8dad77b37a8a8dbb7fea76a3 Mon Sep 17 00:00:00 2001 From: calwolfson Date: Fri, 18 Oct 2024 11:14:15 +1100 Subject: [PATCH 4/7] EntityEquipmentChangeEvent --- .../skyhanni/events/EntityEquipmentChangeEvent.kt | 7 ++++--- .../at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt | 6 +++--- .../features/rift/area/dreadfarm/VoltHighlighter.kt | 8 +++++--- .../mixins/transformers/MixinNetHandlerPlayClient.java | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt index efef208401b4..7ed391d6a3ad 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityEquipmentChangeEvent.kt @@ -1,13 +1,14 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.GenericSkyHanniEvent import net.minecraft.entity.Entity import net.minecraft.item.ItemStack -data class EntityEquipmentChangeEvent( - val entity: Entity, +data class EntityEquipmentChangeEvent( + val entity: T, val equipmentSlot: Int, val newItemStack: ItemStack?, -) : LorenzEvent() { +) : GenericSkyHanniEvent(entity.javaClass) { val isHead get() = equipmentSlot == EQUIPMENT_SLOT_HEAD val isChest get() = equipmentSlot == EQUIPMENT_SLOT_CHEST diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt index bb14c5a3e6a2..eaf972b38d91 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LesserOrbHider.kt @@ -25,12 +25,12 @@ object LesserOrbHider { private const val LESSER_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjgzMjM2NjM5NjA3MDM2YzFiYTM5MWMyYjQ2YTljN2IwZWZkNzYwYzhiZmEyOTk2YTYwNTU1ODJiNGRhNSJ9fX0=" - @SubscribeEvent - fun onArmorChange(event: EntityEquipmentChangeEvent) { + @HandleEvent(onlyOnSkyblock = true) + fun onArmorChange(event: EntityEquipmentChangeEvent) { val entity = event.entity val itemStack = event.newItemStack ?: return - if (entity is EntityArmorStand && event.isHand && itemStack.getSkullTexture() == LESSER_TEXTURE) { + if (event.isHand && itemStack.getSkullTexture() == LESSER_TEXTURE) { hiddenEntities.add(entity) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt index 99c94d63a1df..b1101d840c71 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt @@ -1,5 +1,7 @@ package at.hannibal2.skyhanni.features.rift.area.dreadfarm +import at.hannibal2.skyhanni.api.event.HandleEvent +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.EntityEquipmentChangeEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.features.rift.RiftAPI @@ -34,9 +36,9 @@ object VoltHighlighter { private val CHARGE_TIME = 12.seconds private var chargingSince = mapOf() - @SubscribeEvent - fun onArmorChange(event: EntityEquipmentChangeEvent) { - if (!RiftAPI.inRift() || !config.voltWarning) return + @HandleEvent(onlyOnIsland = IslandType.THE_RIFT) + fun onArmorChange(event: EntityEquipmentChangeEvent) { + if (!config.voltWarning) return val player = Minecraft.getMinecraft().thePlayer ?: return if (event.isHead && getVoltState(event.entity) == VoltState.DOING_LIGHTNING && event.entity.positionVector.squareDistanceTo(player.positionVector) <= LIGHTNING_DISTANCE * LIGHTNING_DISTANCE diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetHandlerPlayClient.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetHandlerPlayClient.java index b8bb676db082..0e1c529df46f 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetHandlerPlayClient.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetHandlerPlayClient.java @@ -26,7 +26,7 @@ private void onSendPacket(Packet packet, CallbackInfo ci) { @Inject(method = "handleEntityEquipment", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setCurrentItemOrArmor(ILnet/minecraft/item/ItemStack;)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) public void onEntityEquipment(S04PacketEntityEquipment packetIn, CallbackInfo ci, Entity entity) { - new EntityEquipmentChangeEvent(entity, packetIn.getEquipmentSlot(), packetIn.getItemStack()).postAndCatch(); + new EntityEquipmentChangeEvent(entity, packetIn.getEquipmentSlot(), packetIn.getItemStack()).post(); } } From 6ba4e5d8540ec9180fb7e8d7d000fc0291d51900 Mon Sep 17 00:00:00 2001 From: calwolfson Date: Fri, 18 Oct 2024 11:26:21 +1100 Subject: [PATCH 5/7] EntityDisplayNameEvent & EntityCustomNameUpdateEvent & DataWatcherUpdatedEvent --- .../java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt | 9 +++++---- .../java/at/hannibal2/skyhanni/data/EntityData.kt | 2 +- .../skyhanni/events/DataWatcherUpdatedEvent.kt | 7 ++++--- .../skyhanni/events/EntityCustomNameUpdateEvent.kt | 7 ++++--- .../skyhanni/events/entity/EntityDisplayNameEvent.kt | 4 ++-- .../event/UniqueGiftingOpportunitiesFeatures.kt | 7 +++---- .../skyhanni/features/misc/ContributorManager.kt | 11 +++++------ .../skyhanni/features/misc/pets/PetNametag.kt | 7 +++---- .../transformers/UpdateDataWatcherEventPatch.java | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt index e7e7fd2b5ac3..60513ca62fcb 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt @@ -1,20 +1,21 @@ package at.hannibal2.skyhanni.api +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.DataWatcherUpdatedEvent import at.hannibal2.skyhanni.events.EntityCustomNameUpdateEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraft.entity.Entity @SkyHanniModule object DataWatcherAPI { private const val DATA_VALUE_CUSTOM_NAME = 2 - @SubscribeEvent - fun onDataWatcherUpdate(event: DataWatcherUpdatedEvent) { + @HandleEvent + fun onDataWatcherUpdate(event: DataWatcherUpdatedEvent) { for (updatedEntry in event.updatedEntries) { if (updatedEntry.dataValueId == DATA_VALUE_CUSTOM_NAME) { - EntityCustomNameUpdateEvent(event.entity.customNameTag, event.entity).postAndCatch() + EntityCustomNameUpdateEvent( event.entity, event.entity.customNameTag).post() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt index 04147ce7794c..0f6fc666fae5 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -100,7 +100,7 @@ object EntityData { private fun postRenderNametag(entity: Entity, chatComponent: ChatComponentText) = nametagCache.getOrPut(entity) { val event = EntityDisplayNameEvent(entity, chatComponent) - event.postAndCatch() + event.post() event.chatComponent } diff --git a/src/main/java/at/hannibal2/skyhanni/events/DataWatcherUpdatedEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/DataWatcherUpdatedEvent.kt index 05389c2d7f04..df2049517f5b 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/DataWatcherUpdatedEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/DataWatcherUpdatedEvent.kt @@ -1,9 +1,10 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.GenericSkyHanniEvent import net.minecraft.entity.DataWatcher import net.minecraft.entity.Entity -data class DataWatcherUpdatedEvent( - val entity: Entity, +data class DataWatcherUpdatedEvent( + val entity: T, val updatedEntries: List, -) : LorenzEvent() +) : GenericSkyHanniEvent(entity.javaClass) diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityCustomNameUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityCustomNameUpdateEvent.kt index 4b4b075e3ac3..4b2d97c3338d 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/EntityCustomNameUpdateEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityCustomNameUpdateEvent.kt @@ -1,8 +1,9 @@ package at.hannibal2.skyhanni.events +import at.hannibal2.skyhanni.api.event.GenericSkyHanniEvent import net.minecraft.entity.Entity -data class EntityCustomNameUpdateEvent( +data class EntityCustomNameUpdateEvent( + val entity: T, val newName: String?, - val entity: Entity, -) : LorenzEvent() +) : GenericSkyHanniEvent(entity.javaClass) diff --git a/src/main/java/at/hannibal2/skyhanni/events/entity/EntityDisplayNameEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/entity/EntityDisplayNameEvent.kt index c4d24eb0a2c9..2fa7272c212d 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/entity/EntityDisplayNameEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/entity/EntityDisplayNameEvent.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.events.entity -import at.hannibal2.skyhanni.events.LorenzEvent +import at.hannibal2.skyhanni.api.event.GenericSkyHanniEvent import net.minecraft.entity.Entity import net.minecraft.util.ChatComponentText -class EntityDisplayNameEvent(val entity: Entity, var chatComponent: ChatComponentText) : LorenzEvent() +class EntityDisplayNameEvent(val entity: T, var chatComponent: ChatComponentText) : GenericSkyHanniEvent(entity.javaClass) diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt index b1939a793bf3..b531a955494e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/UniqueGiftingOpportunitiesFeatures.kt @@ -69,10 +69,9 @@ object UniqueGiftingOpportunitiesFeatures { addGiftedPlayer(matchedPlayer.name) } - @SubscribeEvent - fun onEntityChangeName(event: EntityCustomNameUpdateEvent) { - val entity = event.entity as? EntityArmorStand ?: return - analyzeArmorStand(entity) + @HandleEvent(onlyOnSkyblock = true) + fun onEntityChangeName(event: EntityCustomNameUpdateEvent) { + analyzeArmorStand(event.entity) } @HandleEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ContributorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ContributorManager.kt index bf495c61aadc..ff5bdcacb66c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ContributorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ContributorManager.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.ContributorJsonEntry import at.hannibal2.skyhanni.data.jsonobjects.repo.ContributorsJson import at.hannibal2.skyhanni.data.mob.MobFilter.isRealPlayer @@ -22,13 +23,11 @@ object ContributorManager { contributors = event.getConstant("Contributors").contributors.mapKeys { it.key.lowercase() } } - @SubscribeEvent - fun onRenderNametag(event: EntityDisplayNameEvent) { + @HandleEvent + fun onRenderNametag(event: EntityDisplayNameEvent) { if (!config.contributorNametags) return - (event.entity as? EntityPlayer)?.let { player -> - if (player.isRealPlayer()) getSuffix(event.entity.name)?.let { - event.chatComponent.appendSibling(ChatComponentText(" $it")) - } + if (event.entity.isRealPlayer()) getSuffix(event.entity.name)?.let { + event.chatComponent.appendSibling(ChatComponentText(" $it")) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetNametag.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetNametag.kt index f3b16069e655..d2b85598a676 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetNametag.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/pets/PetNametag.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.pets import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.events.entity.EntityDisplayNameEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.LorenzUtils @@ -10,7 +11,6 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.chat.Text.asComponent import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.entity.item.EntityArmorStand -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object PetNametag { @@ -26,10 +26,9 @@ object PetNametag { "(?§8\\[§7Lv(?\\d+)§8]) (?§.)(?[\\w\\s]+)(?§. ✦)?", ) - @SubscribeEvent - fun onNameTagRender(event: EntityDisplayNameEvent) { + @HandleEvent + fun onNameTagRender(event: EntityDisplayNameEvent) { if (!isEnabled()) return - if (event.entity !is EntityArmorStand) return petNametagPattern.matchMatcher(event.chatComponent.unformattedText) { val start = group("start") diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/UpdateDataWatcherEventPatch.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/UpdateDataWatcherEventPatch.java index bcc30f42dc47..f5f3555f5791 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/UpdateDataWatcherEventPatch.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/UpdateDataWatcherEventPatch.java @@ -20,6 +20,6 @@ public class UpdateDataWatcherEventPatch { @Inject(method = "updateWatchedObjectsFromList", at = @At("TAIL")) public void onWhatever(List list, CallbackInfo ci) { - new DataWatcherUpdatedEvent(owner, list).postAndCatch(); + new DataWatcherUpdatedEvent(owner, list).post(); } } From 08187414d66788dc6b431c3443dd8954a4527a9c Mon Sep 17 00:00:00 2001 From: calwolfson Date: Fri, 18 Oct 2024 11:41:11 +1100 Subject: [PATCH 6/7] formatting --- src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt index 60513ca62fcb..d0f26b33e812 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/DataWatcherAPI.kt @@ -15,7 +15,7 @@ object DataWatcherAPI { fun onDataWatcherUpdate(event: DataWatcherUpdatedEvent) { for (updatedEntry in event.updatedEntries) { if (updatedEntry.dataValueId == DATA_VALUE_CUSTOM_NAME) { - EntityCustomNameUpdateEvent( event.entity, event.entity.customNameTag).post() + EntityCustomNameUpdateEvent(event.entity, event.entity.customNameTag).post() } } } From 2924ec4f13ed105ff49d91476f7298b95bffebb3 Mon Sep 17 00:00:00 2001 From: Cal Date: Fri, 18 Oct 2024 21:41:41 +1100 Subject: [PATCH 7/7] localPlayer --- src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt | 2 +- src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt | 2 +- src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt | 2 +- .../skyhanni/features/event/diana/GriffinBurrowHelper.kt | 2 +- .../java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt index a25dd92f2a67..e16e4fcd5088 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -67,7 +67,7 @@ object EntityMovementData { @HandleEvent(onlyOnSkyblock = true) fun onPlayerMove(event: EntityMoveEvent) { - if (!event.isPlayer) return + if (!event.isLocalPlayer) return val nextData = nextTeleport ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt index 44f8eacefb7c..34cdfe22e2ba 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/IslandGraphs.kt @@ -330,7 +330,7 @@ object IslandGraphs { @HandleEvent(onlyOnSkyblock = true) fun onPlayerMove(event: EntityMoveEvent) { - if (event.isPlayer) { + if (event.isLocalPlayer) { hasMoved = true } } diff --git a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt index 5d1e43cd2d3a..a27db36d3073 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/EntityMoveEvent.kt @@ -11,5 +11,5 @@ class EntityMoveEvent( val newLocation: LorenzVec, val distance: Double, ) : GenericSkyHanniEvent(entity.javaClass) { - val isPlayer by lazy { entity == Minecraft.getMinecraft().thePlayer } + val isLocalPlayer by lazy { entity == Minecraft.getMinecraft().thePlayer } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index 2c4db28ff860..5a2b703956c0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -184,7 +184,7 @@ object GriffinBurrowHelper { @HandleEvent fun onPlayerMove(event: EntityMoveEvent) { if (!isEnabled()) return - if (event.distance > 10 && event.isPlayer) { + if (event.distance > 10 && event.isLocalPlayer) { update() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt index 20de072367ae..0e8bbdf138fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/IslandAreas.kt @@ -96,7 +96,7 @@ object IslandAreas { @HandleEvent(onlyOnSkyblock = true) fun onPlayerMove(event: EntityMoveEvent) { - if (event.isPlayer) { + if (event.isLocalPlayer) { hasMoved = true } }