From 6e96e7a58c8019361628d9723fe9d7429131b1fe Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 28 Oct 2023 22:04:50 +0100 Subject: [PATCH] Fix error ticking sprout blocks --- .../minelittlepony/unicopia/block/SproutBlock.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/block/SproutBlock.java b/src/main/java/com/minelittlepony/unicopia/block/SproutBlock.java index ab2eebcf..a6c44d36 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/SproutBlock.java +++ b/src/main/java/com/minelittlepony/unicopia/block/SproutBlock.java @@ -54,13 +54,19 @@ public class SproutBlock extends CropBlock implements TintedBlock { @Override public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { super.randomTick(state, world, pos, random); - onGrow(world, world.getBlockState(pos), pos); + state = world.getBlockState(pos); + if (state.isOf(this)) { + onGrow(world, state, pos); + } } @Override public void applyGrowth(World world, BlockPos pos, BlockState state) { super.applyGrowth(world, pos, state); - onGrow(world, world.getBlockState(pos), pos); + state = world.getBlockState(pos); + if (state.isOf(this)) { + onGrow(world, world.getBlockState(pos), pos); + } } @Override @@ -81,7 +87,7 @@ public class SproutBlock extends CropBlock implements TintedBlock { protected void mature(World world, BlockState state, BlockPos pos) { state = matureState.get(); - world.setBlockState(pos, matureState.get()); + world.setBlockState(pos, state); BlockSoundGroup group = state.getSoundGroup(); world.playSound(null, pos, group.getPlaceSound(), SoundCategory.BLOCKS, group.getVolume(), group.getPitch()); }