Special case record placement into juke boxes as they update their tile.

This commit is contained in:
md_5 2015-04-10 21:24:34 +10:00
parent 1a1bc08e38
commit 501372f2c9
2 changed files with 33 additions and 8 deletions

View File

@ -0,0 +1,17 @@
--- ../work/decompile-73f3c166/net/minecraft/server/ItemRecord.java 2015-04-10 21:23:03.674603339 +1000
+++ src/main/java/net/minecraft/server/ItemRecord.java 2015-04-10 21:23:03.678603362 +1000
@@ -22,10 +22,14 @@
if (world.isClientSide) {
return true;
} else {
+ // CraftBukkit Start
+ /*
((BlockJukeBox) Blocks.JUKEBOX).a(world, blockposition, iblockdata, itemstack);
world.a((EntityHuman) null, 1005, blockposition, Item.getId(this));
--itemstack.count;
entityhuman.b(StatisticList.X);
+ */
+ // CraftBukkit End
return true;
}
} else {

View File

@ -1,5 +1,5 @@
--- /home/matt/mc-dev-private//net/minecraft/server/ItemStack.java 2015-03-16 09:47:03.755222168 +0000
+++ src/main/java/net/minecraft/server/ItemStack.java 2015-03-16 09:47:03.759222168 +0000
--- ../work/decompile-73f3c166/net/minecraft/server/ItemStack.java 2015-04-10 21:23:03.678603362 +1000
+++ src/main/java/net/minecraft/server/ItemStack.java 2015-04-10 21:23:03.682603388 +1000
@@ -5,6 +5,19 @@
import java.text.DecimalFormat;
import java.util.Random;
@ -39,7 +39,7 @@
}
@@ -83,11 +100,119 @@
@@ -83,11 +100,127 @@
}
public boolean placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) {
@ -134,6 +134,14 @@
+ world.setTileEntity(e.getKey(), e.getValue());
+ }
+
+ // Special case juke boxes as they update their tile entity. Copied from ItemRecord.
+ if (this.getItem() instanceof ItemRecord) {
+ ((BlockJukeBox) Blocks.JUKEBOX).a(world, blockposition, world.getType(blockposition), this);
+ world.a((EntityHuman) null, 1005, blockposition, Item.getId(this.getItem()));
+ --this.count;
+ entityhuman.b(StatisticList.X);
+ }
+
+ if (this.getItem() == Items.SKULL) { // Special case skulls to allow wither spawns to be cancelled
+ BlockPosition bp = blockposition;
+ if (!world.getType(blockposition).getBlock().a(world, blockposition)) {
@ -160,7 +168,7 @@
return flag;
}
@@ -111,7 +236,7 @@
@@ -111,7 +244,7 @@
nbttagcompound.setByte("Count", (byte) this.count);
nbttagcompound.setShort("Damage", (short) this.damage);
if (this.tag != null) {
@ -169,7 +177,7 @@
}
return nbttagcompound;
@@ -125,13 +250,18 @@
@@ -125,13 +258,18 @@
}
this.count = nbttagcompound.getByte("Count");
@ -189,7 +197,7 @@
if (this.item != null) {
this.item.a(this.tag);
}
@@ -168,8 +298,28 @@
@@ -168,8 +306,28 @@
}
public void setData(int i) {
@ -219,7 +227,7 @@
this.damage = 0;
}
@@ -223,6 +373,12 @@
@@ -223,6 +381,12 @@
this.count = 0;
}
@ -232,7 +240,7 @@
this.damage = 0;
}
@@ -489,6 +645,7 @@
@@ -489,6 +653,7 @@
public void setItem(Item item) {
this.item = item;