1
0
forked from xjboss/KCauldronX

Fix ender inventory not synced after cloning, fix #329

This commit is contained in:
Sergey Shatunov 2016-02-04 18:21:25 +07:00
parent 3b321e3116
commit d98e2ca8f6
2 changed files with 18 additions and 4 deletions

View File

@ -23,8 +23,12 @@
public abstract class EntityPlayer extends EntityLivingBase implements ICommandSender public abstract class EntityPlayer extends EntityLivingBase implements ICommandSender
{ {
public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; public static final String PERSISTED_NBT_TAG = "PlayerPersisted";
@@ -102,7 +118,7 @@ @@ -99,10 +115,10 @@
private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); private HashMap<Integer, Boolean> spawnForcedMap = new HashMap<Integer, Boolean>();
public InventoryPlayer inventory = new InventoryPlayer(this);
- private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest();
+ public InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest();
public Container inventoryContainer; public Container inventoryContainer;
public Container openContainer; public Container openContainer;
- protected FoodStats foodStats = new FoodStats(); - protected FoodStats foodStats = new FoodStats();
@ -499,3 +503,12 @@
} }
} }
@@ -2023,7 +2246,7 @@
this.setScore(p_71049_1_.getScore());
}
- this.theInventoryEnderChest = p_71049_1_.theInventoryEnderChest;
+ // this.theInventoryEnderChest = p_71049_1_.theInventoryEnderChest; // KCauldron - moved up
this.spawnChunkMap = p_71049_1_.spawnChunkMap;
this.spawnForcedMap = p_71049_1_.spawnForcedMap;

View File

@ -705,15 +705,16 @@
public void addChatComponentMessage(IChatComponent p_146105_1_) public void addChatComponentMessage(IChatComponent p_146105_1_)
{ {
this.playerNetServerHandler.sendPacket(new S02PacketChat(p_146105_1_)); this.playerNetServerHandler.sendPacket(new S02PacketChat(p_146105_1_));
@@ -878,6 +1204,7 @@ @@ -878,6 +1204,8 @@
public void clonePlayer(EntityPlayer p_71049_1_, boolean p_71049_2_) public void clonePlayer(EntityPlayer p_71049_1_, boolean p_71049_2_)
{ {
+ this.theInventoryEnderChest = p_71049_1_.theInventoryEnderChest;
+ if (p_71049_1_ instanceof EntityPlayerMP) ((org.bukkit.craftbukkit.entity.CraftLivingEntity) (bukkitEntity = ((EntityPlayerMP) p_71049_1_).bukkitEntity)).updateEntity(this); + if (p_71049_1_ instanceof EntityPlayerMP) ((org.bukkit.craftbukkit.entity.CraftLivingEntity) (bukkitEntity = ((EntityPlayerMP) p_71049_1_).bukkitEntity)).updateEntity(this);
super.clonePlayer(p_71049_1_, p_71049_2_); super.clonePlayer(p_71049_1_, p_71049_2_);
this.lastExperience = -1; this.lastExperience = -1;
this.lastHealth = -1.0F; this.lastHealth = -1.0F;
@@ -1037,6 +1364,114 @@ @@ -1037,6 +1365,114 @@
return this.field_143005_bX; return this.field_143005_bX;
} }