3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00
Paper/nms-patches/Block.patch

71 Zeilen
2.7 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
2018-08-26 04:00:00 +02:00
@@ -32,7 +32,7 @@
@Nullable
private String name;
private static final ThreadLocal<Object2ByteLinkedOpenHashMap<Block.a>> q = ThreadLocal.withInitial(() -> {
- Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) {
+ Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap<Block.a>(200) { // CraftBukkit - decompile error
protected void rehash(int i) {}
};
@@ -194,7 +194,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-08-26 04:00:00 +02:00
@@ -409,7 +409,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-08-26 04:00:00 +02:00
@@ -430,7 +431,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-08-26 04:00:00 +02:00
@@ -649,7 +656,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() {
2018-08-26 04:00:00 +02:00
- return "Block{" + IRegistry.BLOCK.getKey(this) + "}";
+ return IRegistry.BLOCK.getKey(this).toString(); // CraftBukkit - cheap hack
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 static boolean c(Block block) {
2018-08-26 04:00:00 +02:00
@@ -1398,8 +1405,14 @@
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) {
2018-08-26 04:00:00 +02:00
- IRegistry.BLOCK.a(minecraftkey, (Object) block);
+ IRegistry.BLOCK.a(minecraftkey, block); // CraftBukkit - decompile error
2016-02-29 22:32:46 +01:00
}
2018-08-26 04:00:00 +02:00
private static void a(String s, Block block) {