geforkt von Mirrors/Paper
ef0e5a642d
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API 48c0c547 PR-786: Add methods to get sounds from entities CraftBukkit Changes: 5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event 4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation 4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API e5d6a9bbf PR-1100: Add methods to get sounds from entities b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta Spigot Changes: 4c157bb4 Rebuild patches
49 Zeilen
2.1 KiB
Diff
49 Zeilen
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
|
Date: Mon, 6 Apr 2020 18:35:09 -0700
|
|
Subject: [PATCH] Reduce Either Optional allocation
|
|
|
|
In order to get chunk values, we shouldn't need to create
|
|
an optional each time.
|
|
|
|
diff --git a/src/main/java/com/mojang/datafixers/util/Either.java b/src/main/java/com/mojang/datafixers/util/Either.java
|
|
index a90adac7bd7ebd423f480e9ae0f44cb9d521fa4f..3f65fe71024928e35111fc6719a290aab9a6859e 100644
|
|
--- a/src/main/java/com/mojang/datafixers/util/Either.java
|
|
+++ b/src/main/java/com/mojang/datafixers/util/Either.java
|
|
@@ -22,7 +22,7 @@ public abstract class Either<L, R> implements App<Either.Mu<R>, L> {
|
|
}
|
|
|
|
private static final class Left<L, R> extends Either<L, R> {
|
|
- private final L value;
|
|
+ private final L value; private Optional<L> valueOptional; // Paper - reduce the optional allocation...
|
|
|
|
public Left(final L value) {
|
|
this.value = value;
|
|
@@ -51,7 +51,7 @@ public abstract class Either<L, R> implements App<Either.Mu<R>, L> {
|
|
|
|
@Override
|
|
public Optional<L> left() {
|
|
- return Optional.of(value);
|
|
+ return this.valueOptional == null ? this.valueOptional = Optional.of(this.value) : this.valueOptional; // Paper - reduce the optional allocation...
|
|
}
|
|
|
|
@Override
|
|
@@ -83,7 +83,7 @@ public abstract class Either<L, R> implements App<Either.Mu<R>, L> {
|
|
}
|
|
|
|
private static final class Right<L, R> extends Either<L, R> {
|
|
- private final R value;
|
|
+ private final R value; private Optional<R> valueOptional; // Paper - reduce the optional allocation...
|
|
|
|
public Right(final R value) {
|
|
this.value = value;
|
|
@@ -117,7 +117,7 @@ public abstract class Either<L, R> implements App<Either.Mu<R>, L> {
|
|
|
|
@Override
|
|
public Optional<R> right() {
|
|
- return Optional.of(value);
|
|
+ return this.valueOptional == null ? this.valueOptional = Optional.of(this.value) : this.valueOptional; // Paper - reduce the optional allocation...
|
|
}
|
|
|
|
@Override
|