From f43bac23acf79325f9f4de060b69c5c0b1d870eb Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 23 Jul 2023 23:45:24 +0200 Subject: Using EntityUtils.getEntities everywhere --- src/main/java/at/hannibal2/skyhanni/data/EntityData.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data') 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() ?: return + for (entity in entities) { val maxHealth = entity.baseMaxHealth val oldMaxHealth = maxHealthMap.getOrDefault(entity, -1) if (oldMaxHealth != maxHealth) { -- cgit