Skip to content

How to prevent plant from growing under certain conditions #1268

Discussion options

You must be logged in to vote

I fixed it by overriding the randomTick function:

@Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
	Block topBlock = world.getBlockState(pos.up(2)).getBlock();
	if (topBlock == Blocks.WATER) {
		super.randomTick(state, world, pos, random);
	}
}

Thanks to lolad#1000 on Discord!

Replies: 1 comment

Comment options

NebelNidas
Jan 15, 2021
Collaborator Author

You must be logged in to vote
0 replies
Answer selected by NebelNidas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant