3
0

Fixed custom modded inventories not being synced on bukkit side after spawning in world. (fix #75)

This commit is contained in:
Prototik 2015-06-29 20:31:50 +07:00
parent c2c4cc3c83
commit 50bc729381

View File

@ -29,7 +29,7 @@ import org.bukkit.plugin.Plugin;
public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
private CraftInventoryPlayer inventory; private CraftInventoryPlayer inventory;
private final CraftInventory enderChest; private CraftInventory enderChest;
protected final PermissibleBase perm = new PermissibleBase(this); protected final PermissibleBase perm = new PermissibleBase(this);
private boolean op; private boolean op;
private GameMode mode; private GameMode mode;
@ -37,8 +37,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
public CraftHumanEntity(final CraftServer server, final net.minecraft.entity.player.EntityPlayer entity) { public CraftHumanEntity(final CraftServer server, final net.minecraft.entity.player.EntityPlayer entity) {
super(server, entity); super(server, entity);
mode = server.getDefaultGameMode(); mode = server.getDefaultGameMode();
this.inventory = new CraftInventoryPlayer(entity.inventory);
enderChest = new CraftInventory(entity.getInventoryEnderChest());
} }
public String getName() { public String getName() {
@ -46,6 +44,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
} }
public PlayerInventory getInventory() { public PlayerInventory getInventory() {
if (inventory == null) inventory = new CraftInventoryPlayer(((net.minecraft.entity.player.EntityPlayer) entity).inventory);
return inventory; return inventory;
} }
@ -54,6 +53,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
} }
public Inventory getEnderChest() { public Inventory getEnderChest() {
if (enderChest == null) enderChest = new CraftInventory(((net.minecraft.entity.player.EntityPlayer) entity).getInventoryEnderChest());
return enderChest; return enderChest;
} }