Yatopia/patches/server/0053-Use-Glue-List-as-delegate-for-NonNullList.patch
Ivan Pekov 37e61be6c2
Updated upstream and sidestream (Tuinity/Purpur)
Closes #289
Also dropped some patches which are useless.

Changes in Purpur: Paper upstream updates
Changes in Tuinity: Paper updated
2020-11-20 09:14:39 +02:00

50 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mykyta Komarn <nkomarn@hotmail.com>
Date: Thu, 1 Oct 2020 06:52:35 -0700
Subject: [PATCH] Use Glue List as delegate for NonNullList
diff --git a/src/main/java/net/minecraft/server/NonNullList.java b/src/main/java/net/minecraft/server/NonNullList.java
index 2d3c406a05b9710d40471aa61c3540dbc971c1e3..52b263fc257e5e8889aa8285331581b7d8142c44 100644
--- a/src/main/java/net/minecraft/server/NonNullList.java
+++ b/src/main/java/net/minecraft/server/NonNullList.java
@@ -10,7 +10,7 @@ import org.apache.commons.lang3.Validate;
public class NonNullList<E> extends AbstractList<E> {
- private final List<E> a;
+ private final net.yatopia.server.list.GlueList<E> a; // Yatopia
private final E b;
public static <E> NonNullList<E> a() {
@@ -22,7 +22,7 @@ public class NonNullList<E> extends AbstractList<E> {
Object[] aobject = new Object[i];
Arrays.fill(aobject, e0);
- return new NonNullList<>(Arrays.asList(aobject), e0);
+ return new NonNullList<>((List<E>) Arrays.asList(aobject), e0); // Yatopia - decompile fix
}
@SafeVarargs
@@ -31,11 +31,18 @@ public class NonNullList<E> extends AbstractList<E> {
}
protected NonNullList() {
- this(Lists.newArrayList(), (Object) null);
+ this(new net.yatopia.server.list.GlueList<>(), null); // Yatopia - decompile fix & GlueList
}
protected NonNullList(List<E> list, @Nullable E e0) {
- this.a = list;
+ // Yatopia start
+ if (!(list instanceof net.yatopia.server.list.GlueList)) {
+ this.a = new net.yatopia.server.list.GlueList<>(list);
+ } else {
+ this.a = (net.yatopia.server.list.GlueList<E>) list;
+ }
+ //this.a = list;
+ // Yatopia end
this.b = e0;
}