Fix terrain block

This commit is contained in:
paulevsGitch 2021-04-29 18:08:18 +03:00
parent 98b740782d
commit 27bac7373d
5 changed files with 69 additions and 40 deletions

View file

@ -74,13 +74,12 @@ public class EndTerrainBlock extends BlockBase {
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
if (random.nextInt(16) == 0 && !canSurvive(state, world, pos)) {
if (random.nextInt(16) == 0 && !canStay(state, world, pos)) {
world.setBlockAndUpdate(pos, Blocks.END_STONE.defaultBlockState());
}
}
@Override
public boolean canSurvive(BlockState state, LevelReader worldView, BlockPos pos) {
public boolean canStay(BlockState state, LevelReader worldView, BlockPos pos) {
BlockPos blockPos = pos.above();
BlockState blockState = worldView.getBlockState(blockPos);
if (blockState.is(Blocks.SNOW) && (Integer) blockState.getValue(SnowLayerBlock.LAYERS) == 1) {