Add missing Rotate and Mirror methods to DirectionalBlock

This commit is contained in:
Mrbysco 2024-03-14 23:13:11 +01:00
parent 87b0261720
commit 3b180faf60

View file

@ -3,6 +3,8 @@ package de.ellpeck.actuallyadditions.mod.blocks.base;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
@ -28,6 +30,16 @@ public abstract class DirectionalBlock extends BlockBase {
builder.add(FACING);
}
@Override
public BlockState rotate(BlockState pState, Rotation pRot) {
return pState.setValue(FACING, pRot.rotate(pState.getValue(FACING)));
}
@Override
public BlockState mirror(BlockState pState, Mirror pMirror) {
return pState.rotate(pMirror.getRotation(pState.getValue(FACING)));
}
public abstract static class Container extends BlockContainerBase {
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;