SPIGOT-4503: Add API to insert complete ItemStack into Jukebox

This commit is contained in:
md_5
2018-12-22 10:50:57 +11:00
parent fc1024944e
commit fe89a8c1bb
3 changed files with 34 additions and 22 deletions

View File

@@ -0,0 +1,17 @@
--- a/net/minecraft/server/BlockJukeBox.java
+++ b/net/minecraft/server/BlockJukeBox.java
@@ -24,7 +24,13 @@
TileEntity tileentity = generatoraccess.getTileEntity(blockposition);
if (tileentity instanceof TileEntityJukeBox) {
- ((TileEntityJukeBox) tileentity).setRecord(itemstack.cloneItemStack());
+ // CraftBukkit start - There can only be one
+ itemstack = itemstack.cloneItemStack();
+ if (!itemstack.isEmpty()) {
+ itemstack.setCount(1);
+ }
+ ((TileEntityJukeBox) tileentity).setRecord(itemstack);
+ // CraftBukkit end
generatoraccess.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockJukeBox.HAS_RECORD, true), 2);
}
}