diff --git a/gradle.properties b/gradle.properties index b34dceba..225b5946 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,6 @@ version=1.21-R0.1-SNAPSHOT mcVersion=1.21 org.gradle.jvmargs=-Xmx2G -paperRef=5a503d7db42eee8d287b7ed32db22a369e9e3146 +paperRef=d08e8d1afabcce6a40bab5863f2c297cd7ba8cfa preVersion=true updatingMinecraft=true diff --git a/patches/server/0001-Build-changes.patch b/patches/server/0001-Build-changes.patch index f153b32d..70640780 100644 --- a/patches/server/0001-Build-changes.patch +++ b/patches/server/0001-Build-changes.patch @@ -184,10 +184,10 @@ index 790bad0494454ca12ee152e3de6da3da634d9b20..c060857cb0551fff8f5033553b887f3a private static final String BUILD_DEV = "DEV"; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 54e581db732c3a104142a2bbc228ecbe16aec0fc..c3b5b132848b8c5af45b171ba3b4f01109b5f724 100644 +index 57e84cf2219d28c37e4c042371afddf585334954..56b030a8dc0a335a88179e49d9165e0e9310420f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1249,7 +1249,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, ChunkIOErrorReporter, CommandSource, AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer { // Paper - rewrite chunk system private static MinecraftServer SERVER; // Paper -@@ -1045,7 +1040,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { entityplayer.connection.suspendFlushing(); }); @@ -892,7 +892,7 @@ index c3b5b132848b8c5af45b171ba3b4f01109b5f724..197e9e806f8f20b01c3ee21d339297ae // Paper start - Folia scheduler API ((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick(); getAllLevels().forEach(level -> { -@@ -1733,21 +1721,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = Lists.newArrayList(); List list1 = this.level.players(); ObjectIterator objectiterator = this.entityMap.values().iterator(); @@ -1026,7 +1026,7 @@ index 6df79aab2f0a75bbe347dc92e9ed5d62ceec7983..61cc6f42be6115f3b634b57d6fb1ee9f ChunkMap.TrackedEntity playerchunkmap_entitytracker; -@@ -1017,17 +1015,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -984,17 +982,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider playerchunkmap_entitytracker.serverEntity.sendChanges(); } } @@ -1045,10 +1045,10 @@ index 6df79aab2f0a75bbe347dc92e9ed5d62ceec7983..61cc6f42be6115f3b634b57d6fb1ee9f } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 36fbbf45ae064a345bf4aafbb9ac527197326eb9..f5f52d4ae8965cacf0d79c863aa64cd92447c6fc 100644 +index 8a0b00d645e4cf2ca96ec7e8ebc6ef726a0ab8b0..63869a234de3e69a690d3d0113755e64bd519b02 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -357,9 +357,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -356,9 +356,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon public void save(boolean flush) { // Paper - rewrite chunk system @@ -1058,7 +1058,7 @@ index 36fbbf45ae064a345bf4aafbb9ac527197326eb9..f5f52d4ae8965cacf0d79c863aa64cd9 } @Override -@@ -394,26 +392,20 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -393,26 +391,20 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon @Override public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { this.level.getProfiler().push("purge"); @@ -1085,15 +1085,13 @@ index 36fbbf45ae064a345bf4aafbb9ac527197326eb9..f5f52d4ae8965cacf0d79c863aa64cd9 this.level.getProfiler().pop(); this.clearCache(); } -@@ -431,7 +423,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - gameprofilerfiller.push("filteringLoadedChunks"); - List list = Lists.newArrayListWithCapacity(this.chunkMap.size()); - Iterator iterator = this.chunkMap.getChunks().iterator(); +@@ -448,13 +440,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + // Paper end - chunk tick iteration optimisations + Iterator iterator = null; // Paper - chunk tick iteration optimisations - if (this.level.getServer().tickRateManager().runsNormally()) this.level.timings.chunkTicks.startTiming(); // Paper - while (iterator.hasNext()) { - ChunkHolder playerchunk = (ChunkHolder) iterator.next(); -@@ -444,7 +435,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper - chunk tick iteration optimisations if (this.level.tickRateManager().runsNormally()) { gameprofilerfiller.popPush("naturalSpawnCount"); @@ -1101,7 +1099,7 @@ index 36fbbf45ae064a345bf4aafbb9ac527197326eb9..f5f52d4ae8965cacf0d79c863aa64cd9 int k = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - Optional per player mob spawns int naturalSpawnChunkCount = k; -@@ -469,7 +459,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -479,7 +469,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); } // Paper end - Optional per player mob spawns @@ -1109,7 +1107,7 @@ index 36fbbf45ae064a345bf4aafbb9ac527197326eb9..f5f52d4ae8965cacf0d79c863aa64cd9 this.lastSpawnState = spawnercreature_d; gameprofilerfiller.popPush("spawnAndTick"); -@@ -510,21 +499,16 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -520,19 +509,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } } } @@ -1124,15 +1122,21 @@ index 36fbbf45ae064a345bf4aafbb9ac527197326eb9..f5f52d4ae8965cacf0d79c863aa64cd9 } gameprofilerfiller.popPush("broadcast"); - list.forEach((chunkproviderserver_a1) -> { -- this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing - chunkproviderserver_a1.holder.broadcastChanges(chunkproviderserver_a1.chunk); -- this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing - }); + // Paper start - chunk tick iteration optimisations +- this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing + { + final it.unimi.dsi.fastutil.objects.ObjectArrayList chunks = (it.unimi.dsi.fastutil.objects.ObjectArrayList)list; + final ServerChunkCache.ChunkAndHolder[] raw = chunks.elements(); +@@ -546,7 +531,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + holder.holder().broadcastChanges(holder.chunk()); + } + } +- this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing + // Paper end - chunk tick iteration optimisations gameprofilerfiller.pop(); gameprofilerfiller.pop(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc430379cf0c20 100644 +index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f89e239474 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1,7 +1,6 @@ @@ -1143,7 +1147,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 import com.google.common.collect.Lists; import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.util.Pair; -@@ -699,7 +698,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -709,7 +708,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } gameprofilerfiller.popPush("tickPending"); @@ -1151,7 +1155,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 if (!this.isDebug() && flag) { j = this.getGameTime(); gameprofilerfiller.push("blockTicks"); -@@ -708,24 +706,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -718,24 +716,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. this.fluidTicks.tick(j, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks gameprofilerfiller.pop(); } @@ -1176,7 +1180,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 } this.handlingTick = false; -@@ -738,7 +729,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -748,7 +739,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. if (flag1 || this.emptyTime++ < 300) { gameprofilerfiller.push("entities"); @@ -1184,7 +1188,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 if (this.dragonFight != null && flag) { gameprofilerfiller.push("dragonFight"); this.dragonFight.tick(); -@@ -746,7 +736,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -756,7 +746,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } org.spigotmc.ActivationRange.activateEntities(this); // Spigot @@ -1192,7 +1196,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 this.entityTickList.forEach((entity) -> { if (!entity.isRemoved()) { if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed -@@ -773,8 +762,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -783,8 +772,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } } }); @@ -1201,23 +1205,20 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 gameprofilerfiller.pop(); this.tickBlockEntities(); } -@@ -878,7 +865,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -945,12 +932,10 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } // Paper - Option to disable ice and snow gameprofilerfiller.popPush("tickBlocks"); - timings.chunkTicksBlocks.startTiming(); // Paper if (randomTickSpeed > 0) { - LevelChunkSection[] achunksection = chunk.getSections(); - -@@ -911,7 +897,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. - } + this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking } - timings.chunkTicksBlocks.stopTiming(); // Paper gameprofilerfiller.pop(); } -@@ -1223,9 +1208,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -1262,9 +1247,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. currentlyTickingEntity.lazySet(entity); } // Paper end - log detailed entity tick information @@ -1227,7 +1228,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 /*if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { // Paper - comment out - EAR 2, reimplement below entity.tickCount++; timer = entity.getType().inactiveTickTimer.startTiming(); try { // Paper - timings -@@ -1234,11 +1217,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -1273,11 +1256,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. return; }*/ // Paper - comment out EAR 2 // Spigot end @@ -1239,7 +1240,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 entity.setOldPosAndRot(); ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -1248,12 +1227,10 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -1287,12 +1266,10 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. }); gameprofilerfiller.incrementCounter("tickNonPassenger"); if (isActive) { // Paper - EAR 2 @@ -1252,7 +1253,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 Iterator iterator = entity.getPassengers().iterator(); while (iterator.hasNext()) { -@@ -1276,8 +1253,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -1315,8 +1292,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. if (passenger instanceof Player || this.entityTickList.contains(passenger)) { // Paper - EAR 2 final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger); @@ -1261,7 +1262,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 // Paper end passenger.setOldPosAndRot(); ++passenger.tickCount; -@@ -1306,8 +1281,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -1345,8 +1320,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. this.tickPassenger(passenger, entity2); } @@ -1270,7 +1271,45 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 } } else { passenger.stopRiding(); -@@ -1329,7 +1302,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -1366,24 +1339,23 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. + org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); + } + +- try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) { +- if (doFull) { +- this.saveLevelData(true); +- } ++ if (doFull) { ++ this.saveLevelData(true); ++ } + +- // chunk autosave is already called by the ChunkSystem during unload processing (ChunkMap#processUnloads) ++ // chunk autosave is already called by the ChunkSystem during unload processing (ChunkMap#processUnloads) + +- // Copied from save() +- // CraftBukkit start - moved from MinecraftServer.saveChunks +- if (doFull) { // Paper +- ServerLevel worldserver1 = this; ++ // Copied from save() ++ // CraftBukkit start - moved from MinecraftServer.saveChunks ++ if (doFull) { // Paper ++ ServerLevel worldserver1 = this; + +- this.serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings()); +- this.serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save(this.registryAccess())); +- this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData()); +- } +- // CraftBukkit end ++ this.serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings()); ++ this.serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save(this.registryAccess())); ++ this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData()); + } ++ // CraftBukkit end ++ + } + // Paper end - Incremental chunk and player saving + +@@ -1397,7 +1369,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. if (!savingDisabled) { org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(this.getWorld())); // CraftBukkit @@ -1278,7 +1317,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 if (progressListener != null) { progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); } -@@ -1339,12 +1311,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -1407,12 +1378,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. progressListener.progressStage(Component.translatable("menu.savingChunks")); } @@ -1292,7 +1331,7 @@ index 4e5fc39f3839d4d626925bcef1c83415376195f4..dc9ef854191eea94bf34e972fbcc4303 // Paper start - add close param if (close) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 5f20606cc2c79ad9a4c4d4d6c9e6a2a31a88b282..a45ece7009dd9a2f4682f4c0a4759e2718404b0b 100644 +index 43eeb8ce4bc350c2b524ade11ca25d8d4d21bea5..f9141e1997ef88ff5478d4a01b6bc719125631f2 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1,6 +1,5 @@ @@ -1302,13 +1341,17 @@ index 5f20606cc2c79ad9a4c4d4d6c9e6a2a31a88b282..a45ece7009dd9a2f4682f4c0a4759e27 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@@ -1183,11 +1182,9 @@ public abstract class PlayerList { +@@ -1190,7 +1189,6 @@ public abstract class PlayerList { - public void saveAll() { + public void saveAll(int interval) { io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main - MinecraftTimings.savePlayers.startTiming(); // Paper + int numSaved = 0; + long now = MinecraftServer.currentTick; for (int i = 0; i < this.players.size(); ++i) { - this.save(this.players.get(i)); +@@ -1201,7 +1199,6 @@ public abstract class PlayerList { + } + // Paper end - Incremental chunk and player saving } - MinecraftTimings.savePlayers.stopTiming(); // Paper return null; }); // Paper - ensure main @@ -1430,7 +1473,7 @@ index 85b4b24361e785acf75571ff98f924c00ae80748..1f3e0392f88a7cb3fb5c0767cdd1b4bc } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c1f392cd7928a142192c87cf46ef2a4fc2495562..6bda11e309ec1216f2d5c4fb4eafa8d8ff897192 100644 +index e2a0487089eb5a7bdc1433e4c75f69d8e9f9d5f9..33a5137b1057fe6203e10f9e7e0cb7c4251466e9 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -173,7 +173,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -1441,7 +1484,7 @@ index c1f392cd7928a142192c87cf46ef2a4fc2495562..6bda11e309ec1216f2d5c4fb4eafa8d8 public static BlockPos lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter tileLimiter; -@@ -719,7 +718,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -763,7 +762,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {} }); // CraftBukkit end @@ -1449,7 +1492,7 @@ index c1f392cd7928a142192c87cf46ef2a4fc2495562..6bda11e309ec1216f2d5c4fb4eafa8d8 this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system -@@ -1325,15 +1323,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1369,15 +1367,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl ProfilerFiller gameprofilerfiller = this.getProfiler(); gameprofilerfiller.push("blockEntities"); @@ -1465,7 +1508,7 @@ index c1f392cd7928a142192c87cf46ef2a4fc2495562..6bda11e309ec1216f2d5c4fb4eafa8d8 // Spigot start // Iterator iterator = this.blockEntityTickers.iterator(); boolean flag = this.tickRateManager().runsNormally(); -@@ -1364,9 +1359,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1408,9 +1403,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 @@ -1476,7 +1519,7 @@ index c1f392cd7928a142192c87cf46ef2a4fc2495562..6bda11e309ec1216f2d5c4fb4eafa8d8 this.spigotConfig.currentPrimedTnt = 0; // Spigot } diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index ed8032495af9ce9c23419224814b8d27e4a97c17..189a6bd4967aba72e12170e091dbb5b779e752a0 100644 +index e524b27d185da3e88668f8ef107517272860bd66..8205d34ed80781b2aab1fb2ef59986b9370f0198 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -128,7 +128,6 @@ public final class NaturalSpawner { @@ -1533,10 +1576,10 @@ index c0563260277f9f4bd9ff08993b2efb4bca9a0c60..d93125ea494cb977b1616cabc90e2e7a private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); public CraftPersistentDataContainer persistentDataContainer; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index db55e9cc3d42ba01f75f6697924baaeccb564b90..12ee7f3cef6cd41b23200bb53bb6fd2018039d49 100644 +index 5453b7051337908ac1c8201827c1b5eec9e1608b..7a1cd74990707cbd79f2d89c96d91072c0433289 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -650,7 +650,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -661,7 +661,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(this.locX, this.locZ).getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system if (this.needsDecoration) { @@ -1544,7 +1587,7 @@ index db55e9cc3d42ba01f75f6697924baaeccb564b90..12ee7f3cef6cd41b23200bb53bb6fd20 this.needsDecoration = false; java.util.Random random = new java.util.Random(); random.setSeed(this.level.getSeed()); -@@ -670,7 +669,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -681,7 +680,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p } } server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk)); @@ -1552,7 +1595,7 @@ index db55e9cc3d42ba01f75f6697924baaeccb564b90..12ee7f3cef6cd41b23200bb53bb6fd20 } } } -@@ -1010,7 +1008,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -1021,7 +1019,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); gameprofilerfiller.push(this::getType); @@ -1560,7 +1603,7 @@ index db55e9cc3d42ba01f75f6697924baaeccb564b90..12ee7f3cef6cd41b23200bb53bb6fd20 BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); if (this.blockEntity.getType().isValid(iblockdata)) { -@@ -1036,9 +1033,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -1047,9 +1044,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p LevelChunk.this.removeBlockEntity(this.getPos()); // Paper end - Prevent block entity and entity crashes // Spigot start @@ -1571,7 +1614,7 @@ index db55e9cc3d42ba01f75f6697924baaeccb564b90..12ee7f3cef6cd41b23200bb53bb6fd20 } } diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index e85b9bb3f9c225d289a4959921970b9963881199..bb9383f1a457433f9db3e78d7913616280925200 100644 +index 2f4d6b56301195f8d39ed50dffe842464065bfe1..22f1ed383313829b8af4badda9ef8dc85cae8fd1 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -1,6 +1,5 @@ @@ -1581,7 +1624,7 @@ index e85b9bb3f9c225d289a4959921970b9963881199..bb9383f1a457433f9db3e78d79136162 import com.google.common.base.Preconditions; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.util.ArrayList; -@@ -304,7 +303,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -297,7 +296,7 @@ public class CraftScheduler implements BukkitScheduler { } return false; } @@ -1590,7 +1633,7 @@ index e85b9bb3f9c225d289a4959921970b9963881199..bb9383f1a457433f9db3e78d79136162 this.handle(task, 0L); for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { if (taskPending == task) { -@@ -344,7 +343,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -337,7 +336,7 @@ public class CraftScheduler implements BukkitScheduler { } } } @@ -1599,7 +1642,7 @@ index e85b9bb3f9c225d289a4959921970b9963881199..bb9383f1a457433f9db3e78d79136162 this.handle(task, 0L); for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { if (taskPending == task) { -@@ -515,10 +514,8 @@ public class CraftScheduler implements BukkitScheduler { +@@ -504,10 +503,8 @@ public class CraftScheduler implements BukkitScheduler { this.runners.remove(task.getTaskId()); } } @@ -1610,7 +1653,7 @@ index e85b9bb3f9c225d289a4959921970b9963881199..bb9383f1a457433f9db3e78d79136162 //this.debugHead = this.debugHead.getNextHead(currentTick); // Paper } -@@ -561,7 +558,6 @@ public class CraftScheduler implements BukkitScheduler { +@@ -550,7 +547,6 @@ public class CraftScheduler implements BukkitScheduler { } void parsePending() { // Paper @@ -1618,7 +1661,7 @@ index e85b9bb3f9c225d289a4959921970b9963881199..bb9383f1a457433f9db3e78d79136162 CraftTask head = this.head; CraftTask task = head.getNext(); CraftTask lastTask = head; -@@ -580,7 +576,6 @@ public class CraftScheduler implements BukkitScheduler { +@@ -569,7 +565,6 @@ public class CraftScheduler implements BukkitScheduler { task.setNext(null); } this.head = lastTask; @@ -1627,7 +1670,7 @@ index e85b9bb3f9c225d289a4959921970b9963881199..bb9383f1a457433f9db3e78d79136162 private boolean isReady(final int currentTick) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -index ea26d9464644b5217879b8c21b4da28e57708dcb..e4868e83cd7883408c598f2dcc3f9f4ea9e967d1 100644 +index ba369f3dcfdf498e971dc4405d39657a9b6e97cc..8870bfa9df854173d105326ebd6bb3c0ea1bdb88 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java @@ -2,14 +2,10 @@ package org.bukkit.craftbukkit.scheduler; @@ -1653,15 +1696,7 @@ index ea26d9464644b5217879b8c21b4da28e57708dcb..e4868e83cd7883408c598f2dcc3f9f4e private final Plugin plugin; private final int id; private final long createdAt = System.nanoTime(); -@@ -55,7 +50,6 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot - this.id = id; - this.period = CraftTask.NO_REPEATING; - this.taskName = taskName; -- this.timings = MinecraftTimings.getInternalTaskName(taskName); - } - // Paper end - -@@ -76,7 +70,6 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -61,7 +56,6 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot } this.id = id; this.period = period; @@ -1669,7 +1704,7 @@ index ea26d9464644b5217879b8c21b4da28e57708dcb..e4868e83cd7883408c598f2dcc3f9f4e } @Override -@@ -96,13 +89,11 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -81,13 +75,11 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot @Override public void run() { @@ -1705,10 +1740,10 @@ index b3e1adeb932da9b3bed16acd94e2f16da48a7c72..e9798517b9211c50a20ea5c69603aab3 } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 3137391cadef7c67019561e65fedd0664e689eae..7852ea0ce6a393c8da15361439d66669b15acc26 100644 +index 28b3ad04e1f4b38ce21084864a59a2cd81b3992c..26762c95769a2aa5adf88a5c5055cffe1150a20c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -216,7 +216,6 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -199,7 +199,6 @@ public final class CraftMagicNumbers implements UnsafeValues { // Paper start @Override public void reportTimings() { diff --git a/patches/server/0004-Leaves-Server-Utils.patch b/patches/server/0004-Leaves-Server-Utils.patch index a40a59ca..4a8edbb1 100644 --- a/patches/server/0004-Leaves-Server-Utils.patch +++ b/patches/server/0004-Leaves-Server-Utils.patch @@ -4,34 +4,8 @@ Date: Tue, 13 Sep 2022 16:59:31 +0800 Subject: [PATCH] Leaves Server Utils -diff --git a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java -index 41b9405d6759d865e0d14dd4f95163e9690e967d..67008112e1d1c059938838c544f093fa1f0a4fee 100644 ---- a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java -+++ b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java -@@ -26,7 +26,7 @@ public abstract class AreaMap { - - // we use linked for better iteration. - // map of: coordinate to set of objects in coordinate -- protected final Long2ObjectOpenHashMap> areaMap = new Long2ObjectOpenHashMap<>(1024, 0.7f); -+ protected Long2ObjectOpenHashMap> areaMap = new Long2ObjectOpenHashMap<>(1024, 0.7f); // Leaves - not final - protected final PooledLinkedHashSets pooledHashSets; - - protected final ChangeCallback addCallback; -diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java -index 46954db7ecd35ac4018fdf476df7c8020d7ce6c8..044c51ebb058fc36074fd178929e3279335f6c99 100644 ---- a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java -+++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java -@@ -5,7 +5,7 @@ import net.minecraft.server.level.ServerPlayer; - /** - * @author Spottedleaf - */ --public final class PlayerAreaMap extends AreaMap { -+public class PlayerAreaMap extends AreaMap { // Leaves - not final - - public PlayerAreaMap() { - super(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index be9976a994dd04cf53048567576dd3484facf625..d582615c0ca9f483f1da31e91e66b22129881d63 100644 +index 1f7594e22f0f08ae110ef9b42f15119358aa5723..bea901be9d4d86cc016cc48a16f2775cf92d98d9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -430,6 +430,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -185,44 +159,6 @@ index 0000000000000000000000000000000000000000..067e351f6e96f2ac1a46d78dc952b2e8 + } + } +} -diff --git a/src/main/java/org/leavesmc/leaves/util/AsyncPlayerAreaMap.java b/src/main/java/org/leavesmc/leaves/util/AsyncPlayerAreaMap.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0a2d58901b25fd771701e45aab6239626681ed4f ---- /dev/null -+++ b/src/main/java/org/leavesmc/leaves/util/AsyncPlayerAreaMap.java -@@ -0,0 +1,32 @@ -+package org.leavesmc.leaves.util; -+ -+import com.destroystokyo.paper.util.misc.PlayerAreaMap; -+import com.destroystokyo.paper.util.misc.PooledLinkedHashSets; -+import net.minecraft.server.level.ServerPlayer; -+ -+import java.util.concurrent.ConcurrentHashMap; -+ -+// Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) -+public class AsyncPlayerAreaMap extends PlayerAreaMap { -+ -+ public AsyncPlayerAreaMap() { -+ super(); -+ this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f)); -+ } -+ -+ public AsyncPlayerAreaMap(final PooledLinkedHashSets pooledHashSets) { -+ super(pooledHashSets); -+ this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f)); -+ } -+ -+ public AsyncPlayerAreaMap(final PooledLinkedHashSets pooledHashSets, final ChangeCallback addCallback, -+ final ChangeCallback removeCallback) { -+ this(pooledHashSets, addCallback, removeCallback, null); -+ } -+ -+ public AsyncPlayerAreaMap(final PooledLinkedHashSets pooledHashSets, final ChangeCallback addCallback, -+ final ChangeCallback removeCallback, final ChangeSourceCallback changeSourceCallback) { -+ super(pooledHashSets, addCallback, removeCallback, changeSourceCallback); -+ this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f)); -+ } -+} diff --git a/src/main/java/org/leavesmc/leaves/util/IterableWrapper.java b/src/main/java/org/leavesmc/leaves/util/IterableWrapper.java new file mode 100644 index 0000000000000000000000000000000000000000..a07feaf53905df87e45e8414b1dca02d4e8411d5 diff --git a/patches/server/0005-Update-version-fetcher-repo.patch b/patches/server/0005-Update-version-fetcher-repo.patch index 823f2c89..0b3f4727 100644 --- a/patches/server/0005-Update-version-fetcher-repo.patch +++ b/patches/server/0005-Update-version-fetcher-repo.patch @@ -27,10 +27,10 @@ index 532306cacd52579cdf37e4aca25887b1ed3ba6a1..917ffaae401f3374d07d7fb7c024234a if (data == null) { return null; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 7852ea0ce6a393c8da15361439d66669b15acc26..65854c9ae9f05678f0a42ae095f602ce7fdb44e4 100644 +index 26762c95769a2aa5adf88a5c5055cffe1150a20c..a52c9347f166631ee0c889a65928bc317285efe2 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -497,7 +497,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -480,7 +480,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @Override public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { diff --git a/patches/server/0006-Leaves-Server-Config-And-Command.patch b/patches/server/0006-Leaves-Server-Config-And-Command.patch index f26e28a4..55b0439b 100644 --- a/patches/server/0006-Leaves-Server-Config-And-Command.patch +++ b/patches/server/0006-Leaves-Server-Config-And-Command.patch @@ -38,10 +38,10 @@ index 29d61b407762504dffc26f3048a17327592d9b4a..ec9ade19778c71561b4045ade5ab6cd0 this.setPvpAllowed(dedicatedserverproperties.pvp); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index caf6ff33b42472d30f28629470e12889f50490cc..0de0d0d290625ad4f6cacc1d6374a5d0eb66ca86 100644 +index 3a91faeb6957e4e783b1de3e1145e7d1d164a857..40851fac8f0d4153d9e56d19fb79eea4a528da8f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1087,6 +1087,7 @@ public final class CraftServer implements Server { +@@ -1096,6 +1096,7 @@ public final class CraftServer implements Server { playerMetadata.removeAll(plugin); } // Paper end @@ -49,7 +49,7 @@ index caf6ff33b42472d30f28629470e12889f50490cc..0de0d0d290625ad4f6cacc1d6374a5d0 this.reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper -@@ -2977,6 +2978,14 @@ public final class CraftServer implements Server { +@@ -2986,6 +2987,14 @@ public final class CraftServer implements Server { { return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); } @@ -65,7 +65,7 @@ index caf6ff33b42472d30f28629470e12889f50490cc..0de0d0d290625ad4f6cacc1d6374a5d0 @Override public void restart() { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index e863c947d6d8d4c9af113fd6472b7ddbe1fdd26e..b4a1a430ce2c361d24ffa46cfdf00b5f8b53586a 100644 +index c2e2e0ea5f2bb8204cb698db7904b0f863d2506f..3f660dabd01087373a41f2eec949a6a1e49926ac 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -168,6 +168,14 @@ public class Main { diff --git a/patches/server/0007-Leaves-Protocol-Core.patch b/patches/server/0007-Leaves-Protocol-Core.patch index 998275c4..82bbbf11 100644 --- a/patches/server/0007-Leaves-Protocol-Core.patch +++ b/patches/server/0007-Leaves-Protocol-Core.patch @@ -47,10 +47,10 @@ index 1967c43ee3a12e63365cc40ee6565307e2fd73cf..6e376d0db5321d8e9b6e0b54617ffd17 assert isValidPath(path); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 197e9e806f8f20b01c3ee21d339297ae45d344ea..785aa6eeb299eb70bbea64631c1c8262ed3cb4ad 100644 +index 478ff73542685c99f30b7c500f79ba6f4f10ec7e..fc8bbbf40c1d74dbb03bcf699a000337a653b4b2 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1800,6 +1800,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak if (set != null && !set.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 785aa6eeb299eb70bbea64631c1c8262ed3cb4ad..778a8c8a88128107b7ccd9bb4a783c0b519da9b1 100644 +index fc8bbbf40c1d74dbb03bcf699a000337a653b4b2..471ded84bdd3e59a75cfa34aac16bb726f80ba28 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -745,6 +745,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> optional = PoiTypes.forState(oldBlock); -@@ -2471,6 +2479,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -2538,6 +2546,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. // ServerLevel.this.getChunkSource().addEntity(entity); // Paper - ignore and warn about illegal addEntity calls instead of crashing server; moved down below valid=true if (entity instanceof ServerPlayer entityplayer) { ServerLevel.this.players.add(entityplayer); @@ -133,7 +133,7 @@ index 176d02ede3e0b727c3619a51af5c2d953ee18de9..782b831f62cd2304fd70b22d468d9f99 ServerLevel.this.updateSleepingPlayerList(); } -@@ -2548,6 +2561,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -2615,6 +2628,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. ServerLevel.this.getChunkSource().removeEntity(entity); if (entity instanceof ServerPlayer entityplayer) { ServerLevel.this.players.remove(entityplayer); @@ -146,10 +146,10 @@ index 176d02ede3e0b727c3619a51af5c2d953ee18de9..782b831f62cd2304fd70b22d468d9f99 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 9d1e68c09fa7093cf0f6fa636f90cb15a44cbb38..9f32ed6b7f7c3dc0175cadf811956991b136be23 100644 +index 5980b70e2d7273239245237189b2debcbccfbac3..40dfc96bbcd1f85a5917c458ae3a8e3c1574c667 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -210,7 +210,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -212,7 +212,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple private static final AttributeModifier CREATIVE_ENTITY_INTERACTION_RANGE_MODIFIER = new AttributeModifier(ResourceLocation.withDefaultNamespace("creative_mode_entity_range"), 2.0D, AttributeModifier.Operation.ADD_VALUE); public ServerGamePacketListenerImpl connection; public final MinecraftServer server; @@ -158,7 +158,7 @@ index 9d1e68c09fa7093cf0f6fa636f90cb15a44cbb38..9f32ed6b7f7c3dc0175cadf811956991 private final PlayerAdvancements advancements; private final ServerStatsCounter stats; private float lastRecordedHealthAndAbsorption = Float.MIN_VALUE; -@@ -771,16 +771,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -770,16 +770,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple --this.invulnerableTime; } @@ -188,7 +188,7 @@ index 9d1e68c09fa7093cf0f6fa636f90cb15a44cbb38..9f32ed6b7f7c3dc0175cadf811956991 Entity entity = this.getCamera(); -@@ -796,7 +800,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -795,7 +799,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple } } @@ -197,7 +197,7 @@ index 9d1e68c09fa7093cf0f6fa636f90cb15a44cbb38..9f32ed6b7f7c3dc0175cadf811956991 if (this.levitationStartPos != null) { CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime); } -@@ -1016,7 +1020,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -1015,7 +1019,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple List loot = new java.util.ArrayList<>(this.getInventory().getContainerSize()); // Paper - Restore vanilla drops behavior boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator(); @@ -206,7 +206,7 @@ index 9d1e68c09fa7093cf0f6fa636f90cb15a44cbb38..9f32ed6b7f7c3dc0175cadf811956991 for (ItemStack item : this.getInventory().getContents()) { if (!item.isEmpty() && !EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) { loot.add(new DefaultDrop(item, stack -> this.drop(stack, true, false, false))); // Paper - Restore vanilla drops behavior; drop function taken from Inventory#dropAll (don't fire drop event) -@@ -1418,6 +1422,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -1417,6 +1421,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple this.lastSentHealth = -1.0F; this.lastSentFood = -1; @@ -221,7 +221,7 @@ index 9d1e68c09fa7093cf0f6fa636f90cb15a44cbb38..9f32ed6b7f7c3dc0175cadf811956991 PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); this.level().getCraftServer().getPluginManager().callEvent(changeEvent); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index ad1aae2c06cae2f0c9756175a61dd32d8e7701ea..3d196ce60afd638867a337ecfa3dbe5a29e8c7e0 100644 +index 8ccd40b562691e757c7b5efa1497d93a95040a9a..901e9ff7a89b48b7acca7e5b96f640045c1d265e 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -123,6 +123,8 @@ import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason; @@ -255,7 +255,7 @@ index ad1aae2c06cae2f0c9756175a61dd32d8e7701ea..3d196ce60afd638867a337ecfa3dbe5a final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage(); if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure -@@ -936,6 +953,13 @@ public abstract class PlayerList { +@@ -937,6 +954,13 @@ public abstract class PlayerList { } // Paper end - Add PlayerPostRespawnEvent @@ -269,7 +269,7 @@ index ad1aae2c06cae2f0c9756175a61dd32d8e7701ea..3d196ce60afd638867a337ecfa3dbe5a // CraftBukkit end return entityplayer1; -@@ -1068,11 +1092,16 @@ public abstract class PlayerList { +@@ -1069,11 +1093,16 @@ public abstract class PlayerList { } public String[] getPlayerNamesArray() { @@ -287,7 +287,7 @@ index ad1aae2c06cae2f0c9756175a61dd32d8e7701ea..3d196ce60afd638867a337ecfa3dbe5a return astring; } -@@ -1539,4 +1568,16 @@ public abstract class PlayerList { +@@ -1553,4 +1582,16 @@ public abstract class PlayerList { public boolean isAllowCommandsForAllPlayers() { return this.allowCommandsForAllPlayers; } @@ -305,7 +305,7 @@ index ad1aae2c06cae2f0c9756175a61dd32d8e7701ea..3d196ce60afd638867a337ecfa3dbe5a + // Leaves end - fakeplayer support } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d582615c0ca9f483f1da31e91e66b22129881d63..ed607672adc50f2929ee333fa2de29aa6e0f3bd5 100644 +index bea901be9d4d86cc016cc48a16f2775cf92d98d9..36577e641ef0cdc5bf273389ae92f0b83d13d78f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1455,7 +1455,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -383,7 +383,7 @@ index 1b1b475ca27e799e251d6f8a8c9fe1a4fd8bae83..bb9d8cb957f5be517d3ae2959e0406af if (randomsource.nextInt(j) >= world.paperConfig().entities.behavior.playerInsomniaStartTicks) { // Paper - Ability to control player's insomnia and phantoms BlockPos blockposition1 = blockposition.above(20 + randomsource.nextInt(15)).east(-10 + randomsource.nextInt(21)).south(-10 + randomsource.nextInt(21)); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index cb4922442cb696e587d07022e152c4fd9a21ca6f..1c7c0e4c5e78b9b4c0046345d71bade4acb730e9 100644 +index fbefffa0c43419e77ec8430db37698befc85837c..9739ec88134c810c0d13b23a9c8ac75d78d319f1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -309,6 +309,7 @@ public final class CraftServer implements Server { @@ -394,7 +394,7 @@ index cb4922442cb696e587d07022e152c4fd9a21ca6f..1c7c0e4c5e78b9b4c0046345d71bade4 // Paper start - Folia region threading API private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler(); -@@ -1450,7 +1451,7 @@ public final class CraftServer implements Server { +@@ -1459,7 +1460,7 @@ public final class CraftServer implements Server { return false; } @@ -403,7 +403,7 @@ index cb4922442cb696e587d07022e152c4fd9a21ca6f..1c7c0e4c5e78b9b4c0046345d71bade4 return false; } -@@ -3216,4 +3217,11 @@ public final class CraftServer implements Server { +@@ -3225,4 +3226,11 @@ public final class CraftServer implements Server { return this.potionBrewer; } // Paper end @@ -416,7 +416,7 @@ index cb4922442cb696e587d07022e152c4fd9a21ca6f..1c7c0e4c5e78b9b4c0046345d71bade4 + // Leaves end - Bot API } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 8045d6c9398d1c88595da6e41aa1ed27fb6fbad0..74f4938c88b547c326c335aac09ab47fed3ea588 100644 +index 362ca138a5cd5ad19f1300015c2571794adc3649..7daa86bff793c040a10125e033b36fbd59a09a05 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -210,7 +210,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -481,10 +481,10 @@ index 2cde808bfa797256409879505ba205a71f381981..a007beca6c00bce4514889935b1762a3 if (entity instanceof EnderDragonPart complexPart) { if (complexPart.parentMob instanceof EnderDragon) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 9c7cd9387f90d061aec76f7f0451a1da8b42ea3d..7c6de0ad3b919043b95429a4e506d63d32543598 100644 +index 0ab53d46f0b8f3f3791dd01766738522c86932e8..f60301047fc22fb72413fe95eb89e4d26e947806 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1018,7 +1018,10 @@ public class CraftEventFactory { +@@ -1021,7 +1021,10 @@ public class CraftEventFactory { event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel populateFields(victim, event); // Paper - make cancellable @@ -497,15 +497,15 @@ index 9c7cd9387f90d061aec76f7f0451a1da8b42ea3d..7c6de0ad3b919043b95429a4e506d63d if (event.isCancelled()) { return event; diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index bb9383f1a457433f9db3e78d7913616280925200..55b41ca7630db143d70137324a9de8717397f0e8 100644 +index 22f1ed383313829b8af4badda9ef8dc85cae8fd1..764a8b623b91acca040699839c52c2ecec6842ee 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -46,7 +46,7 @@ import org.bukkit.scheduler.BukkitWorker; +@@ -46,6 +46,8 @@ import org.bukkit.scheduler.BukkitWorker; */ public class CraftScheduler implements BukkitScheduler { -- static Plugin MINECRAFT = new MinecraftInternalPlugin(); -+ public static Plugin MINECRAFT = new MinecraftInternalPlugin(); // Leaves - package -> public ++ public static final Plugin SERVER = new org.bukkit.plugin.java.JavaPlugin(){}; // Leaves - run async task ++ /** * The start ID for the counter. */ @@ -1401,7 +1401,7 @@ index 0000000000000000000000000000000000000000..0db337866c71283464d026a4f230016b +} diff --git a/src/main/java/org/leavesmc/leaves/bot/ServerBot.java b/src/main/java/org/leavesmc/leaves/bot/ServerBot.java new file mode 100644 -index 0000000000000000000000000000000000000000..0cb04bf5c5da387b295897997ae0692eb8baab6e +index 0000000000000000000000000000000000000000..47b207b6e24c4856304565ce1c9409ca7b6400f2 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/bot/ServerBot.java @@ -0,0 +1,745 @@ @@ -1644,7 +1644,7 @@ index 0000000000000000000000000000000000000000..0cb04bf5c5da387b295897997ae0692e + + playerConnection.send(this.getAddEntityPacket(entityTracker.serverEntity)); + if (login) { -+ Bukkit.getScheduler().runTaskLater(CraftScheduler.MINECRAFT, () -> { ++ Bukkit.getScheduler().runTaskLater(CraftScheduler.SERVER, () -> { + playerConnection.send(new ClientboundRotateHeadPacket(this, (byte) ((getYRot() * 256f) / 360f))); + }, 10); + } else { @@ -2117,12 +2117,12 @@ index 0000000000000000000000000000000000000000..0cb04bf5c5da387b295897997ae0692e + } + return bot != null ? bot.getBukkitEntity() : null; + } -+ Bukkit.getScheduler().runTaskAsynchronously(CraftScheduler.MINECRAFT, () -> { ++ Bukkit.getScheduler().runTaskAsynchronously(CraftScheduler.SERVER, () -> { + if (skinName != null) { + this.skin = MojangAPI.getSkin(skinName); + } + -+ Bukkit.getScheduler().runTask(CraftScheduler.MINECRAFT, () -> { ++ Bukkit.getScheduler().runTask(CraftScheduler.SERVER, () -> { + ServerBot bot = createBot(this); + if (bot != null && consumer != null) { + consumer.accept(bot); @@ -3138,7 +3138,7 @@ index 0000000000000000000000000000000000000000..475bf440d40ac35720b01da18440cf0d +} diff --git a/src/main/java/org/leavesmc/leaves/bot/agent/actions/UseItemOnAction.java b/src/main/java/org/leavesmc/leaves/bot/agent/actions/UseItemOnAction.java new file mode 100644 -index 0000000000000000000000000000000000000000..fe8c4ba7aff74dc297bdf4e271a2d7f1229c357d +index 0000000000000000000000000000000000000000..81e6b4368014599ace20d371eb941faf9f5482a8 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/bot/agent/actions/UseItemOnAction.java @@ -0,0 +1,56 @@ @@ -3187,7 +3187,7 @@ index 0000000000000000000000000000000000000000..fe8c4ba7aff74dc297bdf4e271a2d7f1 + BlockEntity entity = bot.serverLevel().getBlockEntity(blockHitResult.getBlockPos()); + if (entity instanceof TrappedChestBlockEntity chestBlockEntity) { + chestBlockEntity.startOpen(bot); -+ Bukkit.getScheduler().runTaskLater(CraftScheduler.MINECRAFT, () -> chestBlockEntity.stopOpen(bot), 1); ++ Bukkit.getScheduler().runTaskLater(CraftScheduler.SERVER, () -> chestBlockEntity.stopOpen(bot), 1); + return true; + } + } else { @@ -3200,7 +3200,7 @@ index 0000000000000000000000000000000000000000..fe8c4ba7aff74dc297bdf4e271a2d7f1 +} diff --git a/src/main/java/org/leavesmc/leaves/bot/agent/actions/UseItemOnOffhandAction.java b/src/main/java/org/leavesmc/leaves/bot/agent/actions/UseItemOnOffhandAction.java new file mode 100644 -index 0000000000000000000000000000000000000000..a69ede01e5e5df31a144f98e9871183793f5f377 +index 0000000000000000000000000000000000000000..8ef68e0e8a75760c974fdb0849f147aac0c168fa --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/bot/agent/actions/UseItemOnOffhandAction.java @@ -0,0 +1,56 @@ @@ -3249,7 +3249,7 @@ index 0000000000000000000000000000000000000000..a69ede01e5e5df31a144f98e98711837 + BlockEntity entity = bot.serverLevel().getBlockEntity(blockHitResult.getBlockPos()); + if (entity instanceof TrappedChestBlockEntity chestBlockEntity) { + chestBlockEntity.startOpen(bot); -+ Bukkit.getScheduler().runTaskLater(CraftScheduler.MINECRAFT, () -> chestBlockEntity.stopOpen(bot), 1); ++ Bukkit.getScheduler().runTaskLater(CraftScheduler.SERVER, () -> chestBlockEntity.stopOpen(bot), 1); + return true; + } + } else { diff --git a/patches/server/0014-Budding-Amethyst-can-push-by-piston.patch b/patches/server/0014-Budding-Amethyst-can-push-by-piston.patch index bf2e45fe..27fef8f9 100644 --- a/patches/server/0014-Budding-Amethyst-can-push-by-piston.patch +++ b/patches/server/0014-Budding-Amethyst-can-push-by-piston.patch @@ -38,10 +38,10 @@ index 8920855b07a31715327b8102c7faafc9f916825d..32d926a1b952b8069c5bf48c88e3c108 + // Leaves end - budding amethyst can push by piston } diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 0f289d8f9bda2fb2ca2cd2dfd667a975529b3e4c..7426ad401d611a345eb0bee0b49012fcf5b970d5 100644 +index ded6d148110fe3fbb6272ce44582a28472dd49a6..2d44010e51b214c6c58a57e17cd565d2262397b2 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -1104,7 +1104,7 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -1098,7 +1098,7 @@ public abstract class BlockBehaviour implements FeatureElement { } public PushReaction getPistonPushReaction() { diff --git a/patches/server/0018-No-chat-sign.patch b/patches/server/0018-No-chat-sign.patch index e6011ca4..716dc6f5 100644 --- a/patches/server/0018-No-chat-sign.patch +++ b/patches/server/0018-No-chat-sign.patch @@ -149,10 +149,10 @@ index 01c2e26f92d5d1e46b98ebd20727beb779c98095..ced6a08caf546e245bd6a631df3dc9f8 if (packet == null || this.processedDisconnect) { // Spigot return; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 3d196ce60afd638867a337ecfa3dbe5a29e8c7e0..627c6b4bba6863ea89a2be2c3f163533e0d80147 100644 +index 901e9ff7a89b48b7acca7e5b96f640045c1d265e..a06b642d38f8367a5115e6e8a7bb4bae0acdb0bd 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1429,7 +1429,7 @@ public abstract class PlayerList { +@@ -1443,7 +1443,7 @@ public abstract class PlayerList { } public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public diff --git a/patches/server/0020-Optimize-entity-coordinate-key.patch b/patches/server/0020-Optimize-entity-coordinate-key.patch index d3a749ce..ad649be3 100644 --- a/patches/server/0020-Optimize-entity-coordinate-key.patch +++ b/patches/server/0020-Optimize-entity-coordinate-key.patch @@ -5,27 +5,8 @@ Subject: [PATCH] Optimize entity coordinate key This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) -diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index 02d6c98b7a2212b13ffd9859ebfdc0a8357ebe65..8add631c0614879d24455a96d94bc6711456f223 100644 ---- a/src/main/java/io/papermc/paper/util/MCUtil.java -+++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -199,7 +199,13 @@ public final class MCUtil { - } - - public static long getCoordinateKey(final Entity entity) { -- return ((long)(MCUtil.fastFloor(entity.getZ()) >> 4) << 32) | ((MCUtil.fastFloor(entity.getX()) >> 4) & 0xFFFFFFFFL); -+ // Leaves start - eliminate double -> long cast in hotpath -+ if (org.leavesmc.leaves.LeavesConfig.optimizeEntityCoordinateKey) { -+ return ((long)(entity.blockPosition.getZ() >> 4) << 32) | ((entity.blockPosition.getX() >> 4) & 0xFFFFFFFFL); -+ } else { -+ return ((long)(MCUtil.fastFloor(entity.getZ()) >> 4) << 32) | ((MCUtil.fastFloor(entity.getX()) >> 4) & 0xFFFFFFFFL); -+ } -+ // Leaves end - eliminate double -> long cast in hotpath - } - - public static long getCoordinateKey(final ChunkPos pair) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2dc27d27908a50101e5671809d1331db0cb2a96c..9e984f4bad722244d70d8b45755ca3abd0a22d4a 100644 +index 36577e641ef0cdc5bf273389ae92f0b83d13d78f..2563e077ceaf6c21e20f00c59341abcca39c91eb 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -316,7 +316,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0024-Config-to-disable-method-profiler.patch b/patches/server/0024-Config-to-disable-method-profiler.patch index ff6ad05b..421ab77a 100644 --- a/patches/server/0024-Config-to-disable-method-profiler.patch +++ b/patches/server/0024-Config-to-disable-method-profiler.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Config to disable method profiler This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 778a8c8a88128107b7ccd9bb4a783c0b519da9b1..cb9aae6ff466c07781963ca818ff7421e6bc3964 100644 +index 471ded84bdd3e59a75cfa34aac16bb726f80ba28..30c2612260be88c68d94ba483add96bfe06243bd 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2548,6 +2548,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0.0D) { if (k1 > 0) { diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index d4bd71f70f80ea74947e6d478ff636be2ab7d432..598e714120c9d6cfcf870cbb23f2e9f7432588eb 100644 +index c3b1caa352b988ec44fa2b2eb0536517711f5460..95921cc65ebb0d41a52a662130e0e265b4f5afa6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -25,6 +25,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.collis +@@ -25,6 +25,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_ public final PalettedContainer states; // CraftBukkit start - read/write private PalettedContainer> biomes; + public short fluidStateCount; // Leaves - // Paper start - optimise collisions - private int specialCollidingBlocks; -@@ -91,6 +92,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.collis + // Paper start - block counting + private static final it.unimi.dsi.fastutil.ints.IntArrayList FULL_LIST = new it.unimi.dsi.fastutil.ints.IntArrayList(16*16*16); +@@ -104,6 +105,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_ if (!fluid.isEmpty()) { --this.tickingFluidCount; @@ -200,15 +200,15 @@ index d4bd71f70f80ea74947e6d478ff636be2ab7d432..598e714120c9d6cfcf870cbb23f2e9f7 } if (!state.isAir()) { -@@ -102,6 +104,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.collis +@@ -115,6 +117,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_ if (!fluid1.isEmpty()) { ++this.tickingFluidCount; + --this.fluidStateCount; // Leaves } - // Paper start - optimise collisions -@@ -181,6 +184,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.collis + // Paper start - block counting +@@ -208,6 +211,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_ if (fluid.isRandomlyTicking()) { this.tickingFluidCount += paletteCount; } diff --git a/patches/server/0034-InstantBlockUpdater-Reintroduced.patch b/patches/server/0034-InstantBlockUpdater-Reintroduced.patch index 385b2daa..b37b4576 100644 --- a/patches/server/0034-InstantBlockUpdater-Reintroduced.patch +++ b/patches/server/0034-InstantBlockUpdater-Reintroduced.patch @@ -6,10 +6,10 @@ Subject: [PATCH] InstantBlockUpdater Reintroduced This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition) diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index cf48bc7e256af656dc1f491becb54faa2e648fac..5e5467564c4ead220b7b82b94eebb5ff6f8023fe 100644 +index e935903d918f12e5e1617ebf2d74399b9cd4f79c..1f6e6bba0f6d16091f4c6a5fdb4bac4579ba525f 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -679,7 +679,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -723,7 +723,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl this.thread = Thread.currentThread(); this.biomeManager = new BiomeManager(this, i); this.isDebug = flag1; diff --git a/patches/server/0036-BBOR-Protocol.patch b/patches/server/0036-BBOR-Protocol.patch index f68b2fa5..d3058ffc 100644 --- a/patches/server/0036-BBOR-Protocol.patch +++ b/patches/server/0036-BBOR-Protocol.patch @@ -5,10 +5,10 @@ Subject: [PATCH] BBOR Protocol diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 627c6b4bba6863ea89a2be2c3f163533e0d80147..4f3ae7cf3294583b738482964b78ebf2bd65cbbf 100644 +index a06b642d38f8367a5115e6e8a7bb4bae0acdb0bd..f5ea34249bde9ecc19fad0b1fda4f9775522c7a6 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1563,6 +1563,7 @@ public abstract class PlayerList { +@@ -1577,6 +1577,7 @@ public abstract class PlayerList { entityplayer.getRecipeBook().sendInitialRecipeBook(entityplayer); } @@ -17,10 +17,10 @@ index 627c6b4bba6863ea89a2be2c3f163533e0d80147..4f3ae7cf3294583b738482964b78ebf2 public boolean isAllowCommandsForAllPlayers() { diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 12ee7f3cef6cd41b23200bb53bb6fd2018039d49..60e137896271a6aed7604dfd256dc4686aab06db 100644 +index 7a1cd74990707cbd79f2d89c96d91072c0433289..8850d3c32436ebd1caf3d6b824f32d76db1d76f5 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -768,6 +768,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -779,6 +779,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p public void setLoaded(boolean loadedToWorld) { this.loaded = loadedToWorld; diff --git a/patches/server/0040-Player-operation-limiter.patch b/patches/server/0040-Player-operation-limiter.patch index 0917327a..0e870b84 100644 --- a/patches/server/0040-Player-operation-limiter.patch +++ b/patches/server/0040-Player-operation-limiter.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Player operation limiter This patch is Powered by plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition) diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 9f32ed6b7f7c3dc0175cadf811956991b136be23..eee83b3e9bc409c987bf85970f9c2add052cbeb0 100644 +index 40dfc96bbcd1f85a5917c458ae3a8e3c1574c667..b25ce140c29675e16a8ba1caa02bc2318c738734 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -301,6 +301,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -302,6 +302,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent public @Nullable String clientBrandName = null; // Paper - Brand support public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event @@ -20,7 +20,7 @@ index 9f32ed6b7f7c3dc0175cadf811956991b136be23..eee83b3e9bc409c987bf85970f9c2add // Paper start - rewrite chunk system private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader; -@@ -764,6 +768,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -763,6 +767,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple this.joining = false; } // CraftBukkit end @@ -28,7 +28,7 @@ index 9f32ed6b7f7c3dc0175cadf811956991b136be23..eee83b3e9bc409c987bf85970f9c2add this.gameMode.tick(); this.wardenSpawnTracker.tick(); --this.spawnInvulnerableTime; -@@ -2954,5 +2959,32 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -2953,5 +2958,32 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple public CraftPlayer getBukkitEntity() { return (CraftPlayer) super.getBukkitEntity(); } diff --git a/patches/server/0044-MC-Technical-Survival-Mode.patch b/patches/server/0044-MC-Technical-Survival-Mode.patch index 72bc9b24..f19645a2 100644 --- a/patches/server/0044-MC-Technical-Survival-Mode.patch +++ b/patches/server/0044-MC-Technical-Survival-Mode.patch @@ -39,10 +39,10 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..12cf1f7ba7d6c14b8b31d939b6f281bd throw new RuntimeException("Could not reload paper configuration files", ex); } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 75512c4217340c7a501f825f440ecb3229b1092e..0d157e461eeb5b97290fadc602ab179a68285eda 100644 +index 8e31f8df82736df23683f25639be022e1cc030d0..fc1bd47c6079b30e80c278d0f49bdefc76264763 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2483,7 +2483,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -2550,7 +2550,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. public void onTickingEnd(Entity entity) { ServerLevel.this.entityTickList.remove(entity); // Paper start - Reset pearls when they stop being ticked @@ -52,10 +52,10 @@ index 75512c4217340c7a501f825f440ecb3229b1092e..0d157e461eeb5b97290fadc602ab179a pearl.ownerUUID = null; } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index eee83b3e9bc409c987bf85970f9c2add052cbeb0..56dbb46edc04eb5feb1e1e49fa2866ea8c89ef03 100644 +index b25ce140c29675e16a8ba1caa02bc2318c738734..850558feb4f54b99755f912fac24f001cc9f88e3 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1635,7 +1635,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -1634,7 +1634,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple @Override public boolean isInvulnerableTo(DamageSource damageSource) { @@ -104,7 +104,7 @@ index 5f7d152f41eb85f17bcded4bc8099b998e5a338b..cfc7edcf24646d1605d05c3782c7694b this.leftOwner = nbt.getBoolean("LeftOwner"); diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 189a6bd4967aba72e12170e091dbb5b779e752a0..f0713e797b7ddfd39ebf96712983244f0abcf543 100644 +index 8205d34ed80781b2aab1fb2ef59986b9370f0198..c5b26fdb173a59280e790a5d5a687e0c0114bb74 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -90,7 +90,7 @@ public final class NaturalSpawner { diff --git a/patches/server/0045-Return-nether-portal-fix.patch b/patches/server/0045-Return-nether-portal-fix.patch index 86a87c4b..3206586d 100644 --- a/patches/server/0045-Return-nether-portal-fix.patch +++ b/patches/server/0045-Return-nether-portal-fix.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Return nether portal fix This patch is powered by NetherPortalFix(https://github.com/TwelveIterationMods/NetherPortalFix) diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 56dbb46edc04eb5feb1e1e49fa2866ea8c89ef03..c7729737e0be9a5f89ac6fe6ac78d7a833c166d0 100644 +index 850558feb4f54b99755f912fac24f001cc9f88e3..212c4bc00081348b2768c35e7d6350f955f68e59 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1438,6 +1438,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -1437,6 +1437,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); this.level().getCraftServer().getPluginManager().callEvent(changeEvent); // CraftBukkit end @@ -32,10 +32,10 @@ index 56dbb46edc04eb5feb1e1e49fa2866ea8c89ef03..c7729737e0be9a5f89ac6fe6ac78d7a8 if (this.isBlocking()) { this.stopUsingItem(); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 4f3ae7cf3294583b738482964b78ebf2bd65cbbf..f16d0a072ca78ddf3eeb3a483a73869e47ed8ce1 100644 +index f5ea34249bde9ecc19fad0b1fda4f9775522c7a6..d2c98e0f8d2dfbc74180a82bdb53741c488518bf 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -940,6 +940,24 @@ public abstract class PlayerList { +@@ -941,6 +941,24 @@ public abstract class PlayerList { if (fromWorld != worldserver) { PlayerChangedWorldEvent event = new PlayerChangedWorldEvent(entityplayer.getBukkitEntity(), fromWorld.getWorld()); this.server.server.getPluginManager().callEvent(event); @@ -61,7 +61,7 @@ index 4f3ae7cf3294583b738482964b78ebf2bd65cbbf..f16d0a072ca78ddf3eeb3a483a73869e // Save player file again if they were disconnected diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index abf5025cbab6c8f7902bd732ffaca07d1659ca62..3f27a821fccbd95fbe5626c31daf2aaed1e382cc 100644 +index b531a0699f1ccbafbb26907edddd7ab8adce1718..efbac4dd85314cce550d4c8fa1836566012a7a0d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -260,7 +260,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0047-Xaero-Map-Protocol.patch b/patches/server/0047-Xaero-Map-Protocol.patch index 036916ad..14325fd4 100644 --- a/patches/server/0047-Xaero-Map-Protocol.patch +++ b/patches/server/0047-Xaero-Map-Protocol.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Xaero Map Protocol diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f16d0a072ca78ddf3eeb3a483a73869e47ed8ce1..5c47209505af8e9bea3f20effa4e176c32e5109a 100644 +index d2c98e0f8d2dfbc74180a82bdb53741c488518bf..12a848dd032099d315861016e2f18ff0c9bc751b 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1262,6 +1262,7 @@ public abstract class PlayerList { +@@ -1276,6 +1276,7 @@ public abstract class PlayerList { player.connection.send(new ClientboundInitializeBorderPacket(worldborder)); player.connection.send(new ClientboundSetTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(world.getSharedSpawnPos(), world.getSharedSpawnAngle())); diff --git a/patches/server/0050-Fix-update-suppression-crash.patch b/patches/server/0050-Fix-update-suppression-crash.patch index ca9d7e7d..7a7f1d04 100644 --- a/patches/server/0050-Fix-update-suppression-crash.patch +++ b/patches/server/0050-Fix-update-suppression-crash.patch @@ -20,10 +20,10 @@ index 1f7f68aad97ee73763c042837f239bdc7167db55..1e8025ecb14acc7c24917793c97f5435 if (exception instanceof ReportedException) { ReportedException reportedexception = (ReportedException) exception; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 7f6a25a186ca6ccd30964cf84b2c634bfb030ec9..b6ffb96d527e5abcefd567373c2039a0291129ad 100644 +index 4833e476a55c62b706f55102288fa89b2a7976e5..3cb8ed2425b12af821e9ca57408b13493501ba66 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1779,7 +1779,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); - -- void addPlayerToDistanceMaps(ServerPlayer player) { -+ public void addPlayerToDistanceMaps(ServerPlayer player) { // Leaves - package -> public - int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX()); - int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ()); - // Note: players need to be explicitly added to distance maps before they can be updated - this.nearbyPlayers.addPlayer(player); - } - -- void removePlayerFromDistanceMaps(ServerPlayer player) { -+ public void removePlayerFromDistanceMaps(ServerPlayer player) { // Leaves - package -> public - int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX()); - int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ()); - // Note: players need to be explicitly added to distance maps before they can be updated -@@ -782,7 +782,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -749,7 +749,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } private boolean skipPlayer(ServerPlayer player) { @@ -35,7 +18,7 @@ index 0c2755e890bc5ca8a761614640d0c5443b15bd68..34fb3b4e991cf7bb7016e3b32bb8200a } void updatePlayerStatus(ServerPlayer player, boolean added) { -@@ -820,6 +821,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -787,6 +788,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void move(ServerPlayer player) { @@ -57,7 +40,7 @@ index 51a1be78de7a794d13b64db6958977e2e9d20553..31ad4e4aaf321ab3c3909145e36a6774 !worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position()))) )) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2a37944ffb6a253428c0474d24b258e791a8cce0..c9784715419c407821d3b30b0881ffa8c5866f35 100644 +index 993efcba5c43e2ba6d8fd2eb61215ed67c9c6a6b..3ea0530917fbd347691427cd44344b4659fc6e09 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1136,7 +1136,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -97,12 +80,13 @@ index c566031782c4e1401e1c9f5223c62420c4fba87a..0ee227c0f7d54ed7c686a830873fab6c public boolean fauxSleeping; diff --git a/src/main/java/org/leavesmc/leaves/util/ElytraAeronauticsHelper.java b/src/main/java/org/leavesmc/leaves/util/ElytraAeronauticsHelper.java new file mode 100644 -index 0000000000000000000000000000000000000000..3b0e805b3ac9dc40280f9daa1302b1b358bd8083 +index 0000000000000000000000000000000000000000..0a9cde390476a728dd43f017e3eac3c923709b72 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/util/ElytraAeronauticsHelper.java -@@ -0,0 +1,39 @@ +@@ -0,0 +1,40 @@ +package org.leavesmc.leaves.util; + ++import ca.spottedleaf.moonrise.common.util.ChunkSystem; +import net.minecraft.core.SectionPos; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerLevel; @@ -116,14 +100,14 @@ index 0000000000000000000000000000000000000000..3b0e805b3ac9dc40280f9daa1302b1b3 + public static void flightBehaviour(Player player, Vec3 velocity) { + if (LeavesConfig.elytraAeronauticsNoChunk) { + if ((LeavesConfig.elytraAeronauticsNoChunkSpeed <= 0.0D || velocity.horizontalDistanceSqr() >= LeavesConfig.elytraAeronauticsNoChunkSpeed) -+ && (LeavesConfig.elytraAeronauticsNoChunkHeight <= 0.0D || player.getY() >= LeavesConfig.elytraAeronauticsNoChunkHeight)) { ++ && (LeavesConfig.elytraAeronauticsNoChunkHeight <= 0.0D || player.getY() >= LeavesConfig.elytraAeronauticsNoChunkHeight)) { + if (!player.elytraAeronauticsNoChunk) { + player.elytraAeronauticsNoChunk = true; + ServerPlayer serverPlayer = (ServerPlayer) player; + if (LeavesConfig.elytraAeronauticsNoChunkMes) { + serverPlayer.sendSystemMessage(Component.literal(LeavesConfig.elytraAeronauticsNoChunkStartMes), true); + } -+ ((ServerLevel) serverPlayer.level()).chunkSource.chunkMap.removePlayerFromDistanceMaps(serverPlayer); ++ ChunkSystem.removePlayerFromDistanceMaps((ServerLevel) serverPlayer.level(), serverPlayer); + ((ServerLevel) serverPlayer.level()).chunkSource.chunkMap.getDistanceManager().removePlayer(serverPlayer.getLastSectionPos(), serverPlayer); + } + } else { @@ -133,7 +117,7 @@ index 0000000000000000000000000000000000000000..3b0e805b3ac9dc40280f9daa1302b1b3 + if (LeavesConfig.elytraAeronauticsNoChunkMes) { + serverPlayer.sendSystemMessage(Component.literal(LeavesConfig.elytraAeronauticsNoChunkEndMes), true); + } -+ ((ServerLevel) serverPlayer.level()).chunkSource.chunkMap.addPlayerToDistanceMaps(serverPlayer); ++ ChunkSystem.addPlayerToDistanceMaps((ServerLevel) serverPlayer.level(), serverPlayer); + ((ServerLevel) serverPlayer.level()).chunkSource.chunkMap.getDistanceManager().addPlayer(SectionPos.of(serverPlayer), serverPlayer); + } + } diff --git a/patches/server/0068-No-block-update-command.patch b/patches/server/0068-No-block-update-command.patch index 6c1da271..390e1431 100644 --- a/patches/server/0068-No-block-update-command.patch +++ b/patches/server/0068-No-block-update-command.patch @@ -5,10 +5,10 @@ Subject: [PATCH] No block update command diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0d157e461eeb5b97290fadc602ab179a68285eda..828e879953981c41507a08b9b7c7c13ea551a76e 100644 +index fc1bd47c6079b30e80c278d0f49bdefc76264763..b79d34a8cfbe562e53960062d8dd9e9e5156a9ed 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2274,6 +2274,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -2341,6 +2341,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @Override public void blockUpdated(BlockPos pos, Block block) { @@ -17,7 +17,7 @@ index 0d157e461eeb5b97290fadc602ab179a68285eda..828e879953981c41507a08b9b7c7c13e // CraftBukkit start if (this.populating) { diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index fa3dbb93a049962fe10cb0391d437acdb45c82af..d9217d2a2be6bfa8eb099effac8587af715b975c 100644 +index 9e89743328d8b05d69d5637ffc2e4831ada160b3..57b14342183c61bfaa206e4e87db2a9d2a6191ee 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -527,7 +527,7 @@ public final class ItemStack implements DataComponentHolder { @@ -30,10 +30,10 @@ index fa3dbb93a049962fe10cb0391d437acdb45c82af..d9217d2a2be6bfa8eb099effac8587af world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 60e137896271a6aed7604dfd256dc4686aab06db..bfed97cf28be18ce82eda1ab7f105b4c0a5e7178 100644 +index 8850d3c32436ebd1caf3d6b824f32d76db1d76f5..748f04d9031bcf2da57ef902cbba4f798e70b1d9 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -392,7 +392,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -403,7 +403,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p } else { // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled. if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) { diff --git a/patches/server/0073-Faster-chunk-serialization.patch b/patches/server/0073-Faster-chunk-serialization.patch index e60dea48..8c3d76f5 100644 --- a/patches/server/0073-Faster-chunk-serialization.patch +++ b/patches/server/0073-Faster-chunk-serialization.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Faster chunk serialization This patch is Powered by Gale(https://github.com/GaleMC/Gale) diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java -index 68648c5a5e3ff079f832092af0f2f801c42d1ede..0e4555ef99d150b28cabb79fc997b72935fb7ba5 100644 +index 19661e106612b8e4e152085fb398db7bd06acc23..b0eebd6f35bcf5dac99b9efe13ae6b2c03fce4a1 100644 --- a/src/main/java/net/minecraft/util/BitStorage.java +++ b/src/main/java/net/minecraft/util/BitStorage.java @@ -1,5 +1,7 @@ @@ -16,17 +16,18 @@ index 68648c5a5e3ff079f832092af0f2f801c42d1ede..0e4555ef99d150b28cabb79fc997b729 + import java.util.function.IntConsumer; - public interface BitStorage { -@@ -20,4 +22,7 @@ public interface BitStorage { - void unpack(int[] out); + public interface BitStorage extends ca.spottedleaf.moonrise.patches.block_counting.BlockCountingBitStorage { // Paper - block counting +@@ -21,6 +23,8 @@ public interface BitStorage extends ca.spottedleaf.moonrise.patches.block_counti BitStorage copy(); -+ -+ + + void compact(Palette srcPalette, Palette dstPalette, short[] out); // Leaves - faster chunk serialization - } ++ + // Paper start - block counting + // provide default impl in case mods implement this... + @Override diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java -index 9f438d9c6eb05e43d24e4af68188a3d4c46a938c..0958c753227b327af2390249212d11ddaccc527e 100644 +index 8acf2f2491a8d9d13392c5e89b2bd5c9918285e1..eccef53172ed8cd7d7903c7e128908e2cb87fd08 100644 --- a/src/main/java/net/minecraft/util/SimpleBitStorage.java +++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java @@ -3,6 +3,7 @@ package net.minecraft.util; @@ -37,7 +38,7 @@ index 9f438d9c6eb05e43d24e4af68188a3d4c46a938c..0958c753227b327af2390249212d11dd public class SimpleBitStorage implements BitStorage { private static final int[] MAGIC = new int[]{ -@@ -367,4 +368,44 @@ public class SimpleBitStorage implements BitStorage { +@@ -401,4 +402,44 @@ public class SimpleBitStorage implements BitStorage { super(message); } } @@ -83,7 +84,7 @@ index 9f438d9c6eb05e43d24e4af68188a3d4c46a938c..0958c753227b327af2390249212d11dd + // Leaves end - faster chunk serialization } diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java -index 50040c497a819cd1229042ab3cb057d34a32cacc..33cba55d41b305bf193268c04b93b742711231dd 100644 +index 15c5164d0ef41a978c16ee317fa73e97f2480207..93d1416cf2eaeb10e24c69a28a1d9e576ca7dbdc 100644 --- a/src/main/java/net/minecraft/util/ZeroBitStorage.java +++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java @@ -3,6 +3,7 @@ package net.minecraft.util; @@ -94,13 +95,15 @@ index 50040c497a819cd1229042ab3cb057d34a32cacc..33cba55d41b305bf193268c04b93b742 public class ZeroBitStorage implements BitStorage { public static final long[] RAW = new long[0]; -@@ -62,4 +63,6 @@ public class ZeroBitStorage implements BitStorage { - public BitStorage copy() { +@@ -63,6 +64,8 @@ public class ZeroBitStorage implements BitStorage { return this; } -+ + + @Override public void compact(Palette srcPalette, Palette dstPalette, short[] out) {} // Leaves - faster chunk serialization - } ++ + // Paper start - block counting + @Override + public final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap moonrise$countEntries() { diff --git a/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java b/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java index acae3eb30e0689048937f479dc3070f0688abdad..029b62acf1d9f8479ab64a55c12f00ba467249e3 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java diff --git a/patches/server/0082-Reduce-array-allocations.patch b/patches/server/0082-Reduce-array-allocations.patch index 2bb7b952..38c920f5 100644 --- a/patches/server/0082-Reduce-array-allocations.patch +++ b/patches/server/0082-Reduce-array-allocations.patch @@ -5,6 +5,52 @@ Subject: [PATCH] Reduce array allocations This patch is Powered by Gale(https://github.com/GaleMC/Gale) +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/list/EntityList.java b/src/main/java/ca/spottedleaf/moonrise/common/list/EntityList.java +index ba68998f6ef57b24c72fd833bd7de440de9501cc..a8e93e61beb51cc061b489ed4ad70e8fe6dfb8b9 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/list/EntityList.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/list/EntityList.java +@@ -5,6 +5,7 @@ import net.minecraft.world.entity.Entity; + import java.util.Arrays; + import java.util.Iterator; + import java.util.NoSuchElementException; ++import org.leavesmc.leaves.util.ArrayConstants; + + // list with O(1) remove & contains + +@@ -18,9 +19,7 @@ public final class EntityList implements Iterable { + this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE); + } + +- protected static final Entity[] EMPTY_LIST = new Entity[0]; +- +- protected Entity[] entities = EMPTY_LIST; ++ protected Entity[] entities = ArrayConstants.emptyEntityArray; // Leaves - reduce array allocations + protected int count; + + public int size() { +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/list/IBlockDataList.java b/src/main/java/ca/spottedleaf/moonrise/common/list/IBlockDataList.java +index fcfbca333234c09f7c056bbfcd9ac8860b20a8db..18503ef068924d4be4d40390af8db70d26fd9c7d 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/list/IBlockDataList.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/list/IBlockDataList.java +@@ -6,6 +6,7 @@ import java.util.Arrays; + import net.minecraft.world.level.block.Block; + import net.minecraft.world.level.block.state.BlockState; + import net.minecraft.world.level.chunk.GlobalPalette; ++import org.leavesmc.leaves.util.ArrayConstants; + + public final class IBlockDataList { + +@@ -17,9 +18,7 @@ public final class IBlockDataList { + this.map.defaultReturnValue(Long.MAX_VALUE); + } + +- private static final long[] EMPTY_LIST = new long[0]; +- +- private long[] byIndex = EMPTY_LIST; ++ private long[] byIndex = ArrayConstants.emptyLongArray; // Leaves - reduce array allocations + private int size; + + public static int getLocationKey(final int x, final int y, final int z) { diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java index 87d2b3ec165e2e9e4bdbedd7adddaa2130ed507b..aa17f322c6d5bfcada09d32f67f5df8f13f579ca 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java @@ -44,52 +90,6 @@ index 87d2b3ec165e2e9e4bdbedd7adddaa2130ed507b..aa17f322c6d5bfcada09d32f67f5df8f this.storage = (E[])new Entity[DEFAULT_CAPACITY]; } else { this.storage = Arrays.copyOf(this.storage, this.storage.length * 2); -diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java -index 0133ea6feb1ab88f021f66855669f58367e7420b..f56c2491fb2e84e459073ad128abf0dc699d45e9 100644 ---- a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java -+++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java -@@ -5,6 +5,7 @@ import net.minecraft.world.entity.Entity; - import java.util.Arrays; - import java.util.Iterator; - import java.util.NoSuchElementException; -+import org.leavesmc.leaves.util.ArrayConstants; - - // list with O(1) remove & contains - /** -@@ -17,9 +18,7 @@ public final class EntityList implements Iterable { - this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE); - } - -- protected static final Entity[] EMPTY_LIST = new Entity[0]; -- -- protected Entity[] entities = EMPTY_LIST; -+ protected Entity[] entities = ArrayConstants.emptyEntityArray; // Leaves - reduce array allocations - protected int count; - - public int size() { -diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java -index 277cfd9d1e8fff5d9b5e534b75c3c5162d58b0b7..7b870ea004d338b2bb9423f9d8c5759801315950 100644 ---- a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java -+++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java -@@ -6,6 +6,7 @@ import java.util.Arrays; - import net.minecraft.world.level.block.Block; - import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.chunk.GlobalPalette; -+import org.leavesmc.leaves.util.ArrayConstants; - - /** - * @author Spottedleaf -@@ -20,9 +21,7 @@ public final class IBlockDataList { - this.map.defaultReturnValue(Long.MAX_VALUE); - } - -- private static final long[] EMPTY_LIST = new long[0]; -- -- private long[] byIndex = EMPTY_LIST; -+ private long[] byIndex = ArrayConstants.emptyLongArray; // Leaves - reduce array allocations - private int size; - - public static int getLocationKey(final int x, final int y, final int z) { diff --git a/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java b/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java index ae60bd96b5284d54676d8e7e4dd5d170b526ec1e..0c474b1eb4dbef547890b7db5fcf9c13c86092a2 100644 --- a/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java @@ -133,7 +133,7 @@ index 06648f9751fd8a322d0809ffebf6a544596ee1a4..d6761bdb37619b91f147ff7a9197b730 @Override diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index 4e005b7b062e3231f564d284887ea1c2783a4e7d..bc9ee52755c73606e6f5788a947f2bc695986858 100644 +index d7bb00a946346dff0b0269cbd65276e146a63fb0..3f6545f3d2e421b9d2778adb113781b1d516fa0c 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java @@ -18,6 +18,7 @@ import javax.annotation.Nullable; @@ -218,7 +218,7 @@ index 0846e11c82295ccf93683f877962ec7804dad677..b747b3858befe48996ea707cf126f6f8 for (int j = 0; j < i; ++j) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 828e879953981c41507a08b9b7c7c13ea551a76e..73f734ffcf007857bd13235dc14da930dbbe3928 100644 +index 5f779bce04ee8c687550c1386f73550c12da1892..d43f8be8132d825bc84daaa56cc624654e3f04a8 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -181,6 +181,7 @@ import org.bukkit.event.server.MapInitializeEvent; @@ -287,10 +287,10 @@ index b0f7a378f19b9837c060c891002cd5db756cdae1..8b13bd7aec76f30c5b59207583930665 final String s; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 5c47209505af8e9bea3f20effa4e176c32e5109a..fedeaf43f7b61a7ca6dc2a99bb76a47f4c640a1d 100644 +index 12a848dd032099d315861016e2f18ff0c9bc751b..6e68ad42d4fff62e38f45fd09de26da3363dcdd9 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -947,13 +947,9 @@ public abstract class PlayerList { +@@ -948,13 +948,9 @@ public abstract class PlayerList { final ResourceKey OVERWORLD = Level.OVERWORLD; final ResourceKey THE_NETHER = Level.NETHER; if (!((fromDim != OVERWORLD || toDim != THE_NETHER) && (fromDim != THE_NETHER || toDim != OVERWORLD))) { @@ -329,7 +329,7 @@ index c038da20b76c0b7b1c18471b20be01e849d29f3a..603007a376dc76c46d34f265283dda69 public boolean isEmpty() { diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java -index 33cba55d41b305bf193268c04b93b742711231dd..4200e9c5f047e3a124c61a28ff26bf30e8368b5a 100644 +index 93d1416cf2eaeb10e24c69a28a1d9e576ca7dbdc..72d908b88bd21a777a26ed3a510c422912bf9e56 100644 --- a/src/main/java/net/minecraft/util/ZeroBitStorage.java +++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java @@ -4,9 +4,10 @@ import java.util.Arrays; @@ -357,7 +357,7 @@ index 2fa2a4eef21e786f738f36616c3160defa95bce8..36c98f611f043ebadffd1b110ba3002b private EquipmentSlot(final EquipmentSlot.Type type, final int entityId, final int maxCount, final int armorStandId, final String name) { this.type = type; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3f27a821fccbd95fbe5626c31daf2aaed1e382cc..2c385a89db50d85ff65df7b20dcfefdc21856cca 100644 +index efbac4dd85314cce550d4c8fa1836566012a7a0d..a160a6b3a8634d142436ba4098da219cf4d825a8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3280,7 +3280,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -370,10 +370,10 @@ index 3f27a821fccbd95fbe5626c31daf2aaed1e382cc..2c385a89db50d85ff65df7b20dcfefdc for (int j = 0; j < i; ++j) { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 5c20fad61b81189ad45623346fa2b79ea8aa9b2a..2634a4cb8a880363829ecffa85cb57ac22f9a632 100644 +index 9f2ef5ea9f380e78d4a150df9f16ff6bfc398b75..33de05de648c88539a4792c63a903102f0faa7b2 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1152,7 +1152,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1150,7 +1150,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) { super.dropCustomDeathLoot(world, source, causedByPlayer); @@ -382,7 +382,7 @@ index 5c20fad61b81189ad45623346fa2b79ea8aa9b2a..2634a4cb8a880363829ecffa85cb57ac int i = aenumitemslot.length; for (int j = 0; j < i; ++j) { -@@ -1282,7 +1282,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1280,7 +1280,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } boolean flag = true; @@ -391,7 +391,7 @@ index 5c20fad61b81189ad45623346fa2b79ea8aa9b2a..2634a4cb8a880363829ecffa85cb57ac int j = aenumitemslot.length; for (int k = 0; k < j; ++k) { -@@ -1367,7 +1367,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1365,7 +1365,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab protected void populateDefaultEquipmentEnchantments(ServerLevelAccessor world, RandomSource random, DifficultyInstance localDifficulty) { this.enchantSpawnedWeapon(world, random, localDifficulty); @@ -400,7 +400,7 @@ index 5c20fad61b81189ad45623346fa2b79ea8aa9b2a..2634a4cb8a880363829ecffa85cb57ac int i = aenumitemslot.length; for (int j = 0; j < i; ++j) { -@@ -1572,7 +1572,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1570,7 +1570,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab t0.setInvulnerable(this.isInvulnerable()); if (flag) { t0.setCanPickUpLoot(this.canPickUpLoot()); @@ -422,7 +422,7 @@ index 1bf54b0142fe41b29b21c8b97d3f52bb24a36a92..f19ace4f9027260ded3ee37c1bda91c5 public class ShapedRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe implements CraftingRecipe { // Paper - improve exact recipe choices diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 5e5467564c4ead220b7b82b94eebb5ff6f8023fe..9364fe8494b42d4e7061f9d08bbdcaeb8892452c 100644 +index 1f6e6bba0f6d16091f4c6a5fdb4bac4579ba525f..1848ed1dff8327db5c9a01e8e2019997e927692c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -102,6 +102,7 @@ import org.bukkit.craftbukkit.util.CraftSpawnCategory; diff --git a/patches/server/0083-Optimize-sun-burn-tick.patch b/patches/server/0083-Optimize-sun-burn-tick.patch index 40c0076c..ade9ccbe 100644 --- a/patches/server/0083-Optimize-sun-burn-tick.patch +++ b/patches/server/0083-Optimize-sun-burn-tick.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimize sun burn tick This patch is Powered by Gale(https://github.com/GaleMC/Gale) diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c9784715419c407821d3b30b0881ffa8c5866f35..4529c975e573c68bc57a735384b5b8baea7dfc38 100644 +index d32b658a659c8a139060ac96289ca7497f085d52..8067263c419febe749d15e51511c769d97f325ba 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2078,8 +2078,22 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -34,10 +34,10 @@ index c9784715419c407821d3b30b0881ffa8c5866f35..4529c975e573c68bc57a735384b5b8ba public void absMoveTo(double x, double y, double z, float yaw, float pitch) { this.absMoveTo(x, y, z); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 2634a4cb8a880363829ecffa85cb57ac22f9a632..d1ed94b5e924b39d9d17fd27f0e123316a3b4da2 100644 +index 33de05de648c88539a4792c63a903102f0faa7b2..9ad75d9ef0cc8c9faa81c5c674ab7dbba4f6f471 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1752,15 +1752,41 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1750,15 +1750,41 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab protected void playAttackSound() {} diff --git a/patches/server/0088-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0088-Skip-entity-move-if-movement-is-zero.patch index 11954ca7..7c588fa4 100644 --- a/patches/server/0088-Skip-entity-move-if-movement-is-zero.patch +++ b/patches/server/0088-Skip-entity-move-if-movement-is-zero.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Skip entity move if movement is zero This patch is Powered by Gale(https://github.com/GaleMC/Gale) diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4529c975e573c68bc57a735384b5b8baea7dfc38..ad919f7c613549a25656109fc66251dcf9f7989b 100644 +index 8067263c419febe749d15e51511c769d97f325ba..024ec708fb1dd85f270b1864176e7d70414a225b 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -324,6 +324,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -30,7 +30,7 @@ index 4529c975e573c68bc57a735384b5b8baea7dfc38..ad919f7c613549a25656109fc66251dc + // Leaves end - skip entity move if movement is zero final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity // Paper start - detailed watchdog information - io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main"); + ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main"); @@ -4162,6 +4170,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } diff --git a/patches/server/0096-Force-peaceful-mode-switch.patch b/patches/server/0096-Force-peaceful-mode-switch.patch index a8b5d3dc..ba599990 100644 --- a/patches/server/0096-Force-peaceful-mode-switch.patch +++ b/patches/server/0096-Force-peaceful-mode-switch.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Force peaceful mode switch diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index f5f52d4ae8965cacf0d79c863aa64cd92447c6fc..978169b6907db6e513f840c60ef4242b47620f5c 100644 +index 63869a234de3e69a690d3d0113755e64bd519b02..16a4cca571326732566e4725404059bb7d6cbe68 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -129,6 +129,12 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - } +@@ -128,6 +128,12 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon // Paper end - rewrite chunk system + private ServerChunkCache.ChunkAndHolder[] iterationCopy; // Paper - chunk tick iteration optimisations + // Leaves start - peaceful mode switch + public int peacefulModeSwitchTick = org.leavesmc.leaves.LeavesConfig.forcePeacefulMode; @@ -21,10 +21,11 @@ index f5f52d4ae8965cacf0d79c863aa64cd92447c6fc..978169b6907db6e513f840c60ef4242b public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, int simulationDistance, boolean dsync, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory) { this.level = world; this.mainThreadProcessor = new ServerChunkCache.MainThreadExecutor(world); -@@ -424,6 +430,21 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - List list = Lists.newArrayListWithCapacity(this.chunkMap.size()); - Iterator iterator = this.chunkMap.getChunks().iterator(); +@@ -420,6 +426,22 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + gameprofilerfiller.push("pollingChunks"); + gameprofilerfiller.push("filteringLoadedChunks"); ++ + // Leaves start - peaceful mode switch + if (peacefulModeSwitchTick > 0) { + if (this.level.getLevelData().getGameTime() % peacefulModeSwitchTick == 0) { @@ -40,10 +41,10 @@ index f5f52d4ae8965cacf0d79c863aa64cd92447c6fc..978169b6907db6e513f840c60ef4242b + } + // Leaves end - peaceful mode switch + - while (iterator.hasNext()) { - ChunkHolder playerchunk = (ChunkHolder) iterator.next(); - LevelChunk chunk = playerchunk.getTickingChunk(); -@@ -464,6 +485,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper start - chunk tick iteration optimisations + List list; + { +@@ -474,6 +496,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon gameprofilerfiller.popPush("spawnAndTick"); boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit @@ -56,20 +57,20 @@ index f5f52d4ae8965cacf0d79c863aa64cd92447c6fc..978169b6907db6e513f840c60ef4242b + } + // Leaves end - peaceful mode switch + - Util.shuffle(list, this.level.random); + if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.level.random); // Paper - per player mob spawns - do not need this when per-player is enabled // Paper start - PlayerNaturallySpawnCreaturesEvent int chunkRange = level.spigotConfig.mobSpawnRange; -@@ -486,7 +516,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) { +@@ -496,7 +527,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + if (true && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) { // Paper - rewrite chunk system chunk1.incrementInhabitedTime(j); if (flag && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot - NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1); + NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1, peacefulModeSwitch); } - if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { + if (true) { // Paper - rewrite chunk system diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 5184df047c329323dfd1ebbf122963b4add098c3..3140d20aff7b1c518330bae088574e7163793eaf 100644 +index 7cb97b7623b603aa5469c92f5a6816673c994540..adc3169fb375f03c532d0abdaf336bab8079c559 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -127,6 +127,12 @@ public final class NaturalSpawner { @@ -98,7 +99,7 @@ index 5184df047c329323dfd1ebbf122963b4add098c3..3140d20aff7b1c518330bae088574e71 boolean spawnThisTick = true; int limit = enumcreaturetype.getMaxInstancesPerChunk(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 74f4938c88b547c326c335aac09ab47fed3ea588..f7f65f3b7c0298e1e4fee4692ee6cce3bae707b6 100644 +index 7daa86bff793c040a10125e033b36fbd59a09a05..3c019e6d4af27a4305acb6640dc9a86d443101d9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -2372,6 +2372,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0097-Replay-Mod-API.patch b/patches/server/0097-Replay-Mod-API.patch index 8d7f95cb..b48424f7 100644 --- a/patches/server/0097-Replay-Mod-API.patch +++ b/patches/server/0097-Replay-Mod-API.patch @@ -108,10 +108,10 @@ index c8d39e6e1c570c9219f6066da273dc0130920519..96a074281d16a7f64058619da4b102f3 if (((List) object).size() >= i) { return (List) object; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 04b90b90c6fd90ffe8cbd712de48ed55fde6c1e0..8794ea476463fa035fb2d658594d1c633025523f 100644 +index 1a4a3a54a9eb397b20d83dd603a38c9366fda8a7..19c0b7b95fb96978853f05ee1c6829613103acff 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1682,7 +1682,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop !playerList.isOp(player.getGameProfile())) .map(player -> player.getGameProfile().getName()), diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 73f734ffcf007857bd13235dc14da930dbbe3928..d25dd7cf4e59138cfc826503b9d75eb086718d81 100644 +index 1b33ac2eaa4d938f8e930fb2bfcc7169f10f851f..fc9c4711495136c564ad0da3de314811256df4a1 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2498,7 +2498,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -2565,7 +2565,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. if (entity instanceof ServerPlayer entityplayer) { ServerLevel.this.players.add(entityplayer); // Leaves start - skip @@ -159,7 +159,7 @@ index 73f734ffcf007857bd13235dc14da930dbbe3928..d25dd7cf4e59138cfc826503b9d75eb0 ServerLevel.this.realPlayers.add(entityplayer); } // Leaves end - skip -@@ -2580,7 +2580,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -2647,7 +2647,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. if (entity instanceof ServerPlayer entityplayer) { ServerLevel.this.players.remove(entityplayer); // Leaves start - skip @@ -169,7 +169,7 @@ index 73f734ffcf007857bd13235dc14da930dbbe3928..d25dd7cf4e59138cfc826503b9d75eb0 } // Leaves end - skip diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index fedeaf43f7b61a7ca6dc2a99bb76a47f4c640a1d..34b0a606a0bb2073b3ce151a2fdeeb3c7c9f2acb 100644 +index 6e68ad42d4fff62e38f45fd09de26da3363dcdd9..d04ebc381ba3f52954b647bc76ccc9cf628052eb 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -124,6 +124,7 @@ import org.bukkit.event.player.PlayerSpawnChangeEvent; @@ -330,7 +330,7 @@ index fedeaf43f7b61a7ca6dc2a99bb76a47f4c640a1d..34b0a606a0bb2073b3ce151a2fdeeb3c onlinePlayers.add(entityplayer1); // Paper - Use single player info update packet on join } // Paper start - Use single player info update packet on join -@@ -602,6 +725,43 @@ public abstract class PlayerList { +@@ -603,6 +726,43 @@ public abstract class PlayerList { } @@ -374,7 +374,7 @@ index fedeaf43f7b61a7ca6dc2a99bb76a47f4c640a1d..34b0a606a0bb2073b3ce151a2fdeeb3c public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // CraftBukkit - return string // Paper - return Component // Paper start - Fix kick event leave message not being sent return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName()))); -@@ -670,6 +830,7 @@ public abstract class PlayerList { +@@ -671,6 +831,7 @@ public abstract class PlayerList { entityplayer.retireScheduler(); // Paper - Folia schedulers entityplayer.getAdvancements().stopListening(); this.players.remove(entityplayer); @@ -382,7 +382,7 @@ index fedeaf43f7b61a7ca6dc2a99bb76a47f4c640a1d..34b0a606a0bb2073b3ce151a2fdeeb3c this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot this.server.getCustomBossEvents().onPlayerDisconnect(entityplayer); UUID uuid = entityplayer.getUUID(); -@@ -764,7 +925,7 @@ public abstract class PlayerList { +@@ -765,7 +926,7 @@ public abstract class PlayerList { event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure } else { // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null; @@ -392,7 +392,7 @@ index fedeaf43f7b61a7ca6dc2a99bb76a47f4c640a1d..34b0a606a0bb2073b3ce151a2fdeeb3c } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1c7c0e4c5e78b9b4c0046345d71bade4acb730e9..6a51197c6a17c9b57852924d66bd1c52b5b9e4bf 100644 +index 9739ec88134c810c0d13b23a9c8ac75d78d319f1..eadb36fc12822886f73d15b22a50f9f1f87a7214 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -310,6 +310,7 @@ public final class CraftServer implements Server { @@ -412,7 +412,7 @@ index 1c7c0e4c5e78b9b4c0046345d71bade4acb730e9..6a51197c6a17c9b57852924d66bd1c52 @Override public CraftPlayer apply(ServerPlayer player) { return player.getBukkitEntity(); -@@ -3224,4 +3225,11 @@ public final class CraftServer implements Server { +@@ -3233,4 +3234,11 @@ public final class CraftServer implements Server { return botManager; } // Leaves end - Bot API @@ -437,7 +437,7 @@ index a007beca6c00bce4514889935b1762a37826c75a..02881fdb1a3c96466618149c288094b7 // Special case complex part, since there is no extra entity type for them if (entity instanceof EnderDragonPart complexPart) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d01b45a48d412e3cb591acee101730704574448a..2348a98d8fb8a6168465fbb7c4606c1c7e089530 100644 +index 992437a6e838f653f32d33b5b3f702c484640a97..cc2bd9fd33070464bac8aeab9ff26543e7b57801 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2243,7 +2243,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0113-Linear-region-file-format.patch b/patches/server/0113-Linear-region-file-format.patch index e8c764ef..6456fa71 100644 --- a/patches/server/0113-Linear-region-file-format.patch +++ b/patches/server/0113-Linear-region-file-format.patch @@ -36,10 +36,10 @@ index 73df26b27146bbad2106d57b22dd3c792ed3dd1d..f3bd1488da34ea796c8205088e83d4c5 } diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/RegionFileIOThread.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/RegionFileIOThread.java -index c833f78d083b8f661087471c35bc90f65af1b525..8a00fd8c05df53ac99f214254e4dd9bd71858162 100644 +index 3218cbf84f54daf06e84442d5eb1a36d8da6b215..80dd90189d7790066b2e42285f256f21b146600c 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/RegionFileIOThread.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/RegionFileIOThread.java -@@ -1042,9 +1042,9 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread { +@@ -1043,9 +1043,9 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread { return ((ChunkSystemRegionFileStorage)(Object)this.getCache()).moonrise$doesRegionFileNotExistNoIO(chunkX, chunkZ); } @@ -51,7 +51,7 @@ index c833f78d083b8f661087471c35bc90f65af1b525..8a00fd8c05df53ac99f214254e4dd9bd synchronized (cache) { try { if (existingOnly) { -@@ -1060,9 +1060,9 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread { +@@ -1061,9 +1061,9 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread { } } @@ -113,7 +113,7 @@ index cb39c629af1827078f35904a373d35a63fea17ff..4f8ec87adc72f096caeb4bb437c5f43b } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index e761b63eebc1e76b2bb1cb887d83d0b63ad6ec90..2fefc69cc1df01a5ede2e5f2642adec6238e6368 100644 +index eb0389ad86300665b6e057bcfa1d7c068dc6c6ab..22cfab0214c75bab89c4aeeb98fdc81340b0fe4a 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -28,7 +28,7 @@ import net.minecraft.nbt.NbtIo; // Paper @@ -125,7 +125,16 @@ index e761b63eebc1e76b2bb1cb887d83d0b63ad6ec90..2fefc69cc1df01a5ede2e5f2642adec6 private static final Logger LOGGER = LogUtils.getLogger(); private static final int SECTOR_BYTES = 4096; -@@ -465,10 +465,10 @@ public class RegionFile implements AutoCloseable { +@@ -129,7 +129,7 @@ public class RegionFile implements AutoCloseable { + } + + // note: only call for CHUNK regionfiles +- boolean recalculateHeader() throws IOException { ++ public boolean recalculateHeader() throws IOException { // Leaves - make it public + if (!this.canRecalcHeader) { + return false; + } +@@ -928,10 +928,10 @@ public class RegionFile implements AutoCloseable { private static int getChunkIndex(int x, int z) { return (x & 31) + (z & 31) * 32; } @@ -138,7 +147,7 @@ index e761b63eebc1e76b2bb1cb887d83d0b63ad6ec90..2fefc69cc1df01a5ede2e5f2642adec6 final int offset = getChunkIndex(x, z); boolean previous = this.oversized[offset] == 1; this.oversized[offset] = (byte) (oversized ? 1 : 0); -@@ -507,7 +507,7 @@ public class RegionFile implements AutoCloseable { +@@ -970,7 +970,7 @@ public class RegionFile implements AutoCloseable { return this.path.getParent().resolve(this.path.getFileName().toString().replaceAll("\\.mca$", "") + "_oversized_" + x + "_" + z + ".nbt"); } @@ -148,7 +157,7 @@ index e761b63eebc1e76b2bb1cb887d83d0b63ad6ec90..2fefc69cc1df01a5ede2e5f2642adec6 try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) { return NbtIo.read((java.io.DataInput) out); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d82e59b32 100644 +index 40689256711cc94a806ca1da346f4f62eda31526..b5ab653c0e3963f2b925acd1e0287cd91ab88661 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -21,7 +21,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @@ -225,8 +234,8 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d this.regionCache.putAndMoveToFirst(key, ret); -@@ -112,7 +122,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise - this.info = storageKey; +@@ -143,7 +153,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + this.isChunkData = isChunkDataFolder(this.folder); // Paper - recalculate region file headers } - public RegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit // Paper - public @@ -234,7 +243,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d // Paper start - rewrite chunk system if (existingOnly) { return this.moonrise$getRegionFileIfExists(chunkcoordintpair.x, chunkcoordintpair.z); -@@ -120,7 +130,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -151,7 +161,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise synchronized (this) { final long key = ChunkPos.asLong(chunkcoordintpair.x >> REGION_SHIFT, chunkcoordintpair.z >> REGION_SHIFT); @@ -243,7 +252,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d if (ret != null) { return ret; } -@@ -135,7 +145,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -166,7 +176,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise FileUtil.createDirectoriesSafe(this.folder); @@ -252,7 +261,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d this.regionCache.putAndMoveToFirst(key, ret); -@@ -149,7 +159,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -180,7 +190,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); } @@ -261,7 +270,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d synchronized (regionfile) { try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z); -@@ -184,7 +194,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -215,7 +225,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @Nullable public CompoundTag read(ChunkPos pos) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -270,7 +279,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d if (regionfile == null) { return null; } -@@ -235,7 +245,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -279,7 +289,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise public void scanChunk(ChunkPos chunkPos, StreamTagVisitor scanner) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -279,7 +288,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d if (regionfile == null) { return; } -@@ -265,7 +275,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -309,7 +319,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise } public void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException { // Paper - public @@ -288,7 +297,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d // Paper start - rewrite chunk system if (regionfile == null) { // if the RegionFile doesn't exist, no point in deleting from it -@@ -281,8 +291,33 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -325,8 +335,33 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise if (nbt == null) { regionfile.clear(pos); } else { @@ -323,7 +332,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d try { NbtIo.write(nbt, (DataOutput) dataoutputstream); regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone -@@ -324,7 +359,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -368,7 +403,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); @@ -332,7 +341,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d try { regionFile.close(); } catch (final IOException ex) { -@@ -341,7 +376,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -385,7 +420,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); @@ -343,10 +352,10 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d } catch (final IOException ex) { diff --git a/src/main/java/org/leavesmc/leaves/region/AbstractRegionFile.java b/src/main/java/org/leavesmc/leaves/region/AbstractRegionFile.java new file mode 100644 -index 0000000000000000000000000000000000000000..e5439ece2a33a8d88df6423eca22a895129fdbf4 +index 0000000000000000000000000000000000000000..1b9da27d9f409684917680e41a1aae583f021c20 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/region/AbstractRegionFile.java -@@ -0,0 +1,37 @@ +@@ -0,0 +1,39 @@ +package org.leavesmc.leaves.region; + +import net.minecraft.nbt.CompoundTag; @@ -369,6 +378,8 @@ index 0000000000000000000000000000000000000000..e5439ece2a33a8d88df6423eca22a895 + + CompoundTag getOversizedData(int x, int z) throws IOException; + ++ boolean recalculateHeader() throws IOException ; ++ + boolean hasChunk(ChunkPos pos); + + boolean doesChunkExist(ChunkPos pos); @@ -416,10 +427,10 @@ index 0000000000000000000000000000000000000000..72f4507aa10f2ecad545199ccb88038f +} diff --git a/src/main/java/org/leavesmc/leaves/region/LinearRegionFile.java b/src/main/java/org/leavesmc/leaves/region/LinearRegionFile.java new file mode 100644 -index 0000000000000000000000000000000000000000..0c0ccc4d1848ee3c440fbe4b924aead09c9947dc +index 0000000000000000000000000000000000000000..381897d87b10147a67dbb13194eb054d4823c9de --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/region/LinearRegionFile.java -@@ -0,0 +1,314 @@ +@@ -0,0 +1,319 @@ +package org.leavesmc.leaves.region; + +import com.github.luben.zstd.ZstdInputStream; @@ -716,6 +727,11 @@ index 0000000000000000000000000000000000000000..0c0ccc4d1848ee3c440fbe4b924aead0 + throw new IOException("getOversizedData is a stub " + this.path); + } + ++ @Override ++ public boolean recalculateHeader() { ++ return false; ++ } ++ + public boolean isOversized(int x, int z) { + return false; + } diff --git a/patches/server/0115-Servux-Protocol.patch b/patches/server/0115-Servux-Protocol.patch index cd43feaa..c9c53409 100644 --- a/patches/server/0115-Servux-Protocol.patch +++ b/patches/server/0115-Servux-Protocol.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Servux Protocol diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index d25dd7cf4e59138cfc826503b9d75eb086718d81..60883c3245c3d5a6bec8fa86e8f0ab7a071016fd 100644 +index fc9c4711495136c564ad0da3de314811256df4a1..0138c39c6c0b2c1f3526f9b4ff30d132d95a4e6f 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1983,6 +1983,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -2050,6 +2050,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } this.lastSpawnChunkRadius = i; diff --git a/patches/server/0116-Placing-locked-hopper-no-longer-send-NC-updates.patch b/patches/server/0116-Placing-locked-hopper-no-longer-send-NC-updates.patch index f51ce51f..36cc9ba7 100644 --- a/patches/server/0116-Placing-locked-hopper-no-longer-send-NC-updates.patch +++ b/patches/server/0116-Placing-locked-hopper-no-longer-send-NC-updates.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Placing locked hopper no longer send NC updates diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 9364fe8494b42d4e7061f9d08bbdcaeb8892452c..d1a4d133f14736dff64883d38a7a287182de9cfa 100644 +index 1848ed1dff8327db5c9a01e8e2019997e927692c..79f5a45cb0f4e2ffdbe82614afa6ad017fd1b09e 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -1084,7 +1084,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1128,7 +1128,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } if ((i & 1) != 0) { diff --git a/patches/server/0120-Fast-resume.patch b/patches/server/0120-Fast-resume.patch index c3c9bbec..32a425d3 100644 --- a/patches/server/0120-Fast-resume.patch +++ b/patches/server/0120-Fast-resume.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fast resume diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java -index 1030e1b059f7ccdedd9c00527c3dd20c9cb81f42..ea9786fa2331154c7bff09df01675994d2631a9e 100644 +index 58d3d1a47e9f2423c467bb329c2d5f4b58a8b5ef..ea1ffe6b5e49ccf2b472829ed97e977b4938f3a5 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java -@@ -581,6 +581,49 @@ public final class ChunkHolderManager { +@@ -582,6 +582,49 @@ public final class ChunkHolderManager { } } @@ -59,7 +59,7 @@ index 1030e1b059f7ccdedd9c00527c3dd20c9cb81f42..ea9786fa2331154c7bff09df01675994 return this.removeTicketAtLevel(type, CoordinateUtils.getChunkKey(chunkPos), level, identifier); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8794ea476463fa035fb2d658594d1c633025523f..cf50e7b61e553f26fa3c89d8fde4410ca4d8bfbb 100644 +index 19c0b7b95fb96978853f05ee1c6829613103acff..3f544556ba256d0a39fe9e1098a2e8ede5d27996 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -747,6 +747,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop