Skip to content

Commit

Permalink
Fixed Crystal Cutter playing animation twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Lykrast committed Jul 14, 2019
1 parent c21f89f commit 43557bd
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos p
{
ItemStack itemstack = player.getHeldItem(hand);
IBlockState state = worldIn.getBlockState(pos);
if (state.getBlock() == ModBlocks.energionCrystal && player.canPlayerEdit(pos, facing, itemstack))
{
if (state.getBlock() == ModBlocks.energionCrystal && player.canPlayerEdit(pos, facing, itemstack)) {
if (worldIn.isRemote) {
itemstack.damageItem(1, player);
return EnumActionResult.SUCCESS;
}

int age = BlockEnergionCrystal.getAge(state);
if (age > 0)
{
Expand All @@ -77,13 +81,12 @@ public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos p
Block.spawnAsEntity(worldIn, pos, new ItemStack(ModItems.energionCrystalSeed));

int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, itemstack);
if (fortune > 0) for (int j = 0; j < fortune; j++)
{
if (fortune > 0) for (int j = 0; j < fortune; j++) {
if (worldIn.rand.nextInt(2) == 0) Block.spawnAsEntity(worldIn, pos, new ItemStack(ModItems.energionCrystalSeed));
}
}
else worldIn.destroyBlock(pos, true);

itemstack.damageItem(1, player);
return EnumActionResult.SUCCESS;
}
Expand Down

0 comments on commit 43557bd

Please sign in to comment.