diff --git a/paper-server/patches/sources/com/mojang/datafixers/util/Either.java.patch b/paper-server/patches/sources/com/mojang/datafixers/util/Either.java.patch new file mode 100644 index 0000000000..810603f8a3 --- /dev/null +++ b/paper-server/patches/sources/com/mojang/datafixers/util/Either.java.patch @@ -0,0 +1,38 @@ +--- a/com/mojang/datafixers/util/Either.java ++++ b/com/mojang/datafixers/util/Either.java +@@ -22,7 +22,7 @@ + } + + private static final class Left extends Either { +- private final L value; ++ private final L value; private Optional valueOptional; // Paper - Perf: Reduce Either Optional allocation + + public Left(final L value) { + this.value = value; +@@ -51,7 +51,7 @@ + + @Override + public Optional left() { +- return Optional.of(value); ++ return this.valueOptional == null ? this.valueOptional = Optional.of(this.value) : this.valueOptional; // Paper - Perf: Reduce Either Optional allocation + } + + @Override +@@ -83,7 +83,7 @@ + } + + private static final class Right extends Either { +- private final R value; ++ private final R value; private Optional valueOptional; // Paper - Perf: Reduce Either Optional allocation + + public Right(final R value) { + this.value = value; +@@ -117,7 +117,7 @@ + + @Override + public Optional right() { +- return Optional.of(value); ++ return this.valueOptional == null ? this.valueOptional = Optional.of(this.value) : this.valueOptional; // Paper - Perf: Reduce Either Optional allocation + } + + @Override