Skip to content

Commit

Permalink
Fix NPE in EntityPlayerMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSVK12 committed Aug 10, 2024
1 parent feee472 commit 1858d44
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
}
}
Expand Down

0 comments on commit 1858d44

Please sign in to comment.