1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
--- a/net/minecraft/server/BlockShulkerBox.java
+++ b/net/minecraft/server/BlockShulkerBox.java
@@ -81,7 +81,31 @@
super.a(world, blockposition, iblockdata, entityhuman);
}
- public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, float f, int i) {}
+ // CraftBukkit start - override to prevent duplication when dropping
+ @Override
+ public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, float f, int i) {
+ if (true) {
+ TileEntity tileentity = world.getTileEntity(blockposition);
+
+ if (tileentity instanceof TileEntityShulkerBox) {
+ TileEntityShulkerBox tileentityshulkerbox = (TileEntityShulkerBox) tileentity;
+
+ if (!tileentityshulkerbox.s() && tileentityshulkerbox.G()) {
+ ItemStack itemstack = new ItemStack(this);
+
+ itemstack.getOrCreateTag().set("BlockEntityTag", ((TileEntityShulkerBox) tileentity).g(new NBTTagCompound()));
+ if (tileentityshulkerbox.hasCustomName()) {
+ itemstack.a(tileentityshulkerbox.getCustomName());
+ tileentityshulkerbox.setCustomName((IChatBaseComponent) null);
+ }
+
+ a(world, blockposition, itemstack);
+ }
+ }
+ world.updateAdjacentComparators(blockposition, iblockdata.getBlock());
+ }
+ }
+ // CraftBukkit end
public void postPlace(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving, ItemStack itemstack) {
if (itemstack.hasName()) {
@@ -98,7 +122,7 @@
if (iblockdata.getBlock() != iblockdata1.getBlock()) {
TileEntity tileentity = world.getTileEntity(blockposition);
- if (tileentity instanceof TileEntityShulkerBox) {
+ if (false && tileentity instanceof TileEntityShulkerBox) { // CraftBukkit - moved up
TileEntityShulkerBox tileentityshulkerbox = (TileEntityShulkerBox) tileentity;
if (!tileentityshulkerbox.s() && tileentityshulkerbox.G()) {
@@ -113,8 +137,8 @@
a(world, blockposition, itemstack);
}
- world.updateAdjacentComparators(blockposition, iblockdata.getBlock());
}
+ world.updateAdjacentComparators(blockposition, iblockdata.getBlock()); // CraftBukkit - moved down
super.remove(iblockdata, world, blockposition, iblockdata1, flag);
}
|