Skip to content

Commit

Permalink
Make sure Empty ItemStacks never get to the point where "getItem()" i…
Browse files Browse the repository at this point in the history
…s called on it, which returns a null item. #388
  • Loading branch information
alexbegt committed Aug 29, 2017
1 parent c3c49df commit 0186811
Showing 1 changed file with 7 additions and 4 deletions.
Expand Up @@ -69,11 +69,14 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state,
{
ItemStack itemstack = playerIn.getHeldItem(hand);

if (state.getValue(BlockCloud.TYPE) == BlockCloud.CloudType.SULFUR && itemstack.getItem() != Items.AIR && itemstack.getItem() == Items.FLINT_AND_STEEL)
if (!itemstack.isEmpty())
{
worldIn.setBlockToAir(pos);
this.explode(worldIn, pos, 1, playerIn);
return true;
if (state.getValue(BlockCloud.TYPE) == BlockCloud.CloudType.SULFUR && itemstack.getItem() != Items.AIR && itemstack.getItem() == Items.FLINT_AND_STEEL)
{
worldIn.setBlockToAir(pos);
this.explode(worldIn, pos, 1, playerIn);
return true;
}
}

return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
Expand Down

0 comments on commit 0186811

Please sign in to comment.