Fix nullability on Block#breakNaturally (#6651)
This commit is contained in:
parent
3e8fb21553
commit
2b404b0cfa
8 changed files with 32 additions and 19 deletions
|
@ -5,10 +5,10 @@ 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 bfacffcb39d0c4e6992df282b5b28bd7ca8d5398..f92e8a53e327779d4e30a5f6806825a2a21b547a 100644
|
||||
index bfacffcb39d0c4e6992df282b5b28bd7ca8d5398..d15dda75952269addf0aa2a028c6552217bef312 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -634,6 +634,13 @@ public class CraftBlock implements Block {
|
||||
@@ -634,6 +634,18 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public boolean breakNaturally(ItemStack item) {
|
||||
|
@ -17,12 +17,17 @@ index bfacffcb39d0c4e6992df282b5b28bd7ca8d5398..f92e8a53e327779d4e30a5f6806825a2
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean breakNaturally(boolean triggerEffect) {
|
||||
+ return breakNaturally(null, triggerEffect);
|
||||
+ }
|
||||
+
|
||||
+ @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();
|
||||
@@ -643,6 +650,7 @@ public class CraftBlock implements Block {
|
||||
@@ -643,6 +655,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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue