Paper/Spigot-Server-Patches/0404-Add-effect-to-block-break-naturally.patch
Aikar 1ab021ddca Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
565a5727 #533: Add consumed item, hand and consumeItem boolean to EntityShootBowEvent

CraftBukkit Changes:
927200a9 #718: Add consumed item, hand and consumeItem boolean to EntityShootBowEvent
2020-08-31 08:30:51 -04:00

33 lines
1.7 KiB
Diff

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 8a1261ccb3b3eae7f00fdcad7f1220f459cdbfad..9905478f08aee2ea2beb6a1bcd86c2ab05718cac 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -632,6 +632,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();
@@ -641,6 +648,7 @@ public class CraftBlock implements Block {
// Modelled off EntityHuman#hasBlock
if (block != Blocks.AIR && (item == null || !iblockdata.isRequiresSpecialTool() || 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;
}