Paper/nms-patches/Block.patch
2018-08-08 18:07:02 +10:00

68 lines
2.5 KiB
Diff

--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
@@ -17,7 +17,7 @@
public static final RegistryBlocks<MinecraftKey, Block> REGISTRY = new RegistryBlocks(Block.a);
public static final RegistryBlockID<IBlockData> REGISTRY_ID = new RegistryBlockID();
protected final int g;
- protected final float strength;
+ public final float strength; // PAIL: private -> public
protected final float durability;
protected final boolean j;
protected final SoundEffectType stepSound;
@@ -212,7 +212,7 @@
}
public Block(Block.Info block_info) {
- BlockStateList.a blockstatelist_a = new BlockStateList.a(this);
+ BlockStateList.a<Block, IBlockData> blockstatelist_a = new BlockStateList.a(this); // CraftBukkit - decompile error
this.a(blockstatelist_a);
this.blockStateList = blockstatelist_a.a(BlockData::new);
@@ -427,7 +427,8 @@
int j = this.getDropCount(iblockdata, i, world, blockposition, world.random);
for (int k = 0; k < j; ++k) {
- if (f >= 1.0F || world.random.nextFloat() <= f) {
+ // CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions
+ if (f >= 1.0F || world.random.nextFloat() < f) {
Item item = this.getDropType(iblockdata, world, blockposition, i).getItem();
if (item != Items.AIR) {
@@ -448,7 +449,13 @@
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
entityitem.n();
- world.addEntity(entityitem);
+ // CraftBukkit start
+ if (world.captureDrops != null) {
+ world.captureDrops.add(entityitem);
+ } else {
+ world.addEntity(entityitem);
+ }
+ // CraftBukkit end
}
}
@@ -667,7 +674,7 @@
}
public String toString() {
- return "Block{" + Block.REGISTRY.b(this) + "}";
+ return Block.REGISTRY.b(this).toString(); // CraftBukkit - cheap hack
}
public static boolean c(Block block) {
@@ -1406,6 +1413,12 @@
}
+ // CraftBukkit start
+ public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, int enchantmentLevel) {
+ return 0;
+ }
+ // CraftBukkit end
+
private static void a(MinecraftKey minecraftkey, Block block) {
Block.REGISTRY.a(minecraftkey, block);
}