From fb0be1fc0acfa85a5b25786a6df5b494a936dbb2 Mon Sep 17 00:00:00 2001 From: feildmaster Date: Tue, 1 Jan 2013 23:17:38 -0600 Subject: Move the tile entity with the falling block. Adds BUKKIT-3349 Allows for interesting things to be done with world.spawn() --- .../net/minecraft/server/EntityFallingBlock.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/main/java/net/minecraft/server/EntityFallingBlock.java') diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java index 1daf7bee..ea440dcb 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -18,6 +18,7 @@ public class EntityFallingBlock extends Entity { private boolean hurtEntities; private int fallHurtMax; private float fallHurtAmount; + private NBTTagCompound tileEntityData; // CraftBukkit public EntityFallingBlock(World world) { super(world); @@ -90,6 +91,17 @@ public class EntityFallingBlock extends Entity { return; } + // CraftBukkit start - Store the block tile entity with this entity + TileEntity tile = this.world.getTileEntity(i, j, k); + if (tile != null) { + tileEntityData = new NBTTagCompound(); + // Save the data + tile.b(tileEntityData); + // Remove the existing tile entity + this.world.r(i, j, k); + } + // CraftBukkit end + this.world.setTypeId(i, j, k, 0); } @@ -105,6 +117,10 @@ public class EntityFallingBlock extends Entity { return; } this.world.setTypeIdAndData(i, j, k, this.id, this.data); + + if (this.tileEntityData != null) { + this.world.setTileEntity(i, j, k, TileEntity.c(this.tileEntityData)); + } // CraftBukkit end if (Block.byId[this.id] instanceof BlockSand) { ((BlockSand) Block.byId[this.id]).a_(this.world, i, j, k, this.data); @@ -171,6 +187,11 @@ public class EntityFallingBlock extends Entity { nbttagcompound.setBoolean("HurtEntities", this.hurtEntities); nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount); nbttagcompound.setInt("FallHurtMax", this.fallHurtMax); + // CraftBukkit start - store the tile data + if (this.tileEntityData != null) { + nbttagcompound.set("Bukkit.tileData", this.tileEntityData.clone()); + } + // CraftBukkit end } protected void a(NBTTagCompound nbttagcompound) { @@ -185,6 +206,12 @@ public class EntityFallingBlock extends Entity { this.hurtEntities = true; } + // CraftBukkit start - load tileData + if (nbttagcompound.hasKey("Bukkit.tileData")) { + this.tileEntityData = (NBTTagCompound) nbttagcompound.getCompound("Bukkit.tileData").clone(); + } + // CraftBukkit end + if (nbttagcompound.hasKey("DropItem")) { this.dropItem = nbttagcompound.getBoolean("DropItem"); } -- cgit v1.2.3