mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-06 10:49:40 +01:00
4104545b11
"It was from a different time before books were as jank as they are now. As time has gone on they've only proven to be worse and worse."
33 lines
1.8 KiB
Diff
33 lines
1.8 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 75dd8cbadae9a2d18931dd49f49f8f1e14b50da5..64c304cab8c7c4c9c29f73465f99c11f224a72bd 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
@@ -635,6 +635,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.world.level.block.state.BlockState iblockdata = this.getNMS();
|
|
net.minecraft.world.level.block.Block block = iblockdata.getBlock();
|
|
@@ -644,6 +651,7 @@ public class CraftBlock implements Block {
|
|
// Modelled off EntityHuman#hasBlock
|
|
if (block != Blocks.AIR && (item == null || !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata))) {
|
|
net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), position, this.world.getBlockEntity(position), null, nmsItem);
|
|
+ if (triggerEffect) world.levelEvent(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.world.level.block.Block.getId(block.defaultBlockState())); // Paper
|
|
result = true;
|
|
}
|
|
|