mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 17:22:55 +01:00
Special case record placement into juke boxes as they update their tile.
By: md_5 <git@md-5.net>
This commit is contained in:
parent
b3ac41214f
commit
5093b8e50a
2 changed files with 33 additions and 8 deletions
17
paper-server/nms-patches/ItemRecord.patch
Normal file
17
paper-server/nms-patches/ItemRecord.patch
Normal 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 {
|
|
@ -1,5 +1,5 @@
|
||||||
--- /home/matt/mc-dev-private//net/minecraft/server/ItemStack.java 2015-03-16 09:47:03.755222168 +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-03-16 09:47:03.759222168 +0000
|
+++ src/main/java/net/minecraft/server/ItemStack.java 2015-04-10 21:23:03.682603388 +1000
|
||||||
@@ -5,6 +5,19 @@
|
@@ -5,6 +5,19 @@
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Random;
|
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) {
|
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());
|
+ 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
|
+ if (this.getItem() == Items.SKULL) { // Special case skulls to allow wither spawns to be cancelled
|
||||||
+ BlockPosition bp = blockposition;
|
+ BlockPosition bp = blockposition;
|
||||||
+ if (!world.getType(blockposition).getBlock().a(world, blockposition)) {
|
+ if (!world.getType(blockposition).getBlock().a(world, blockposition)) {
|
||||||
|
@ -160,7 +168,7 @@
|
||||||
|
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
@@ -111,7 +236,7 @@
|
@@ -111,7 +244,7 @@
|
||||||
nbttagcompound.setByte("Count", (byte) this.count);
|
nbttagcompound.setByte("Count", (byte) this.count);
|
||||||
nbttagcompound.setShort("Damage", (short) this.damage);
|
nbttagcompound.setShort("Damage", (short) this.damage);
|
||||||
if (this.tag != null) {
|
if (this.tag != null) {
|
||||||
|
@ -169,7 +177,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
@@ -125,13 +250,18 @@
|
@@ -125,13 +258,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.count = nbttagcompound.getByte("Count");
|
this.count = nbttagcompound.getByte("Count");
|
||||||
|
@ -189,7 +197,7 @@
|
||||||
if (this.item != null) {
|
if (this.item != null) {
|
||||||
this.item.a(this.tag);
|
this.item.a(this.tag);
|
||||||
}
|
}
|
||||||
@@ -168,8 +298,28 @@
|
@@ -168,8 +306,28 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(int i) {
|
public void setData(int i) {
|
||||||
|
@ -219,7 +227,7 @@
|
||||||
this.damage = 0;
|
this.damage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,6 +373,12 @@
|
@@ -223,6 +381,12 @@
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +240,7 @@
|
||||||
this.damage = 0;
|
this.damage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,6 +645,7 @@
|
@@ -489,6 +653,7 @@
|
||||||
|
|
||||||
public void setItem(Item item) {
|
public void setItem(Item item) {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
|
Loading…
Add table
Reference in a new issue