diff options
author | Fabrizio La Rosa <[email protected]> | 2024-09-08 22:12:36 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-09-08 22:12:36 +0200 |
commit | 971a7a5511b3c656b96a9be66ec9848915eb6d3d (patch) | |
tree | 14db760bce66a267a4e0bdbb7da01a675c2bf750 /patches/server/0816-Avoid-Lazy-Initialization-for-Enum-Fields.patch | |
parent | b09eaf2e8d15fea856005f6727638b753850c8d1 (diff) | |
download | Paper-971a7a5511b3c656b96a9be66ec9848915eb6d3d.tar.gz Paper-971a7a5511b3c656b96a9be66ec9848915eb6d3d.zip |
Add Decorated Pot Cracked API (#11365)
Diffstat (limited to 'patches/server/0816-Avoid-Lazy-Initialization-for-Enum-Fields.patch')
-rw-r--r-- | patches/server/0816-Avoid-Lazy-Initialization-for-Enum-Fields.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/patches/server/0816-Avoid-Lazy-Initialization-for-Enum-Fields.patch b/patches/server/0816-Avoid-Lazy-Initialization-for-Enum-Fields.patch new file mode 100644 index 0000000000..becde16ce8 --- /dev/null +++ b/patches/server/0816-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 0a3b6b8e250bd35530c05a1cdaf2eb8a9af4c72b..9aa82fc757c67a9456b2bdec744c0cb474d64df6 100644 +--- a/src/main/java/com/mojang/math/OctahedralGroup.java ++++ b/src/main/java/com/mojang/math/OctahedralGroup.java +@@ -110,6 +110,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() { +@@ -138,7 +139,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(); +@@ -153,6 +154,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); + } + |