Fixed compile-time fatal error (#1510)

Added Creative handling
This commit is contained in:
Tobias Gremeyer 2019-01-21 00:16:22 +01:00 committed by Nick Ignoffo
parent 7e2251b8e5
commit c6a315a51c

View file

@ -241,14 +241,15 @@ public class ItemBoundTool extends ItemTool implements IBindable, IActivatable {
float strengthVsBlock = getDestroySpeed(stack, blockState);
if (strengthVsBlock > 1.1F && world.canMineBlockBody(player, blockPos)) {
if (silkTouch && blockState.getBlock().canSilkHarvest(world, blockPos, world.getBlockState(blockPos), player))
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(Item.getItemFromBlock(blockState.getBlock())));
else {
NonNullList<ItemStack> itemDrops = new NonNullList<>();
blockState.getBlock().getDrops(itemDrops, world, blockPos, world.getBlockState(blockPos), fortuneLvl);
for (ItemStack stacks : itemDrops)
ItemHandlerHelper.giveItemToPlayer(player, stacks);
}
if (!player.isCreative())
if (silkTouch && blockState.getBlock().canSilkHarvest(world, blockPos, world.getBlockState(blockPos), player))
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(Item.getItemFromBlock(blockState.getBlock())));
else {
NonNullList<ItemStack> itemDrops = NonNullList.create();
blockState.getBlock().getDrops(itemDrops, world, blockPos, world.getBlockState(blockPos), fortuneLvl);
for (ItemStack stacks : itemDrops)
ItemHandlerHelper.giveItemToPlayer(player, stacks);
}
blockState.getBlock().removedByPlayer(world.getBlockState(blockPos), world, blockPos, player, false);
}
}