mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@efc76215 Add missing copper blocks to waxables and weatherables options (#1712) PurpurMC/Purpur@3ca0d663 Updated Upstream (Paper) PurpurMC/Purpur@917675d0 Updated Upstream (Paper) PurpurMC/Purpur@ffe2f809 Add option to disable Warden Sonic Boom (#1713)
91 lines
3.4 KiB
Diff
91 lines
3.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Mon, 24 Feb 2025 19:10:17 +0300
|
|
Subject: [PATCH] lithium: fast_util
|
|
|
|
This patch is based on the following mixins:
|
|
* "net/caffeinemc/mods/lithium/mixin/math/fast_util/DirectionMixin.java"
|
|
* "net/caffeinemc/mods/lithium/mixin/math/fast_util/AABBMixin.java"
|
|
By: 2No2Name <2No2Name@web.de>
|
|
As part of: Lithium (https://github.com/CaffeineMC/lithium)
|
|
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
|
|
|
diff --git a/net/minecraft/core/Direction.java b/net/minecraft/core/Direction.java
|
|
index cbb743ce94f08b624a64555d057ed04286094ba9..15360c644f559f16c319ddd10f6171a9b9cc7ac4 100644
|
|
--- a/net/minecraft/core/Direction.java
|
|
+++ b/net/minecraft/core/Direction.java
|
|
@@ -225,7 +225,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
|
|
}
|
|
|
|
public Direction getOpposite() {
|
|
- return this.opposite; // Paper - optimise collisions
|
|
+ return VALUES[this.oppositeIndex]; // DivineMC - lithium: fast_util
|
|
}
|
|
|
|
public Direction getClockWise(Direction.Axis axis) {
|
|
@@ -358,7 +358,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
|
|
}
|
|
|
|
public static Direction getRandom(RandomSource random) {
|
|
- return Util.getRandom(VALUES, random);
|
|
+ return VALUES[random.nextInt(VALUES.length)]; // DivineMC - lithium: fast_util
|
|
}
|
|
|
|
public static Direction getApproximateNearest(double x, double y, double z) {
|
|
diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java
|
|
index 529bd339441fde279ed81573ca5339a0837b3b87..b26ea727a7867a74edd7b0fb60965fe9c2fcb474 100644
|
|
--- a/net/minecraft/world/phys/AABB.java
|
|
+++ b/net/minecraft/world/phys/AABB.java
|
|
@@ -19,6 +19,15 @@ public class AABB {
|
|
public final double maxY;
|
|
public final double maxZ;
|
|
|
|
+ // DivineMC start - lithium: fast_util
|
|
+ static {
|
|
+ assert Direction.Axis.X.ordinal() == 0;
|
|
+ assert Direction.Axis.Y.ordinal() == 1;
|
|
+ assert Direction.Axis.Z.ordinal() == 2;
|
|
+ assert Direction.Axis.values().length == 3;
|
|
+ }
|
|
+ // DivineMC end - lithium: fast_util
|
|
+
|
|
public AABB(double x1, double y1, double z1, double x2, double y2, double z2) {
|
|
this.minX = Math.min(x1, x2);
|
|
this.minY = Math.min(y1, y2);
|
|
@@ -80,11 +89,33 @@ public class AABB {
|
|
}
|
|
|
|
public double min(Direction.Axis axis) {
|
|
- return axis.choose(this.minX, this.minY, this.minZ);
|
|
+ // DivineMC start - lithium: fast_util
|
|
+ switch (axis.ordinal()) {
|
|
+ case 0: // X
|
|
+ return this.minX;
|
|
+ case 1: // Y
|
|
+ return this.minY;
|
|
+ case 2: // Z
|
|
+ return this.minZ;
|
|
+ }
|
|
+
|
|
+ throw new IllegalArgumentException();
|
|
+ // DivineMC end - lithium: fast_util
|
|
}
|
|
|
|
public double max(Direction.Axis axis) {
|
|
- return axis.choose(this.maxX, this.maxY, this.maxZ);
|
|
+ // DivineMC start - lithium: fast_util
|
|
+ switch (axis.ordinal()) {
|
|
+ case 0: // X
|
|
+ return this.maxX;
|
|
+ case 1: // Y
|
|
+ return this.maxY;
|
|
+ case 2: // Z
|
|
+ return this.maxZ;
|
|
+ }
|
|
+
|
|
+ throw new IllegalArgumentException();
|
|
+ // DivineMC end - lithium: fast_util
|
|
}
|
|
|
|
@Override
|