geforkt von Mirrors/Paper
Move the tile entity with the falling block. Adds BUKKIT-3349
Allows for interesting things to be done with world.spawn()
Dieser Commit ist enthalten in:
Ursprung
8f0c1aed6b
Commit
fb0be1fc0a
@ -18,6 +18,7 @@ public class EntityFallingBlock extends Entity {
|
|||||||
private boolean hurtEntities;
|
private boolean hurtEntities;
|
||||||
private int fallHurtMax;
|
private int fallHurtMax;
|
||||||
private float fallHurtAmount;
|
private float fallHurtAmount;
|
||||||
|
private NBTTagCompound tileEntityData; // CraftBukkit
|
||||||
|
|
||||||
public EntityFallingBlock(World world) {
|
public EntityFallingBlock(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
@ -90,6 +91,17 @@ public class EntityFallingBlock extends Entity {
|
|||||||
return;
|
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);
|
this.world.setTypeId(i, j, k, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +117,10 @@ public class EntityFallingBlock extends Entity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.world.setTypeIdAndData(i, j, k, this.id, this.data);
|
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
|
// CraftBukkit end
|
||||||
if (Block.byId[this.id] instanceof BlockSand) {
|
if (Block.byId[this.id] instanceof BlockSand) {
|
||||||
((BlockSand) Block.byId[this.id]).a_(this.world, i, j, k, this.data);
|
((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.setBoolean("HurtEntities", this.hurtEntities);
|
||||||
nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount);
|
nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount);
|
||||||
nbttagcompound.setInt("FallHurtMax", this.fallHurtMax);
|
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) {
|
protected void a(NBTTagCompound nbttagcompound) {
|
||||||
@ -185,6 +206,12 @@ public class EntityFallingBlock extends Entity {
|
|||||||
this.hurtEntities = true;
|
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")) {
|
if (nbttagcompound.hasKey("DropItem")) {
|
||||||
this.dropItem = nbttagcompound.getBoolean("DropItem");
|
this.dropItem = nbttagcompound.getBoolean("DropItem");
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren