From 572e159de71827c5c8a6433de90adba2ebec5c4a Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Mon, 30 Oct 2023 20:02:47 +0100 Subject: NullPointerException fix for getEntityByID (#652) Fixed rare error message while disconnecting. #652 --- src/main/java/at/hannibal2/skyhanni/data/EntityData.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 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 b26312b51..1ffa5a70b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -6,9 +6,9 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.utils.EntityUtils +import at.hannibal2.skyhanni.utils.EntityUtils.getEntityByID import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.LorenzUtils.derpy -import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.client.entity.EntityPlayerSP import net.minecraft.entity.EntityLivingBase @@ -50,8 +50,7 @@ class EntityData { val watchableObjects = packet.func_149376_c() ?: return val entityId = packet.entityId - val theWorld = Minecraft.getMinecraft().theWorld ?: return - val entity = theWorld.getEntityByID(entityId) ?: return + val entity = getEntityByID(entityId) ?: return if (entity is EntityArmorStand) return if (entity is EntityXPOrb) return if (entity is EntityItem) return @@ -77,4 +76,4 @@ class EntityData { } } } -} \ No newline at end of file +} -- cgit