package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; /** * Access widened by fabric-transitive-access-wideners-v1 to accessible */ public class WeatheringLightningRodBlock extends LightningRodBlock implements WeatheringCopper { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( i -> i.group(WeatheringCopper.WeatherState.CODEC.fieldOf("weathering_state").forGetter(WeatheringLightningRodBlock::getAge), propertiesCodec()) .apply(i, WeatheringLightningRodBlock::new) ); private final WeatheringCopper.WeatherState weatherState; @Override public MapCodec codec() { return CODEC; } /** * Access widened by fabric-transitive-access-wideners-v1 to accessible */ public WeatheringLightningRodBlock(final WeatheringCopper.WeatherState weatherState, final BlockBehaviour.Properties properties) { super(properties); this.weatherState = weatherState; } @Override protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { this.changeOverTime(state, level, pos, random); } @Override protected boolean isRandomlyTicking(final BlockState state) { return WeatheringCopper.getNext(state.getBlock()).isPresent(); } public WeatheringCopper.WeatherState getAge() { return this.weatherState; } }