Last 1.18 initial work. Getting ready for 1.19

This commit is contained in:
2022-06-10 18:58:26 +02:00
parent a49903cc69
commit 94e13cc65d
35 changed files with 639 additions and 97 deletions

View File

@@ -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();
}