minecraft_25w45a_unobfuscated/net/minecraft/world/level/block/WeatheringCopperFullBlock.java
2025-11-24 22:52:51 +03:00

56 lines
2.0 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.mojang.datafixers.kinds.App
* com.mojang.datafixers.kinds.Applicative
* com.mojang.serialization.MapCodec
* com.mojang.serialization.codecs.RecordCodecBuilder
*/
package net.minecraft.world.level.block;
import com.mojang.datafixers.kinds.App;
import com.mojang.datafixers.kinds.Applicative;
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.Block;
import net.minecraft.world.level.block.ChangeOverTimeBlock;
import net.minecraft.world.level.block.WeatheringCopper;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
public class WeatheringCopperFullBlock
extends Block
implements WeatheringCopper {
public static final MapCodec<WeatheringCopperFullBlock> CODEC = RecordCodecBuilder.mapCodec(i -> i.group((App)WeatheringCopper.WeatherState.CODEC.fieldOf("weathering_state").forGetter(ChangeOverTimeBlock::getAge), WeatheringCopperFullBlock.propertiesCodec()).apply((Applicative)i, WeatheringCopperFullBlock::new));
private final WeatheringCopper.WeatherState weatherState;
public MapCodec<WeatheringCopperFullBlock> codec() {
return CODEC;
}
public WeatheringCopperFullBlock(WeatheringCopper.WeatherState weatherState, BlockBehaviour.Properties properties) {
super(properties);
this.weatherState = weatherState;
}
@Override
protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
this.changeOverTime(state, level, pos, random);
}
@Override
protected boolean isRandomlyTicking(BlockState state) {
return WeatheringCopper.getNext(state.getBlock()).isPresent();
}
@Override
public WeatheringCopper.WeatherState getAge() {
return this.weatherState;
}
}