aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/Block.java.patch
blob: 9f700659419e827c548d6ff2a3b82777cea01981 (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
--- a/net/minecraft/world/level/block/Block.java
+++ b/net/minecraft/world/level/block/Block.java
@@ -351,8 +348,14 @@
         if (!level.isClientSide && !itemstack.isEmpty() && level.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
             ItemEntity itementity = (ItemEntity) supplier.get();
 
-            itementity.setDefaultPickUpDelay();
-            level.addFreshEntity(itementity);
+            entityitem.setDefaultPickUpDelay();
+            // CraftBukkit start
+            if (level.captureDrops != null) {
+                level.captureDrops.add(entityitem);
+            } else {
+                level.addFreshEntity(entityitem);
+            }
+            // CraftBukkit end
         }
     }
 
@@ -378,8 +381,8 @@
 
     public void playerDestroy(Level level, Player player, BlockPos blockpos, BlockState blockstate, @Nullable BlockEntity blockentity, ItemStack itemstack) {
         player.awardStat(Stats.BLOCK_MINED.get(this));
-        player.causeFoodExhaustion(0.005F);
-        dropResources(blockstate, level, blockpos, blockentity, player, itemstack);
+        player.causeFoodExhaustion(0.005F, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.BLOCK_MINED); // CraftBukkit - EntityExhaustionEvent
+        dropResources(state, level, pos, blockEntity, player, tool);
     }
 
     public void setPlacedBy(Level level, BlockPos blockpos, BlockState blockstate, @Nullable LivingEntity livingentity, ItemStack itemstack) {}
@@ -518,7 +518,8 @@
         return this.builtInRegistryHolder;
     }
 
-    protected void tryDropExperience(ServerLevel serverlevel, BlockPos blockpos, ItemStack itemstack, IntProvider intprovider) {
+    // CraftBukkit start
+    protected int tryDropExperience(ServerLevel worldserver, BlockPos blockposition, ItemStack itemstack, IntProvider intprovider) {
         if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
             int i = intprovider.sample(serverlevel.random);
 
@@ -529,6 +532,11 @@
 
     }
 
+    public int getExpDrop(IBlockData iblockdata, ServerLevel worldserver, BlockPos blockposition, ItemStack itemstack, boolean flag) {
+        return 0;
+    }
+    // CraftBukkit end
+
     public static final class BlockStatePairKey {
 
         private final BlockState first;