2020-05-06 11:48:49 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2020-01-19 03:10:06 +01:00
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
2021-04-11 10:49:43 +02:00
index aab855c64507e4a695c1be8693522b91b24b9cdd..650b80b6e38dffa6b6b211cf4ea1125105748935 100644
2020-01-19 03:10:06 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
2021-04-11 10:49:43 +02:00
@@ -633,6 +633,13 @@ public class CraftBlock implements Block {
2020-01-19 03:10:06 +01:00
@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
2021-03-16 08:19:45 +01:00
net.minecraft.world.level.block.state.IBlockData iblockdata = this.getNMS();
net.minecraft.world.level.block.Block block = iblockdata.getBlock();
2021-04-11 10:49:43 +02:00
@@ -642,6 +649,7 @@ public class CraftBlock implements Block {
2020-05-12 07:27:03 +02:00
// Modelled off EntityHuman#hasBlock
2020-08-25 04:22:08 +02:00
if (block != Blocks.AIR && (item == null || !iblockdata.isRequiresSpecialTool() || nmsItem.canDestroySpecialBlock(iblockdata))) {
2021-03-16 08:19:45 +01:00
net.minecraft.world.level.block.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem);
+ if (triggerEffect) world.triggerEffect(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.world.level.block.Block.getCombinedId(block.getBlockData())); // Paper
2020-01-19 03:10:06 +01:00
result = true;
}