/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.mojang.serialization.MapCodec */ package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.ScheduledTickAccess; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; public class SnowyDirtBlock extends Block { public static final MapCodec CODEC = SnowyDirtBlock.simpleCodec(SnowyDirtBlock::new); public static final BooleanProperty SNOWY = BlockStateProperties.SNOWY; protected MapCodec codec() { return CODEC; } protected SnowyDirtBlock(BlockBehaviour.Properties properties) { super(properties); this.registerDefaultState((BlockState)((BlockState)this.stateDefinition.any()).setValue(SNOWY, false)); } @Override protected BlockState updateShape(BlockState state, LevelReader level, ScheduledTickAccess ticks, BlockPos pos, Direction directionToNeighbour, BlockPos neighbourPos, BlockState neighbourState, RandomSource random) { if (directionToNeighbour == Direction.UP) { return (BlockState)state.setValue(SNOWY, SnowyDirtBlock.isSnowySetting(neighbourState)); } return super.updateShape(state, level, ticks, pos, directionToNeighbour, neighbourPos, neighbourState, random); } @Override public BlockState getStateForPlacement(BlockPlaceContext context) { BlockState aboveState = context.getLevel().getBlockState(context.getClickedPos().above()); return (BlockState)this.defaultBlockState().setValue(SNOWY, SnowyDirtBlock.isSnowySetting(aboveState)); } protected static boolean isSnowySetting(BlockState aboveState) { return aboveState.is(BlockTags.SNOW); } @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(SNOWY); } }