summaryrefslogtreecommitdiffstats
path: root/nms-patches/Block.patch
blob: 8060e69d3d17782cfb9896db82fae725aa6632e7 (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
@@ -37,7 +37,7 @@
     private String name;
 
     public static int getId(Block block) {
-        return Block.REGISTRY.a((Object) block);
+        return Block.REGISTRY.a(block); // CraftBukkit - decompile error
     }
 
     public static int getCombinedId(IBlockData iblockdata) {
@@ -343,7 +343,8 @@
             int j = this.getDropCount(i, world.random);
 
             for (int k = 0; k < j; ++k) {
-                if (world.random.nextFloat() <= f) {
+                // CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions
+                if (world.random.nextFloat() < f) {
                     Item item = this.getDropType(iblockdata, world.random, i);
 
                     if (item != Items.a) {
@@ -364,7 +365,13 @@
             EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
 
             entityitem.q();
-            world.addEntity(entityitem);
+            // CraftBukkit start
+            if (world.captureDrops != null) {
+                world.captureDrops.add(entityitem);
+            } else {
+                world.addEntity(entityitem);
+            }
+            // CraftBukkit end
         }
     }
 
@@ -931,7 +938,7 @@
 
             if (hashset.contains(block16)) {
                 for (int i = 0; i < 15; ++i) {
-                    int j = Block.REGISTRY.a((Object) block16) << 4 | i;
+                    int j = Block.REGISTRY.a(block16) << 4 | i; // CraftBukkit - decompile error
 
                     Block.REGISTRY_ID.a(block16.fromLegacyData(i), j);
                 }
@@ -940,7 +947,7 @@
 
                 while (unmodifiableiterator.hasNext()) {
                     IBlockData iblockdata = (IBlockData) unmodifiableiterator.next();
-                    int k = Block.REGISTRY.a((Object) block16) << 4 | block16.toLegacyData(iblockdata);
+                    int k = Block.REGISTRY.a(block16) << 4 | block16.toLegacyData(iblockdata); // CraftBukkit - decompile error
 
                     Block.REGISTRY_ID.a(iblockdata, k);
                 }
@@ -949,6 +956,12 @@
 
     }
 
+    // CraftBukkit start
+    public int getExpDrop(World world, IBlockData data, int enchantmentLevel) {
+        return 0;
+    }
+    // CraftBukkit end
+
     private static void a(int i, MinecraftKey minecraftkey, Block block) {
         Block.REGISTRY.a(i, minecraftkey, block);
     }