Yatopia/patches/server/0063-Use-GlueList-as-delegate-for-NonNullList.patch
Ivan Pekov e14836e8ea
Drop lithium noise patches & voronoi
Fixes #226

All these were doing some kind of weirdness to the chunk generation, thats why they were dropped.
Unfortunately this will decrease performance, but bugs is our priority before speed.
2020-10-01 19:51:56 +03: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 GlueList 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;
}