use of net.minecraft.world.level.block.state.properties.StairsShape in project MinecraftForge by MinecraftForge.
the class BlockStateProvider method stairsBlock.
public void stairsBlock(StairBlock block, ModelFile stairs, ModelFile stairsInner, ModelFile stairsOuter) {
getVariantBuilder(block).forAllStatesExcept(state -> {
Direction facing = state.getValue(StairBlock.FACING);
Half half = state.getValue(StairBlock.HALF);
StairsShape shape = state.getValue(StairBlock.SHAPE);
// Stairs model is rotated 90 degrees clockwise for some reason
int yRot = (int) facing.getClockWise().toYRot();
if (shape == StairsShape.INNER_LEFT || shape == StairsShape.OUTER_LEFT) {
// Left facing stairs are rotated 90 degrees clockwise
yRot += 270;
}
if (shape != StairsShape.STRAIGHT && half == Half.TOP) {
// Top stairs are rotated 90 degrees clockwise
yRot += 90;
}
yRot %= 360;
// Don't set uvlock for states that have no rotation
boolean uvlock = yRot != 0 || half == Half.TOP;
return ConfiguredModel.builder().modelFile(shape == StairsShape.STRAIGHT ? stairs : shape == StairsShape.INNER_LEFT || shape == StairsShape.INNER_RIGHT ? stairsInner : stairsOuter).rotationX(half == Half.BOTTOM ? 0 : 180).rotationY(yRot).uvLock(uvlock).build();
}, StairBlock.WATERLOGGED);
}
Aggregations