mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Add rotation and mirror code to FullyDirectionalBlock
This commit is contained in:
parent
62ff6acddb
commit
b3bac386ad
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;
|
||||
|
@ -29,6 +31,16 @@ public abstract class FullyDirectionalBlock extends BlockBase {
|
|||
return this.stateDefinition.getOwner().defaultBlockState().setValue(FACING, Direction.NORTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState rotate(BlockState pState, Rotation pRotation) {
|
||||
return pState.setValue(FACING, pRotation.rotate(pState.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState mirror(BlockState pState, Mirror pMirror) {
|
||||
return pState.rotate(pMirror.getRotation(pState.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
||||
builder.add(FACING);
|
||||
|
|
Loading…
Reference in a new issue