package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.util.ParticleUtils; import net.minecraft.util.RandomSource; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; public class CherryLeavesBlock extends LeavesBlock { public static final MapCodec CODEC = simpleCodec(CherryLeavesBlock::new); @Override public MapCodec codec() { return CODEC; } public CherryLeavesBlock(BlockBehaviour.Properties properties) { super(properties); } @Override public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) { super.animateTick(state, level, pos, random); if (random.nextInt(10) == 0) { BlockPos blockPos = pos.below(); BlockState blockState = level.getBlockState(blockPos); if (!isFaceFull(blockState.getCollisionShape(level, blockPos), Direction.UP)) { ParticleUtils.spawnParticleBelow(level, pos, random, ParticleTypes.CHERRY_LEAVES); } } } }