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();
|
||||
}
|
||||
|
@@ -25,7 +25,8 @@ public class OptifineUtils {
|
||||
Class ofConfigClass = Class.forName("net.optifine.Config");
|
||||
Method rrField = ofConfigClass.getMethod("isRenderRegions");
|
||||
return (boolean) rrField.invoke(null);
|
||||
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
|
||||
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException |
|
||||
IllegalAccessException e) {
|
||||
// Optifine is probably not present. Ignore the error
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
|
@@ -39,12 +39,15 @@ public class RenderUtils {
|
||||
public static int alpha(int pPackedColor) {
|
||||
return pPackedColor >>> 24;
|
||||
}
|
||||
|
||||
public static int red(int pPackedColor) {
|
||||
return pPackedColor >> 16 & 255;
|
||||
}
|
||||
|
||||
public static int green(int pPackedColor) {
|
||||
return pPackedColor >> 8 & 255;
|
||||
}
|
||||
|
||||
public static int blue(int pPackedColor) {
|
||||
return pPackedColor & 255;
|
||||
}
|
||||
|
Reference in New Issue
Block a user