Yatopia/patches/server/0017-lithium-MixinBox.patch
2020-06-27 19:00:18 +02:00

60 lines
1.7 KiB
Diff

From 48bab6a46e0ddd8b02af16b3d75d2ba81458d05f Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Mon, 11 May 2020 21:02:57 +0200
Subject: [PATCH] lithium MixinBox
---
.../net/minecraft/server/AxisAlignedBB.java | 34 ++++++++++++++++---
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java
index d54bf7140..661331bc0 100644
--- a/src/main/java/net/minecraft/server/AxisAlignedBB.java
+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java
@@ -155,12 +155,38 @@ public class AxisAlignedBB {
return new AxisAlignedBB(vec3d.x, vec3d.y, vec3d.z, vec3d.x + 1.0D, vec3d.y + 1.0D, vec3d.z + 1.0D);
}
+ /**
+ * @reason Simplify the code to better help the JVM optimize it
+ * @author JellySquid
+ */
public double a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- return enumdirection_enumaxis.a(this.minX, this.minY, this.minZ);
- }
-
+ switch (enumdirection_enumaxis) {
+ case X:
+ return this.minX;
+ case Y:
+ return this.minY;
+ case Z:
+ return this.minZ;
+ }
+
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * @reason Simplify the code to better help the JVM optimize it
+ * @author JellySquid
+ */
public double b(EnumDirection.EnumAxis enumdirection_enumaxis) {
- return enumdirection_enumaxis.a(this.maxX, this.maxY, this.maxZ);
+ switch (enumdirection_enumaxis) {
+ case X:
+ return this.maxX;
+ case Y:
+ return this.maxY;
+ case Z:
+ return this.maxZ;
+ }
+
+ throw new IllegalArgumentException();
}
public boolean equals(Object object) {
--
2.25.1.windows.1