diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-23 23:45:24 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-23 23:45:24 +0200 |
commit | f43bac23acf79325f9f4de060b69c5c0b1d870eb (patch) | |
tree | f05971f36500a18091762a4b29f0b0415c25558f /src/main/java/at/hannibal2/skyhanni/data | |
parent | a21c3298d2ae7790b3d3770ee4a135c1817f3018 (diff) | |
download | skyhanni-f43bac23acf79325f9f4de060b69c5c0b1d870eb.tar.gz skyhanni-f43bac23acf79325f9f4de060b69c5c0b1d870eb.tar.bz2 skyhanni-f43bac23acf79325f9f4de060b69c5c0b1d870eb.zip |
Using EntityUtils.getEntities everywhere
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/EntityData.kt | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt index c57119818..e64f09403 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent import at.hannibal2.skyhanni.events.EntityMaxHealthUpdateEvent import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP @@ -26,11 +27,8 @@ class EntityData { fun onTick(event: TickEvent.ClientTickEvent) { if (event.phase != TickEvent.Phase.START) return - val minecraft = Minecraft.getMinecraft() ?: return - val theWorld = minecraft.theWorld ?: return - for (entity in theWorld.loadedEntityList) { - if (entity !is EntityLivingBase) continue - + val entities = EntityUtils.getEntitiesOrNull<EntityLivingBase>() ?: return + for (entity in entities) { val maxHealth = entity.baseMaxHealth val oldMaxHealth = maxHealthMap.getOrDefault(entity, -1) if (oldMaxHealth != maxHealth) { |