Search in sources :

Example 1 with AttachFace

use of net.minecraft.world.level.block.state.properties.AttachFace in project MinecraftForge by MinecraftForge.

the class BlockStateProvider method buttonBlock.

public void buttonBlock(ButtonBlock block, ModelFile button, ModelFile buttonPressed) {
    getVariantBuilder(block).forAllStates(state -> {
        Direction facing = state.getValue(ButtonBlock.FACING);
        AttachFace face = state.getValue(ButtonBlock.FACE);
        boolean powered = state.getValue(ButtonBlock.POWERED);
        return ConfiguredModel.builder().modelFile(powered ? buttonPressed : button).rotationX(face == AttachFace.FLOOR ? 0 : (face == AttachFace.WALL ? 90 : 180)).rotationY((int) (face == AttachFace.CEILING ? facing : facing.getOpposite()).toYRot()).uvLock(face == AttachFace.WALL).build();
    });
}
Also used : AttachFace(net.minecraft.world.level.block.state.properties.AttachFace) Direction(net.minecraft.core.Direction)

Aggregations

Direction (net.minecraft.core.Direction)1 AttachFace (net.minecraft.world.level.block.state.properties.AttachFace)1