mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2025-01-22 08:01:54 +01:00
Merge branch 'ver/1.16.5' of github.com:YatopiaMC/Yatopia into staging/1.16.5
This commit is contained in:
commit
6b6b528af2
@ -241,7 +241,6 @@ # Patches
|
||||
| server | Multi-Threaded Server Ticking Vanilla | Spottedleaf | |
|
||||
| server | Multi-Threaded ticking CraftBukkit | Spottedleaf | |
|
||||
| server | Name craft scheduler threads according to the plugin using | Spottedleaf | |
|
||||
| server | New Network System | Hugo Planque | Ivan Pekov |
|
||||
| server | New nbt cache | Hugo Planque | |
|
||||
| server | Nuke streams off BlockPosition | Ivan Pekov | |
|
||||
| server | Nuke streams off SectionPosition | Ivan Pekov | |
|
||||
@ -292,7 +291,6 @@ # Patches
|
||||
| server | Players should not cram to death | William Blake Galbreath | |
|
||||
| server | Populator seed controls | Spottedleaf | |
|
||||
| server | Port hydrogen | JellySquid | |
|
||||
| server | Port krypton | Andrew Steinborn | Hugo Planque |
|
||||
| server | Prevent light queue overfill when no players are online | Spottedleaf | |
|
||||
| server | Prevent long map entry creation in light engine | Spottedleaf | |
|
||||
| server | Prevent unload() calls removing tickets for sync loads | Spottedleaf | |
|
||||
|
@ -333,177 +333,6 @@ index 0000000000000000000000000000000000000000..a5314a0396f4a8f373d855e873820ddd
|
||||
+ return this.indices.addOrGet(ints);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/BiomeStorage.java b/src/main/java/net/minecraft/server/BiomeStorage.java
|
||||
index b7f5c932197529c0ea045cfe696fd5da1ccc7202..af6245ba0c6b1389703722596ab7aa50deaf9e9f 100644
|
||||
--- a/src/main/java/net/minecraft/server/BiomeStorage.java
|
||||
+++ b/src/main/java/net/minecraft/server/BiomeStorage.java
|
||||
@@ -1,23 +1,32 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ShortMap;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ShortOpenHashMap;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class BiomeStorage implements BiomeManager.Provider {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
- private static final int e = (int) Math.round(Math.log(16.0D) / Math.log(2.0D)) - 2;
|
||||
+ private static final int e = (int) Math.round(Math.log(16.0D) / Math.log(2.0D)) - 2; public static final int HORIZONTAL_SECTION_COUNT = e; // Yatopia - OBFHELPER
|
||||
private static final int f = (int) Math.round(Math.log(256.0D) / Math.log(2.0D)) - 2;
|
||||
public static final int a = 1 << BiomeStorage.e + BiomeStorage.e + BiomeStorage.f;
|
||||
- public static final int b = (1 << BiomeStorage.e) - 1;
|
||||
- public static final int c = (1 << BiomeStorage.f) - 1;
|
||||
+ public static final int b = (1 << BiomeStorage.e) - 1; public static final int HORIZONTAL_BIT_MASK = b; // Yatopia - OBFHELPER
|
||||
+ public static final int c = (1 << BiomeStorage.f) - 1; public static final int VERTICAL_BIT_MASK = c; // Yatopia - OBFHELPER
|
||||
public final Registry<BiomeBase> registry;
|
||||
- private final BiomeBase[] h;
|
||||
+ private BiomeBase[] h; private BiomeBase[] getData() { return h; } // Yatopia - OBFHELPER , remove final
|
||||
+
|
||||
+ // Yatopia start - Port hydrogen
|
||||
+ private BiomeBase[] palette;
|
||||
+ private DataBits intArray;
|
||||
+ // Yatopia end
|
||||
|
||||
public BiomeStorage(Registry<BiomeBase> registry, BiomeBase[] abiomebase) {
|
||||
this.registry = registry;
|
||||
this.h = abiomebase;
|
||||
+ this.createCompact(); // Yatopia - Port hydrogen
|
||||
}
|
||||
|
||||
private BiomeStorage(Registry<BiomeBase> registry) {
|
||||
@@ -37,6 +46,7 @@ public class BiomeStorage implements BiomeManager.Provider {
|
||||
this.h[k] = worldchunkmanager.getBiome(i + l, i1, j + j1);
|
||||
}
|
||||
|
||||
+ this.createCompact(); // Yatopia - Port hydrogen
|
||||
}
|
||||
|
||||
public BiomeStorage(Registry<BiomeBase> registry, ChunkCoordIntPair chunkcoordintpair, WorldChunkManager worldchunkmanager, @Nullable int[] aint) {
|
||||
@@ -67,9 +77,11 @@ public class BiomeStorage implements BiomeManager.Provider {
|
||||
}
|
||||
}
|
||||
|
||||
+ this.createCompact(); // Yatopia - Port hydrogen
|
||||
}
|
||||
|
||||
public int[] a() {
|
||||
+ /* // Yatopia start - Port hydrogen
|
||||
int[] aint = new int[this.h.length];
|
||||
|
||||
for (int i = 0; i < this.h.length; ++i) {
|
||||
@@ -77,15 +89,33 @@ public class BiomeStorage implements BiomeManager.Provider {
|
||||
}
|
||||
|
||||
return aint;
|
||||
+ */
|
||||
+ int size = this.intArray.getSize();
|
||||
+ int[] array = new int[size];
|
||||
+
|
||||
+ for (int i = 0; i < size; ++i) {
|
||||
+ array[i] = this.registry.a(this.palette[this.intArray.get(i)]);
|
||||
+ }
|
||||
+
|
||||
+ return array;
|
||||
+ // Yatopia end
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeBase getBiome(int i, int j, int k) {
|
||||
+ /* // Yatopia start - Port hydrogen
|
||||
int l = i & BiomeStorage.b;
|
||||
int i1 = MathHelper.clamp(j, 0, BiomeStorage.c);
|
||||
int j1 = k & BiomeStorage.b;
|
||||
|
||||
return this.h[i1 << BiomeStorage.e + BiomeStorage.e | j1 << BiomeStorage.e | l];
|
||||
+ */
|
||||
+ int x = i & HORIZONTAL_BIT_MASK;
|
||||
+ int y = MathHelper.clamp(j, 0, VERTICAL_BIT_MASK);
|
||||
+ int z = k & HORIZONTAL_BIT_MASK;
|
||||
+
|
||||
+ return this.palette[this.intArray.get(y << HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT | z << HORIZONTAL_SECTION_COUNT | x)];
|
||||
+ // Yatopia end
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -94,7 +124,74 @@ public class BiomeStorage implements BiomeManager.Provider {
|
||||
int i1 = MathHelper.clamp(j, 0, BiomeStorage.c);
|
||||
int j1 = k & BiomeStorage.b;
|
||||
|
||||
- this.h[i1 << BiomeStorage.e + BiomeStorage.e | j1 << BiomeStorage.e | l] = biome;
|
||||
+ this.palette[this.intArray.get(l << HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT | i1 << HORIZONTAL_SECTION_COUNT | j1)] = biome; // Yatopia - Port Hydrogen
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+
|
||||
+ // Yatopia Start - Port Hydrogen
|
||||
+ private void createCompact() {
|
||||
+ if (this.intArray != null || this.getData()[0] == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ Reference2ShortOpenHashMap<BiomeBase> paletteTable = this.createPalette();
|
||||
+ BiomeBase[] paletteIndexed = new BiomeBase[paletteTable.size()];
|
||||
+
|
||||
+ for (Reference2ShortMap.Entry<BiomeBase> entry : paletteTable.reference2ShortEntrySet()) {
|
||||
+ paletteIndexed[entry.getShortValue()] = entry.getKey();
|
||||
+ }
|
||||
+
|
||||
+ int packedIntSize = Math.max(2, MathHelper.e(paletteTable.size()));
|
||||
+ DataBits integerArray = new DataBits(packedIntSize, a);
|
||||
+
|
||||
+ BiomeBase prevBiome = null;
|
||||
+ short prevId = -1;
|
||||
+
|
||||
+ for (int i = 0; i < this.getData().length; i++) {
|
||||
+ BiomeBase biome = this.getData()[i];
|
||||
+ short id;
|
||||
+
|
||||
+ if (prevBiome == biome) {
|
||||
+ id = prevId;
|
||||
+ } else {
|
||||
+ id = paletteTable.getShort(biome);
|
||||
+
|
||||
+ if (id < 0) {
|
||||
+ throw new IllegalStateException("Palette is missing entry: " + biome);
|
||||
+ }
|
||||
+
|
||||
+ prevId = id;
|
||||
+ prevBiome = biome;
|
||||
+ }
|
||||
+
|
||||
+ integerArray.set(i, id);
|
||||
+ }
|
||||
+
|
||||
+ this.palette = paletteIndexed;
|
||||
+ this.intArray = integerArray;
|
||||
+ this.h = null;
|
||||
+ }
|
||||
+
|
||||
+ private Reference2ShortOpenHashMap<BiomeBase> createPalette() {
|
||||
+ Reference2ShortOpenHashMap<BiomeBase> map = new Reference2ShortOpenHashMap<>();
|
||||
+ map.defaultReturnValue(Short.MIN_VALUE);
|
||||
+
|
||||
+ BiomeBase prevObj = null;
|
||||
+ short id = 0;
|
||||
+
|
||||
+ for (BiomeBase obj : this.getData()) {
|
||||
+ if (obj == prevObj) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (map.getShort(obj) < 0) {
|
||||
+ map.put(obj, id++);
|
||||
+ }
|
||||
+
|
||||
+ prevObj = obj;
|
||||
+ }
|
||||
+
|
||||
+ return map;
|
||||
+ } // Yatopia end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 8b7fd21e6b366196fbc9cd44a340335c4cf9205f..8b8ecc2d8925b3c209d99e101f6e478b08d86db9 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
@ -27,11 +27,11 @@ index 76aac1b131f314775e418339e434f4f2da2ad619..46aef6e142c7ec0cf2d4ac53a2db4987
|
||||
}
|
||||
// Paper end - fix sand duping
|
||||
diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
||||
index c67654e8701b9da6499d442048429149daae7150..ac73a0629347a3d5842f00ee8d28c288acdec375 100644
|
||||
index c2dc5265552ebd429111253c70481003a4be29dd..a9286dbb9a9d2dd5b0d1331b756a9d66f226be0c 100644
|
||||
--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
||||
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
||||
@@ -284,4 +284,8 @@ public class YatopiaConfig {
|
||||
debugNetwork = getBoolean("network.debug", debugNetwork);
|
||||
@@ -271,4 +271,8 @@ public class YatopiaConfig {
|
||||
logPlayerLoginLoc = getBoolean("settings.log-player-login-location", logPlayerLoginLoc);
|
||||
}
|
||||
|
||||
+ public static boolean allowSandDupe = false;
|
@ -6,7 +6,7 @@ Subject: [PATCH] New nbt cache
|
||||
The goal of this patch is to reduce I/O operations from the main thread while saving player data and also to avoid too many I/O operations while reading NBT Player file by using a cache (Which start to delete the oldest data when there is too much player compared to the map size)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index a1c2bea7c93433434b4e4dfd0bb4b9620657c40d..c7f1bf9d7fd86a1afbc1e4bb56dc56cef367283e 100644
|
||||
index 87cf9cd88d1fb5ae70d19e5618ebfb67d281304a..27cdbcdad0ae7be6a2aa8b9982bcd80205c48c9b 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -824,7 +824,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
Loading…
Reference in New Issue
Block a user