From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Mykyta Komarn 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 extends AbstractList { - private final List a; + private final net.yatopia.server.list.GlueList a; // Yatopia private final E b; public static NonNullList a() { @@ -22,7 +22,7 @@ public class NonNullList extends AbstractList { Object[] aobject = new Object[i]; Arrays.fill(aobject, e0); - return new NonNullList<>(Arrays.asList(aobject), e0); + return new NonNullList<>((List) Arrays.asList(aobject), e0); // Yatopia - decompile fix } @SafeVarargs @@ -31,11 +31,18 @@ public class NonNullList extends AbstractList { } protected NonNullList() { - this(Lists.newArrayList(), (Object) null); + this(new net.yatopia.server.list.GlueList<>(), null); // Yatopia - decompile fix & GlueList } protected NonNullList(List 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) list; + } + //this.a = list; + // Yatopia end this.b = e0; }