Skip to content

Commit

Permalink
Add rotate and mirror to BlockSlate.java (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamsTheNerd authored Nov 5, 2024
2 parents e731b82 + ceae1d3 commit 481d883
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
Expand Down Expand Up @@ -230,4 +232,12 @@ protected static Direction getConnectedDirection(BlockState pState) {
default -> pState.getValue(FACING);
};
}

public BlockState rotate(BlockState state, Rotation rot) {
return (BlockState) state.setValue(FACING, rot.rotate((Direction) state.getValue(FACING)));
}

public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation((Direction) state.getValue(FACING)));
}
}

0 comments on commit 481d883

Please sign in to comment.