1
0
Fork 0

Forward bukkit's CraftPlayer during cloning player

Fix #318
kcx-1614
Sergey Shatunov 2016-02-01 22:45:16 +07:00
parent 07698c433a
commit 0d3b4e763c
3 changed files with 19 additions and 8 deletions

View File

@ -705,7 +705,15 @@
public void addChatComponentMessage(IChatComponent p_146105_1_)
{
this.playerNetServerHandler.sendPacket(new S02PacketChat(p_146105_1_));
@@ -1037,6 +1363,114 @@
@@ -878,6 +1204,7 @@
public void clonePlayer(EntityPlayer p_71049_1_, boolean p_71049_2_)
{
+ 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_);
this.lastExperience = -1;
this.lastHealth = -1.0F;
@@ -1037,6 +1364,114 @@
return this.field_143005_bX;
}

View File

@ -1795,7 +1795,7 @@
{
packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(p_147349_1_.func_149558_e()));
@@ -1093,16 +2398,18 @@
{
if (itemstack.getItem() == Items.writable_book && itemstack.getItem() == itemstack1.getItem())
{
- itemstack1.setTagInfo("pages", itemstack.getTagCompound().getTagList("pages", 8));
@ -1818,7 +1818,7 @@
finally
{
@@ -1135,19 +2442,18 @@
{
if (itemstack.getItem() == Items.written_book && itemstack1.getItem() == Items.writable_book)
{
- itemstack1.setTagInfo("author", new NBTTagString(this.playerEntity.getCommandSenderName()));

View File

@ -48,15 +48,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public Class<? extends net.minecraft.entity.EntityLivingBase> entityClass;
public String entityName;
// Cauldron end
public CraftLivingEntity(final CraftServer server, final net.minecraft.entity.EntityLivingBase entity) {
super(server, entity);
// Cauldron start
public void updateEntity(net.minecraft.entity.EntityLivingBase entity) {
super.entity = entity;
this.entityClass = entity.getClass();
this.entityName = EntityRegistry.getCustomEntityTypeName(entityClass);
if (entityName == null)
entityName = entity.getCommandSenderName();
// Cauldron end
}
public CraftLivingEntity(final CraftServer server, final net.minecraft.entity.EntityLivingBase entity) {
super(server, entity);
updateEntity(entity); // KCauldron
if (entity instanceof net.minecraft.entity.EntityLiving) {
equipment = new CraftEntityEquipment(this);