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); float strengthVsBlock = getDestroySpeed(stack, blockState);
if (strengthVsBlock > 1.1F && world.canMineBlockBody(player, blockPos)) { if (strengthVsBlock > 1.1F && world.canMineBlockBody(player, blockPos)) {
if (silkTouch && blockState.getBlock().canSilkHarvest(world, blockPos, world.getBlockState(blockPos), player)) if (!player.isCreative())
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(Item.getItemFromBlock(blockState.getBlock()))); if (silkTouch && blockState.getBlock().canSilkHarvest(world, blockPos, world.getBlockState(blockPos), player))
else { ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(Item.getItemFromBlock(blockState.getBlock())));
NonNullList<ItemStack> itemDrops = new NonNullList<>(); else {
blockState.getBlock().getDrops(itemDrops, world, blockPos, world.getBlockState(blockPos), fortuneLvl); NonNullList<ItemStack> itemDrops = NonNullList.create();
for (ItemStack stacks : itemDrops) blockState.getBlock().getDrops(itemDrops, world, blockPos, world.getBlockState(blockPos), fortuneLvl);
ItemHandlerHelper.giveItemToPlayer(player, stacks); for (ItemStack stacks : itemDrops)
} ItemHandlerHelper.giveItemToPlayer(player, stacks);
}
blockState.getBlock().removedByPlayer(world.getBlockState(blockPos), world, blockPos, player, false); blockState.getBlock().removedByPlayer(world.getBlockState(blockPos), world, blockPos, player, false);
} }
} }