Last 1.18 initial work. Getting ready for 1.19
This commit is contained in:
@@ -9,11 +9,11 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
public class MathUtils {
|
||||
|
||||
public static VoxelShape rotateShape(Direction from, Direction to, VoxelShape shape) {
|
||||
VoxelShape[] buffer = new VoxelShape[]{ shape, Shapes.empty() };
|
||||
VoxelShape[] buffer = new VoxelShape[]{shape, Shapes.empty()};
|
||||
|
||||
int times = (to.ordinal() - from.ordinal() + 4) % 4;
|
||||
for (int i = 0; i < times; i++) {
|
||||
buffer[0].forAllBoxes((minX, minY, minZ, maxX, maxY, maxZ) -> buffer[1] = Shapes.or(buffer[1], Shapes.box(1-maxZ, minY, minX, 1-minZ, maxY, maxX)));
|
||||
buffer[0].forAllBoxes((minX, minY, minZ, maxX, maxY, maxZ) -> buffer[1] = Shapes.or(buffer[1], Shapes.box(1 - maxZ, minY, minX, 1 - minZ, maxY, maxX)));
|
||||
buffer[0] = buffer[1];
|
||||
buffer[1] = Shapes.empty();
|
||||
}
|
||||
|
Reference in New Issue
Block a user