geforkt von Mirrors/Paper
ce270e1412
Upstream has released updates that appears 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: b2f1908c SPIGOT-5783: Add helpful info to UnknownDependencyException e4f46260 SPIGOT-2623: Add EntityEquipment methods to get/set ItemStacks by slot. 529a9a69 SPIGOT-5751: Clarify behaviour of block drop-related API methods CraftBukkit Changes:8ea9b138
Remove outdated build delay.ffc2b251
Revert "#675: Fix redirected CommandNodes sometimes not being properly redirected"cb701f6b
#675: Fix redirected CommandNodes sometimes not being properly redirectedc9d7c16b
SPIGOT-2623: Add EntityEquipment methods to get/set ItemStacks by slot.fad2494a
#673: Fix Craftworld#isChunkLoaded8637ec00
SPIGOT-5751: Made breakNaturally and getDrops returns the correct item if no argument is given Spigot Changes: a99063f7 Rebuild patches Fixes #3602
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
|