From 1858d447dca7e755cf26e5e02a67c09e410cfa36 Mon Sep 17 00:00:00 2001 From: MartinSVK12 <37455793+MartinSVK12@users.noreply.github.com> Date: Sat, 10 Aug 2024 17:29:59 +0200 Subject: [PATCH] Fix NPE in EntityPlayerMixin --- .../signalindustries/mixin/EntityPlayerMixin.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/sunsetsatellite/signalindustries/mixin/EntityPlayerMixin.java b/src/main/java/sunsetsatellite/signalindustries/mixin/EntityPlayerMixin.java index b2b3b7c2..2aa72048 100644 --- a/src/main/java/sunsetsatellite/signalindustries/mixin/EntityPlayerMixin.java +++ b/src/main/java/sunsetsatellite/signalindustries/mixin/EntityPlayerMixin.java @@ -6,6 +6,7 @@ import net.minecraft.core.entity.player.EntityPlayer; import net.minecraft.core.enums.EnumSleepStatus; import net.minecraft.core.item.ItemStack; +import net.minecraft.core.player.inventory.Container; import net.minecraft.core.player.inventory.InventoryPlayer; import net.minecraft.core.util.helper.DamageType; import net.minecraft.core.world.World; @@ -41,6 +42,8 @@ public abstract class EntityPlayerMixin extends EntityLiving implements IPlayerP @Shadow protected float baseSpeed; + @Shadow public Container inventorySlots; + public EntityPlayerMixin(World world) { super(world); } @@ -128,7 +131,7 @@ protected void damageEntity(int damage, DamageType damageType, CallbackInfo ci) powerSuit.temperature += 0.5f; } } - if(inventory.armorItemInSlot(2).getData().getBoolean("active_shield") && damageType == DamageType.COMBAT){ + if(inventory.armorItemInSlot(2) != null && inventory.armorItemInSlot(2).getData().getBoolean("active_shield") && damageType == DamageType.COMBAT){ ci.cancel(); } }