Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Fix problems of null inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
TonimatasDEV committed Feb 17, 2024
1 parent 7cc6843 commit ab92d46
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
private CraftInventoryPlayer inventory;
private final CraftInventory enderChest;
private CraftInventory enderChest;// Magma - remove final modifier
protected PermissibleBase perm = new PermissibleBase(this); //Magma - remove final modifier
private boolean op;
private GameMode mode;
Expand All @@ -65,16 +65,31 @@ public CraftHumanEntity(final CraftServer server, final net.minecraft.world.enti

@Override
public PlayerInventory getInventory() {
// Magma start - Fix null problems
if (inventory == null) {
inventory = new CraftInventoryPlayer(((ServerPlayer) entity).getInventory());
}
// Magma end
return inventory;
}

@Override
public EntityEquipment getEquipment() {
// Magma start - Fix null problems
if (inventory == null) {
inventory = new CraftInventoryPlayer(((ServerPlayer) entity).getInventory());
}
// Magma end
return inventory;
}

@Override
public Inventory getEnderChest() {
// Magma start - Fix null problems
if (enderChest == null) {
enderChest = new CraftInventory(((ServerPlayer) entity).getEnderChestInventory());
}
// Magma end
return enderChest;
}

Expand Down

0 comments on commit ab92d46

Please sign in to comment.