mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Add missing Rotate and Mirror methods to DirectionalBlock
This commit is contained in:
parent
87b0261720
commit
3b180faf60
1 changed files with 12 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue