aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0864-Avoid-Lazy-Initialization-for-Enum-Fields.patch
diff options
context:
space:
mode:
authormaxcom1 <[email protected]>2024-03-23 22:26:17 +0100
committerGitHub <[email protected]>2024-03-23 17:26:17 -0400
commitb6001403e9703cadaa6e8c8558e732b91c3c6d6e (patch)
treea8c57bbc334a8ad48d4ad2b43db335667b142bee /patches/server/0864-Avoid-Lazy-Initialization-for-Enum-Fields.patch
parent9ec7dfcbc41c6e625de0050b6997160a75df9f44 (diff)
downloadPaper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.tar.gz
Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.zip
Add methods to change entity physics (#10334)
Diffstat (limited to 'patches/server/0864-Avoid-Lazy-Initialization-for-Enum-Fields.patch')
-rw-r--r--patches/server/0864-Avoid-Lazy-Initialization-for-Enum-Fields.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/patches/server/0864-Avoid-Lazy-Initialization-for-Enum-Fields.patch b/patches/server/0864-Avoid-Lazy-Initialization-for-Enum-Fields.patch
new file mode 100644
index 0000000000..346c3fd86c
--- /dev/null
+++ b/patches/server/0864-Avoid-Lazy-Initialization-for-Enum-Fields.patch
@@ -0,0 +1,40 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Owen1212055 <[email protected]>
+Date: Sun, 14 May 2023 00:47:28 -0400
+Subject: [PATCH] Avoid Lazy Initialization for Enum Fields
+
+This patch is meant to get rid of any instances of lazy initialization that Minecraft introduces for enums.
+This has the possibility to create race condition issues, and generally don't make sense to be lazily done anyways.
+
+diff --git a/src/main/java/com/mojang/math/OctahedralGroup.java b/src/main/java/com/mojang/math/OctahedralGroup.java
+index a5a889d40228a0d6c7259caf8cb2554588d9aaf9..5009192046e5e083d14cef3f448b98b978dd54bf 100644
+--- a/src/main/java/com/mojang/math/OctahedralGroup.java
++++ b/src/main/java/com/mojang/math/OctahedralGroup.java
+@@ -111,6 +111,7 @@ public enum OctahedralGroup implements StringRepresentable {
+ this.permutation = axisTransformation;
+ this.transformation = (new Matrix3f()).scaling(flipX ? -1.0F : 1.0F, flipY ? -1.0F : 1.0F, flipZ ? -1.0F : 1.0F);
+ this.transformation.mul(axisTransformation.transformation());
++ this.initializeRotationDirections(); // Paper - Avoid Lazy Initialization for Enum Fields
+ }
+
+ private BooleanList packInversions() {
+@@ -139,7 +140,7 @@ public enum OctahedralGroup implements StringRepresentable {
+ return this.name;
+ }
+
+- public Direction rotate(Direction direction) {
++ public void initializeRotationDirections() { // Paper - Avoid Lazy Initialization for Enum Fields
+ if (this.rotatedDirections == null) {
+ this.rotatedDirections = Maps.newEnumMap(Direction.class);
+ Direction.Axis[] axiss = Direction.Axis.values();
+@@ -154,6 +155,10 @@ public enum OctahedralGroup implements StringRepresentable {
+ }
+ }
+
++ // Paper start - Avoid Lazy Initialization for Enum Fields
++ }
++ public Direction rotate(Direction direction) {
++ // Paper end - Avoid Lazy Initialization for Enum Fields
+ return this.rotatedDirections.get(direction);
+ }
+