mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-31 04:36:34 +00:00
Update to 1.19.3 (test)
This commit is contained in:
86
patches/server/0004-lithium-fast-util.patch
Normal file
86
patches/server/0004-lithium-fast-util.patch
Normal file
@@ -0,0 +1,86 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: 2No2Name <2No2Name@web.de>
|
||||
Date: Tue, 14 Dec 2021 12:04:01 -0500
|
||||
Subject: [PATCH] lithium: fast util
|
||||
|
||||
Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
|
||||
index c1172ba542bc07e0c780a50d5b4ce26ac04c1720..4ebbd0bbbecb07eb1950231cf0b3a7f25e09f1c9 100644
|
||||
--- a/src/main/java/net/minecraft/core/Direction.java
|
||||
+++ b/src/main/java/net/minecraft/core/Direction.java
|
||||
@@ -191,7 +191,7 @@ public enum Direction implements StringRepresentable {
|
||||
}
|
||||
|
||||
public Direction getOpposite() {
|
||||
- return from3DDataValue(this.oppositeIndex);
|
||||
+ return VALUES[this.oppositeIndex]; // JettPack - lithium: fast util
|
||||
}
|
||||
|
||||
public Direction getClockWise(Direction.Axis axis) {
|
||||
@@ -441,7 +441,7 @@ public enum Direction implements StringRepresentable {
|
||||
}
|
||||
|
||||
public static Direction getRandom(RandomSource random) {
|
||||
- return Util.getRandom(VALUES, random);
|
||||
+ return VALUES[random.nextInt(VALUES.length)]; // JettPack - lithium: fast util
|
||||
}
|
||||
|
||||
public static Direction getNearest(double x, double y, double z) {
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..c5ff387a78693b0d5b18653dae67eb4a03324ff7 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
@@ -16,6 +16,15 @@ public class AABB {
|
||||
public final double maxY;
|
||||
public final double maxZ;
|
||||
|
||||
+ // JettPack 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;
|
||||
+ }
|
||||
+ // JettPack end
|
||||
+
|
||||
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);
|
||||
@@ -81,11 +90,33 @@ public class AABB {
|
||||
}
|
||||
|
||||
public double min(Direction.Axis axis) {
|
||||
- return axis.choose(this.minX, this.minY, this.minZ);
|
||||
+ // JettPack 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();
|
||||
+ // JettPack end
|
||||
}
|
||||
|
||||
public double max(Direction.Axis axis) {
|
||||
- return axis.choose(this.maxX, this.maxY, this.maxZ);
|
||||
+ // JettPack 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();
|
||||
+ // JettPack end
|
||||
}
|
||||
|
||||
@Override
|
||||
Reference in New Issue
Block a user