aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0410-Add-effect-to-block-break-naturally.patch
blob: 712d4676d1248749ece9d7ed6a3fde962ea70b5a (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
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 2 Jan 2020 12:25:07 -0600
Subject: [PATCH] Add effect to block break naturally


diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index bda3e17ae7a5de98ef94f37307df302fefa3675f..9b0e868f006a34b47ef9a48c7ea844be8122c291 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -620,6 +620,13 @@ public class CraftBlock implements Block {
 
     @Override
     public boolean breakNaturally(ItemStack item) {
+        // Paper start
+        return breakNaturally(item, false);
+    }
+
+    @Override
+    public boolean breakNaturally(ItemStack item, boolean triggerEffect) {
+        // Paper end
         // Order matters here, need to drop before setting to air so skulls can get their data
         net.minecraft.server.IBlockData iblockdata = this.getNMS();
         net.minecraft.server.Block block = iblockdata.getBlock();
@@ -629,6 +636,7 @@ public class CraftBlock implements Block {
         // Modelled off EntityHuman#hasBlock
         if (block != Blocks.AIR && (item == null || !iblockdata.isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) {
             net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem);
+            if (triggerEffect) world.triggerEffect(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.server.Block.getCombinedId(block.getBlockData())); // Paper
             result = true;
         }