mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
SPIGOT-5751: Made breakNaturally and getDrops returns the correct item if no argument is given
This commit is contained in:
parent
1b2830a3b3
commit
8637ec008d
1 changed files with 4 additions and 4 deletions
|
@ -587,7 +587,7 @@ public class CraftBlock implements Block {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean breakNaturally() {
|
public boolean breakNaturally() {
|
||||||
return breakNaturally(new ItemStack(Material.AIR));
|
return breakNaturally(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -599,7 +599,7 @@ public class CraftBlock implements Block {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
// Modelled off EntityHuman#hasBlock
|
// Modelled off EntityHuman#hasBlock
|
||||||
if (block != Blocks.AIR && (iblockdata.getMaterial().isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) {
|
if (block != Blocks.AIR && (item == null || iblockdata.getMaterial().isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) {
|
||||||
net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem);
|
net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ public class CraftBlock implements Block {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<ItemStack> getDrops() {
|
public Collection<ItemStack> getDrops() {
|
||||||
return getDrops(new ItemStack(Material.AIR));
|
return getDrops(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -623,7 +623,7 @@ public class CraftBlock implements Block {
|
||||||
net.minecraft.server.ItemStack nms = CraftItemStack.asNMSCopy(item);
|
net.minecraft.server.ItemStack nms = CraftItemStack.asNMSCopy(item);
|
||||||
|
|
||||||
// Modelled off EntityHuman#hasBlock
|
// Modelled off EntityHuman#hasBlock
|
||||||
if (iblockdata.getMaterial().isAlwaysDestroyable() || nms.canDestroySpecialBlock(iblockdata)) {
|
if (item == null || iblockdata.getMaterial().isAlwaysDestroyable() || nms.canDestroySpecialBlock(iblockdata)) {
|
||||||
return net.minecraft.server.Block.getDrops(iblockdata, (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), entity == null ? null : ((CraftEntity) entity).getHandle(), nms)
|
return net.minecraft.server.Block.getDrops(iblockdata, (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), entity == null ? null : ((CraftEntity) entity).getHandle(), nms)
|
||||||
.stream().map(CraftItemStack::asBukkitCopy).collect(Collectors.toList());
|
.stream().map(CraftItemStack::asBukkitCopy).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue