aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0510-Inline-shift-direction-fields.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0510-Inline-shift-direction-fields.patch')
-rw-r--r--patches/server/0510-Inline-shift-direction-fields.patch17
1 files changed, 9 insertions, 8 deletions
diff --git a/patches/server/0510-Inline-shift-direction-fields.patch b/patches/server/0510-Inline-shift-direction-fields.patch
index 4f26750f0e..88027eb7c0 100644
--- a/patches/server/0510-Inline-shift-direction-fields.patch
+++ b/patches/server/0510-Inline-shift-direction-fields.patch
@@ -7,22 +7,23 @@ Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is
critical section for much of the server, including the lighting engine.
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
-index 3abec6de94f0ef1d788320e33653c598887f17ca..073c717bb676b9e99aada00c349fb7eee91df1e7 100644
+index 14b57310811bb930b40396a02b263cdbccb1076b..75694cfd7d8adde6b9246518c20fe75774297a57 100644
--- a/src/main/java/net/minecraft/core/Direction.java
+++ b/src/main/java/net/minecraft/core/Direction.java
-@@ -52,6 +52,11 @@ public enum Direction implements StringRepresentable {
- })).toArray((i) -> {
- return new Direction[i];
- });
+@@ -48,6 +48,12 @@ public enum Direction implements StringRepresentable {
+ .sorted(Comparator.comparingInt(direction -> direction.data2d))
+ .toArray(Direction[]::new);
+
+ // Paper start - Perf: Inline shift direction fields
+ private final int adjX;
+ private final int adjY;
+ private final int adjZ;
+ // Paper end - Perf: Inline shift direction fields
-
++
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) {
this.data3d = id;
-@@ -61,6 +66,11 @@ public enum Direction implements StringRepresentable {
+ this.data2d = idHorizontal;
+@@ -56,6 +62,11 @@ public enum Direction implements StringRepresentable {
this.axis = axis;
this.axisDirection = direction;
this.normal = vector;
@@ -34,7 +35,7 @@ index 3abec6de94f0ef1d788320e33653c598887f17ca..073c717bb676b9e99aada00c349fb7ee
}
public static Direction[] orderedByNearest(Entity entity) {
-@@ -348,15 +358,15 @@ public enum Direction implements StringRepresentable {
+@@ -219,15 +230,15 @@ public enum Direction implements StringRepresentable {
}
public int getStepX() {