Paper/nms-patches/Block.patch
2019-05-14 10:00:00 +10:00

41 Zeilen
2.0 KiB
Diff

--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
@@ -435,7 +435,8 @@
}
public static List<ItemStack> getDrops(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, @Nullable TileEntity tileentity, Entity entity, ItemStack itemstack) {
- LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder(worldserver)).a(worldserver.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, itemstack).set(LootContextParameters.THIS_ENTITY, entity).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
+ // CraftBukkit - make entity optional
+ LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder(worldserver)).a(worldserver.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, itemstack).setOptional(LootContextParameters.THIS_ENTITY, entity).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
return iblockdata.a(loottableinfo_builder);
}
@@ -489,7 +490,13 @@
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
entityitem.defaultPickupDelay();
- world.addEntity(entityitem);
+ // CraftBukkit start
+ if (world.captureDrops != null) {
+ world.captureDrops.add(entityitem);
+ } else {
+ world.addEntity(entityitem);
+ }
+ // CraftBukkit end
}
}
@@ -686,6 +693,12 @@
return block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL;
}
+ // CraftBukkit start
+ public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
+ return 0;
+ }
+ // CraftBukkit end
+
public static enum EnumRandomOffset {
NONE, XZ, XYZ;