Yatopia/patches/server/0060-Use-Glue-List-as-delegate-for-NonNullList.patch
budgidiere c09ee99f7e
Hydrinity optimizations & Lithium generation patches & more
Closes #257 

Ports 2 patches from Purpur: Infinity-bow-settings & Allow-infinite-and-mending-enchantments-together
Added an option for infinity with no arrows too.

Option for custom locale has come! You can put a locale.json file in your server folder to change it. 

We've got the finest patches from Hydrinity ( Mykyta approved & allowed ) too.

We have some amazing new options in yatopia.yml, we're gonna have documentation for them soon so stay tuned!
Last but not least, chunk generation patches. We've tested them extensively so no weirdness happens.

Thanks for using Yatopia as your production server software.

Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
2020-10-27 21:15:13 +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;
}