Yatopia/patches/server/0059-Use-Glue-List-as-delegate-for-NonNullList.patch
Mykyta Komarnytskyy 2e894832ed Remove unstable/unnecessary patches
- Removed async entity tracking, as this is not a good implementation and has caused issues numerous times
- Removed "0037-Load-also-the-chunk-that-you-re-teleporting-to" as it does not fix the core problem
- Removed "0048-Fix-villager-dupe" as it was deemed unnecessary
2020-10-10 13:09:06 -07: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;
}