From 501372f2c968a03be98e2d161c6228f4a5d856fb Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 10 Apr 2015 21:24:34 +1000 Subject: Special case record placement into juke boxes as they update their tile. --- nms-patches/ItemRecord.patch | 17 +++++++++++++++++ nms-patches/ItemStack.patch | 24 ++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 nms-patches/ItemRecord.patch diff --git a/nms-patches/ItemRecord.patch b/nms-patches/ItemRecord.patch new file mode 100644 index 00000000..7507049d --- /dev/null +++ b/nms-patches/ItemRecord.patch @@ -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 { diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch index 79bdd15a..a869e407 100644 --- a/nms-patches/ItemStack.patch +++ b/nms-patches/ItemStack.patch @@ -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; -- cgit v1.2.3