package net.minecraft.world.level.block; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.block.state.BlockBehaviour; public class StainedGlassPaneBlock extends IronBarsBlock implements BeaconBeamBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( instance -> instance.group(DyeColor.CODEC.fieldOf("color").forGetter(StainedGlassPaneBlock::getColor), propertiesCodec()) .apply(instance, StainedGlassPaneBlock::new) ); private final DyeColor color; @Override public MapCodec codec() { return CODEC; } public StainedGlassPaneBlock(DyeColor color, BlockBehaviour.Properties properties) { super(properties); this.color = color; this.registerDefaultState( this.stateDefinition.any().setValue(NORTH, false).setValue(EAST, false).setValue(SOUTH, false).setValue(WEST, false).setValue(WATERLOGGED, false) ); } @Override public DyeColor getColor() { return this.color; } }