mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-24 01:58:05 +01:00
parent
21c8252193
commit
e1a085de4c
@ -119,6 +119,5 @@ # Patches
|
||||
| server | lithium VoxelShapesMixin | JellySquid | Ivan Pekov |
|
||||
| server | lithium collision optimizations | JellySquid | Ivan Pekov |
|
||||
| server | lithium enum_values | JellySquid | |
|
||||
| server | lithium serialization improvements | JellySquid | |
|
||||
| server | lithium-MixinChunkGeneratorAbstract | JellySquid | tr7zw |
|
||||
| server | lithium-MixinDataWatcher | JellySquid | tr7zw |
|
||||
|
2
Tuinity
2
Tuinity
@ -1 +1 @@
|
||||
Subproject commit a63298fbc609c71f21cedfa118aabf091230875b
|
||||
Subproject commit f2ac6495ff13f7123bbca4180832723c699e3141
|
@ -19,10 +19,10 @@ index b42091752981a1f309ab350e9a394092cb334824..ba03cb48d483b6955d4635e9071fff5b
|
||||
+ // Yatopia end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 62cc1c74c11f56dcbd1e24e9c5478497742e6351..59787c474f1a17dff156e74107f880ac083a7cb3 100644
|
||||
index bfe842364ee0a4bf39dacdbb6972477d57a4ef8a..8d172d58b7c935f608ac49d3376d5b90bdf0abdd 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1776,4 +1776,15 @@ public final class Bukkit {
|
||||
@@ -1787,4 +1787,15 @@ public final class Bukkit {
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
}
|
||||
@ -39,10 +39,10 @@ index 62cc1c74c11f56dcbd1e24e9c5478497742e6351..59787c474f1a17dff156e74107f880ac
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 46c4d98ce32a0b1d8cfd391f2c7a9566a045cb55..e5170b299bb4252a7910c1aa5a607dbc3b30a0d1 100644
|
||||
index 740a86a808bf0470a755b5f728640557733bfbca..b8f89453ed7771cc92ea6459830675b7a14f0d44 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1455,6 +1455,54 @@ public interface Server extends PluginMessageRecipient {
|
||||
@@ -1464,6 +1464,54 @@ public interface Server extends PluginMessageRecipient {
|
||||
}
|
||||
// Tuinity end - add config to timings report
|
||||
|
||||
@ -97,7 +97,7 @@ index 46c4d98ce32a0b1d8cfd391f2c7a9566a045cb55..e5170b299bb4252a7910c1aa5a607dbc
|
||||
/**
|
||||
* Sends the component to the player
|
||||
*
|
||||
@@ -1555,4 +1603,13 @@ public interface Server extends PluginMessageRecipient {
|
||||
@@ -1564,4 +1612,13 @@ public interface Server extends PluginMessageRecipient {
|
||||
@NotNull
|
||||
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
|
||||
// Paper end
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add getLastTickMs api
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 59787c474f1a17dff156e74107f880ac083a7cb3..74bb5aa790d072c130a05d0e59afdb1cbf359440 100644
|
||||
index 8d172d58b7c935f608ac49d3376d5b90bdf0abdd..808574e7d40346fd0b923b14b534730cbfd10aae 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1787,4 +1787,10 @@ public final class Bukkit {
|
||||
@@ -1798,4 +1798,10 @@ public final class Bukkit {
|
||||
return server.isLagging();
|
||||
}
|
||||
// Purpur end
|
||||
@ -20,10 +20,10 @@ index 59787c474f1a17dff156e74107f880ac083a7cb3..74bb5aa790d072c130a05d0e59afdb1c
|
||||
+ // Yatopia end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index e5170b299bb4252a7910c1aa5a607dbc3b30a0d1..bac4710b98f993875d52548b9fd1538f821fb866 100644
|
||||
index b8f89453ed7771cc92ea6459830675b7a14f0d44..12cb98afc6845a1efdd83ff3389f12d0b3b80a79 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1612,4 +1612,13 @@ public interface Server extends PluginMessageRecipient {
|
||||
@@ -1621,4 +1621,13 @@ public interface Server extends PluginMessageRecipient {
|
||||
*/
|
||||
boolean isLagging();
|
||||
// Purpur end
|
||||
|
@ -1830,7 +1830,7 @@ index a40eff6d66cb3518d1773856dfdf2da816c52470..00000000000000000000000000000000
|
||||
- }
|
||||
- }
|
||||
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
||||
index 375f974e391f0f233ad5f0bd755471ec68d7bf6d..3833a6dfdd507f2d2bf6736e1b7fcf80188a419f 100644
|
||||
index 1ca8dcf2fbcf6a920c18d470f7da90b6daa50b7b..99c88522ad28ceb9489783960e9ff1e3deb7250b 100644
|
||||
--- a/src/main/java/net/minecraft/server/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
||||
@@ -105,7 +105,7 @@ public class Explosion {
|
||||
@ -1842,7 +1842,7 @@ index 375f974e391f0f233ad5f0bd755471ec68d7bf6d..3833a6dfdd507f2d2bf6736e1b7fcf80
|
||||
for (int k = 0; k < 16; ++k) {
|
||||
for (i = 0; i < 16; ++i) {
|
||||
for (j = 0; j < 16; ++j) {
|
||||
@@ -284,7 +284,7 @@ public class Explosion {
|
||||
@@ -293,7 +293,7 @@ public class Explosion {
|
||||
if (!iblockdata.isAir() && iblockdata.isDestroyable()) { // Paper
|
||||
BlockPosition blockposition1 = blockposition.immutableCopy();
|
||||
|
||||
@ -2277,7 +2277,7 @@ index 759862aba781ec6f1ae0c9a76c4ab6352d603a4c..00000000000000000000000000000000
|
||||
-
|
||||
- if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 0b574089783b1491ba8cbe4058efae32e286fa27..9bbb1bcf3e715b1fb50954e62b1faa139384c59f 100644
|
||||
index 07c54c58f7a9256e2f1c51d99ede36371955be25..2a15972c0a48153fba481b08351642ed36a9da12 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -189,7 +189,7 @@ public abstract class PlayerList {
|
||||
@ -2630,7 +2630,7 @@ index 3a35169eaf680c45fe42922eb5f0014fa422c31c..00000000000000000000000000000000
|
||||
- }
|
||||
- // Spigot Start
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 952cf3a18c5368e1646e7e057ec02a9b91bebd48..fa91be82444dabaa6f404e07e06bf76b0bbde5c0 100644
|
||||
index c084fc4f386a4e341c6714851f0a06c9be533122..0d8cf0adc9d42b8909c3d6af754f1487cc46d6c4 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -869,11 +869,11 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
@ -3104,10 +3104,10 @@ index 2899c94ef3dadf9e139f8d78003805814288544e..00000000000000000000000000000000
|
||||
- public double drownedJockeyChance = 0.05D;
|
||||
- public boolean drownedJockeyTryExistingChickens = true;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 0a4acfe46a26ef6b66d0489273376538c6343480..0d148d3be8b1df52e7989bbc98e476942038e0a2 100644
|
||||
index ad868f6f49e36bcb7d62d31bccb89404098a0cfc..510e82002ed6ada5c2f4b14e01021068806a98e8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -835,6 +835,8 @@ public final class CraftServer implements Server {
|
||||
@@ -842,6 +842,8 @@ public final class CraftServer implements Server {
|
||||
com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper
|
||||
com.tuinity.tuinity.config.TuinityConfig.init((File) console.options.valueOf("tuinity-settings")); // Tuinity - Server Config
|
||||
net.pl3x.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
|
||||
@ -3116,7 +3116,7 @@ index 0a4acfe46a26ef6b66d0489273376538c6343480..0d148d3be8b1df52e7989bbc98e47694
|
||||
for (WorldServer world : console.getWorlds()) {
|
||||
world.worldDataServer.setDifficulty(config.difficulty);
|
||||
world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals);
|
||||
@@ -871,6 +873,8 @@ public final class CraftServer implements Server {
|
||||
@@ -878,6 +880,8 @@ public final class CraftServer implements Server {
|
||||
world.paperConfig.init(); // Paper
|
||||
world.tuinityConfig.init(); // Tuinity - Server Config
|
||||
world.purpurConfig.init(); // Purpur
|
||||
@ -3125,7 +3125,7 @@ index 0a4acfe46a26ef6b66d0489273376538c6343480..0d148d3be8b1df52e7989bbc98e47694
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -2247,6 +2251,19 @@ public final class CraftServer implements Server {
|
||||
@@ -2254,6 +2258,19 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
@ -3145,7 +3145,7 @@ index 0a4acfe46a26ef6b66d0489273376538c6343480..0d148d3be8b1df52e7989bbc98e47694
|
||||
@Override
|
||||
public void restart() {
|
||||
org.spigotmc.RestartCommand.restart();
|
||||
@@ -2386,4 +2403,11 @@ public final class CraftServer implements Server {
|
||||
@@ -2393,4 +2410,11 @@ public final class CraftServer implements Server {
|
||||
return mobGoals;
|
||||
}
|
||||
// Paper end
|
||||
|
@ -133,7 +133,7 @@ index 4a8a768e66ee00c7230eb955c3cc14e100112dc2..94cc21d445ad501e6ddd5cc5d45718e0
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 0d148d3be8b1df52e7989bbc98e476942038e0a2..5219441e22aa126f2640e863d2381ed12fbb5691 100644
|
||||
index 510e82002ed6ada5c2f4b14e01021068806a98e8..8bc7c1598807dc3c34355c347983047d13597670 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -216,7 +216,7 @@ import javax.annotation.Nullable; // Paper
|
||||
|
@ -28,10 +28,10 @@ index 94cc21d445ad501e6ddd5cc5d45718e0c915149c..d2f7130752ec50bcb8fa2797652157ec
|
||||
this.X = true;
|
||||
// Purpur start - tps catchup
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 5219441e22aa126f2640e863d2381ed12fbb5691..7feb7933d56af0e58605c6eecb4ffb723ec8df0d 100644
|
||||
index 8bc7c1598807dc3c34355c347983047d13597670..2d32ab02d7edee9a964dc2d9248c0c769e7dcac8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2410,4 +2410,11 @@ public final class CraftServer implements Server {
|
||||
@@ -2417,4 +2417,11 @@ public final class CraftServer implements Server {
|
||||
return getServer().lagging;
|
||||
}
|
||||
// Purpur end
|
||||
|
@ -423,10 +423,10 @@ index f24f7f1230a380f46112e886fb5dff7c33edb2ce..88f4c30a03e9139b0284ff1a545ad809
|
||||
if (this.isFireProof() || this.world.isClientSide) {
|
||||
this.extinguish();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 7feb7933d56af0e58605c6eecb4ffb723ec8df0d..ea10950bfa54966d93f578a692388d8c92728c61 100644
|
||||
index 2d32ab02d7edee9a964dc2d9248c0c769e7dcac8..9f9bbd1c7830a93da3fcbd399bb2e402b7698ec3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -837,6 +837,7 @@ public final class CraftServer implements Server {
|
||||
@@ -844,6 +844,7 @@ public final class CraftServer implements Server {
|
||||
net.pl3x.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
|
||||
com.proximyst.rainforest.RainforestConfig.init((File) console.options.valueOf("rainforest-settings")); // Rainforest
|
||||
de.minebench.origami.OrigamiConfig.init((File) console.options.valueOf("origami-settings")); // Origami
|
||||
@ -434,7 +434,7 @@ index 7feb7933d56af0e58605c6eecb4ffb723ec8df0d..ea10950bfa54966d93f578a692388d8c
|
||||
for (WorldServer world : console.getWorlds()) {
|
||||
world.worldDataServer.setDifficulty(config.difficulty);
|
||||
world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals);
|
||||
@@ -2264,6 +2265,13 @@ public final class CraftServer implements Server {
|
||||
@@ -2271,6 +2272,13 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
// Origami end
|
||||
|
||||
|
@ -77,7 +77,7 @@ index ce4ebc96c01f3dacf4e4d0569d86f52140440d43..a52c0391b171c8a57de75f87c534ce1e
|
||||
nbttagcompound.set("ShoulderEntityLeft", this.getShoulderEntityLeft());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 9bbb1bcf3e715b1fb50954e62b1faa139384c59f..77eb467dfc4d2f02d2ca1db3691addbd347d9d61 100644
|
||||
index 2a15972c0a48153fba481b08351642ed36a9da12..75953420936f1c6e8de221c1331df4d6c2fc7af6 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -1284,6 +1284,28 @@ public abstract class PlayerList {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Modify default configs
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 60f03502a7fd622d2de3b2da9fe8014b289f3d31..3007cf83708b6e24dc73d10a0e25e574fef69a10 100644
|
||||
index 9fc12595a566f216620a7fb296d2d30e22332689..02e05390a6106e3e83cdc95a42e966dd6eb968a0 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -201,7 +201,7 @@ public class PaperConfig {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Optimize player loops around weather
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index fa91be82444dabaa6f404e07e06bf76b0bbde5c0..f339bc126e97bf57806fe673a27886125b3ce207 100644
|
||||
index 0d8cf0adc9d42b8909c3d6af754f1487cc46d6c4..31a97c4ccfa23ef0547c783e9ca9da656689ee7d 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -814,12 +814,17 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
@ -1028,7 +1028,7 @@ index f2134c4ec6877ae3475f56928ad218c709c0e59d..c4ea24195ac8744e4abf4a9043d79ad1
|
||||
sum += size;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index f339bc126e97bf57806fe673a27886125b3ce207..b41e6544802cf14bdacb69652dc0891d92f2660b 100644
|
||||
index 31a97c4ccfa23ef0547c783e9ca9da656689ee7d..214904925963188c037c01c226d5cf501dbeaa1c 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -649,8 +649,14 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
@ -1,380 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JellySquid <jellysquid+atwork@protonmail.com>
|
||||
Date: Sat, 22 Aug 2020 20:49:11 +0300
|
||||
Subject: [PATCH] lithium serialization improvements
|
||||
|
||||
Original code by JellySquid, licensed under LGPLv3
|
||||
you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/CompactingPackedIntegerArray.java b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/CompactingPackedIntegerArray.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6f00db6560f9d9802774fe755f7adc4ab1142124
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/CompactingPackedIntegerArray.java
|
||||
@@ -0,0 +1,11 @@
|
||||
+package me.jellysquid.mods.lithium.common.world.chunk;
|
||||
+
|
||||
+import net.minecraft.server.DataPalette;
|
||||
+
|
||||
+public interface CompactingPackedIntegerArray {
|
||||
+ /**
|
||||
+ * Copies the data out of this array into a new non-packed array. The returned array contains a copy of this array
|
||||
+ * re-mapped using {@param destPalette}.
|
||||
+ */
|
||||
+ <T> void compact(DataPalette<T> srcPalette, DataPalette<T> dstPalette, short[] out);
|
||||
+}
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..79bb15e7af8e67c08214537eec35f4fc025a0635
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
@@ -0,0 +1,156 @@
|
||||
+package me.jellysquid.mods.lithium.common.world.chunk;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.HashCommon;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2IntMap;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.function.Function;
|
||||
+import java.util.function.Predicate;
|
||||
+import net.minecraft.server.DataPalette;
|
||||
+import net.minecraft.server.DataPaletteExpandable;
|
||||
+import net.minecraft.server.NBTTagCompound;
|
||||
+import net.minecraft.server.NBTTagList;
|
||||
+import net.minecraft.server.PacketDataSerializer;
|
||||
+import net.minecraft.server.RegistryBlockID;
|
||||
+
|
||||
+import static it.unimi.dsi.fastutil.Hash.FAST_LOAD_FACTOR;
|
||||
+
|
||||
+public class LithiumHashPalette<T> implements DataPalette<T> {
|
||||
+ private static final int ABSENT_VALUE = -1;
|
||||
+
|
||||
+ private final RegistryBlockID<T> idList;
|
||||
+ private final DataPaletteExpandable<T> resizeHandler;
|
||||
+ private final Function<NBTTagCompound, T> elementDeserializer;
|
||||
+ private final Function<T, NBTTagCompound> elementSerializer;
|
||||
+ private final int indexBits;
|
||||
+
|
||||
+ private final Reference2IntMap<T> table;
|
||||
+ private T[] entries;
|
||||
+ private int size = 0;
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ public LithiumHashPalette(RegistryBlockID<T> idList, int bits, DataPaletteExpandable<T> paletteListener, Function<NBTTagCompound, T> elementDeserializer, Function<T, NBTTagCompound> elementSerializer) {
|
||||
+ this.idList = idList;
|
||||
+ this.resizeHandler = paletteListener;
|
||||
+ this.elementDeserializer = elementDeserializer;
|
||||
+ this.elementSerializer = elementSerializer;
|
||||
+ this.indexBits = bits;
|
||||
+
|
||||
+ int capacity = 1 << bits;
|
||||
+ this.entries = (T[]) new Object[capacity];
|
||||
+ this.table = new Reference2IntOpenHashMap<>(capacity, FAST_LOAD_FACTOR);
|
||||
+ this.table.defaultReturnValue(ABSENT_VALUE);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int a(T t0) {
|
||||
+ int id = this.table.getInt(t0);
|
||||
+
|
||||
+ if (id == ABSENT_VALUE) {
|
||||
+ id = this.computeEntry(t0);
|
||||
+ }
|
||||
+
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
+ private int computeEntry(T obj) {
|
||||
+ int id = this.addEntry(obj);
|
||||
+
|
||||
+ if (id >= 1 << this.indexBits) {
|
||||
+ if (this.resizeHandler == null) {
|
||||
+ throw new IllegalStateException("Cannot grow");
|
||||
+ } else {
|
||||
+ id = this.resizeHandler.onResize(this.indexBits + 1, obj);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
+ private int addEntry(T obj) {
|
||||
+ int nextId = this.size;
|
||||
+
|
||||
+ if (nextId >= this.entries.length) {
|
||||
+ this.resize(this.size);
|
||||
+ }
|
||||
+
|
||||
+ this.table.put(obj, nextId);
|
||||
+ this.entries[nextId] = obj;
|
||||
+
|
||||
+ this.size++;
|
||||
+
|
||||
+ return nextId;
|
||||
+ }
|
||||
+
|
||||
+ private void resize(int neededCapacity) {
|
||||
+ this.entries = Arrays.copyOf(this.entries, HashCommon.nextPowerOfTwo(neededCapacity + 1));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean a(Predicate<T> predicate) {
|
||||
+ for (int i = 0; i < this.size; ++i) {
|
||||
+ if (predicate.test(this.entries[i])) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public T a(int id) {
|
||||
+ T[] entries = this.entries;
|
||||
+
|
||||
+ if (id >= 0 && id < entries.length) {
|
||||
+ return entries[id];
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void b(PacketDataSerializer buf) {
|
||||
+ int size = this.size;
|
||||
+ buf.writeVarInt(size);
|
||||
+
|
||||
+ for (int i = 0; i < size; ++i) {
|
||||
+ buf.writeVarInt(this.idList.getId(this.a(i)));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int a() {
|
||||
+ int size = PacketDataSerializer.countBytes(this.size);
|
||||
+
|
||||
+ for (int i = 0; i < this.size; ++i) {
|
||||
+ size += PacketDataSerializer.countBytes(this.idList.getId(this.a(i)));
|
||||
+ }
|
||||
+
|
||||
+ return size;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void a(NBTTagList list) {
|
||||
+ this.clear();
|
||||
+
|
||||
+ for (int i = 0; i < list.size(); ++i) {
|
||||
+ this.addEntry(this.elementDeserializer.apply(list.getCompound(i)));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void toTag(NBTTagList list) {
|
||||
+ for (int i = 0; i < this.size; ++i) {
|
||||
+ list.add(this.elementSerializer.apply(this.a(i)));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public int getSize() {
|
||||
+ return this.size;
|
||||
+ }
|
||||
+
|
||||
+ private void clear() {
|
||||
+ Arrays.fill(this.entries, null);
|
||||
+ this.table.clear();
|
||||
+ this.size = 0;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java
|
||||
index 353b61aa57501fa76ce42dff5ba61bdb6a1e302e..1257871044e66f5b2334c0d708218454051e65b6 100644
|
||||
--- a/src/main/java/net/minecraft/server/DataBits.java
|
||||
+++ b/src/main/java/net/minecraft/server/DataBits.java
|
||||
@@ -4,14 +4,14 @@ import java.util.function.IntConsumer;
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
-public class DataBits {
|
||||
+public class DataBits implements me.jellysquid.mods.lithium.common.world.chunk.CompactingPackedIntegerArray { // Yatopia
|
||||
|
||||
private static final int[] a = new int[]{-1, -1, 0, Integer.MIN_VALUE, 0, 0, 1431655765, 1431655765, 0, Integer.MIN_VALUE, 0, 1, 858993459, 858993459, 0, 715827882, 715827882, 0, 613566756, 613566756, 0, Integer.MIN_VALUE, 0, 2, 477218588, 477218588, 0, 429496729, 429496729, 0, 390451572, 390451572, 0, 357913941, 357913941, 0, 330382099, 330382099, 0, 306783378, 306783378, 0, 286331153, 286331153, 0, Integer.MIN_VALUE, 0, 3, 252645135, 252645135, 0, 238609294, 238609294, 0, 226050910, 226050910, 0, 214748364, 214748364, 0, 204522252, 204522252, 0, 195225786, 195225786, 0, 186737708, 186737708, 0, 178956970, 178956970, 0, 171798691, 171798691, 0, 165191049, 165191049, 0, 159072862, 159072862, 0, 153391689, 153391689, 0, 148102320, 148102320, 0, 143165576, 143165576, 0, 138547332, 138547332, 0, Integer.MIN_VALUE, 0, 4, 130150524, 130150524, 0, 126322567, 126322567, 0, 122713351, 122713351, 0, 119304647, 119304647, 0, 116080197, 116080197, 0, 113025455, 113025455, 0, 110127366, 110127366, 0, 107374182, 107374182, 0, 104755299, 104755299, 0, 102261126, 102261126, 0, 99882960, 99882960, 0, 97612893, 97612893, 0, 95443717, 95443717, 0, 93368854, 93368854, 0, 91382282, 91382282, 0, 89478485, 89478485, 0, 87652393, 87652393, 0, 85899345, 85899345, 0, 84215045, 84215045, 0, 82595524, 82595524, 0, 81037118, 81037118, 0, 79536431, 79536431, 0, 78090314, 78090314, 0, 76695844, 76695844, 0, 75350303, 75350303, 0, 74051160, 74051160, 0, 72796055, 72796055, 0, 71582788, 71582788, 0, 70409299, 70409299, 0, 69273666, 69273666, 0, 68174084, 68174084, 0, Integer.MIN_VALUE, 0, 5};
|
||||
- private final long[] b;
|
||||
- private final int c;
|
||||
- private final long d;
|
||||
- private final int e;
|
||||
- private final int f;
|
||||
+ private final long[] b; // Yatopia - storage
|
||||
+ private final int c; // Yatopia - elementBits
|
||||
+ private final long d; // Yatopia - maxValue
|
||||
+ private final int e; // Yatopia - size
|
||||
+ private final int f; // Yatopia - yarn field_24079
|
||||
private final int g;
|
||||
private final int h;
|
||||
private final int i;
|
||||
@@ -142,4 +142,38 @@ public class DataBits {
|
||||
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Yatopia start
|
||||
+ @Override
|
||||
+ public <T> void compact(DataPalette<T> srcPalette, DataPalette<T> dstPalette, short[] out) {
|
||||
+ if (e >= Short.MAX_VALUE) throw new IllegalStateException("Array too large");
|
||||
+ if (e != out.length) throw new IllegalStateException("Array size mismatch");
|
||||
+
|
||||
+ short[] mappings = new short[(int) (this.d + 1)];
|
||||
+
|
||||
+ int idx = 0;
|
||||
+ for (long word : b) {
|
||||
+ long bits = word;
|
||||
+
|
||||
+ for (int i = 0; i < f; i++) {
|
||||
+ int value = (int) (bits & d);
|
||||
+ int remappedId = mappings[value];
|
||||
+
|
||||
+ if (remappedId == 0) {
|
||||
+ remappedId = dstPalette.a(srcPalette.a(value)) + 1;
|
||||
+ mappings[value] = (short) remappedId;
|
||||
+ }
|
||||
+
|
||||
+ out[idx] = (short) (remappedId - 1);
|
||||
+ bits >>= c;
|
||||
+
|
||||
+ ++idx;
|
||||
+
|
||||
+ if (idx >= this.e) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
|
||||
index 52948a84b89554646c9ec1fd13d6d3c9e7cbf996..42aa0828a4598df507eb0bcaa6b35cb88c143ed8 100644
|
||||
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
|
||||
@@ -11,6 +11,10 @@ import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
|
||||
+ // Yatopia start
|
||||
+ private static final ThreadLocal<short[]> cachedCompactionArrays = ThreadLocal.withInitial(() -> new short[4096]);
|
||||
+ private static final long[] EMPTY_PALETTE_DATA = new long[(4 * 4096) / 64];
|
||||
+ // Yatopia end
|
||||
|
||||
private final DataPalette<T> b; private final DataPalette<T> getDataPaletteGlobal() { return this.b; } // Paper - OBFHELPER
|
||||
private final DataPaletteExpandable<T> c = (i, object) -> {
|
||||
@@ -228,6 +232,44 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
|
||||
}
|
||||
|
||||
public synchronized void a(NBTTagCompound nbttagcompound, String s, String s1) { // Paper - synchronize
|
||||
+ // Yatopia start - rewrite
|
||||
+ me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<T> palette = null;
|
||||
+ long[] dataArray = null;
|
||||
+
|
||||
+ if (h instanceof me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette) {
|
||||
+ palette = (me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<T>) h;
|
||||
+
|
||||
+ if (palette.getSize() == 1 && palette.a(0) == g) {
|
||||
+ dataArray = EMPTY_PALETTE_DATA;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (dataArray == null) {
|
||||
+ me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<T> compactedPalette =
|
||||
+ new me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<>(d, i, null, e, f);
|
||||
+ short[] array = cachedCompactionArrays.get();
|
||||
+ ((me.jellysquid.mods.lithium.common.world.chunk.CompactingPackedIntegerArray)a).compact(h, compactedPalette, array);
|
||||
+
|
||||
+ if (h != null && h.a() == compactedPalette.getSize()) {
|
||||
+ dataArray = a.getDataBits().clone();
|
||||
+ } else {
|
||||
+ int size = Math.max(4, MathHelper.e(compactedPalette.getSize()));
|
||||
+ DataBits copy = new DataBits(size, 4096);
|
||||
+ for (int i = 0; i < array.length; i++) {
|
||||
+ copy.set(i, array[i]);
|
||||
+ }
|
||||
+
|
||||
+ dataArray = copy.getDataBits();
|
||||
+ palette = compactedPalette;
|
||||
+ }
|
||||
+ }
|
||||
+ NBTTagList paletteTag = new NBTTagList();
|
||||
+ palette.toTag(paletteTag);
|
||||
+
|
||||
+ nbttagcompound.set(s, paletteTag);
|
||||
+ nbttagcompound.setLongArray(s1, dataArray);
|
||||
+
|
||||
+ /*
|
||||
this.a();
|
||||
DataPaletteHash<T> datapalettehash = new DataPaletteHash<>(this.d, this.i, this.c, this.e, this.f);
|
||||
T t0 = this.g;
|
||||
@@ -258,6 +300,7 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
|
||||
|
||||
nbttagcompound.a(s1, databits.a());
|
||||
this.b();
|
||||
+ */ // Yatopia end
|
||||
}
|
||||
|
||||
public int c() {
|
||||
@@ -281,9 +324,24 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
|
||||
|
||||
// Paper start
|
||||
public void forEachLocation(DataPaletteBlock.a<T> datapaletteblock_a) {
|
||||
+ // Yatopia start
|
||||
+ int len = (1 << i);
|
||||
+ if (len > 4096) return;
|
||||
+
|
||||
+ short[] counts = new short[len];
|
||||
+
|
||||
+ getDataBits().a((l) -> counts[l]++);
|
||||
+
|
||||
+ for (int i = 0; i < counts.length; i++) {
|
||||
+ T obj = h.a(i);
|
||||
+ if (obj != null) datapaletteblock_a.accept(obj, counts[i]);
|
||||
+ }
|
||||
+ /*
|
||||
this.getDataBits().forEach((int location, int data) -> {
|
||||
datapaletteblock_a.accept(this.getDataPalette().getObject(data), location);
|
||||
});
|
||||
+ */
|
||||
+ // Yatopia end
|
||||
}
|
||||
// Paper end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DataPaletteExpandable.java b/src/main/java/net/minecraft/server/DataPaletteExpandable.java
|
||||
index a550b21a9756ff1dcb4a21d8116f0a393ee88282..c2441e3f75805bc604411da66cb02b8ec148b031 100644
|
||||
--- a/src/main/java/net/minecraft/server/DataPaletteExpandable.java
|
||||
+++ b/src/main/java/net/minecraft/server/DataPaletteExpandable.java
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
-interface DataPaletteExpandable<T> {
|
||||
+public interface DataPaletteExpandable<T> { // Yatopia - wtf?
|
||||
|
||||
int onResize(int i, T t0);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
|
||||
index 06d5acab794e3ee139a11f9b068e8a359c46db2c..e94bf9dbc8d965c5b3dbcec177fd6ed1c76bcb18 100644
|
||||
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
|
||||
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
|
||||
@@ -193,6 +193,7 @@ public class NBTTagCompound implements NBTBase {
|
||||
this.map.put(s, new NBTTagIntArray(list));
|
||||
}
|
||||
|
||||
+ public final void setLongArray(String s, long[] arr) { a(s, arr); } // Yatopia - OBFHELPER
|
||||
public void a(String s, long[] along) {
|
||||
this.map.put(s, new NBTTagLongArray(along));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
|
||||
index f43193c1090238f2241b878120247d1b3d0d4e57..9942ac3e1bf7fb997fee4719e6d98dc6fb912a4f 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
|
||||
@@ -210,6 +210,7 @@ public class PacketDataSerializer extends ByteBuf {
|
||||
return new UUID(this.readLong(), this.readLong());
|
||||
}
|
||||
|
||||
+ public final PacketDataSerializer writeVarInt(int i) { return d(i); } // Yatopia - OBFHELPER
|
||||
public PacketDataSerializer d(int i) {
|
||||
while ((i & -128) != 0) {
|
||||
this.writeByte(i & 127 | 128);
|
Loading…
Reference in New Issue
Block a user