mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 12:05:53 +01:00
SPIGOT-5718: Block.BreakBlockNaturally does not reflect tool used
This commit is contained in:
parent
214ffea95e
commit
46a1386066
@ -593,11 +593,14 @@ public class CraftBlock implements Block {
|
|||||||
@Override
|
@Override
|
||||||
public boolean breakNaturally(ItemStack item) {
|
public boolean breakNaturally(ItemStack item) {
|
||||||
// Order matters here, need to drop before setting to air so skulls can get their data
|
// Order matters here, need to drop before setting to air so skulls can get their data
|
||||||
net.minecraft.server.Block block = this.getNMSBlock();
|
net.minecraft.server.IBlockData iblockdata = this.getNMS();
|
||||||
|
net.minecraft.server.Block block = iblockdata.getBlock();
|
||||||
|
net.minecraft.server.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
if (block != null && block != Blocks.AIR) {
|
// Modelled off EntityHuman#hasBlock
|
||||||
net.minecraft.server.Block.dropItems(getNMS(), world.getMinecraftWorld(), position, world.getTileEntity(position), null, CraftItemStack.asNMSCopy(item));
|
if (block != Blocks.AIR && (iblockdata.getMaterial().isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) {
|
||||||
|
net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user