Paper/nms-patches/Block.patch

59 lines
2.1 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
2018-07-22 04:00:00 +02:00
@@ -212,7 +212,7 @@
2016-02-29 22:32:46 +01:00
}
2018-07-15 02:00:00 +02:00
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);
2018-07-22 04:00:00 +02:00
@@ -427,7 +427,8 @@
2018-07-15 02:00:00 +02:00
int j = this.getDropCount(iblockdata, i, world, blockposition, world.random);
for (int k = 0; k < j; ++k) {
2018-07-15 02:00:00 +02:00
- if (f >= 1.0F || world.random.nextFloat() <= f) {
+ // CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions
2018-07-15 02:00:00 +02:00
+ if (f >= 1.0F || world.random.nextFloat() < f) {
Item item = this.getDropType(iblockdata, world, blockposition, i).getItem();
2018-07-15 02:00:00 +02:00
if (item != Items.AIR) {
2018-07-22 04:00:00 +02:00
@@ -448,7 +449,13 @@
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
2018-07-15 02:00:00 +02:00
entityitem.n();
- world.addEntity(entityitem);
+ // CraftBukkit start
+ if (world.captureDrops != null) {
+ world.captureDrops.add(entityitem);
+ } else {
+ world.addEntity(entityitem);
+ }
+ // CraftBukkit end
}
}
2018-07-22 04:00:00 +02:00
@@ -667,7 +674,7 @@
2018-07-15 02:00:00 +02:00
}
2016-02-29 22:32:46 +01:00
2018-07-15 02:00:00 +02:00
public String toString() {
- return "Block{" + Block.REGISTRY.b(this) + "}";
+ return Block.REGISTRY.b(this).toString(); // CraftBukkit - cheap hack
}
2016-02-29 22:32:46 +01:00
2018-07-15 02:00:00 +02:00
public static boolean c(Block block) {
2018-07-22 04:00:00 +02:00
@@ -1406,6 +1413,12 @@
2016-02-29 22:32:46 +01:00
}
2016-02-29 22:32:46 +01:00
+ // CraftBukkit start
2018-07-15 02:00:00 +02:00
+ public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, int enchantmentLevel) {
+ return 0;
+ }
+ // CraftBukkit end
2016-02-29 22:32:46 +01:00
+
2018-07-15 02:00:00 +02:00
private static void a(MinecraftKey minecraftkey, Block block) {
Block.REGISTRY.a(minecraftkey, block);
2016-02-29 22:32:46 +01:00
}