minecraft-src/net/minecraft/world/level/block/StainedGlassPaneBlock.java
2025-07-04 01:41:11 +03:00

32 lines
1.1 KiB
Java

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<StainedGlassPaneBlock> 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<StainedGlassPaneBlock> 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;
}
}