33 lines
1.3 KiB
Java
33 lines
1.3 KiB
Java
package net.minecraft.world.level.block;
|
|
|
|
import com.mojang.serialization.MapCodec;
|
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
import com.mojang.serialization.codecs.RecordCodecBuilder.Instance;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.util.ColorRGBA;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.world.level.Level;
|
|
import net.minecraft.world.level.block.sounds.AmbientDesertBlockSoundsPlayer;
|
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
|
|
public class SandBlock extends ColoredFallingBlock {
|
|
public static final MapCodec<SandBlock> CODEC = RecordCodecBuilder.mapCodec(
|
|
p_391601_ -> p_391601_.group(ColorRGBA.CODEC.fieldOf("falling_dust_color").forGetter(p_395369_ -> p_395369_.dustColor), propertiesCodec())
|
|
.apply(p_391601_, SandBlock::new)
|
|
);
|
|
|
|
@Override
|
|
public MapCodec<SandBlock> codec() {
|
|
return CODEC;
|
|
}
|
|
|
|
public SandBlock(ColorRGBA p_395563_, BlockBehaviour.Properties p_393836_) {
|
|
super(p_395563_, p_393836_);
|
|
}
|
|
|
|
@Override
|
|
public void animateTick(BlockState p_393155_, Level p_394075_, BlockPos p_394564_, RandomSource p_392109_) {
|
|
AmbientDesertBlockSoundsPlayer.playAmbientBlockSounds(p_393155_, p_394075_, p_394564_, p_392109_);
|
|
}
|
|
} |