Skip to content

Commit

Permalink
1.0.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Starexify committed Aug 18, 2024
1 parent 18f3e36 commit bd740c3
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/main/java/net/nova/mysticshrubs/block/MysticShrubBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,23 @@ public boolean isBonemealSuccess(Level pLevel, RandomSource pRandom, BlockPos pP
// On player interactions drops
@Override
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHitResult) {
if (!pLevel.isClientSide) {
if (pState.getValue(AGE).equals(1)) {
// Drop item for age 1 and set the age to 0
pLevel.destroyBlock(pPos, true);
pLevel.setBlock(pPos, pState.setValue(AGE, 0), 2);
if (!pLevel.isClientSide && pState.getValue(AGE).equals(1)) {
// Drop item for age 1 and set the age to 0
pLevel.destroyBlock(pPos, true);
pLevel.setBlock(pPos, pState.setValue(AGE, 0), 2);

return ItemInteractionResult.SUCCESS;
}
return ItemInteractionResult.SUCCESS;
}
return ItemInteractionResult.FAIL;
}

@Override
public boolean onDestroyedByPlayer(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, boolean willHarvest, FluidState fluid) {
if (!pLevel.isClientSide) {
if (pState.getValue(AGE).equals(1)) {
// Drop item for age 1 and set the age to 0
pLevel.setBlock(pPos, pState.setValue(AGE, 0), 3);
}
public boolean onDestroyedByPlayer(BlockState state, Level level, BlockPos pos, Player player, boolean willHarvest, FluidState fluid) {
if (!level.isClientSide && state.getValue(AGE).equals(1)) {
super.onDestroyedByPlayer(state, level, pos, player, willHarvest, fluid);
return level.setBlock(pos, state.setValue(AGE, 0), 3);
}
return false;
return super.onDestroyedByPlayer(state, level, pos, player, willHarvest, fluid);
}

// Slower destroy speed for age 0
Expand Down

0 comments on commit bd740c3

Please sign in to comment.