Started by
Kostya_Swiftkey
on
Topic category: Help with Minecraft modding (Java Edition)
I want to make a block that works like a redstone lamp:
when the logical blockstate LIT = true, return the light 15
else the logical blockstate LIT = false, return the light 0
public class LargeKeroseneLanternBlock extends Block {
public static final IntegerProperty POWER = IntegerProperty.create("power", 0, 15);
public static final ToIntFunction<BlockState> LIGHT = $$0 -> $$0.getValue(POWER);
public LargeKeroseneLanternBlock() {
super(BlockBehaviour.Properties.of().sound(SoundType.METAL).strength(3f).lightLevel(LIGHT).requiresCorrectToolForDrops());
this.registerDefaultState(this.stateDefinition.any().setValue(POWER, 0));
}
I use the ToIntFunction to set the light level to the block, but how can I do this in the case of a logical blockstate LIT (like a redstone lamp).
Can anyone help me with this?