diff --git a/patches/unapplied/server/minecraft-patches/features/0001-Rebrand.patch b/divinemc-server/minecraft-patches/features/0001-Rebrand.patch similarity index 93% rename from patches/unapplied/server/minecraft-patches/features/0001-Rebrand.patch rename to divinemc-server/minecraft-patches/features/0001-Rebrand.patch index d36e881..1cfd6de 100644 --- a/patches/unapplied/server/minecraft-patches/features/0001-Rebrand.patch +++ b/divinemc-server/minecraft-patches/features/0001-Rebrand.patch @@ -18,10 +18,10 @@ index 394443d00e661715439be1e56dddc129947699a4..480ad57a6b7b74e6b83e9c6ceb69ea1f public CrashReport(String title, Throwable exception) { io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); // Paper diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 781030cb2e0316151c20351f04347c8db63f43e1..6bb8afb3b0e92c374474c92fa44dc7b80af0bd73 100644 +index 71d28092e0c3fe6e3ab284263f657eb12ba9dc60..4e347f56c98283485f7e279322c19f899e6fd569 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1182,6 +1182,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, AutoCl + // Paper end - add paper world config - public final io.papermc.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur - Purpur config files + public final org.bxteam.divinemc.DivineWorldConfig divineConfig; // DivineMC - Configuration - public static BlockPos lastPhysicsProblem; // Spigot - private org.spigotmc.TickLimiter entityLimiter; - private org.spigotmc.TickLimiter tileLimiter; -@@ -898,6 +899,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + public static @Nullable BlockPos lastPhysicsProblem; // Spigot + private int tileTickPosition; + public final Map explosionDensityCache = new java.util.HashMap<>(); // Paper - Optimize explosions +@@ -885,6 +886,14 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName(), env); // Purpur - Purpur config files diff --git a/patches/unapplied/server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch b/divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch similarity index 93% rename from patches/unapplied/server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch rename to divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch index ed5ce7b..8ca5590 100644 --- a/patches/unapplied/server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch +++ b/divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Completely remove Mojang profiler diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index d7922847bd398d809e8b8a31bf136c804305a32b..212d2bcfd34f7cb14e18a8af2cd296fc01d371f6 100644 +index 5e39795860916e8e88e1fde45f71693adee3df58..07e228b620962e507b7db70e5a743daf2e5c82ca 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java @@ -55,7 +55,6 @@ import net.minecraft.server.commands.CloneCommands; @@ -40,7 +40,7 @@ index d7922847bd398d809e8b8a31bf136c804305a32b..212d2bcfd34f7cb14e18a8af2cd296fc ContextChain contextChain = this.finishParsing(parseResults, command, commandSourceStack, label); // CraftBukkit // Paper - Add UnknownCommandEvent try { -@@ -394,8 +390,6 @@ public class Commands { +@@ -393,8 +389,6 @@ public class Commands { commandSourceStack.sendFailure(Component.literal(Util.describeError(var12))); LOGGER.error("'/{}' threw an exception", command, var12); } @@ -49,7 +49,7 @@ index d7922847bd398d809e8b8a31bf136c804305a32b..212d2bcfd34f7cb14e18a8af2cd296fc } } -@@ -452,7 +446,7 @@ public class Commands { +@@ -451,7 +445,7 @@ public class Commands { int max = Math.max(1, server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH)); int _int = server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT); @@ -213,10 +213,10 @@ index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..aa25f5ebaf7d1b22825b962b02dcae02 } } diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 6bb8afb3b0e92c374474c92fa44dc7b80af0bd73..4cb26cb312802ffc00426293014ed3994793a391 100644 +index 4e347f56c98283485f7e279322c19f899e6fd569..eb9b9473417a107092b05a9baf467410db32dc49 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -114,19 +114,8 @@ import net.minecraft.util.TimeUtil; +@@ -113,19 +113,8 @@ import net.minecraft.util.TimeUtil; import net.minecraft.util.debugchart.RemoteDebugSampleType; import net.minecraft.util.debugchart.SampleLogger; import net.minecraft.util.debugchart.TpsDebugDimensions; @@ -236,7 +236,7 @@ index 6bb8afb3b0e92c374474c92fa44dc7b80af0bd73..4cb26cb312802ffc00426293014ed399 import net.minecraft.util.thread.ReentrantBlockableEventLoop; import net.minecraft.world.Difficulty; import net.minecraft.world.RandomSequences; -@@ -199,13 +188,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop tickables = Lists.newArrayList(); @@ -250,7 +250,7 @@ index 6bb8afb3b0e92c374474c92fa44dc7b80af0bd73..4cb26cb312802ffc00426293014ed399 private ServerConnectionListener connection; public final ChunkProgressListenerFactory progressListenerFactory; @Nullable -@@ -1005,9 +987,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; try { this.isSaving = true; -@@ -1608,10 +1574,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop serverPlayer1.connection.suspendFlushing()); this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit // Paper start - Folia scheduler API -@@ -1726,9 +1684,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur - Ridables @@ -431,7 +431,7 @@ index 6bb8afb3b0e92c374474c92fa44dc7b80af0bd73..4cb26cb312802ffc00426293014ed399 try { serverLevel.tick(hasTimeLeft); } catch (Throwable var7) { -@@ -1783,34 +1734,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop true); + this.chunkMap.tick(() -> true); - gameprofilerfiller.pop(); -- this.clearCache(); -- } -- // CraftBukkit end -- + this.clearCache(); + } + // CraftBukkit end + @Override public void tick(BooleanSupplier hasTimeLeft, boolean tickChunks) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("purge"); if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot - this.distanceManager.purgeStaleTickets(); + this.ticketStorage.purgeStaleTickets(); } this.runDistanceManagerUpdates(); @@ -1212,29 +1209,17 @@ index 6540b2d6a1062d883811ce240c49d30d1925b291..8055b8552b40160732953b15876dda79 this.clearCache(); } -@@ -506,34 +484,26 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -511,22 +500,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon long l = gameTime - this.lastInhabitedUpdate; this.lastInhabitedUpdate = gameTime; if (!this.level.isDebug()) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("pollingChunks"); if (this.level.tickRateManager().runsNormally()) { - List list = this.tickingChunks; - - try { -- profilerFiller.push("filteringTickingChunks"); - this.collectTickingChunks(list); -- profilerFiller.popPush("shuffleChunks"); - // Paper start - chunk tick iteration optimisation - this.shuffleRandom.setSeed(this.level.random.nextLong()); - if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled - // Paper end - chunk tick iteration optimisation -- this.tickChunks(profilerFiller, l, list); -- profilerFiller.pop(); -+ this.tickChunks(l, list); - } finally { - list.clear(); - } +- profilerFiller.push("tickingChunks"); +- this.tickChunks(profilerFiller, l); +- profilerFiller.pop(); ++ this.tickChunks(l); } - this.broadcastChangedChunks(profilerFiller); @@ -1250,25 +1235,20 @@ index 6540b2d6a1062d883811ce240c49d30d1925b291..8055b8552b40160732953b15876dda79 for (ChunkHolder chunkHolder : this.chunkHoldersToBroadcast) { LevelChunk tickingChunk = chunkHolder.getChunkToSend(); // Paper - rewrite chunk system if (tickingChunk != null) { -@@ -542,7 +512,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -535,11 +517,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } this.chunkHoldersToBroadcast.clear(); - profiler.pop(); } - private void collectTickingChunks(List output) { -@@ -568,8 +537,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - // Paper end - chunk tick iteration optimisation - } - -- private void tickChunks(ProfilerFiller profiler, long timeInhabited, List chunks) { +- private void tickChunks(ProfilerFiller profiler, long timeInhabited) { - profiler.popPush("naturalSpawnCount"); -+ private void tickChunks(long timeInhabited, List chunks) { ++ private void tickChunks(long timeInhabited) { int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - Optional per player mob spawns NaturalSpawner.SpawnState spawnState; -@@ -594,7 +562,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -564,7 +544,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - Optional per player mob spawns this.lastSpawnState = spawnState; @@ -1276,15 +1256,33 @@ index 6540b2d6a1062d883811ce240c49d30d1925b291..8055b8552b40160732953b15876dda79 boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); List filteredSpawningCategories; -@@ -625,7 +592,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - } +@@ -586,14 +565,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + List list = this.spawningChunks; + + try { +- profiler.push("filteringSpawningChunks"); + this.chunkMap.collectSpawningChunks(list); +- profiler.popPush("shuffleSpawningChunks"); + // Paper start - chunk tick iteration optimisation + this.shuffleRandom.setSeed(this.level.random.nextLong()); + if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled + // Paper end - chunk tick iteration optimisation +- profiler.popPush("tickSpawningChunks"); + + for (LevelChunk levelChunk : list) { + this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, spawnState); +@@ -602,10 +578,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + list.clear(); } +- profiler.popPush("tickTickingChunks"); + this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimisations +- profiler.pop(); - profiler.popPush("customSpawners"); if (_boolean) { this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); } -@@ -814,7 +780,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -814,7 +787,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon @Override protected void doRunTask(Runnable task) { @@ -1293,19 +1291,19 @@ index 6540b2d6a1062d883811ce240c49d30d1925b291..8055b8552b40160732953b15876dda79 } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da78ecc6020 100644 +index d8a8e6d006d18de5ec148a0d9d6f08a6a40a65bb..2bb5055f2fb1e8b95b2a5d8dba5f1fa0bb5fdec7 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -77,8 +77,6 @@ import net.minecraft.util.ProgressListener; +@@ -74,8 +74,6 @@ import net.minecraft.util.Mth; + import net.minecraft.util.ProgressListener; import net.minecraft.util.RandomSource; - import net.minecraft.util.Unit; import net.minecraft.util.datafix.DataFixTypes; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.valueproviders.IntProvider; import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.DifficultyInstance; -@@ -735,16 +733,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -725,16 +723,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } public void tick(BooleanSupplier hasTimeLeft) { @@ -1322,7 +1320,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 } int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); -@@ -778,41 +772,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -768,41 +762,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.tickTime(); } @@ -1338,7 +1336,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 - profilerFiller.popPush("raid"); if (runsNormally) { - this.raids.tick(); + this.raids.tick(this); } - profilerFiller.popPush("chunkSource"); @@ -1350,7 +1348,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 this.handlingTick = false; - profilerFiller.pop(); - boolean flag = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this + boolean flag = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this if (flag) { this.resetEmptyTime(); } @@ -1364,7 +1362,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 } io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR -@@ -821,9 +804,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -811,9 +794,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity -> { if (!entity.isRemoved()) { if (!tickRateManager.isEntityFrozen(entity)) { @@ -1374,7 +1372,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 if (true) { // Paper - rewrite chunk system Entity vehicle = entity.getVehicle(); if (vehicle != null) { -@@ -834,21 +815,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -824,21 +805,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity.stopRiding(); } @@ -1396,7 +1394,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 } @Override -@@ -863,9 +838,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -853,9 +828,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (this.tickTime) { long l = this.levelData.getGameTime() + 1L; this.serverLevelData.setGameTime(l); @@ -1405,26 +1403,17 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 - Profiler.get().pop(); if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { // Purpur start - Configurable daylight cycle - int incrementTicks = isDay() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks; -@@ -966,8 +939,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - boolean isRaining = this.isRaining(); + int incrementTicks = isBrightOutside() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks; +@@ -955,8 +928,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + ChunkPos pos = chunk.getPos(); int minBlockX = pos.getMinBlockX(); int minBlockZ = pos.getMinBlockZ(); - ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("thunder"); - if (!this.paperConfig().environment.disableThunder && isRaining && this.isThundering() && this.spigotConfig.thunderChance > 0 && simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking - BlockPos blockPos = this.findLightningTargetAround(this.getBlockRandomPos(minBlockX, 0, minBlockZ, 15)); - if (this.isRainingAt(blockPos)) { -@@ -1002,8 +973,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - } +- profilerFiller.push("iceandsnow"); -- profilerFiller.popPush("iceandsnow"); -- if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow for (int i = 0; i < randomTickSpeed; i++) { - if (simpleRandom.nextInt(48) == 0) { // Paper - optimise random ticking -@@ -1012,12 +981,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -966,12 +937,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } } // Paper - Option to disable ice and snow @@ -1436,8 +1425,26 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 - profilerFiller.pop(); } + public void tickThunder(LevelChunk chunk) { +@@ -979,8 +947,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + boolean isRaining = this.isRaining(); + int minBlockX = pos.getMinBlockX(); + int minBlockZ = pos.getMinBlockZ(); +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("thunder"); + if (!this.paperConfig().environment.disableThunder && isRaining && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder + BlockPos blockPos = this.findLightningTargetAround(this.getBlockRandomPos(minBlockX, 0, minBlockZ, 15)); + if (this.isRainingAt(blockPos)) { +@@ -1014,8 +980,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + } + } +- +- profilerFiller.pop(); + } + @VisibleForTesting -@@ -1356,17 +1322,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1355,17 +1319,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // Paper end - log detailed entity tick information entity.setOldPosAndRot(); @@ -1455,7 +1462,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 for (Entity entity1 : entity.getPassengers()) { this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2 -@@ -1387,9 +1349,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1386,9 +1346,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe passengerEntity.setOldPosAndRot(); passengerEntity.tickCount++; passengerEntity.totalEntityAge++; // Paper - age-like counter for all entities @@ -1465,7 +1472,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 // Paper start - EAR 2 if (isActive) { passengerEntity.rideTick(); -@@ -1401,7 +1360,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1400,7 +1357,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe ridingEntity.positionRider(passengerEntity); } // Paper end - EAR 2 @@ -1474,10 +1481,10 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 for (Entity entity : passengerEntity.getPassengers()) { this.tickPassenger(passengerEntity, entity, isActive); // Paper - EAR 2 diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index a9f723528dd05cb9583319edcb14143b784a2fd7..21d41b477cc0e8d2476d1e3141bdf23d0c06f3e0 100644 +index 55d02c1d8c4cbea2eecd82b4fdf0f609647273cb..30c6bdbcd2e33e384f4d6b67e03e7a0acad2a464 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -96,8 +96,6 @@ import net.minecraft.tags.FluidTags; +@@ -104,8 +104,6 @@ import net.minecraft.util.HashOps; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; @@ -1486,7 +1493,7 @@ index a9f723528dd05cb9583319edcb14143b784a2fd7..21d41b477cc0e8d2476d1e3141bdf23d import net.minecraft.world.Container; import net.minecraft.world.Difficulty; import net.minecraft.world.InteractionHand; -@@ -1466,14 +1464,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1410,14 +1408,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.unsetRemoved(); */ // CraftBukkit end @@ -1501,7 +1508,7 @@ index a9f723528dd05cb9583319edcb14143b784a2fd7..21d41b477cc0e8d2476d1e3141bdf23d // CraftBukkit start this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds LevelData worlddata = level.getLevelData(); -@@ -1491,7 +1485,6 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1435,7 +1429,6 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event this.connection.resetPosition(); level.addDuringTeleport(this); @@ -1510,7 +1517,7 @@ index a9f723528dd05cb9583319edcb14143b784a2fd7..21d41b477cc0e8d2476d1e3141bdf23d this.stopUsingItem(); this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index c089a01765945277aafc62cb3566d81162c40c1d..801dd76a2c7f76fc6fdb7167cbf3ab1310be36c9 100644 +index eb6c6b6b45a680336944361f96927400c65601e6..482f0b5945a4ea12a805d3b926140a08151e21a6 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -24,7 +24,6 @@ import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket; @@ -1521,7 +1528,7 @@ index c089a01765945277aafc62cb3566d81162c40c1d..801dd76a2c7f76fc6fdb7167cbf3ab13 import org.slf4j.Logger; public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener, org.bukkit.craftbukkit.entity.CraftPlayer.TransferCookieConnection { // CraftBukkit -@@ -256,7 +255,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -255,7 +254,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } protected void keepConnectionAlive() { @@ -1529,7 +1536,7 @@ index c089a01765945277aafc62cb3566d81162c40c1d..801dd76a2c7f76fc6fdb7167cbf3ab13 long millis = Util.getMillis(); // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings // This should effectively place the keepalive handling back to "as it was" before 1.12.2 -@@ -290,8 +288,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -289,8 +287,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge)); } } @@ -1539,7 +1546,7 @@ index c089a01765945277aafc62cb3566d81162c40c1d..801dd76a2c7f76fc6fdb7167cbf3ab13 private boolean checkIfClosed(long time) { diff --git a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java -index 71a4a0b8535a21667261fd66d41cca1216fd9933..1e9edae4708e1b2c282a13bd6a74f71ec4116895 100644 +index f0e2bca572c6f1790772980cd3ec651e9077382d..954e4103c9c359bc13c9a07bec885af90df14cb5 100644 --- a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java +++ b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java @@ -9,8 +9,6 @@ import java.util.concurrent.TimeUnit; @@ -1551,15 +1558,16 @@ index 71a4a0b8535a21667261fd66d41cca1216fd9933..1e9edae4708e1b2c282a13bd6a74f71e import org.slf4j.Logger; public class ProfiledReloadInstance extends SimpleReloadInstance { -@@ -51,12 +49,9 @@ public class ProfiledReloadInstance extends SimpleReloadInstance executor.execute(() -> { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push(name); long nanos = Util.getNanos(); runnable.run(); timeTaken.addAndGet(Util.getNanos() - nanos); + timesRun.incrementAndGet(); - profilerFiller.pop(); }); } @@ -1640,10 +1648,10 @@ index 64b0508ef21952c65b0b967b756b2a4c64d96899..9682d64983d43f3c0142565e0cbb06f9 } diff --git a/net/minecraft/util/profiling/ActiveProfiler.java b/net/minecraft/util/profiling/ActiveProfiler.java deleted file mode 100644 -index 595e0fd9bf08bcb8358bce2a46d4322f1394e7cb..0000000000000000000000000000000000000000 +index 365995455c5e076f145063ab9415b89139f76393..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/ActiveProfiler.java +++ /dev/null -@@ -1,206 +0,0 @@ +@@ -1,207 +0,0 @@ -package net.minecraft.util.profiling; - -import com.google.common.collect.Lists; @@ -1659,6 +1667,7 @@ index 595e0fd9bf08bcb8358bce2a46d4322f1394e7cb..00000000000000000000000000000000 -import java.util.List; -import java.util.Map; -import java.util.Set; +-import java.util.function.BooleanSupplier; -import java.util.function.IntSupplier; -import java.util.function.LongSupplier; -import java.util.function.Supplier; @@ -1682,15 +1691,15 @@ index 595e0fd9bf08bcb8358bce2a46d4322f1394e7cb..00000000000000000000000000000000 - private boolean started; - @Nullable - private ActiveProfiler.PathEntry currentEntry; -- private final boolean warn; +- private final BooleanSupplier suppressWarnings; - private final Set> chartedPaths = new ObjectArraySet<>(); - -- public ActiveProfiler(LongSupplier startTimeNano, IntSupplier startTimeTicks, boolean warn) { -- this.startTimeNano = startTimeNano.getAsLong(); -- this.getRealTime = startTimeNano; -- this.startTimeTicks = startTimeTicks.getAsInt(); -- this.getTickTime = startTimeTicks; -- this.warn = warn; +- public ActiveProfiler(LongSupplier getRealTime, IntSupplier getTickTime, BooleanSupplier supressWarnings) { +- this.startTimeNano = getRealTime.getAsLong(); +- this.getRealTime = getRealTime; +- this.startTimeTicks = getTickTime.getAsInt(); +- this.getTickTime = getTickTime; +- this.suppressWarnings = supressWarnings; - } - - @Override @@ -1763,7 +1772,7 @@ index 595e0fd9bf08bcb8358bce2a46d4322f1394e7cb..00000000000000000000000000000000 - currentEntry.count++; - currentEntry.maxDuration = Math.max(currentEntry.maxDuration, l1); - currentEntry.minDuration = Math.min(currentEntry.minDuration, l1); -- if (this.warn && l1 > WARNING_TIME_NANOS) { +- if (l1 > WARNING_TIME_NANOS && !this.suppressWarnings.getAsBoolean()) { - LOGGER.warn( - "Something's taking too long! '{}' took aprox {} ms", - LogUtils.defer(() -> ProfileResults.demanglePath(this.path)), @@ -1852,23 +1861,26 @@ index 595e0fd9bf08bcb8358bce2a46d4322f1394e7cb..00000000000000000000000000000000 -} diff --git a/net/minecraft/util/profiling/ContinuousProfiler.java b/net/minecraft/util/profiling/ContinuousProfiler.java deleted file mode 100644 -index e96949cc279aeb4ef670ec07b6ec2407da2f68bd..0000000000000000000000000000000000000000 +index 553638f3140f2e0f2892adbf082b3af415424550..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/ContinuousProfiler.java +++ /dev/null -@@ -1,35 +0,0 @@ +@@ -1,38 +0,0 @@ -package net.minecraft.util.profiling; - +-import java.util.function.BooleanSupplier; -import java.util.function.IntSupplier; -import java.util.function.LongSupplier; - -public class ContinuousProfiler { - private final LongSupplier realTime; - private final IntSupplier tickCount; +- private final BooleanSupplier suppressWarnings; - private ProfileCollector profiler = InactiveProfiler.INSTANCE; - -- public ContinuousProfiler(LongSupplier realTime, IntSupplier tickCount) { +- public ContinuousProfiler(LongSupplier realTime, IntSupplier tickTime, BooleanSupplier supressWarnings) { - this.realTime = realTime; -- this.tickCount = tickCount; +- this.tickCount = tickTime; +- this.suppressWarnings = supressWarnings; - } - - public boolean isEnabled() { @@ -1880,7 +1892,7 @@ index e96949cc279aeb4ef670ec07b6ec2407da2f68bd..00000000000000000000000000000000 - } - - public void enable() { -- this.profiler = new ActiveProfiler(this.realTime, this.tickCount, true); +- this.profiler = new ActiveProfiler(this.realTime, this.tickCount, this.suppressWarnings); - } - - public ProfilerFiller getFiller() { @@ -2687,7 +2699,7 @@ index 82aef3d962e8ee6bb9c49a5655a5db49c331b022..00000000000000000000000000000000 -} diff --git a/net/minecraft/util/profiling/SingleTickProfiler.java b/net/minecraft/util/profiling/SingleTickProfiler.java deleted file mode 100644 -index 6ead9eb534103a001427ee5bec84cebe7ae97162..0000000000000000000000000000000000000000 +index 33b323b78b8210afeac1f592d36d03bf9c907a1d..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/SingleTickProfiler.java +++ /dev/null @@ -1,50 +0,0 @@ @@ -2715,7 +2727,7 @@ index 6ead9eb534103a001427ee5bec84cebe7ae97162..00000000000000000000000000000000 - } - - public ProfilerFiller startTick() { -- this.profiler = new ActiveProfiler(this.realTime, () -> this.tick, false); +- this.profiler = new ActiveProfiler(this.realTime, () -> this.tick, () -> true); - this.tick++; - return this.profiler; - } @@ -3329,7 +3341,7 @@ index 4cfaf358f9d7d07c8d58dc152a1c85d6c7824d57..00000000000000000000000000000000 -import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java b/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java deleted file mode 100644 -index 0cb8ee7b629cb3db348d4c050a63a79fbdcc99b2..0000000000000000000000000000000000000000 +index b26c1f0f07b38a3da8d81af915e8043d55d5060f..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java +++ /dev/null @@ -1,168 +0,0 @@ @@ -3390,13 +3402,13 @@ index 0cb8ee7b629cb3db348d4c050a63a79fbdcc99b2..00000000000000000000000000000000 - ) { - this.metricsSamplerProvider = metricsSamplerProvider; - this.wallTimeSource = wallTimeSource; -- this.taskProfiler = new ContinuousProfiler(wallTimeSource, () -> this.currentTick); +- this.taskProfiler = new ContinuousProfiler(wallTimeSource, () -> this.currentTick, () -> false); - this.ioExecutor = ioExecutor; - this.metricsPersister = metricPersister; - this.onProfilingEnd = onProfilerEnd; - this.onReportFinished = globalOnReportFinished == null ? onReportFinished : onReportFinished.andThen(globalOnReportFinished); - this.deadlineNano = wallTimeSource.getAsLong() + TimeUnit.NANOSECONDS.convert(10L, TimeUnit.SECONDS); -- this.singleTickProfiler = new ActiveProfiler(this.wallTimeSource, () -> this.currentTick, false); +- this.singleTickProfiler = new ActiveProfiler(this.wallTimeSource, () -> this.currentTick, () -> true); - this.taskProfiler.enable(); - } - @@ -3452,7 +3464,7 @@ index 0cb8ee7b629cb3db348d4c050a63a79fbdcc99b2..00000000000000000000000000000000 - } - - if (!this.killSwitch && this.wallTimeSource.getAsLong() <= this.deadlineNano) { -- this.singleTickProfiler = new ActiveProfiler(this.wallTimeSource, () -> this.currentTick, false); +- this.singleTickProfiler = new ActiveProfiler(this.wallTimeSource, () -> this.currentTick, () -> true); - } else { - this.killSwitch = false; - ProfileResults results = this.taskProfiler.getResults(); @@ -3996,10 +4008,10 @@ index 39a604c9a53930b53d959b1d2eb504aa964e9a58..0d0380e3955836ce125f777841477503 @Override diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616619e4bd1 100644 +index 5b0a4ef4ae5a762432dbb0def005f7505197445e..d513b82c0681fdc990af082af69278bd773225a9 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -78,8 +78,6 @@ import net.minecraft.tags.FluidTags; +@@ -82,8 +82,6 @@ import net.minecraft.tags.FluidTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; @@ -4008,7 +4020,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.Nameable; -@@ -857,8 +855,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -844,8 +842,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // CraftBukkit end public void baseTick() { @@ -4017,7 +4029,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups this.inBlockState = null; if (this.isPassenger() && this.getVehicle().isRemoved()) { -@@ -921,8 +917,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -902,8 +898,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (this.level() instanceof ServerLevel serverLevelx && this instanceof Leashable) { Leashable.tickLeash(serverLevelx, (Entity & Leashable)this); } @@ -4026,7 +4038,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 } public void setSharedFlagOnFire(boolean isOnFire) { -@@ -1141,8 +1135,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1124,8 +1118,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } @@ -4035,7 +4047,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) { movement = movement.multiply(this.stuckSpeedMultiplier); this.stuckSpeedMultiplier = Vec3.ZERO; -@@ -1151,7 +1143,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1134,7 +1126,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // Paper start - ignore movement changes while inactive. if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) { setDeltaMovement(Vec3.ZERO); @@ -4043,8 +4055,8 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 return; } // Paper end -@@ -1173,8 +1164,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - this.setPos(this.getX() + vec3.x, this.getY() + vec3.y, this.getZ() + vec3.z); +@@ -1169,8 +1160,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.setPos(vec31); } - profilerFiller.pop(); @@ -4052,7 +4064,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 boolean flag = !Mth.equal(movement.x, vec3.x); boolean flag1 = !Mth.equal(movement.z, vec3.z); this.horizontalCollision = flag || flag1; -@@ -1197,7 +1186,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1193,7 +1182,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } if (this.isRemoved()) { @@ -4061,7 +4073,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 } else { if (this.horizontalCollision) { Vec3 deltaMovement = this.getDeltaMovement(); -@@ -1242,7 +1231,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1237,7 +1226,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess float blockSpeedFactor = this.getBlockSpeedFactor(); this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor)); @@ -4069,7 +4081,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 } } // Paper start - detailed watchdog information -@@ -3325,8 +3313,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3257,8 +3245,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.processPortalCooldown(); if (this.portalProcess != null) { if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) { @@ -4078,7 +4090,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 this.setPortalCooldown(); TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this); if (portalDestination != null) { -@@ -3336,8 +3322,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3268,8 +3254,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.teleport(portalDestination); } } @@ -4087,7 +4099,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 } else if (this.portalProcess.hasExpired()) { this.portalProcess = null; } -@@ -3857,15 +3841,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3824,15 +3808,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess entity.teleport(this.calculatePassengerTransition(teleportTransition, entity)); } @@ -4103,7 +4115,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 return this; } -@@ -3881,11 +3862,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3848,11 +3829,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } @@ -4115,7 +4127,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 return null; } else { // Paper start - Fix item duplication and teleport issues -@@ -3908,7 +3886,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3871,7 +3849,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess level.resetEmptyTime(); teleportTransition.postTeleportTransition().onTransition(entityx); @@ -4124,10 +4136,10 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 } } diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index e7f1be39ecc532e83d9099e81a2dfd8ed5f0df7d..04a1c17a34b495b71eb1b0ccd597cef83480464d 100644 +index b427d3283a6c197203ab0ffed902bca33e0e0017..352421829e24284e4832a168c278233b780a58a2 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -72,8 +72,6 @@ import net.minecraft.tags.FluidTags; +@@ -70,8 +70,6 @@ import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; @@ -4136,7 +4148,7 @@ index e7f1be39ecc532e83d9099e81a2dfd8ed5f0df7d..04a1c17a34b495b71eb1b0ccd597cef8 import net.minecraft.world.Difficulty; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.CombatRules; -@@ -448,8 +446,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -420,8 +418,6 @@ public abstract class LivingEntity extends Entity implements Attackable { } super.baseTick(); @@ -4145,45 +4157,46 @@ index e7f1be39ecc532e83d9099e81a2dfd8ed5f0df7d..04a1c17a34b495b71eb1b0ccd597cef8 if (this.fireImmune() || this.level().isClientSide) { this.clearFire(); } -@@ -565,7 +561,6 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.yHeadRotO = this.yHeadRot; +@@ -512,7 +508,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.yBodyRotO = this.yBodyRot; this.yRotO = this.getYRot(); this.xRotO = this.getXRot(); - profilerFiller.pop(); } @Override -@@ -3260,11 +3255,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3305,11 +3300,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + f1 = this.getYRot(); } - this.run = this.run + (f3 - this.run) * 0.3F; - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("headTurn"); - f2 = this.tickHeadTurn(f1, f2); + this.tickHeadTurn(f1); - profilerFiller.pop(); - profilerFiller.push("rangeChecks"); // Paper start - stop large pitch and yaw changes from crashing the server this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; -@@ -3275,7 +3266,6 @@ public abstract class LivingEntity extends Entity implements Attackable { - +@@ -3321,7 +3312,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; + // Paper end - stop large pitch and yaw changes from crashing the server - profilerFiller.pop(); - this.animStep += f2; if (this.isFallFlying()) { this.fallFlyTicks++; -@@ -3487,20 +3477,14 @@ public abstract class LivingEntity extends Entity implements Attackable { + } else { +@@ -3497,21 +3487,15 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.setDeltaMovement(d, d1, d2); - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("ai"); + this.applyInput(); if (this.isImmobile()) { this.jumping = false; this.xxa = 0.0F; this.zza = 0.0F; - } else if (this.isEffectiveAi()) { + } else if (this.isEffectiveAi() && !this.level().isClientSide) { - profilerFiller.push("newAi"); this.serverAiStep(); - profilerFiller.pop(); @@ -4194,29 +4207,33 @@ index e7f1be39ecc532e83d9099e81a2dfd8ed5f0df7d..04a1c17a34b495b71eb1b0ccd597cef8 if (this.jumping && this.isAffectedByFluids()) { double fluidHeight; if (this.isInLava()) { -@@ -3529,8 +3513,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3540,8 +3524,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.noJumpDelay = 0; } - profilerFiller.pop(); - profilerFiller.push("travel"); - this.xxa *= 0.98F; - this.zza *= 0.98F; if (this.isFallFlying()) { -@@ -3554,8 +3536,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.updateFallFlying(); } - - this.calculateEntityAnimation(this instanceof FlyingAnimal); -- profilerFiller.pop(); -- profilerFiller.push("freezing"); - if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API - int ticksFrozen = this.getTicksFrozen(); - if (this.isInPowderSnow && this.canFreeze()) { -@@ -3571,15 +3551,12 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.hurtServer(serverLevel, this.damageSources().freeze(), 1.0F); +@@ -3566,9 +3548,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.calculateEntityAnimation(this instanceof FlyingAnimal); } - profilerFiller.pop(); + if (this.level() instanceof ServerLevel serverLevel) { +- profilerFiller.push("freezing"); + if ((!this.isInPowderSnow || !this.canFreeze()) && !this.freezeLocked) { // Paper - Freeze Tick Lock API + this.setTicksFrozen(Math.max(0, this.getTicksFrozen() - 2)); + } +@@ -3578,18 +3558,14 @@ public abstract class LivingEntity extends Entity implements Attackable { + if (this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) { + this.hurtServer(serverLevel, this.damageSources().freeze(), 1.0F); + } +- +- profilerFiller.pop(); + } + - profilerFiller.push("push"); if (this.autoSpinAttackTicks > 0) { this.autoSpinAttackTicks--; @@ -4229,19 +4246,19 @@ index e7f1be39ecc532e83d9099e81a2dfd8ed5f0df7d..04a1c17a34b495b71eb1b0ccd597cef8 // Purpur start - Ridables if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index bc22d67bba9b1ebb6bef84f5326375100d24461d..66f3565b978f2ed91cb2bc3a816f1701c0873c73 100644 +index e9344f61a943d610dfabe4918c227ddba166f17f..5bcbebf35eb726a43b957aca5b8b7a1dca7648cd 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -33,8 +33,6 @@ import net.minecraft.sounds.SoundEvent; +@@ -30,8 +30,6 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.Container; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; -@@ -331,14 +329,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -318,14 +316,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void baseTick() { super.baseTick(); @@ -4256,7 +4273,7 @@ index bc22d67bba9b1ebb6bef84f5326375100d24461d..66f3565b978f2ed91cb2bc3a816f1701 incrementTicksSinceLastInteraction(); // Purpur - Entity lifespan } -@@ -642,8 +637,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -513,8 +508,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void aiStep() { super.aiStep(); @@ -4265,7 +4282,7 @@ index bc22d67bba9b1ebb6bef84f5326375100d24461d..66f3565b978f2ed91cb2bc3a816f1701 if (this.level() instanceof ServerLevel serverLevel && this.canPickUpLoot() && this.isAlive() -@@ -666,8 +659,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -537,8 +530,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } } } @@ -4274,7 +4291,7 @@ index bc22d67bba9b1ebb6bef84f5326375100d24461d..66f3565b978f2ed91cb2bc3a816f1701 } protected Vec3i getPickupReach() { -@@ -882,42 +873,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -748,42 +739,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return; } // Paper end - Allow nerfed mobs to jump and float @@ -4372,7 +4389,7 @@ index a927c2790c8ab9ccaa7161b970e10b0b44817dd8..b816b2de8eb327060ca6ea7c4afc1737 public Set getAvailableGoals() { diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index b44f2c49509d847817a78e9c4fb1499fb378054b..6c8fb611943aee8cabc471c63166f9b44ef14826 100644 +index 06389019deba08c7c0966affcdc90512c88db3d5..6bbdfc748f1ce66689c63424fadcf261b1e967b3 100644 --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -10,8 +10,6 @@ import net.minecraft.core.Vec3i; @@ -4423,10 +4440,10 @@ index c569074403b1d8b443aaa98ba9cf9bbd0e98bd2d..b1aa7294f9479f45fcde77c5ea46db9f this.seen.add(id); } else { diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java -index 22e0fad86da2e7b932863ef30182355aa41424a1..b2c9da89ae6044536f4996fdbd37e2cabf22ca12 100644 +index 062f2ca0c8f2443cf890dc917b9de46310eb79bc..29c22b464705f1b50ec0e423c5df40d8f21e57b7 100644 --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -30,8 +30,6 @@ import net.minecraft.tags.GameEventTags; +@@ -29,8 +29,6 @@ import net.minecraft.tags.GameEventTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; @@ -4435,7 +4452,7 @@ index 22e0fad86da2e7b932863ef30182355aa41424a1..b2c9da89ae6044536f4996fdbd37e2ca import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.SimpleContainer; -@@ -288,14 +286,9 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS +@@ -284,14 +282,9 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @Override protected void customServerAiStep(ServerLevel level) { @@ -4451,10 +4468,10 @@ index 22e0fad86da2e7b932863ef30182355aa41424a1..b2c9da89ae6044536f4996fdbd37e2ca } diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java -index 90bcd8c79cccbcbe7ff3fd2534e0c3450b970bd4..a24ed1747fb8836927ac41b822dc666862701516 100644 +index 0b4d1e6633ecc2e11606024d085bb9e6cca5a86b..aea96e036846c66d411fdea55fbbf0efb60d467d 100644 --- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java +++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java -@@ -23,8 +23,6 @@ import net.minecraft.util.ByIdMap; +@@ -24,8 +24,6 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; import net.minecraft.util.TimeUtil; @@ -4463,7 +4480,7 @@ index 90bcd8c79cccbcbe7ff3fd2534e0c3450b970bd4..a24ed1747fb8836927ac41b822dc6668 import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -@@ -165,13 +163,8 @@ public class Armadillo extends Animal { +@@ -166,13 +164,8 @@ public class Armadillo extends Animal { @Override protected void customServerAiStep(ServerLevel level) { @@ -4478,10 +4495,10 @@ index 90bcd8c79cccbcbe7ff3fd2534e0c3450b970bd4..a24ed1747fb8836927ac41b822dc6668 this.forceDrops = true; // CraftBukkit if (this.dropFromGiftLootTable(level, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) { diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index eb74d8313fd3cc15a33330fe7bafaca4f0a5a368..bbfe48fd278cda9926793d0d2de743558fefd622 100644 +index c5aac98efa518696381b4018b3504ebb323bb6b4..0b787911c929f1564d859dcba1ee04510b4a9b7f 100644 --- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -26,8 +26,6 @@ import net.minecraft.util.ByIdMap; +@@ -31,8 +31,6 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; @@ -4490,7 +4507,7 @@ index eb74d8313fd3cc15a33330fe7bafaca4f0a5a368..bbfe48fd278cda9926793d0d2de74355 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -348,14 +346,9 @@ public class Axolotl extends Animal implements VariantHolder, B +@@ -373,14 +371,9 @@ public class Axolotl extends Animal implements Bucketable { @Override protected void customServerAiStep(ServerLevel level) { @@ -4506,19 +4523,19 @@ index eb74d8313fd3cc15a33330fe7bafaca4f0a5a368..bbfe48fd278cda9926793d0d2de74355 Optional memory = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS); this.setPlayingDead(memory.isPresent() && memory.get() > 0); diff --git a/net/minecraft/world/entity/animal/camel/Camel.java b/net/minecraft/world/entity/animal/camel/Camel.java -index 1d7ae2a08968860636918e7c66b60139a9d761b4..64ff0d2923f16a567aa753cad028a1b21c20101b 100644 +index 344edef98e13831d1238e5ae155d81b13126a696..101931ff4474ab4445be3fa1a241a731ad3ac1da 100644 --- a/net/minecraft/world/entity/animal/camel/Camel.java +++ b/net/minecraft/world/entity/animal/camel/Camel.java -@@ -17,8 +17,6 @@ import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.BlockTags; +@@ -19,8 +19,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -159,14 +157,9 @@ public class Camel extends AbstractHorse { +@@ -171,14 +169,9 @@ public class Camel extends AbstractHorse { @Override protected void customServerAiStep(ServerLevel level) { @@ -4534,10 +4551,10 @@ index 1d7ae2a08968860636918e7c66b60139a9d761b4..64ff0d2923f16a567aa753cad028a1b2 } diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index 143a740ce2e7f9d384b71b4d64e8b8218f60cba7..4aabb98e0b37b652ad4d334b99c48a818c2859b4 100644 +index 71c09b9b8cc66d1a6f557a685539f9f4c93c0b8b..eb3aa96b2a5cb553b016744863818186d1d831c4 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -28,8 +28,6 @@ import net.minecraft.tags.ItemTags; +@@ -29,8 +29,6 @@ import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; @@ -4546,7 +4563,7 @@ index 143a740ce2e7f9d384b71b4d64e8b8218f60cba7..4aabb98e0b37b652ad4d334b99c48a81 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; -@@ -243,14 +241,9 @@ public class Frog extends Animal implements VariantHolder> { +@@ -260,14 +258,9 @@ public class Frog extends Animal { @Override protected void customServerAiStep(ServerLevel level) { @@ -4562,7 +4579,7 @@ index 143a740ce2e7f9d384b71b4d64e8b8218f60cba7..4aabb98e0b37b652ad4d334b99c48a81 } diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java -index e888e606b4b14fa6485de7426bc146b6005962af..78d256f6a95acb367efd690bc368d2106a928b8f 100644 +index 4db2d63fbc021f28b8ad8d20cc1cc1bb257b057f..63645451495dffd87362fd37cf91a90717ae4470 100644 --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java @@ -12,8 +12,6 @@ import net.minecraft.server.level.ServerLevel; @@ -4574,7 +4591,7 @@ index e888e606b4b14fa6485de7426bc146b6005962af..78d256f6a95acb367efd690bc368d210 import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -@@ -134,14 +132,9 @@ public class Tadpole extends AbstractFish { +@@ -135,14 +133,9 @@ public class Tadpole extends AbstractFish { @Override protected void customServerAiStep(ServerLevel level) { @@ -4590,7 +4607,7 @@ index e888e606b4b14fa6485de7426bc146b6005962af..78d256f6a95acb367efd690bc368d210 } diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java -index 6f106f10466440f8e65e04511f67d48f082d703f..9b8f5d9926d68fd8b9f1f976e0be0975158cafc3 100644 +index 5eb656a33cb6ca8a93125c27cd7db175d35b80c3..6029051a7bade2eb412d7ec4957a4361e7e575b1 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java @@ -21,8 +21,6 @@ import net.minecraft.tags.ItemTags; @@ -4602,7 +4619,7 @@ index 6f106f10466440f8e65e04511f67d48f082d703f..9b8f5d9926d68fd8b9f1f976e0be0975 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -224,14 +222,9 @@ public class Goat extends Animal { +@@ -227,14 +225,9 @@ public class Goat extends Animal { @Override protected void customServerAiStep(ServerLevel level) { @@ -4618,7 +4635,7 @@ index 6f106f10466440f8e65e04511f67d48f082d703f..9b8f5d9926d68fd8b9f1f976e0be0975 } diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index 11a5da22149a61ca48bbb0a8ed10b71e91a5cc98..68751f7ed123c3e99f56259ccc23121661f89bc1 100644 +index a21604d3ff3377946cbcbd57ddfa1cbb7e84dac6..0565b37dd5320b49efb11cf28f064d6a970048aa 100644 --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java @@ -29,8 +29,6 @@ import net.minecraft.tags.BlockTags; @@ -4644,7 +4661,7 @@ index 11a5da22149a61ca48bbb0a8ed10b71e91a5cc98..68751f7ed123c3e99f56259ccc231216 } diff --git a/net/minecraft/world/entity/monster/Zoglin.java b/net/minecraft/world/entity/monster/Zoglin.java -index d2a67f3e1c971f737e58567dae23fa70e9d942ea..ee59cf42db965296e6e8d4aa4ec7b33dc5142237 100644 +index bdf52bfe661d4c0ad6c5a28254302f8f0021c09b..743946e69af541f6d5fe626108c70f96fe7fce65 100644 --- a/net/minecraft/world/entity/monster/Zoglin.java +++ b/net/minecraft/world/entity/monster/Zoglin.java @@ -15,8 +15,6 @@ import net.minecraft.network.syncher.SynchedEntityData; @@ -4656,7 +4673,7 @@ index d2a67f3e1c971f737e58567dae23fa70e9d942ea..ee59cf42db965296e6e8d4aa4ec7b33d import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; -@@ -287,11 +285,8 @@ public class Zoglin extends Monster implements HoglinBase { +@@ -288,11 +286,8 @@ public class Zoglin extends Monster implements HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { @@ -4669,7 +4686,7 @@ index d2a67f3e1c971f737e58567dae23fa70e9d942ea..ee59cf42db965296e6e8d4aa4ec7b33d } diff --git a/net/minecraft/world/entity/monster/breeze/Breeze.java b/net/minecraft/world/entity/monster/breeze/Breeze.java -index 23dff1d01387ce89b020aa93de99e6ef557c04e3..fb643596bd5fb12e4cd323706f51a479d78a5455 100644 +index c12653070d62c44b97a07676f24caf7ab570cd2a..d91ce14cc39b1b6ccd558f53ed605d4c6a5acae5 100644 --- a/net/minecraft/world/entity/monster/breeze/Breeze.java +++ b/net/minecraft/world/entity/monster/breeze/Breeze.java @@ -12,8 +12,6 @@ import net.minecraft.sounds.SoundEvent; @@ -4695,10 +4712,10 @@ index 23dff1d01387ce89b020aa93de99e6ef557c04e3..fb643596bd5fb12e4cd323706f51a479 } diff --git a/net/minecraft/world/entity/monster/creaking/Creaking.java b/net/minecraft/world/entity/monster/creaking/Creaking.java -index 887a81ea82b86edceaa46eb2032f53fccb84e158..2c6833753950f1bb0941b0cbe54bebddb84b137d 100644 +index d19f34616942177e736ba507c27ec93ba1e1e903..c9404d72de59e18dc809b8dec107f1f23d50f441 100644 --- a/net/minecraft/world/entity/monster/creaking/Creaking.java +++ b/net/minecraft/world/entity/monster/creaking/Creaking.java -@@ -18,8 +18,6 @@ import net.minecraft.server.level.ServerLevel; +@@ -17,8 +17,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.DamageTypeTags; @@ -4707,7 +4724,7 @@ index 887a81ea82b86edceaa46eb2032f53fccb84e158..2c6833753950f1bb0941b0cbe54bebdd import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.Entity; -@@ -234,10 +232,7 @@ public class Creaking extends Monster { +@@ -235,10 +233,7 @@ public class Creaking extends Monster { @Override protected void customServerAiStep(ServerLevel level) { @@ -4719,7 +4736,7 @@ index 887a81ea82b86edceaa46eb2032f53fccb84e158..2c6833753950f1bb0941b0cbe54bebdd } diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 28f3bc31b4c093e426ae141edeee61a12a444ba1..a5ee49e35b0825c03af058347ee189a7962e8027 100644 +index 252a6469cab202bcc612b4d52a5027c615029a21..0644f425cddebe8e5a65e69acae57db867380981 100644 --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java @@ -16,8 +16,6 @@ import net.minecraft.sounds.SoundEvents; @@ -4731,7 +4748,7 @@ index 28f3bc31b4c093e426ae141edeee61a12a444ba1..a5ee49e35b0825c03af058347ee189a7 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -204,11 +202,8 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -207,11 +205,8 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { @@ -4744,7 +4761,7 @@ index 28f3bc31b4c093e426ae141edeee61a12a444ba1..a5ee49e35b0825c03af058347ee189a7 if (this.isConverting()) { this.timeInOverworld++; diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java -index f0d78cf5fe2c39add9a673471103c352cce72a45..b2e64c0d4c1943f8a50a03ba59318fc2e6b9e26a 100644 +index 54ab9593b39051d47f1dd8bddf210064768382be..73049e486fbf8411819551b43e3ca641ed7a5578 100644 --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java @@ -17,8 +17,6 @@ import net.minecraft.tags.ItemTags; @@ -4756,7 +4773,7 @@ index f0d78cf5fe2c39add9a673471103c352cce72a45..b2e64c0d4c1943f8a50a03ba59318fc2 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -383,11 +381,8 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -358,11 +356,8 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected void customServerAiStep(ServerLevel level) { @@ -4769,7 +4786,7 @@ index f0d78cf5fe2c39add9a673471103c352cce72a45..b2e64c0d4c1943f8a50a03ba59318fc2 super.customServerAiStep(level); } diff --git a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -index 4984b9864b63f92bc939b530253e871ca94a3277..460dace4818605ecd5409be887013713f06442a5 100644 +index 70ee15527fa6f30783d6a58bb767b18124f25c53..c4eb58d0b0c51e930f9cb72e1de0103902badba7 100644 --- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java @@ -8,8 +8,6 @@ import net.minecraft.server.level.ServerLevel; @@ -4794,10 +4811,10 @@ index 4984b9864b63f92bc939b530253e871ca94a3277..460dace4818605ecd5409be887013713 PiglinBruteAi.maybePlayActivitySound(this); super.customServerAiStep(level); diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index f968e5c99bdb23b268bc34ea1ba5d54ae9ad0ff9..e4b8a74fae6d058a9a75a12d2ff08c7984442538 100644 +index 8d61d5347896481f250a18d04d17fd4d2088f633..60a8d79306755e9483ba9e93a07939b73ad717fe 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -32,8 +32,6 @@ import net.minecraft.tags.TagKey; +@@ -31,8 +31,6 @@ import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; @@ -4806,7 +4823,7 @@ index f968e5c99bdb23b268bc34ea1ba5d54ae9ad0ff9..e4b8a74fae6d058a9a75a12d2ff08c79 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; -@@ -308,10 +306,7 @@ public class Warden extends Monster implements VibrationSystem { +@@ -305,10 +303,7 @@ public class Warden extends Monster implements VibrationSystem { @Override protected void customServerAiStep(ServerLevel level) { @@ -4818,10 +4835,10 @@ index f968e5c99bdb23b268bc34ea1ba5d54ae9ad0ff9..e4b8a74fae6d058a9a75a12d2ff08c79 if ((this.tickCount + this.getId()) % 120 == 0) { applyDarknessAround(level, this.position(), this, 20); diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java -index 16fbe4e6521cd4f6baa8f5dd590da0fc749f6585..fec90e482c8935dfca609bbf90e67f86a1586221 100644 +index 5b52bbac242a7fbb8eaea7e41b7265a1a859ff7c..a08818450ed6fd78bb429743ee044726fc7994e7 100644 --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java -@@ -35,8 +35,6 @@ import net.minecraft.stats.Stats; +@@ -36,8 +36,6 @@ import net.minecraft.stats.Stats; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.SpawnUtil; @@ -4830,7 +4847,7 @@ index 16fbe4e6521cd4f6baa8f5dd590da0fc749f6585..fec90e482c8935dfca609bbf90e67f86 import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; -@@ -390,8 +388,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -393,8 +391,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } protected void customServerAiStep(ServerLevel level, boolean inactive) { // Purpur - Lobotomize stuck villagers - not final // Paper end - EAR 2 @@ -4839,7 +4856,7 @@ index 16fbe4e6521cd4f6baa8f5dd590da0fc749f6585..fec90e482c8935dfca609bbf90e67f86 // Purpur start - Lobotomize stuck villagers if (this.level().purpurConfig.villagerLobotomizeEnabled) { // treat as inactive if lobotomized -@@ -406,7 +402,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -409,7 +405,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } else if (this.isLobotomized && shouldRestock()) restock(); // Purpur - Lobotomize stuck villagers // Pufferfish end @@ -4848,7 +4865,7 @@ index 16fbe4e6521cd4f6baa8f5dd590da0fc749f6585..fec90e482c8935dfca609bbf90e67f86 this.assignProfessionWhenSpawned = false; } diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java -index 70eb3f84da8f0c962eaa52998ded69fcfae2f197..c7d91a38fc3b5cf2487e09719a1f9bc39ca5d20e 100644 +index b857e811b4b7a25eaec6dceaae5528d2ec0a1c45..bf69cef9b8ade11a1c08199cdd6c723e5a78c078 100644 --- a/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java @@ -28,7 +28,6 @@ import net.minecraft.server.level.ServerLevel; @@ -4878,7 +4895,7 @@ index 70eb3f84da8f0c962eaa52998ded69fcfae2f197..c7d91a38fc3b5cf2487e09719a1f9bc3 LOGGER.info("Loaded {} recipes", object.values().size()); } diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d07006c41deca 100644 +index 38ddadf551c039202c68c44d740f23a08b58d003..2e90bb96ed90f3debbe5803856ed41a5c08003f8 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -35,8 +35,6 @@ import net.minecraft.util.AbortableIterationConsumer; @@ -4890,7 +4907,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.TickRateManager; import net.minecraft.world.damagesource.DamageSource; -@@ -267,7 +265,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -254,7 +252,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @Override public final List getEntitiesOfClass(final Class entityClass, final AABB boundingBox, final Predicate predicate) { @@ -4898,7 +4915,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 final List ret = new java.util.ArrayList<>(); ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate); -@@ -277,7 +274,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -264,7 +261,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @Override public final List moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate predicate) { @@ -4906,7 +4923,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 final List ret = new java.util.ArrayList<>(); ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate); -@@ -1513,8 +1509,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1498,8 +1494,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl } protected void tickBlockEntities() { @@ -4915,7 +4932,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 this.tickingBlockEntities = true; if (!this.pendingBlockEntityTickers.isEmpty()) { this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); -@@ -1545,7 +1539,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1529,7 +1523,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 this.tickingBlockEntities = false; @@ -4923,7 +4940,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 this.spigotConfig.currentPrimedTnt = 0; // Spigot } -@@ -1804,7 +1797,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1788,7 +1781,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @Override public List getEntities(@Nullable Entity entity, AABB boundingBox, Predicate predicate) { @@ -4931,7 +4948,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 List list = Lists.newArrayList(); // Paper start - rewrite chunk system -@@ -1833,8 +1825,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1817,8 +1809,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl public void getEntities(final EntityTypeTest entityTypeTest, final AABB boundingBox, final Predicate predicate, final List into, final int maxCount) { @@ -4941,7 +4958,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 if (maxCount != Integer.MAX_VALUE) { ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(byType, boundingBox, into, predicate, maxCount); diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index 8aeeeffae50b3ec68ab972e793bb5edb4530ca78..d3f5242fc66529bf3137da4d505a6cf55e749e43 100644 +index fa06ecacc27f619853c8db76d909ab4ba75dc529..345d4b80bd4383e0fb66d744d87bc8ef4100fd32 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java @@ -23,8 +23,6 @@ import net.minecraft.tags.BlockTags; @@ -4950,10 +4967,10 @@ index 8aeeeffae50b3ec68ab972e793bb5edb4530ca78..d3f5242fc66529bf3137da4d505a6cf5 import net.minecraft.util.VisibleForDebug; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; - import net.minecraft.util.random.WeightedRandomList; + import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySpawnReason; -@@ -158,9 +156,6 @@ public final class NaturalSpawner { +@@ -152,9 +150,6 @@ public final class NaturalSpawner { } public static void spawnForChunk(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, List categories) { @@ -4963,7 +4980,7 @@ index 8aeeeffae50b3ec68ab972e793bb5edb4530ca78..d3f5242fc66529bf3137da4d505a6cf5 for (MobCategory mobCategory : categories) { // Paper start - Optional per player mob spawns final boolean canSpawn; -@@ -195,8 +190,6 @@ public final class NaturalSpawner { +@@ -189,8 +184,6 @@ public final class NaturalSpawner { // Paper end - Optional per player mob spawns } } @@ -4973,7 +4990,7 @@ index 8aeeeffae50b3ec68ab972e793bb5edb4530ca78..d3f5242fc66529bf3137da4d505a6cf5 // Paper start - Add mobcaps commands diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 278761647a6095581f8d8ff4f94ccc28b6e9c8a7..6bddf42504039f2be5eb9a5a35a0835e0e3239fe 100644 +index 6cbb5e923d9cc79090ec00bbe173a298ed674dbe..a772f2bd7be00172ad41353c6ad42d9239b9ec88 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java @@ -13,8 +13,6 @@ import net.minecraft.Util; @@ -4985,7 +5002,7 @@ index 278761647a6095581f8d8ff4f94ccc28b6e9c8a7..6bddf42504039f2be5eb9a5a35a0835e import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -@@ -682,10 +680,7 @@ public class ServerExplosion implements Explosion { +@@ -671,10 +669,7 @@ public class ServerExplosion implements Explosion { List list = this.calculateExplodedPositions(); this.hurtEntities(); if (this.interactsWithBlocks()) { @@ -4997,7 +5014,7 @@ index 278761647a6095581f8d8ff4f94ccc28b6e9c8a7..6bddf42504039f2be5eb9a5a35a0835e if (this.fire) { diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 048ad8e11c6913ef08c977c7fab3200cc610519c..e3d71604c161373ef44164606602290af1bd1cb0 100644 +index 3829e02fcdd7c6b101157d3bc187cd1d2016b770..04942e23dd2bc82e4c60110756beedb5e0f074d7 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java @@ -23,8 +23,6 @@ import net.minecraft.network.FriendlyByteBuf; @@ -5009,7 +5026,7 @@ index 048ad8e11c6913ef08c977c7fab3200cc610519c..e3d71604c161373ef44164606602290a import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; -@@ -393,12 +391,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -390,12 +388,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p } if (LightEngine.hasDifferentLightProperties(blockState, state)) { @@ -5021,8 +5038,8 @@ index 048ad8e11c6913ef08c977c7fab3200cc610519c..e3d71604c161373ef44164606602290a - profilerFiller.pop(); } - boolean hasBlockEntity = blockState.hasBlockEntity(); -@@ -918,8 +912,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + boolean flag = !blockState.is(block); +@@ -922,8 +916,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p BlockPos blockPos = this.blockEntity.getBlockPos(); if (LevelChunk.this.isTicking(blockPos)) { try { @@ -5031,7 +5048,7 @@ index 048ad8e11c6913ef08c977c7fab3200cc610519c..e3d71604c161373ef44164606602290a BlockState blockState = LevelChunk.this.getBlockState(blockPos); if (this.blockEntity.getType().isValid(blockState)) { this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity); -@@ -933,8 +925,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -937,8 +929,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p } // Paper end - Remove the Block Entity if it's invalid } diff --git a/patches/unapplied/server/minecraft-patches/features/0004-Implement-Secure-Seed.patch b/divinemc-server/minecraft-patches/features/0004-Implement-Secure-Seed.patch similarity index 92% rename from patches/unapplied/server/minecraft-patches/features/0004-Implement-Secure-Seed.patch rename to divinemc-server/minecraft-patches/features/0004-Implement-Secure-Seed.patch index 1001338..fc0d04a 100644 --- a/patches/unapplied/server/minecraft-patches/features/0004-Implement-Secure-Seed.patch +++ b/divinemc-server/minecraft-patches/features/0004-Implement-Secure-Seed.patch @@ -52,10 +52,10 @@ index 5748658abf0b90812005ae9d426df92daf5532f0..8b4b91be368b4195326eeb1c714d713a this.get("generator-settings", property -> GsonHelper.parse(!property.isEmpty() ? property : "{}"), new JsonObject()), this.get("level-type", property -> property.toLowerCase(Locale.ROOT), WorldPresets.NORMAL.location().toString()) diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 8055b8552b40160732953b15876dda7983890d06..ab30af9cd58ff7310e05be87b08f42bacf69e11e 100644 +index f5d4f439c3346cc158043ada02094257ff05a06e..4d4139b5f42a4db6e22bf1d063a23dc7b9914f85 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -618,6 +618,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -619,6 +619,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } public ChunkGenerator getGenerator() { @@ -64,10 +64,10 @@ index 8055b8552b40160732953b15876dda7983890d06..ab30af9cd58ff7310e05be87b08f42ba } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 3980e0dfb08a357384ea33670fb282a26a598f6e..9afd448ede87c9192dc576f66e08676a68b34d98 100644 +index 2bb5055f2fb1e8b95b2a5d8dba5f1fa0bb5fdec7..c03895b2fc783d748fe52660b9ef30367143d0f5 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -632,6 +632,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -624,6 +624,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe chunkGenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkGenerator, gen); } // CraftBukkit end @@ -76,27 +76,24 @@ index 3980e0dfb08a357384ea33670fb282a26a598f6e..9afd448ede87c9192dc576f66e08676a DataFixer fixerUpper = server.getFixerUpper(); // Paper - rewrite chunk system diff --git a/net/minecraft/world/entity/monster/Slime.java b/net/minecraft/world/entity/monster/Slime.java -index 240a54b210e23d5b79e6bcaf3806aa454668135d..66dffb8a2c6725ea2502b498044b854f043f3c73 100644 +index 7b6db084a483b4a9c2f292c5ed6e4c7550344c50..0a15269413b443f284b4c703b47e5436c22c15a3 100644 --- a/net/minecraft/world/entity/monster/Slime.java +++ b/net/minecraft/world/entity/monster/Slime.java -@@ -423,8 +423,13 @@ public class Slime extends Mob implements Enemy { - return false; +@@ -412,7 +412,11 @@ public class Slime extends Mob implements Enemy { } -- ChunkPos chunkPos = new ChunkPos(pos); -- boolean flag = level.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel) level).getSeed(), level.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper -+ ChunkPos chunkPos = new ChunkPos(pos); -+ // DivineMC start - Implement Secure Seed -+ boolean isSlimeChunk = org.bxteam.divinemc.DivineConfig.enableSecureSeed -+ ? level.getChunk(chunkPos.x, chunkPos.z).isSlimeChunk() -+ : WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel) level).getSeed(), level.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper -+ boolean flag = level.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || isSlimeChunk; -+ // DivineMC end - Implement Secure Seed + ChunkPos chunkPos = new ChunkPos(pos); +- boolean flag = level.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel) level).getSeed(), level.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Paper ++ // DivineMC start - Implement Secure Seed ++ boolean flag = level.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || org.bxteam.divinemc.DivineConfig.enableSecureSeed ++ ? level.getChunk(chunkPos.x, chunkPos.z).isSlimeChunk() ++ : WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel) level).getSeed(), level.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Paper ++ // DivineMC end - Implement Secure Seed // Paper start - Replace rules for Height in Slime Chunks final double maxHeightSlimeChunk = level.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum; if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) { diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java -index 6d565b52552534ce9cacfc35ad1bf4adcb69eac3..80a0f5524e91e55d716e93c29e199d9816b0072a 100644 +index 3b7f0d5fe40bdda65ab859a0c22bf0d369dc0f01..42458418e6217adba28f729f04904814542eaa17 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java @@ -82,6 +82,10 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh @@ -126,13 +123,13 @@ index 6d565b52552534ce9cacfc35ad1bf4adcb69eac3..80a0f5524e91e55d716e93c29e199d98 + // DivineMC end - Implement Secure Seed + public abstract BlockState getBlockState(final int x, final int y, final int z); // Paper + @Nullable - public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean isMoving); diff --git a/net/minecraft/world/level/chunk/ChunkGenerator.java b/net/minecraft/world/level/chunk/ChunkGenerator.java -index 6ed51cf42b5864194d671b5b56f5b9bdf0291dc0..7e0b602e9fd9e3b3f60014ab179b3a82e3bf5c2a 100644 +index 857aa6e29b57a0a8eea4d7c14971b9dde59bb0d0..fdf9318b96d7ac7f707777bb63a5d36a5230b066 100644 --- a/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -343,7 +343,11 @@ public abstract class ChunkGenerator { +@@ -342,7 +342,11 @@ public abstract class ChunkGenerator { Registry registry = level.registryAccess().lookupOrThrow(Registries.STRUCTURE); Map> map = registry.stream().collect(Collectors.groupingBy(structure1 -> structure1.step().ordinal())); List list = this.featuresPerStep.get(); @@ -145,7 +142,7 @@ index 6ed51cf42b5864194d671b5b56f5b9bdf0291dc0..7e0b602e9fd9e3b3f60014ab179b3a82 long l = worldgenRandom.setDecorationSeed(level.getSeed(), blockPos.getX(), blockPos.getZ()); Set> set = new ObjectArraySet<>(); ChunkPos.rangeClosed(sectionPos.chunk(), 1).forEach(chunkPos -> { -@@ -556,8 +560,18 @@ public abstract class ChunkGenerator { +@@ -551,8 +555,18 @@ public abstract class ChunkGenerator { } else { ArrayList list1 = new ArrayList<>(list.size()); list1.addAll(list); @@ -331,7 +328,7 @@ index c92508741439a8d0d833ea02d0104416adb83c92..630f6c409db349819fc5fd19a3d78fad public static OptionalLong parseSeed(String seed) { seed = seed.trim(); diff --git a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java -index 38475f6975533909924c8d54f438cf43cdfe31a3..6759df026a29810021ddb37f3ddb62382b83a94e 100644 +index 4e72eb49dbf4c70ae7556ba6eb210fcd5ef36aaa..44cefaac4806008ce59b43f5b95ce17ee3ad39e5 100644 --- a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java @@ -41,7 +41,11 @@ public class GeodeFeature extends Feature { @@ -391,10 +388,10 @@ index ee0d9dddb36b6879fa113299e24f1aa3b2b151cc..f01d96895ab348971fb31b614026fb3d int i3 = this.spreadType.evaluate(worldgenRandom, i2); int i4 = this.spreadType.evaluate(worldgenRandom, i2); diff --git a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -index 670335a7bbfbc9da64c389977498c22dfcd03251..7174a9767cbc94544be81c74d6468f3f73386edc 100644 +index 1f939b325ec5291b3c4aabc4735c863f9436a6f8..4ed6a3d6103ce48797950c7363ea0854227e62e8 100644 --- a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java +++ b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -@@ -118,8 +118,17 @@ public abstract class StructurePlacement { +@@ -119,8 +119,17 @@ public abstract class StructurePlacement { public abstract StructurePlacementType type(); private static boolean probabilityReducer(long levelSeed, int regionX, int regionZ, int salt, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs; ignore here @@ -415,7 +412,7 @@ index 670335a7bbfbc9da64c389977498c22dfcd03251..7174a9767cbc94544be81c74d6468f3f } diff --git a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java -index eb85edaa3b7fab4f11545b0fa8bfea882dedb67d..63143ceec98f7a84ec4064d05e8f88c11200172f 100644 +index 1cfa0fcd28685736fcdce4aef817e4d4cc4061cb..e275dc8395e556e8a9412b121034e91553fbaea4 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java @@ -64,7 +64,11 @@ public class JigsawPlacement { diff --git a/patches/unapplied/server/minecraft-patches/features/0005-Async-Pathfinding.patch b/divinemc-server/minecraft-patches/features/0005-Async-Pathfinding.patch similarity index 98% rename from patches/unapplied/server/minecraft-patches/features/0005-Async-Pathfinding.patch rename to divinemc-server/minecraft-patches/features/0005-Async-Pathfinding.patch index a99b3e5..afaebb5 100644 --- a/patches/unapplied/server/minecraft-patches/features/0005-Async-Pathfinding.patch +++ b/divinemc-server/minecraft-patches/features/0005-Async-Pathfinding.patch @@ -393,7 +393,7 @@ index 045cfafb3afe8271d60852ae3c7cdcb039b44d4f..f544bf28ac6531061da08c7266846874 } diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 6c8fb611943aee8cabc471c63166f9b44ef14826..02814be0e1ac9b743a4c6b5b75015a5e87fc2aa6 100644 +index 6bbdfc748f1ce66689c63424fadcf261b1e967b3..55d0ed422f25b6469f9d8ee3ecf2ef8eaf77e9cb 100644 --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -167,6 +167,10 @@ public abstract class PathNavigation { @@ -557,7 +557,7 @@ index 1f96fd5085bacb4c584576c7cb9f51e7898e9b03..9494dd144ff1115c9f0862614ef61803 + // DivineMC end - async pathfinding } diff --git a/net/minecraft/world/entity/animal/Bee.java b/net/minecraft/world/entity/animal/Bee.java -index d5727999eb67ff30dbf47865d59452483338e170..ddbee0f0f42fae0a26321bb324d22f5e7520ae72 100644 +index e9dfff7e3726cd2229f89bb39fa1ca4815d99a6d..a0294937487bfd13f26a5e7eb2bd21f29aa7c229 100644 --- a/net/minecraft/world/entity/animal/Bee.java +++ b/net/minecraft/world/entity/animal/Bee.java @@ -936,7 +936,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -579,10 +579,10 @@ index d5727999eb67ff30dbf47865d59452483338e170..ddbee0f0f42fae0a26321bb324d22f5e } } diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index 4aabb98e0b37b652ad4d334b99c48a818c2859b4..dfcba5c2c8a489ebe74c2d5c1fa980c401806757 100644 +index eb3aa96b2a5cb553b016744863818186d1d831c4..3ccc48afb7a9eb2290f16c6a3218515bee59c2bd 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -473,6 +473,17 @@ public class Frog extends Animal implements VariantHolder> { +@@ -482,6 +482,17 @@ public class Frog extends Animal { super(mob, level); } @@ -600,7 +600,7 @@ index 4aabb98e0b37b652ad4d334b99c48a818c2859b4..dfcba5c2c8a489ebe74c2d5c1fa980c4 @Override public boolean canCutCorner(PathType pathType) { return pathType != PathType.WATER_BORDER && super.canCutCorner(pathType); -@@ -481,6 +492,11 @@ public class Frog extends Animal implements VariantHolder> { +@@ -490,6 +501,11 @@ public class Frog extends Animal { @Override protected PathFinder createPathFinder(int maxVisitedNodes) { this.nodeEvaluator = new Frog.FrogNodeEvaluator(true); @@ -613,7 +613,7 @@ index 4aabb98e0b37b652ad4d334b99c48a818c2859b4..dfcba5c2c8a489ebe74c2d5c1fa980c4 } } diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java -index 6c73245b8d04f194e72165aa0000ca79a95db59d..2686df57d9d48db1438278d0d053bdbd3c65c0a7 100644 +index b85d1e196d2bf61ac4896205afb08eba89c4397e..ea90e3d7ad84e301f975ff91fade63c5429972cf 100644 --- a/net/minecraft/world/entity/monster/Drowned.java +++ b/net/minecraft/world/entity/monster/Drowned.java @@ -313,7 +313,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @@ -626,10 +626,10 @@ index 6c73245b8d04f194e72165aa0000ca79a95db59d..2686df57d9d48db1438278d0d053bdbd if (target != null) { double d = this.distanceToSqr(target.getX(), target.getY(), target.getZ()); diff --git a/net/minecraft/world/entity/monster/Strider.java b/net/minecraft/world/entity/monster/Strider.java -index 241526239bdbd5d9276f85e7fca46a7051f46a25..2329973f735e1ae7fbb76798dc113f4261c906b7 100644 +index fe31c4a45afd61be8b74efe9d0858ccd0aced075..5f965f50294d03e7b03c5d7e912b7aec99db635c 100644 --- a/net/minecraft/world/entity/monster/Strider.java +++ b/net/minecraft/world/entity/monster/Strider.java -@@ -579,9 +579,25 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { +@@ -560,9 +560,25 @@ public class Strider extends Animal implements ItemSteerable { super(strider, level); } @@ -656,10 +656,10 @@ index 241526239bdbd5d9276f85e7fca46a7051f46a25..2329973f735e1ae7fbb76798dc113f42 } diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index e4b8a74fae6d058a9a75a12d2ff08c7984442538..59a12809e5c7f5ee85ca1f587f6b77383a1ff062 100644 +index 60a8d79306755e9483ba9e93a07939b73ad717fe..97ee07ebbba5ad29f766dff5eb4e51fc0e12cfcb 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -597,6 +597,16 @@ public class Warden extends Monster implements VibrationSystem { +@@ -578,6 +578,16 @@ public class Warden extends Monster implements VibrationSystem { @Override protected PathFinder createPathFinder(int maxVisitedNodes) { this.nodeEvaluator = new WalkNodeEvaluator(); diff --git a/patches/unapplied/server/minecraft-patches/features/0006-Multithreaded-Tracker.patch b/divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch similarity index 83% rename from patches/unapplied/server/minecraft-patches/features/0006-Multithreaded-Tracker.patch rename to divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch index 2f524d7..0521fbd 100644 --- a/patches/unapplied/server/minecraft-patches/features/0006-Multithreaded-Tracker.patch +++ b/divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Multithreaded Tracker diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -index dd2509996bfd08e8c3f9f2be042229eac6d7692d..8ef5a1aaac9c27873ce746eb281f77bb318a3c69 100644 +index 02a9ef1694c796584c29430d27f0a09047368835..7a52c42845bd74d0bb7649f87764aba12f442f02 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -@@ -342,7 +342,11 @@ public final class RegionizedPlayerChunkLoader { +@@ -340,7 +340,11 @@ public final class RegionizedPlayerChunkLoader { private boolean canGenerateChunks = true; private final ArrayDeque> delayedTicketOps = new ArrayDeque<>(); @@ -22,10 +22,10 @@ index dd2509996bfd08e8c3f9f2be042229eac6d7692d..8ef5a1aaac9c27873ce746eb281f77bb private static final byte CHUNK_TICKET_STAGE_NONE = 0; private static final byte CHUNK_TICKET_STAGE_LOADING = 1; diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..965899a98223b15bd770378c202873cbf15b714d 100644 +index b28d19b2fcdff9250e95db05f6e428db54a771e6..b5028cc64e2a43c841801114908825102df41765 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -951,6 +951,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1013,6 +1013,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end - optimise entity tracker protected void tick() { @@ -39,7 +39,7 @@ index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..965899a98223b15bd770378c202873cb // Paper start - optimise entity tracker if (true) { this.newTrackerTick(); -@@ -1073,7 +1080,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1135,7 +1142,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final Entity entity; private final int range; SectionPos lastSectionPos; @@ -52,7 +52,7 @@ index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..965899a98223b15bd770378c202873cb // Paper start - optimise entity tracker private long lastChunkUpdate = -1L; -@@ -1100,21 +1111,55 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1162,21 +1173,55 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lastTrackedChunk = chunk; final ServerPlayer[] playersRaw = players.getRawDataUnchecked(); @@ -118,7 +118,7 @@ index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..965899a98223b15bd770378c202873cb } @Override -@@ -1176,7 +1221,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1238,7 +1283,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void broadcast(Packet packet) { @@ -127,7 +127,7 @@ index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..965899a98223b15bd770378c202873cb serverPlayerConnection.send(packet); } } -@@ -1189,21 +1234,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1259,21 +1304,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void broadcastRemoved() { @@ -169,29 +169,10 @@ index f106373ef3ac4a8685c2939c9e8361688a285913..3b4dff8867e91884b5720ca8a9cb64af public boolean visible = true; diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index 0fb253aa55a24b56b17f524b3261c5b75c7d7e59..b6053158f5d9b6ad325ea075ab7c60f9966ba496 100644 +index 257ecbcf7d463eefb951867a5426eaf24e356305..7748183dd12434693b89d2dbc8325988381857c9 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -110,8 +110,16 @@ public class ServerEntity { - .forEach( - removedPassenger -> { - if (removedPassenger instanceof ServerPlayer serverPlayer1) { -- serverPlayer1.connection -- .teleport(serverPlayer1.getX(), serverPlayer1.getY(), serverPlayer1.getZ(), serverPlayer1.getYRot(), serverPlayer1.getXRot()); -+ // DivineMC start - Multithreaded tracker -+ if (org.bxteam.divinemc.DivineConfig.multithreadedEnabled && Thread.currentThread() instanceof org.bxteam.divinemc.entity.tracking.MultithreadedTracker.MultithreadedTrackerThread) { -+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> serverPlayer1.connection -+ .teleport(serverPlayer1.getX(), serverPlayer1.getY(), serverPlayer1.getZ(), serverPlayer1.getYRot(), serverPlayer1.getXRot()) -+ ); -+ } else { -+ serverPlayer1.connection -+ .teleport(serverPlayer1.getX(), serverPlayer1.getY(), serverPlayer1.getZ(), serverPlayer1.getYRot(), serverPlayer1.getXRot()); -+ } -+ // DivineMC end - Multithreaded tracker - } - } - ); -@@ -410,12 +418,13 @@ public class ServerEntity { +@@ -418,12 +418,13 @@ public class ServerEntity { if (this.entity instanceof LivingEntity) { Set attributesToSync = ((LivingEntity)this.entity).getAttributes().getAttributesToSync(); if (!attributesToSync.isEmpty()) { @@ -208,10 +189,10 @@ index 0fb253aa55a24b56b17f524b3261c5b75c7d7e59..b6053158f5d9b6ad325ea075ab7c60f9 attributesToSync.clear(); diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index c229d69ce3d007e4cb57e559611b3fca7a03562f..ba5ca5213fafd60b2257409f334a7c6b28fe918a 100644 +index c03895b2fc783d748fe52660b9ef30367143d0f5..8fa3af0ebcb92138d0dae858c131db0a710df693 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -2497,7 +2497,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2481,7 +2481,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public LevelEntityGetter getEntities() { @@ -220,7 +201,7 @@ index c229d69ce3d007e4cb57e559611b3fca7a03562f..ba5ca5213fafd60b2257409f334a7c6b return this.moonrise$getEntityLookup(); // Paper - rewrite chunk system } -@@ -2724,7 +2724,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2717,7 +2717,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } map.carriedByPlayers.remove(player); @@ -230,10 +211,10 @@ index c229d69ce3d007e4cb57e559611b3fca7a03562f..ba5ca5213fafd60b2257409f334a7c6b } } diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 56a22d19a82a937c08cb4527b0f67f219a6bb8a0..f8c76bb2c9fa625e191036dc58ef3dfb1d4ee930 100644 +index 374d9e1036a1c4b50f80f3121c7ad0793506a280..b05657f763bbdbc9268c83d78c2da62b97d095e2 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1822,7 +1822,7 @@ public class ServerGamePacketListenerImpl +@@ -1882,7 +1882,7 @@ public class ServerGamePacketListenerImpl } public void internalTeleport(PositionMoveRotation posMoveRotation, Set relatives) { @@ -243,10 +224,10 @@ index 56a22d19a82a937c08cb4527b0f67f219a6bb8a0..f8c76bb2c9fa625e191036dc58ef3dfb if (this.player.isRemoved()) { LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName()); diff --git a/net/minecraft/world/entity/ai/attributes/AttributeInstance.java b/net/minecraft/world/entity/ai/attributes/AttributeInstance.java -index 8013594bb4844e7a8abf28123958e7f632d39341..72593629324ccd4d70b8ed86a90fb69785d57f5f 100644 +index 3ac9f36eae87369354e992a1d9b5c5b2d87d17cb..3a6c481fae0d3cb5ffdd39caf85252f164774323 100644 --- a/net/minecraft/world/entity/ai/attributes/AttributeInstance.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeInstance.java -@@ -24,8 +24,11 @@ public class AttributeInstance { +@@ -26,8 +26,11 @@ public class AttributeInstance { private final Map> modifiersByOperation = Maps.newEnumMap( AttributeModifier.Operation.class ); @@ -261,13 +242,13 @@ index 8013594bb4844e7a8abf28123958e7f632d39341..72593629324ccd4d70b8ed86a90fb697 private boolean dirty = true; private double cachedValue; diff --git a/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/net/minecraft/world/entity/ai/attributes/AttributeMap.java -index a25d74592e89e3d6339479c6dc2b6f45d1932cfc..621b183211b8148bb8db256d2119c82f8a2c626b 100644 +index 23576e631ad4a12ec3ff3630be253738534588f3..b37a49c44ecb456c798d153fddf3cb6090a9a296 100644 --- a/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeMap.java -@@ -19,9 +19,12 @@ import org.slf4j.Logger; +@@ -14,9 +14,12 @@ import net.minecraft.nbt.ListTag; + import net.minecraft.resources.ResourceLocation; public class AttributeMap { - private static final Logger LOGGER = LogUtils.getLogger(); - private final Map, AttributeInstance> attributes = new Object2ObjectOpenHashMap<>(); - private final Set attributesToSync = new ObjectOpenHashSet<>(); - private final Set attributesToUpdate = new ObjectOpenHashSet<>(); @@ -281,10 +262,10 @@ index a25d74592e89e3d6339479c6dc2b6f45d1932cfc..621b183211b8148bb8db256d2119c82f private final net.minecraft.world.entity.LivingEntity entity; // Purpur - Ridables diff --git a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 681dec447486138088fe5f705ef4fadab531139f..3d6aad86519be3e1449d3288369a41aebb924c90 100644 +index 3ae69b17fec1cdb2bee2b5a795026a875f197c30..f8620d34137fe13122deb5b761512e09bb8c4aa7 100644 --- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -279,6 +279,7 @@ public class MapItemSavedData extends SavedData { +@@ -211,6 +211,7 @@ public class MapItemSavedData extends SavedData { for (int i = 0; i < this.carriedBy.size(); i++) { MapItemSavedData.HoldingPlayer holdingPlayer1 = this.carriedBy.get(i); diff --git a/patches/unapplied/server/minecraft-patches/features/0007-Async-locate-command.patch b/divinemc-server/minecraft-patches/features/0007-Async-locate-command.patch similarity index 96% rename from patches/unapplied/server/minecraft-patches/features/0007-Async-locate-command.patch rename to divinemc-server/minecraft-patches/features/0007-Async-locate-command.patch index d8757d2..4d7c0da 100644 --- a/patches/unapplied/server/minecraft-patches/features/0007-Async-locate-command.patch +++ b/divinemc-server/minecraft-patches/features/0007-Async-locate-command.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Async locate command diff --git a/net/minecraft/server/commands/LocateCommand.java b/net/minecraft/server/commands/LocateCommand.java -index 13bcd8653d766cd0b754a22e9aab261fbc62b0a5..0bc2d17e9bad62f62ab171feb2a92b87e1c3ba6a 100644 +index 2723d5377567241921fef61952e474c1c0ee9bbf..ee9f84b33a34b5b9d7c3f8928c958c298f780a03 100644 --- a/net/minecraft/server/commands/LocateCommand.java +++ b/net/minecraft/server/commands/LocateCommand.java @@ -103,44 +103,77 @@ public class LocateCommand { @@ -119,7 +119,7 @@ index 13bcd8653d766cd0b754a22e9aab261fbc62b0a5..0bc2d17e9bad62f62ab171feb2a92b87 public static int showLocateResult( @@ -195,7 +228,7 @@ public class LocateCommand { - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.coordinates.tooltip"))) + .withHoverEvent(new HoverEvent.ShowText(Component.translatable("chat.coordinates.tooltip"))) ); source.sendSuccess(() -> Component.translatable(translationKey, elementName, component, i), false); - LOGGER.info("Locating element " + elementName + " took " + duration.toMillis() + " ms"); diff --git a/patches/unapplied/server/minecraft-patches/features/0009-Misc-Optimizations.patch b/divinemc-server/minecraft-patches/features/0008-Misc-Optimizations.patch similarity index 91% rename from patches/unapplied/server/minecraft-patches/features/0009-Misc-Optimizations.patch rename to divinemc-server/minecraft-patches/features/0008-Misc-Optimizations.patch index 0f21d72..c54e374 100644 --- a/patches/unapplied/server/minecraft-patches/features/0009-Misc-Optimizations.patch +++ b/divinemc-server/minecraft-patches/features/0008-Misc-Optimizations.patch @@ -18,22 +18,22 @@ index 2ae5b80338282ac73c74765fc0729af2d54f6d6c..00a63a6a5983e6a25f2a9014a2f9eefe private final Map> arguments = new LinkedHashMap<>(); public Predicate requirement; // Paper - public-f diff --git a/com/mojang/math/OctahedralGroup.java b/com/mojang/math/OctahedralGroup.java -index 11902e7427761746ee098fea3276a34fef0096ba..3ba23fa243f7af712a41316066ca554f1c23b495 100644 +index c2bdb4b37e8af761815a072df93ee1e241fb29e8..c23e99fcda6fc9062d77472ac756187275b22ed8 100644 --- a/com/mojang/math/OctahedralGroup.java +++ b/com/mojang/math/OctahedralGroup.java -@@ -112,6 +112,7 @@ public enum OctahedralGroup implements StringRepresentable { - this.transformation = new Matrix3f().scaling(invertX ? -1.0F : 1.0F, invertY ? -1.0F : 1.0F, invertZ ? -1.0F : 1.0F); - this.transformation.mul(permutation.transformation()); - this.initializeRotationDirections(); // Paper - Avoid Lazy Initialization for Enum Fields +@@ -138,6 +138,7 @@ public enum OctahedralGroup implements StringRepresentable { + Matrix3f matrix3f = new Matrix3f().scaling(invertX ? -1.0F : 1.0F, invertY ? -1.0F : 1.0F, invertZ ? -1.0F : 1.0F); + matrix3f.mul(permutation.transformation()); + this.transformation = matrix3f; + this.rotate(Direction.UP); // DivineMC - Math Optimizations } private BooleanList packInversions() { diff --git a/com/mojang/math/Transformation.java b/com/mojang/math/Transformation.java -index aa755b8b7f8bc5910322e0c5b520f603da06a85a..e781dea43279aa77cc40a7afd2281c32cc8347a9 100644 +index 5fb382be4d86328690c49f2a5a0c3ec698a38e21..f333d9028f315e7912dd335c8158abd525c27ecd 100644 --- a/com/mojang/math/Transformation.java +++ b/com/mojang/math/Transformation.java -@@ -51,6 +51,7 @@ public final class Transformation { +@@ -52,6 +52,7 @@ public final class Transformation { } else { this.matrix = matrix; } @@ -41,7 +41,7 @@ index aa755b8b7f8bc5910322e0c5b520f603da06a85a..e781dea43279aa77cc40a7afd2281c32 } public Transformation(@Nullable Vector3f translation, @Nullable Quaternionf leftRotation, @Nullable Vector3f scale, @Nullable Quaternionf rightRotation) { -@@ -60,6 +61,7 @@ public final class Transformation { +@@ -61,6 +62,7 @@ public final class Transformation { this.scale = scale != null ? scale : new Vector3f(1.0F, 1.0F, 1.0F); this.rightRotation = rightRotation != null ? rightRotation : new Quaternionf(); this.decomposed = true; @@ -50,10 +50,10 @@ index aa755b8b7f8bc5910322e0c5b520f603da06a85a..e781dea43279aa77cc40a7afd2281c32 public static Transformation identity() { diff --git a/net/minecraft/core/MappedRegistry.java b/net/minecraft/core/MappedRegistry.java -index 5f752603aa5611ce9d3dd44cc5b70c27ac46a86e..332122c0b700fb743f91f3fed16aade41dceec28 100644 +index 761e583a56b1c4a605b0cbb04b61c4df60b8b9bb..c07155589ef44cbbacafe03b36d2cd4cdcba3fd2 100644 --- a/net/minecraft/core/MappedRegistry.java +++ b/net/minecraft/core/MappedRegistry.java -@@ -34,10 +34,12 @@ public class MappedRegistry implements WritableRegistry { +@@ -33,10 +33,12 @@ public class MappedRegistry implements WritableRegistry { private final ResourceKey> key; private final ObjectList> byId = new ObjectArrayList<>(256); private final Reference2IntMap toId = Util.make(new Reference2IntOpenHashMap<>(2048), map -> map.defaultReturnValue(-1)); // Paper - Perf: Use bigger expected size to reduce collisions @@ -399,7 +399,7 @@ index ab3a221c115992d0f4ea921aa92cf0976b815ff4..076a931341da486162f289a5f19d3d67 return number % multiple == 0; } diff --git a/net/minecraft/util/RandomSource.java b/net/minecraft/util/RandomSource.java -index 98a54bc4de251014342cda6d0951b7fea79ce553..663edee4dfa660e3d3a04c728fd764258867916d 100644 +index 8516d47b0ba79d91638837199e7ae0fb6cb44a79..71444431b10582f5917c1795275ccdadd2364c3c 100644 --- a/net/minecraft/util/RandomSource.java +++ b/net/minecraft/util/RandomSource.java @@ -12,7 +12,7 @@ public interface RandomSource { @@ -421,23 +421,23 @@ index 98a54bc4de251014342cda6d0951b7fea79ce553..663edee4dfa660e3d3a04c728fd76425 static RandomSource createNewThreadLocalInstance() { diff --git a/net/minecraft/util/debugchart/DebugSampleSubscriptionTracker.java b/net/minecraft/util/debugchart/DebugSampleSubscriptionTracker.java -index 15de39fa82c7aea18298509fe9587d027c30cc15..eb534ed5a7478fc632db096328e3582f4ec410b8 100644 +index a18240418a19a95147341a634527d774f3d5bb92..66f74ad2a194a6676574da2932cf4677f9383ecd 100644 --- a/net/minecraft/util/debugchart/DebugSampleSubscriptionTracker.java +++ b/net/minecraft/util/debugchart/DebugSampleSubscriptionTracker.java -@@ -15,7 +15,7 @@ public class DebugSampleSubscriptionTracker { +@@ -14,7 +14,7 @@ public class DebugSampleSubscriptionTracker { public static final int STOP_SENDING_AFTER_MS = 10000; private final PlayerList playerList; - private final EnumMap> subscriptions; + private final Map> subscriptions; - private final Queue subscriptionRequestQueue = new LinkedList<>(); + private final java.util.List subscriptionRequestQueue = java.util.Collections.synchronizedList(new LinkedList<>()); // DivineMC - Misc Optimizations public DebugSampleSubscriptionTracker(PlayerList playerList) { this.playerList = playerList; diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 258cb45f1f959b75c1bcdb130811af2f8fddf07d..9c0e539f09bddac018f93d212e3cdbc446f3c672 100644 +index d513b82c0681fdc990af082af69278bd773225a9..18718693412f3cc0848c462361c2f06e1ad65a6e 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -143,7 +143,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -149,7 +149,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper start - Share random for entities to make them more random @@ -447,10 +447,10 @@ index 258cb45f1f959b75c1bcdb130811af2f8fddf07d..9c0e539f09bddac018f93d212e3cdbc4 private static final class RandomRandomSource extends ca.spottedleaf.moonrise.common.util.ThreadUnsafeRandom { public RandomRandomSource() { diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index 66f3565b978f2ed91cb2bc3a816f1701c0873c73..b4e19cc65701d5ef94e1cc0a7473225c222725c3 100644 +index 5bcbebf35eb726a43b957aca5b8b7a1dca7648cd..d618752727e2f2f5c0c1afa97f455e349cb7e76c 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -832,7 +832,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -698,7 +698,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { @@ -459,7 +459,7 @@ index 66f3565b978f2ed91cb2bc3a816f1701c0873c73..b4e19cc65701d5ef94e1cc0a7473225c if (nearestPlayer != null) { // Paper start - Configurable despawn distances final io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DespawnRangePair despawnRangePair = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()); -@@ -861,6 +861,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -727,6 +727,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } } @@ -480,10 +480,10 @@ index 66f3565b978f2ed91cb2bc3a816f1701c0873c73..b4e19cc65701d5ef94e1cc0a7473225c protected final void serverAiStep() { this.noActionTime++; diff --git a/net/minecraft/world/level/GameRules.java b/net/minecraft/world/level/GameRules.java -index 5ded2f808a9fcb26856567de6bc56e206f948a84..02d64a5ea756b2c91a71b7a0fc0f21219983616a 100644 +index 02bc5d83b92a594ec519f0a02b0517fdb4b9e954..86c1f5effde3173c8bc458af21b454c81738935e 100644 --- a/net/minecraft/world/level/GameRules.java +++ b/net/minecraft/world/level/GameRules.java -@@ -249,7 +249,7 @@ public class GameRules { +@@ -277,7 +277,7 @@ public class GameRules { } private GameRules(Map, GameRules.Value> rules, FeatureFlagSet enabledFeatures) { @@ -555,36 +555,24 @@ index 01e5b29d6e9a5c53c0e23b61ed0c1d7be1a0fe08..d80df05e40f3941ade5ed320e12f8dcf return 1.0 * (32.0 * (d1 - 128.0) - 3.0 * (d1 - 120.0) * d2 + 3.0 * d2 * d2) / (128.0 * (32.0 - 3.0 * d2)); } -diff --git a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 681dec447486138088fe5f705ef4fadab531139f..12ea268eaec629fde20d55460e618fde3a3e006d 100644 ---- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -+++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -198,6 +198,7 @@ public class MapItemSavedData extends SavedData { - } - } - -+ mapItemSavedData.setDirty(false); // DivineMC - Misc Optimizations - return mapItemSavedData; - } - diff --git a/net/minecraft/world/level/storage/DimensionDataStorage.java b/net/minecraft/world/level/storage/DimensionDataStorage.java -index d9a3b5a2e6495b7e22c114506c2bd1e406f58f8f..a6e03345afd6d8a38e06a43c59103209618baa14 100644 +index 05361803a929cbcf651a37cf43009e57acb25f3e..5d21d2520dd33889988d8300060e6a41a8334562 100644 --- a/net/minecraft/world/level/storage/DimensionDataStorage.java +++ b/net/minecraft/world/level/storage/DimensionDataStorage.java -@@ -34,7 +34,7 @@ import org.slf4j.Logger; - +@@ -39,7 +39,7 @@ import org.slf4j.Logger; public class DimensionDataStorage implements AutoCloseable { private static final Logger LOGGER = LogUtils.getLogger(); -- public final Map> cache = new HashMap<>(); -+ public final Map> cache = new java.util.concurrent.ConcurrentHashMap<>(); // DivineMC - Concurrent HashMap + private final SavedData.Context context; +- public final Map, Optional> cache = new HashMap<>(); ++ public final Map, Optional> cache = new java.util.concurrent.ConcurrentHashMap<>(); // DivineMC - Misc Optimizations private final DataFixer fixerUpper; private final HolderLookup.Provider registries; private final Path dataFolder; diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java -index c9c6e4e460ad8435f12761704bb9b0284d6aa708..54807bb4b4189ceaded1f78a1a9ab85ce40ab2b1 100644 +index 5767fbfd7f33c5276fb4335ce473b2e1baca411c..1866d857cabde481f23e861e0db7994bfa84ac40 100644 --- a/net/minecraft/world/phys/AABB.java +++ b/net/minecraft/world/phys/AABB.java -@@ -189,13 +189,15 @@ public class AABB { +@@ -190,13 +190,15 @@ public class AABB { } public AABB intersect(AABB other) { @@ -607,7 +595,7 @@ index c9c6e4e460ad8435f12761704bb9b0284d6aa708..54807bb4b4189ceaded1f78a1a9ab85c } public AABB minmax(AABB other) { -@@ -227,16 +229,37 @@ public class AABB { +@@ -228,16 +230,37 @@ public class AABB { } public boolean intersects(AABB other) { diff --git a/patches/unapplied/server/minecraft-patches/features/0010-Chunk-System-Optimizations.patch b/divinemc-server/minecraft-patches/features/0009-Chunk-System-Optimizations.patch similarity index 93% rename from patches/unapplied/server/minecraft-patches/features/0010-Chunk-System-Optimizations.patch rename to divinemc-server/minecraft-patches/features/0009-Chunk-System-Optimizations.patch index a4b1721..c0027b0 100644 --- a/patches/unapplied/server/minecraft-patches/features/0010-Chunk-System-Optimizations.patch +++ b/divinemc-server/minecraft-patches/features/0009-Chunk-System-Optimizations.patch @@ -96,10 +96,10 @@ index 866f38eb0f379ffbe2888023a7d1c290f521a231..08666b4aa1c7663861dc361f60e6f1cc if (indexer == null) { return dfl; diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f2686feb3 100644 +index 7a52c42845bd74d0bb7649f87764aba12f442f02..78f2d7c698a4f2c21a473627c3017a9751f80cf1 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -@@ -189,13 +189,13 @@ public final class RegionizedPlayerChunkLoader { +@@ -187,13 +187,13 @@ public final class RegionizedPlayerChunkLoader { } if (((ChunkSystemServerPlayer)player).moonrise$getChunkLoader() != null) { @@ -115,7 +115,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f } public void updatePlayer(final ServerPlayer player) { -@@ -301,7 +301,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -299,7 +299,7 @@ public final class RegionizedPlayerChunkLoader { return false; } @@ -124,7 +124,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f TickThread.ensureTickThread("Cannot tick player chunk loader async"); long currTime = System.nanoTime(); for (final ServerPlayer player : new java.util.ArrayList<>(this.world.players())) { -@@ -312,6 +312,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -310,6 +310,7 @@ public final class RegionizedPlayerChunkLoader { } loader.update(); // can't invoke plugin logic loader.updateQueues(currTime); @@ -132,7 +132,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f } } -@@ -362,7 +363,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -360,7 +361,7 @@ public final class RegionizedPlayerChunkLoader { GENERATED_TICKET_LEVEL, TICK_TICKET_LEVEL }; @@ -141,7 +141,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f { this.chunkTicketStage.defaultReturnValue(CHUNK_TICKET_STAGE_NONE); } -@@ -384,10 +385,19 @@ public final class RegionizedPlayerChunkLoader { +@@ -382,10 +383,19 @@ public final class RegionizedPlayerChunkLoader { final int centerX = PlayerChunkLoaderData.this.lastChunkX; final int centerZ = PlayerChunkLoaderData.this.lastChunkZ; @@ -165,7 +165,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f }; private final LongHeapPriorityQueue sendQueue = new LongHeapPriorityQueue(CLOSEST_MANHATTAN_DIST); private final LongHeapPriorityQueue tickingQueue = new LongHeapPriorityQueue(CLOSEST_MANHATTAN_DIST); -@@ -490,7 +500,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -488,7 +498,7 @@ public final class RegionizedPlayerChunkLoader { } @Override @@ -174,7 +174,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f final long chunk = CoordinateUtils.getChunkKey(chunkX, chunkZ); // note: by the time this is called, the tick cleanup should have ran - so, if the chunk is at // the tick stage it was deemed in range for loading. Thus, we need to move it to generated -@@ -624,7 +634,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -622,7 +632,7 @@ public final class RegionizedPlayerChunkLoader { return Math.max(Math.abs(dx), Math.abs(dz)) <= this.lastTickDistance; } @@ -183,7 +183,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f for (int dz = -radius; dz <= radius; ++dz) { for (int dx = -radius; dx <= radius; ++dx) { if ((dx | dz) == 0) { -@@ -643,10 +653,10 @@ public final class RegionizedPlayerChunkLoader { +@@ -641,10 +651,10 @@ public final class RegionizedPlayerChunkLoader { return true; } @@ -196,7 +196,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f } // update rate limits final double loadRate = this.getMaxChunkLoadRate(); -@@ -910,10 +920,10 @@ public final class RegionizedPlayerChunkLoader { +@@ -907,10 +917,10 @@ public final class RegionizedPlayerChunkLoader { ); } @@ -209,7 +209,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f } final ViewDistances playerDistances = ((ChunkSystemServerPlayer)this.player).moonrise$getViewDistanceHolder().getViewDistances(); final ViewDistances worldDistances = ((ChunkSystemServerLevel)this.world).moonrise$getViewDistanceHolder().getViewDistances(); -@@ -1062,7 +1072,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -1059,7 +1069,7 @@ public final class RegionizedPlayerChunkLoader { this.flushDelayedTicketOps(); } @@ -218,7 +218,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f TickThread.ensureTickThread(this.player, "Cannot add player asynchronously"); if (this.removed) { throw new IllegalStateException("Removing removed player chunk loader"); -@@ -1090,7 +1100,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -1087,7 +1097,7 @@ public final class RegionizedPlayerChunkLoader { } public LongOpenHashSet getSentChunksRaw() { @@ -228,17 +228,17 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f } } diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java -index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d56318eb22 100644 +index f473999938840562b1007a789600342e5796a123..60705955e231d47c60f5a0a5e869988aed8774fc 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java -@@ -71,36 +71,49 @@ public final class ChunkHolderManager { - private static final long PROBE_MARKER = Long.MIN_VALUE + 1; +@@ -72,36 +72,49 @@ public final class ChunkHolderManager { + private static final long NO_TIMEOUT_MARKER = Long.MIN_VALUE; public final ReentrantAreaLock ticketLockArea; -- private final ConcurrentLong2ReferenceChainedHashTable>> tickets = new ConcurrentLong2ReferenceChainedHashTable<>(); +- private final ConcurrentLong2ReferenceChainedHashTable> tickets = new ConcurrentLong2ReferenceChainedHashTable<>(); - private final ConcurrentLong2ReferenceChainedHashTable sectionToChunkToExpireCount = new ConcurrentLong2ReferenceChainedHashTable<>(); + // DivineMC start - Chunk System optimization -+ private final ConcurrentLong2ReferenceChainedHashTable>> tickets = ConcurrentLong2ReferenceChainedHashTable.createWithCapacity(20, 0.9F); ++ private final ConcurrentLong2ReferenceChainedHashTable> tickets = ConcurrentLong2ReferenceChainedHashTable.createWithCapacity(20, 0.9F); + private final ConcurrentLong2ReferenceChainedHashTable sectionToChunkToExpireCount = ConcurrentLong2ReferenceChainedHashTable.createWithCapacity(20, 0.9F); + // DivineMC end - Chunk System optimization final ChunkUnloadQueue unloadQueue; @@ -298,9 +298,9 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 + } + // DivineMC end - Chunk System optimization - public ChunkHolderManager(final ServerLevel world, final ChunkTaskScheduler taskScheduler) { - this.world = world; -@@ -222,26 +235,29 @@ public final class ChunkHolderManager { + private final ConcurrentLong2ReferenceChainedHashTable ticketCounters = new ConcurrentLong2ReferenceChainedHashTable<>(); + +@@ -224,26 +237,29 @@ public final class ChunkHolderManager { this.taskScheduler.setShutdown(true); } @@ -337,7 +337,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 holder.lastAutoSave = currentTick; if (holder.save(false) != null) { -@@ -255,10 +271,11 @@ public final class ChunkHolderManager { +@@ -257,10 +273,11 @@ public final class ChunkHolderManager { for (final NewChunkHolder holder : reschedule) { if (holder.getChunkStatus().isOrAfter(FullChunkStatus.FULL)) { @@ -350,7 +350,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 public void saveAllChunks(final boolean flush, final boolean shutdown, final boolean logProgress) { final List holders = this.getChunkHolders(); -@@ -317,13 +334,9 @@ public final class ChunkHolderManager { +@@ -319,13 +336,9 @@ public final class ChunkHolderManager { } if (logProgress) { final long currTime = System.nanoTime(); @@ -366,8 +366,8 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 } } } -@@ -425,8 +438,8 @@ public final class ChunkHolderManager { - final Long2ObjectOpenHashMap>> ret = new Long2ObjectOpenHashMap<>(); +@@ -459,8 +472,8 @@ public final class ChunkHolderManager { + final Long2ObjectOpenHashMap> ret = new Long2ObjectOpenHashMap<>(); final Long2ObjectOpenHashMap sections = new Long2ObjectOpenHashMap<>(); final int sectionShift = this.taskScheduler.getChunkSystemLockShift(); - for (final PrimitiveIterator.OfLong iterator = this.tickets.keyIterator(); iterator.hasNext();) { @@ -377,7 +377,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 sections.computeIfAbsent( CoordinateUtils.getChunkKey( CoordinateUtils.getChunkX(coord) >> sectionShift, -@@ -523,7 +536,7 @@ public final class ChunkHolderManager { +@@ -557,7 +570,7 @@ public final class ChunkHolderManager { chunkZ >> sectionShift ); @@ -386,16 +386,18 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 return new Long2IntOpenHashMap(); }).addTo(chunkKey, 1); } -@@ -567,7 +580,7 @@ public final class ChunkHolderManager { +@@ -601,8 +614,8 @@ public final class ChunkHolderManager { final ReentrantAreaLock.Node ticketLock = lock ? this.ticketLockArea.lock(chunkX, chunkZ) : null; try { -- final SortedArraySet> ticketsAtChunk = this.tickets.computeIfAbsent(chunk, (final long keyInMap) -> { -+ final SortedArraySet> ticketsAtChunk = this.tickets.computeIfAbsent(chunk, (keyInMap) -> { // DivineMC - Chunk System optimization - return SortedArraySet.create(4); +- final SortedArraySet ticketsAtChunk = this.tickets.computeIfAbsent(chunk, (final long keyInMap) -> { +- return (SortedArraySet)SortedArraySet.create(4); ++ final SortedArraySet ticketsAtChunk = this.tickets.computeIfAbsent(chunk, (keyInMap) -> { // DivineMC - Chunk System optimization ++ return SortedArraySet.create(4); }); -@@ -697,8 +710,8 @@ public final class ChunkHolderManager { + final int levelBefore = getTicketLevelAt(ticketsAtChunk); +@@ -782,8 +795,8 @@ public final class ChunkHolderManager { final Long2ObjectOpenHashMap sections = new Long2ObjectOpenHashMap<>(); final int sectionShift = this.taskScheduler.getChunkSystemLockShift(); @@ -406,7 +408,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 sections.computeIfAbsent( CoordinateUtils.getChunkKey( CoordinateUtils.getChunkX(coord) >> sectionShift, -@@ -746,8 +759,8 @@ public final class ChunkHolderManager { +@@ -831,8 +844,8 @@ public final class ChunkHolderManager { return removeDelay <= 0L; }; @@ -417,16 +419,16 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 if (!this.sectionToChunkToExpireCount.containsKey(sectionKey)) { // removed concurrently -@@ -1033,7 +1046,7 @@ public final class ChunkHolderManager { +@@ -1118,7 +1131,7 @@ public final class ChunkHolderManager { } - if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking && !TickThread.isTickThreadFor(world)) { // DivineMC - Parallel world ticking + if (!TickThread.isTickThread()) { this.taskScheduler.scheduleChunkTask(() -> { - final ArrayDeque pendingFullLoadUpdate = ChunkHolderManager.this.pendingFullLoadUpdate; + final java.util.Deque pendingFullLoadUpdate = ChunkHolderManager.this.getData().pendingFullLoadUpdate; // DivineMC - Chunk System optimization for (int i = 0, len = changedFullStatus.size(); i < len; ++i) { pendingFullLoadUpdate.add(changedFullStatus.get(i)); } -@@ -1041,16 +1054,16 @@ public final class ChunkHolderManager { +@@ -1126,16 +1139,16 @@ public final class ChunkHolderManager { ChunkHolderManager.this.processPendingFullUpdate(); }, Priority.HIGHEST); } else { @@ -446,7 +448,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 PlatformHooks.get().onChunkHolderDelete(this.world, holder.vanillaChunkHolder); this.chunkHolders.remove(CoordinateUtils.getChunkKey(holder.chunkX, holder.chunkZ)); } -@@ -1214,6 +1227,27 @@ public final class ChunkHolderManager { +@@ -1293,6 +1306,27 @@ public final class ChunkHolderManager { } } @@ -474,7 +476,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 public enum TicketOperationType { ADD, REMOVE, ADD_IF_REMOVED, ADD_AND_REMOVE } -@@ -1387,7 +1421,7 @@ public final class ChunkHolderManager { +@@ -1466,7 +1500,7 @@ public final class ChunkHolderManager { // only call on tick thread private boolean processPendingFullUpdate() { @@ -483,21 +485,21 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 boolean ret = false; -@@ -1423,8 +1457,7 @@ public final class ChunkHolderManager { +@@ -1502,8 +1536,7 @@ public final class ChunkHolderManager { final JsonArray allTicketsJson = new JsonArray(); ret.add("tickets", allTicketsJson); -- for (final Iterator>>> iterator = this.tickets.entryIterator(); +- for (final Iterator>> iterator = this.tickets.entryIterator(); - iterator.hasNext();) { -+ for (final Iterator>>> iterator = this.tickets.entryIterator(); iterator.hasNext();) { // DivineMC - Chunk System optimization - final ConcurrentLong2ReferenceChainedHashTable.TableEntry>> coordinateTickets = iterator.next(); ++ for (final Iterator>> iterator = this.tickets.entryIterator(); iterator.hasNext();) { // DivineMC - Chunk System optimization + final ConcurrentLong2ReferenceChainedHashTable.TableEntry> coordinateTickets = iterator.next(); final long coordinate = coordinateTickets.getKey(); - final SortedArraySet> tickets = coordinateTickets.getValue(); + final SortedArraySet tickets = coordinateTickets.getValue(); diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java -index 67532b85073b7978254a0b04caadfe822679e61f..4b97b676d4245e7ece956eb4c78bed96ff452b2d 100644 +index 8f8268924ac92fca5df8a11e08031fa8416c6e05..f1bc7a5e80de0293e1837b2f7401b347fc59f831 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java -@@ -65,14 +65,6 @@ public final class ChunkTaskScheduler { +@@ -66,14 +66,6 @@ public final class ChunkTaskScheduler { private static final Logger LOGGER = LogUtils.getClassLogger(); @@ -509,10 +511,10 @@ index 67532b85073b7978254a0b04caadfe822679e61f..4b97b676d4245e7ece956eb4c78bed96 - LOGGER.info("Chunk system is using population gen parallelism: " + useParallelGen); - } - - public static final TicketType CHUNK_LOAD = TicketType.create("chunk_system:chunk_load", Long::compareTo); + public static final TicketType CHUNK_LOAD = ChunkSystemTicketType.create("chunk_system:chunk_load", Long::compareTo); private static final AtomicLong CHUNK_LOAD_IDS = new AtomicLong(); -@@ -115,12 +107,12 @@ public final class ChunkTaskScheduler { +@@ -116,12 +108,12 @@ public final class ChunkTaskScheduler { public final ServerLevel world; public final RadiusAwarePrioritisedExecutor radiusAwareScheduler; @@ -530,7 +532,7 @@ index 67532b85073b7978254a0b04caadfe822679e61f..4b97b676d4245e7ece956eb4c78bed96 private final PrioritisedTaskQueue mainThreadExecutor = new PrioritisedTaskQueue(); -@@ -291,14 +283,14 @@ public final class ChunkTaskScheduler { +@@ -292,14 +284,14 @@ public final class ChunkTaskScheduler { this.lockShift = Math.max(((ChunkSystemServerLevel)world).moonrise$getRegionChunkShift(), ThreadedTicketLevelPropagator.SECTION_SHIFT); this.schedulingLockArea = new ReentrantAreaLock(this.getChunkSystemLockShift()); @@ -784,7 +786,7 @@ index 28ffa653e87a4e8ef7cf614916ef3fe61681fe16..b35b92b204fbefd139c4544f15e32d46 } finally { this.returnNode(); diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/task/ChunkFullTask.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/task/ChunkFullTask.java -index 6ab353b0d2465c3680bb3c8d0852ba0f65c00fd2..70067c12d4d82460d55d8f90d01b0bc1e5368408 100644 +index 96ccb8f657d755b2e58a8dd0cda00ca0df4886b2..89de0fcb3f8142f76399fc00e288e03d7f3742f2 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/task/ChunkFullTask.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/task/ChunkFullTask.java @@ -35,7 +35,7 @@ public final class ChunkFullTask extends ChunkProgressionTask implements Runnabl @@ -865,17 +867,18 @@ index 95ed5a0ff3f0588f625ba48a5fee3aafbab9d13f..f2fd6d5eb024f646875868c441eb2da2 protected static final class LoadDataFromDiskTask { diff --git a/ca/spottedleaf/moonrise/patches/chunk_tick_iteration/ChunkTickConstants.java b/ca/spottedleaf/moonrise/patches/chunk_tick_iteration/ChunkTickConstants.java -index e97e7d276faf055c89207385d3820debffb06463..4aeb75a2cdcfb4206bab3eee5ad674dd9890e720 100644 +index 6d1fe8028739145b11fce98ad62b2f8044299548..2cd1197fa0d15e19749409cc857a0254de444ba5 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_tick_iteration/ChunkTickConstants.java +++ b/ca/spottedleaf/moonrise/patches/chunk_tick_iteration/ChunkTickConstants.java -@@ -2,6 +2,6 @@ package ca.spottedleaf.moonrise.patches.chunk_tick_iteration; +@@ -2,7 +2,7 @@ package ca.spottedleaf.moonrise.patches.chunk_tick_iteration; public final class ChunkTickConstants { - public static final int PLAYER_SPAWN_TRACK_RANGE = 8; + public static final int PLAYER_SPAWN_TRACK_RANGE = (int) Math.round(org.bxteam.divinemc.DivineConfig.playerNearChunkDetectionRange / 16.0); // DivineMC - Chunk System optimization - - } + // the smallest distance on x/z is at 45 degrees, we need to subtract 0.5 since this is calculated from chunk center and not chunk perimeter + // note: vanilla does not subtract 0.5 but the result is (luckily!) the same + public static final int NARROW_SPAWN_TRACK_RANGE = (int)Math.floor(((double)PLAYER_SPAWN_TRACK_RANGE / Math.sqrt(2.0)) - 0.5); diff --git a/ca/spottedleaf/moonrise/patches/starlight/light/SWMRNibbleArray.java b/ca/spottedleaf/moonrise/patches/starlight/light/SWMRNibbleArray.java index 4ca68a903e67606fc4ef0bfa9862a73797121c8b..f94f443f862611f039454d1dc8ff2a4ba5f081d3 100644 --- a/ca/spottedleaf/moonrise/patches/starlight/light/SWMRNibbleArray.java @@ -890,10 +893,10 @@ index 4ca68a903e67606fc4ef0bfa9862a73797121c8b..f94f443f862611f039454d1dc8ff2a4b return false; } diff --git a/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java b/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java -index 571db5f9bf94745a8afe2cd313e593fb15db5e37..c8e59f6abed384f45314fc995d3822724c9b4001 100644 +index 51f4dd4f583dfbd16cb00f1cb4418d1044cecb1c..2f83deafbb5b50e5ce191b5351ec5ed948262008 100644 --- a/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java +++ b/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java -@@ -888,7 +888,7 @@ public final class StarLightInterface { +@@ -887,7 +887,7 @@ public final class StarLightInterface { super(chunkCoordinate, lightEngine, queue); this.task = ((ChunkSystemServerLevel)(ServerLevel)lightEngine.getWorld()).moonrise$getChunkTaskScheduler().radiusAwareScheduler.createTask( CoordinateUtils.getChunkX(chunkCoordinate), CoordinateUtils.getChunkZ(chunkCoordinate), @@ -903,7 +906,7 @@ index 571db5f9bf94745a8afe2cd313e593fb15db5e37..c8e59f6abed384f45314fc995d382272 } diff --git a/io/papermc/paper/FeatureHooks.java b/io/papermc/paper/FeatureHooks.java -index 460bb584db04b582f3297ae419183f430aff1ec0..72c4e1876115745fbeec12fe8a1ad6f4803e9d7f 100644 +index 52b981a05ad5aabb7c85dc1e0f1d2b835163bb87..f4af8e131c2badbe0e57ccec5be8710e12d7c38d 100644 --- a/io/papermc/paper/FeatureHooks.java +++ b/io/papermc/paper/FeatureHooks.java @@ -32,11 +32,6 @@ import org.bukkit.Chunk; @@ -919,10 +922,10 @@ index 460bb584db04b582f3297ae419183f430aff1ec0..72c4e1876115745fbeec12fe8a1ad6f4 commands.put(Set.of("fixlight"), new FixLightCommand()); // Paper - rewrite chunk system commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand()); // Paper - rewrite chunk system diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae82185929494b62 100644 +index b5028cc64e2a43c841801114908825102df41765..fb6e0beb35d1d6bb9a159debeb06e861051821b9 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -127,8 +127,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -132,8 +132,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final AtomicInteger tickingGenerated = new AtomicInteger(); // Paper - public private final String storageName; private final PlayerMap playerMap = new PlayerMap(); @@ -933,7 +936,7 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 // Paper - rewrite chunk system public int serverViewDistance; public final WorldGenContext worldGenContext; // Paper - public -@@ -249,7 +249,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -256,7 +256,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final ServerPlayer[] backingSet = inRange.getRawDataUnchecked(); for (int i = 0, len = inRange.size(); i < len; i++) { @@ -946,7 +949,7 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 } } -@@ -266,7 +270,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -273,7 +277,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } final ServerPlayer[] backingSet = inRange.getRawDataUnchecked(); for (int i = 0, len = inRange.size(); i < len; i++) { @@ -959,7 +962,7 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 } } // Paper end - per player mob count backoff -@@ -720,27 +728,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -774,27 +782,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return false; } @@ -977,8 +980,8 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 - if (event == null || event.isCancelled()) continue; - blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4)); - } -- // Paper end - PlayerNaturallySpawnCreaturesEvent - if (this.playerIsCloseEnoughForSpawning(serverPlayer, chunkPos, blockRange)) { +- // Paper end - PlayerNaturallySpawnCreaturesEvent - return true; - } - } @@ -988,7 +991,7 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 // Paper end - chunk tick iteration optimisation } -@@ -758,10 +746,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -812,10 +800,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final ServerPlayer[] raw = players.getRawDataUnchecked(); final int len = players.size(); @@ -1002,7 +1005,7 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 if (ret == null) { ret = new ArrayList<>(len - i); ret.add(player); -@@ -1146,6 +1134,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1208,6 +1196,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } else { for (int i = 0, len = players.size(); i < len; ++i) { final ServerPlayer player = playersRaw[i]; @@ -1011,10 +1014,10 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 } diff --git a/net/minecraft/server/level/DistanceManager.java b/net/minecraft/server/level/DistanceManager.java -index 5eab6179ce3913cb4e4d424f910ba423faf21c85..4b1efd53e423bdfe90d5efd472823869fc87e73b 100644 +index fd3d0f6cb53bc8b6186f0d86575f21007b2c20ed..7f3c41b59e288364d67534511fc038e6dbb268fa 100644 --- a/net/minecraft/server/level/DistanceManager.java +++ b/net/minecraft/server/level/DistanceManager.java -@@ -178,15 +178,13 @@ public abstract class DistanceManager implements ca.spottedleaf.moonrise.patches +@@ -127,15 +127,13 @@ public abstract class DistanceManager implements ca.spottedleaf.moonrise.patches public boolean inEntityTickingRange(long chunkPos) { // Paper start - rewrite chunk system @@ -1033,10 +1036,10 @@ index 5eab6179ce3913cb4e4d424f910ba423faf21c85..4b1efd53e423bdfe90d5efd472823869 } diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index ab30af9cd58ff7310e05be87b08f42bacf69e11e..ae0e36d198ad8243920c8e8a55c0be4945542763 100644 +index 4d4139b5f42a4db6e22bf1d063a23dc7b9914f85..9a65321ce62f21b150d29be30dbae7dba0ff40be 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -439,8 +439,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -444,8 +444,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon public boolean isPositionTicking(long chunkPos) { // Paper start - rewrite chunk system @@ -1047,18 +1050,18 @@ index ab30af9cd58ff7310e05be87b08f42bacf69e11e..ae0e36d198ad8243920c8e8a55c0be49 } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6c5e40023 100644 +index 8fa3af0ebcb92138d0dae858c131db0a710df693..e351b75f03b7096dcd0378b49987d27c04474116 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -181,6 +181,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -177,6 +177,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public final ServerChunkCache chunkSource; private final MinecraftServer server; public final net.minecraft.world.level.storage.PrimaryLevelData serverLevelData; // CraftBukkit - type + public final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager.LevelHolderData chunkHolderData; // DivineMC - Chunk System optimization private int lastSpawnChunkRadius; - final EntityTickList entityTickList = new EntityTickList(this); // DivineMC - Parallel world ticking + final EntityTickList entityTickList = new EntityTickList(); // Paper - rewrite chunk system -@@ -291,6 +292,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -287,6 +288,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // Paper end - optimise getPlayerByUUID // Paper start - rewrite chunk system @@ -1066,7 +1069,7 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 private final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder viewDistanceHolder = new ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder(); private final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader chunkLoader = new ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader((ServerLevel)(Object)this); private final ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.EntityDataController entityDataController; -@@ -689,6 +691,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -678,6 +680,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Paper start - rewrite chunk system this.moonrise$setEntityLookup(new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup((ServerLevel)(Object)this, ((ServerLevel)(Object)this).new EntityCallbacks())); this.chunkTaskScheduler = new ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler((ServerLevel)(Object)this); @@ -1074,15 +1077,15 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 this.entityDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.EntityDataController( new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.EntityDataController.EntityRegionFileStorage( new RegionStorageInfo(levelStorageAccess.getLevelId(), dimension, "entities"), -@@ -703,6 +706,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -691,6 +694,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + // Paper end - rewrite chunk system this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit - this.tickExecutor = java.util.concurrent.Executors.newSingleThreadExecutor(new org.bxteam.divinemc.server.ServerLevelTickExecutorThreadFactory(getWorld().getName())); // DivineMC - Parallel world ticking this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle + this.chunkSystemPriorities = new org.bxteam.divinemc.server.chunk.PriorityHandler(this); // DivineMC - Chunk System optimizations } // Paper start -@@ -832,8 +836,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -820,8 +824,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public boolean shouldTickBlocksAt(long chunkPos) { // Paper start - rewrite chunk system @@ -1092,7 +1095,7 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 // Paper end - rewrite chunk system } -@@ -889,7 +892,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -877,7 +880,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe private void optimiseRandomTick(final LevelChunk chunk, final int tickSpeed) { final LevelChunkSection[] sections = chunk.getSections(); @@ -1101,7 +1104,7 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = this.simpleRandom; final boolean doubleTickFluids = !ca.spottedleaf.moonrise.common.PlatformHooks.get().configFixMC224294(); -@@ -897,42 +900,41 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -885,42 +888,41 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe final int offsetX = cpos.x << 4; final int offsetZ = cpos.z << 4; @@ -1154,9 +1157,9 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 } // Paper end - optimise random ticking -@@ -2557,30 +2559,25 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2532,16 +2534,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - private boolean isPositionTickingWithEntitiesLoaded(long chunkPos) { + public boolean isPositionTickingWithEntitiesLoaded(long chunkPos) { // Paper start - rewrite chunk system - final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(chunkPos); - // isTicking implies the chunk is loaded, and the chunk is loaded now implies the entities are loaded @@ -1173,24 +1176,8 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 // Paper end - rewrite chunk system } - public boolean isNaturalSpawningAllowed(BlockPos pos) { - // Paper start - rewrite chunk system -- final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(pos)); -- return chunkHolder != null && chunkHolder.isEntityTickingReady(); -+ return this.moonrise$getChunkTaskScheduler().chunkHolderManager.entityTickingChunkHolders.contains(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(pos)); // DivineMC - Chunk System optimization - // Paper end - rewrite chunk system - } - - public boolean isNaturalSpawningAllowed(ChunkPos chunkPos) { - // Paper start - rewrite chunk system -- final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(chunkPos)); -- return chunkHolder != null && chunkHolder.isEntityTickingReady(); -+ return this.moonrise$getChunkTaskScheduler().chunkHolderManager.entityTickingChunkHolders.contains(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(chunkPos)); // DivineMC - Chunk System optimization - // Paper end - rewrite chunk system - } - diff --git a/net/minecraft/server/level/ThreadedLevelLightEngine.java b/net/minecraft/server/level/ThreadedLevelLightEngine.java -index 5c9ac44a3b4bc8e047feaf61a94eb163761498a2..66dc6d77263d6f5de7d0a96b8b6575e7a363f5bf 100644 +index 216c2294f59a9d53613ac249ea63adeaa8a8efa4..b83438852a7b01fef9a736a5b0bc46f15ed1d59b 100644 --- a/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/net/minecraft/server/level/ThreadedLevelLightEngine.java @@ -138,7 +138,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @@ -1203,10 +1190,10 @@ index 5c9ac44a3b4bc8e047feaf61a94eb163761498a2..66dc6d77263d6f5de7d0a96b8b6575e7 return chunks.size(); } diff --git a/net/minecraft/world/level/LevelReader.java b/net/minecraft/world/level/LevelReader.java -index 26c8c1e5598daf3550aef05b12218c47bda6618b..94c824ab1457939c425e1f99929d3222ee2c18a0 100644 +index 0842fd6488c8b27d98c4344e1244996b4c0e9912..cba72a86d99fb4b3a3f9f5aefe9993ec8e84abfd 100644 --- a/net/minecraft/world/level/LevelReader.java +++ b/net/minecraft/world/level/LevelReader.java -@@ -70,10 +70,27 @@ public interface LevelReader extends ca.spottedleaf.moonrise.patches.chunk_syste +@@ -74,10 +74,27 @@ public interface LevelReader extends ca.spottedleaf.moonrise.patches.chunk_syste @Override default Holder getNoiseBiome(int x, int y, int z) { @@ -1424,7 +1411,7 @@ index cf3172be76fa4c7987ed569138439ff42f92fa7f..ed3c470056855a520a110ac7014f7839 + // DivineMC end - Chunk System Optimizations } diff --git a/net/minecraft/world/level/chunk/LevelChunkSection.java b/net/minecraft/world/level/chunk/LevelChunkSection.java -index c83d0667b19830304f22319a46a23422a8766790..aa10c5087a0fc9306b734f20ccbad73045a1b6d0 100644 +index 4db7ec2647b9f08536dc5253dac0fa8d3044e38b..e3abc97a1a66988e44b1ed78b76a198b82051da1 100644 --- a/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/net/minecraft/world/level/chunk/LevelChunkSection.java @@ -23,6 +23,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_ @@ -1539,7 +1526,7 @@ index a80b2e9dceea423180a9c390d1970317dff4f1b0..6d9dfc1837dccef2073da180aaaf68b0 void read(FriendlyByteBuf buffer); diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java -index 230cb433c38f9b6ffb1adeaa8b6040490f13e826..712d3d1669aecd38934957c81835e1f38289539a 100644 +index d7f4d54f73adc0d4d71fb9ba425e45a11c456961..a512609aaa823b940ed269c981fc9beec49a126e 100644 --- a/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/net/minecraft/world/level/chunk/PalettedContainer.java @@ -393,6 +393,12 @@ public class PalettedContainer implements PaletteResize, PalettedContainer @@ -1556,7 +1543,7 @@ index 230cb433c38f9b6ffb1adeaa8b6040490f13e826..712d3d1669aecd38934957c81835e1f3 public PalettedContainer copy() { return new PalettedContainer<>(this, this.presetValues); // Paper - Anti-Xray - Add preset values diff --git a/net/minecraft/world/level/chunk/ProtoChunk.java b/net/minecraft/world/level/chunk/ProtoChunk.java -index e66239e2da91bd3ddf358d239be796719c0da327..35e9d8cfe12252d3419626f1cefb64d30e20069e 100644 +index 13837d5508c34de3ccc49caac0d6c0ba7010d88a..3449d4dbb68353204ec67c46eed1404dd6410e96 100644 --- a/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/net/minecraft/world/level/chunk/ProtoChunk.java @@ -41,7 +41,7 @@ public class ProtoChunk extends ChunkAccess { @@ -1610,7 +1597,7 @@ index 2ffae24b0cb1a20c7d5a8520f1b5197c2cedea11..c3ec5e5645f680a915c95d833b589b68 public T valueFor(int id) { if (this.value != null && id == 0) { diff --git a/net/minecraft/world/level/chunk/storage/IOWorker.java b/net/minecraft/world/level/chunk/storage/IOWorker.java -index 2199a9e2a0141c646d108f2687a27f1d165453c5..c28c2583b257f92207b822a1fdde8f5b7e480992 100644 +index 27e1edbd8d8ffd80c1a3df17bc47f4a6936619f7..fae062a643692369175f58bb1687e766e873d8e3 100644 --- a/net/minecraft/world/level/chunk/storage/IOWorker.java +++ b/net/minecraft/world/level/chunk/storage/IOWorker.java @@ -212,7 +212,38 @@ public class IOWorker implements ChunkScanAccess, AutoCloseable { @@ -1653,10 +1640,10 @@ index 2199a9e2a0141c646d108f2687a27f1d165453c5..c28c2583b257f92207b822a1fdde8f5b if (entry != null) { this.runStore(entry.getKey(), entry.getValue()); diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 6ebd1300c2561116b83cb2472ac7939ead36d576..16cd10ab8de69ca3d29c84cf93715645322fd72a 100644 +index 8d1174f25e0e90d0533970f4ddd8448442024936..c98cb390bda4b536f97445f228e06aaebcd84609 100644 --- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -244,7 +244,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -269,7 +269,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise protected RegionFileStorage(RegionStorageInfo info, Path folder, boolean sync) { // Paper - protected this.folder = folder; @@ -2222,7 +2209,7 @@ index c62a15ea4a1bb22e7bcc2fc544acf8a601892029..bc67039f8374ae4e471ca14e0c623e6b } } diff --git a/net/minecraft/world/level/levelgen/Beardifier.java b/net/minecraft/world/level/levelgen/Beardifier.java -index 131923282c9ecbcb1d7f45a826da907c02bd2716..1af75406ba69c5eec4a41fe7a8dce0d07c259099 100644 +index 74d8202b5c9bb2a3ee832be70f95c0b5cbecb460..4c11b822fa65388c1d8d9aaa7fd70200d0eaa418 100644 --- a/net/minecraft/world/level/levelgen/Beardifier.java +++ b/net/minecraft/world/level/levelgen/Beardifier.java @@ -29,6 +29,17 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { @@ -2243,7 +2230,7 @@ index 131923282c9ecbcb1d7f45a826da907c02bd2716..1af75406ba69c5eec4a41fe7a8dce0d0 public static Beardifier forStructuresInChunk(StructureManager structureManager, ChunkPos chunkPos) { int minBlockX = chunkPos.getMinBlockX(); -@@ -76,50 +87,44 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { +@@ -75,50 +86,44 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { this.junctionIterator = junctionIterator; } @@ -2318,7 +2305,7 @@ index 131923282c9ecbcb1d7f45a826da907c02bd2716..1af75406ba69c5eec4a41fe7a8dce0d0 @Override public double minValue() { -@@ -132,8 +137,14 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { +@@ -131,8 +136,14 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } private static double getBuryContribution(double x, double y, double z) { @@ -2336,10 +2323,10 @@ index 131923282c9ecbcb1d7f45a826da907c02bd2716..1af75406ba69c5eec4a41fe7a8dce0d0 private static double getBeardContribution(int x, int y, int z, int height) { diff --git a/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java b/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java -index 4993ace2b3d615570de3d4b6621aeba3a3e7fe99..1be79332446559c95ae3048a71a6634fd01cf2e2 100644 +index 3379c3893227d42bb54f3a94e697a9851d279605..161aed37d14cd283a3b4341ea15d57a4a0f088b3 100644 --- a/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java +++ b/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java -@@ -82,6 +82,7 @@ public final class BelowZeroRetrogen { +@@ -74,6 +74,7 @@ public final class BelowZeroRetrogen { } public void applyBedrockMask(ProtoChunk chunk) { @@ -2623,20 +2610,19 @@ index 9d3a9ca1e13cd80f468f1352bbb74345f03903dd..d97b9b43686bda0a95fc02f6ca31b2d0 public RandomSource at(int x, int y, int z) { long seed = Mth.getSeed(x, y, z); diff --git a/net/minecraft/world/level/levelgen/feature/stateproviders/RandomizedIntStateProvider.java b/net/minecraft/world/level/levelgen/feature/stateproviders/RandomizedIntStateProvider.java -index f4009671880b00ecec98fe604215e2824e453cdf..7b00301da0b3fb6429d04e4d10cafa30e168aa62 100644 +index 21cbf6c1723feb1813d8cd5106e36594d140d987..29fad81878fe6902328b810e1584650cfb65aba6 100644 --- a/net/minecraft/world/level/levelgen/feature/stateproviders/RandomizedIntStateProvider.java +++ b/net/minecraft/world/level/levelgen/feature/stateproviders/RandomizedIntStateProvider.java -@@ -54,18 +54,21 @@ public class RandomizedIntStateProvider extends BlockStateProvider { - } +@@ -55,17 +55,21 @@ public class RandomizedIntStateProvider extends BlockStateProvider { @Override -+ @SuppressWarnings("DataFlowIssue") public BlockState getState(RandomSource random, BlockPos pos) { - BlockState state = this.source.getState(random, pos); - if (this.property == null || !state.hasProperty(this.property)) { - IntegerProperty integerProperty = findProperty(state, this.propertyName); - if (integerProperty == null) { - return state; ++ // DivineMC start - Chunk System optimization + BlockState blockState = this.source.getState(random, pos); + IntegerProperty propertyLocal = this.property; + if (propertyLocal == null || !blockState.hasProperty(propertyLocal)) { @@ -2650,13 +2636,14 @@ index f4009671880b00ecec98fe604215e2824e453cdf..7b00301da0b3fb6429d04e4d10cafa30 + this.property = intProperty; } -- return state.setValue(this.property, Integer.valueOf(this.values.sample(random))); -+ return (BlockState)blockState.setValue(propertyLocal, this.values.sample(random)); +- return state.setValue(this.property, this.values.sample(random)); ++ return (BlockState) blockState.setValue(this.property, this.values.sample(random)); ++ // DivineMC end - Chunk System optimization } @Nullable diff --git a/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java b/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java -index d122221deefb218db962e97ba2d958c33d903b8a..56311b439ac22700593d2d31da3a4efe3a519d53 100644 +index e2036a80eff3dc1a9ec625880d4aab6ef71d84fa..6c5200a311a6c5a93a49999cc0c3a8b3f3ca8240 100644 --- a/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java +++ b/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java @@ -12,7 +12,7 @@ public abstract class ScatteredFeaturePiece extends StructurePiece { @@ -2669,10 +2656,10 @@ index d122221deefb218db962e97ba2d958c33d903b8a..56311b439ac22700593d2d31da3a4efe protected ScatteredFeaturePiece(StructurePieceType type, int x, int y, int z, int width, int height, int depth, Direction orientation) { super(type, 0, StructurePiece.makeBoundingBox(x, y, z, orientation, width, height, depth)); diff --git a/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/net/minecraft/world/level/levelgen/structure/StructureCheck.java -index f7dc4957b38878ddd3bfc7546be8a4e0af65c807..4023115e8120a6ccbc2a5bf7f2d17ffb2f808eb7 100644 +index 48fce0845fb023d6286dac144c285b048d778564..3e8e740f08614143f09c62f07bee7b305dd7929c 100644 --- a/net/minecraft/world/level/levelgen/structure/StructureCheck.java +++ b/net/minecraft/world/level/levelgen/structure/StructureCheck.java -@@ -46,6 +46,7 @@ public class StructureCheck { +@@ -47,6 +47,7 @@ public class StructureCheck { private final LevelHeightAccessor heightAccessor; private final BiomeSource biomeSource; private final long seed; @@ -2680,7 +2667,7 @@ index f7dc4957b38878ddd3bfc7546be8a4e0af65c807..4023115e8120a6ccbc2a5bf7f2d17ffb private final DataFixer fixerUpper; // Paper start - rewrite chunk system // make sure to purge entries from the maps to prevent memory leaks -@@ -235,15 +236,13 @@ public class StructureCheck { +@@ -229,15 +230,13 @@ public class StructureCheck { } private void storeFullResults(long chunkPos, Object2IntMap structureChunks) { @@ -2702,7 +2689,7 @@ index f7dc4957b38878ddd3bfc7546be8a4e0af65c807..4023115e8120a6ccbc2a5bf7f2d17ffb public void incrementReference(ChunkPos pos, Structure structure) { diff --git a/net/minecraft/world/level/levelgen/structure/StructureStart.java b/net/minecraft/world/level/levelgen/structure/StructureStart.java -index 4dafa79dd4ec55a443ba3731a79e7cd6e8052f48..8aeab4d773473ad20b1c64295c93d6fcb4ea02a1 100644 +index f9a15c3769f29af1952ef880f6fcd2612119ecf0..13f6654e06f87e9a9fbeba2217ee0e0eaa95347d 100644 --- a/net/minecraft/world/level/levelgen/structure/StructureStart.java +++ b/net/minecraft/world/level/levelgen/structure/StructureStart.java @@ -26,7 +26,7 @@ public final class StructureStart { @@ -2768,10 +2755,10 @@ index c84d865837e0f009fcde19e14a44fa43aefe660a..64d7adbd4aa398044a1d68d51e463b67 @Nullable private volatile StructureTemplatePool.Projection projection; diff --git a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java -index e8c125ddb335bfe81b8f1dbb91f7f7ccec11d980..4b6b18b3d255f6a72e6be3b85260732b8eab533c 100644 +index 0d2451a9ade43650dbbcbab69ce0f6e8f69b5aee..21b8e738c8823eac5d8fc8241dd8fb0e5ce82364 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java +++ b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java -@@ -23,29 +23,44 @@ import net.minecraft.world.level.storage.loot.BuiltInLootTables; +@@ -23,29 +23,45 @@ import net.minecraft.world.level.storage.loot.BuiltInLootTables; public class DesertPyramidPiece extends ScatteredFeaturePiece { public static final int WIDTH = 21; public static final int DEPTH = 21; @@ -2798,15 +2785,16 @@ index e8c125ddb335bfe81b8f1dbb91f7f7ccec11d980..4b6b18b3d255f6a72e6be3b85260732b public DesertPyramidPiece(CompoundTag tag) { super(StructurePieceType.DESERT_PYRAMID_PIECE, tag); -- this.hasPlacedChest[0] = tag.getBoolean("hasPlacedChest0"); -- this.hasPlacedChest[1] = tag.getBoolean("hasPlacedChest1"); -- this.hasPlacedChest[2] = tag.getBoolean("hasPlacedChest2"); -- this.hasPlacedChest[3] = tag.getBoolean("hasPlacedChest3"); +- this.hasPlacedChest[0] = tag.getBooleanOr("hasPlacedChest0", false); +- this.hasPlacedChest[1] = tag.getBooleanOr("hasPlacedChest1", false); +- this.hasPlacedChest[2] = tag.getBooleanOr("hasPlacedChest2", false); +- this.hasPlacedChest[3] = tag.getBooleanOr("hasPlacedChest3", false); + // DivineMC start - Chunk System Optimizations -+ this.hasPlacedChestAtomic.set(0, tag.getBoolean("hasPlacedChest0")); -+ this.hasPlacedChestAtomic.set(1, tag.getBoolean("hasPlacedChest1")); -+ this.hasPlacedChestAtomic.set(2, tag.getBoolean("hasPlacedChest2")); -+ this.hasPlacedChestAtomic.set(3, tag.getBoolean("hasPlacedChest3")); ++ this.hasPlacedChestAtomic.set(0, tag.getBooleanOr("hasPlacedChest0", false)); ++ this.hasPlacedChestAtomic.set(1, tag.getBooleanOr("hasPlacedChest1", false)); ++ this.hasPlacedChestAtomic.set(2, tag.getBooleanOr("hasPlacedChest2", false)); ++ this.hasPlacedChestAtomic.set(3, tag.getBooleanOr("hasPlacedChest3", false)); ++ init(); + // DivineMC end - Chunk System Optimizations } @@ -2826,7 +2814,7 @@ index e8c125ddb335bfe81b8f1dbb91f7f7ccec11d980..4b6b18b3d255f6a72e6be3b85260732b } @Override -@@ -287,12 +302,12 @@ public class DesertPyramidPiece extends ScatteredFeaturePiece { +@@ -287,12 +303,12 @@ public class DesertPyramidPiece extends ScatteredFeaturePiece { this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 10, -11, 13, box); for (Direction direction : Direction.Plane.HORIZONTAL) { @@ -2842,7 +2830,7 @@ index e8c125ddb335bfe81b8f1dbb91f7f7ccec11d980..4b6b18b3d255f6a72e6be3b85260732b } } -@@ -419,7 +434,7 @@ public class DesertPyramidPiece extends ScatteredFeaturePiece { +@@ -419,7 +435,7 @@ public class DesertPyramidPiece extends ScatteredFeaturePiece { this.randomCollapsedRoofPos = new BlockPos(this.getWorldX(i1, randomInt), this.getWorldY(y), this.getWorldZ(i1, randomInt)); } @@ -2852,7 +2840,7 @@ index e8c125ddb335bfe81b8f1dbb91f7f7ccec11d980..4b6b18b3d255f6a72e6be3b85260732b } diff --git a/net/minecraft/world/level/levelgen/structure/structures/JungleTemplePiece.java b/net/minecraft/world/level/levelgen/structure/structures/JungleTemplePiece.java -index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793ad612fbc6 100644 +index d28f1a25e2137955402e41679d1a4220a0136579..d751eac6d7a97b8de44c83c35ff7d3e36ca3b066 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/JungleTemplePiece.java +++ b/net/minecraft/world/level/levelgen/structure/structures/JungleTemplePiece.java @@ -30,10 +30,12 @@ import net.minecraft.world.level.storage.loot.BuiltInLootTables; @@ -2876,15 +2864,15 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a public JungleTemplePiece(CompoundTag tag) { super(StructurePieceType.JUNGLE_PYRAMID_PIECE, tag); -- this.placedMainChest = tag.getBoolean("placedMainChest"); -- this.placedHiddenChest = tag.getBoolean("placedHiddenChest"); -- this.placedTrap1 = tag.getBoolean("placedTrap1"); -- this.placedTrap2 = tag.getBoolean("placedTrap2"); +- this.placedMainChest = tag.getBooleanOr("placedMainChest", false); +- this.placedHiddenChest = tag.getBooleanOr("placedHiddenChest", false); +- this.placedTrap1 = tag.getBooleanOr("placedTrap1", false); +- this.placedTrap2 = tag.getBooleanOr("placedTrap2", false); + // DivineMC start - Chunk System Optimizations -+ this.placedMainChest.set(tag.getBoolean("placedMainChest")); -+ this.placedHiddenChest.set(tag.getBoolean("placedHiddenChest")); -+ this.placedTrap1.set(tag.getBoolean("placedTrap1")); -+ this.placedTrap2.set(tag.getBoolean("placedTrap2")); ++ this.placedMainChest.set(tag.getBooleanOr("placedMainChest", false)); ++ this.placedHiddenChest.set(tag.getBooleanOr("placedHiddenChest", false)); ++ this.placedTrap1.set(tag.getBooleanOr("placedTrap1", false)); ++ this.placedTrap2.set(tag.getBooleanOr("placedTrap2", false)); + // DivineMC end - Chunk System Optimizations } @@ -2904,7 +2892,7 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a } @Override -@@ -242,8 +248,8 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { +@@ -236,8 +242,8 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { box ); this.placeBlock(level, Blocks.MOSSY_COBBLESTONE.defaultBlockState(), 3, -3, 1, box); @@ -2914,8 +2902,8 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a + this.placedTrap1.set(this.createDispenser(level, box, random, 3, -2, 1, Direction.NORTH, BuiltInLootTables.JUNGLE_TEMPLE_DISPENSER)); // DivineMC - Chunk System Optimizations } - this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.SOUTH, Boolean.valueOf(true)), 3, -2, 2, box); -@@ -340,14 +346,14 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { + this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.SOUTH, true), 3, -2, 2, box); +@@ -328,14 +334,14 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { ); this.placeBlock(level, Blocks.MOSSY_COBBLESTONE.defaultBlockState(), 9, -3, 4, box); this.placeBlock(level, blockState4, 9, -2, 4, box); @@ -2925,8 +2913,8 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a + this.placedTrap2.set(this.createDispenser(level, box, random, 9, -2, 3, Direction.WEST, BuiltInLootTables.JUNGLE_TEMPLE_DISPENSER)); // DivineMC - Chunk System Optimizations } - this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.EAST, Boolean.valueOf(true)), 8, -1, 3, box); - this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.EAST, Boolean.valueOf(true)), 8, -2, 3, box); + this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.EAST, true), 8, -1, 3, box); + this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.EAST, true), 8, -2, 3, box); - if (!this.placedMainChest) { - this.placedMainChest = this.createChest(level, box, random, 8, -3, 3, BuiltInLootTables.JUNGLE_TEMPLE); + if (!this.placedMainChest.get()) { // DivineMC - Chunk System Optimizations @@ -2934,7 +2922,7 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a } this.placeBlock(level, Blocks.MOSSY_COBBLESTONE.defaultBlockState(), 9, -3, 2, box); -@@ -390,8 +396,8 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { +@@ -378,8 +384,8 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { this.placeBlock(level, Blocks.STICKY_PISTON.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.WEST), 10, -2, 8, box); this.placeBlock(level, Blocks.STICKY_PISTON.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.WEST), 10, -1, 8, box); this.placeBlock(level, Blocks.REPEATER.defaultBlockState().setValue(RepeaterBlock.FACING, Direction.NORTH), 10, -2, 10, box); @@ -2946,10 +2934,10 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a } } diff --git a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java -index 1acd506f7c0679fa9f69b6ab221002b28d00c3e5..52237559477e1965cb13a94ee4e6b4ff2ee99b03 100644 +index 53d3bf1d2a1debe46e276b1db25b420be4ad9958..5212e4a4392efa0171c9d709dc2606a4e14df07f 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java -@@ -95,7 +95,7 @@ public class MineshaftPieces { +@@ -91,7 +91,7 @@ public class MineshaftPieces { public static class MineShaftCorridor extends MineshaftPieces.MineShaftPiece { private final boolean hasRails; private final boolean spiderCorridor; @@ -2958,7 +2946,7 @@ index 1acd506f7c0679fa9f69b6ab221002b28d00c3e5..52237559477e1965cb13a94ee4e6b4ff private final int numSections; public MineShaftCorridor(CompoundTag tag) { -@@ -954,7 +954,7 @@ public class MineshaftPieces { +@@ -950,7 +950,7 @@ public class MineshaftPieces { } public static class MineShaftRoom extends MineshaftPieces.MineShaftPiece { @@ -2968,10 +2956,10 @@ index 1acd506f7c0679fa9f69b6ab221002b28d00c3e5..52237559477e1965cb13a94ee4e6b4ff public MineShaftRoom(int genDepth, RandomSource random, int x, int z, MineshaftStructure.Type type) { super( diff --git a/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java b/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java -index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa44642f417 100644 +index ae4ffcf1859e8ff7f8fbc91246e66e20f5c33dd7..b9124999f1aede4450f25e25c55bca96077670e8 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java -@@ -1301,7 +1301,7 @@ public class NetherFortressPieces { +@@ -1112,7 +1112,7 @@ public class NetherFortressPieces { int i = 0; for (NetherFortressPieces.PieceWeight pieceWeight : weights) { @@ -2980,7 +2968,7 @@ index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa4 flag = true; } -@@ -1341,7 +1341,7 @@ public class NetherFortressPieces { +@@ -1152,7 +1152,7 @@ public class NetherFortressPieces { pieceWeight, pieces, random, x, y, z, orientation, genDepth ); if (netherBridgePiece != null) { @@ -2989,7 +2977,7 @@ index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa4 startPiece.previousPiece = pieceWeight; if (!pieceWeight.isValid()) { weights.remove(pieceWeight); -@@ -1576,7 +1576,7 @@ public class NetherFortressPieces { +@@ -1387,7 +1387,7 @@ public class NetherFortressPieces { static class PieceWeight { public final Class pieceClass; public final int weight; @@ -2998,7 +2986,7 @@ index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa4 public final int maxPlaceCount; public final boolean allowInRow; -@@ -1592,11 +1592,11 @@ public class NetherFortressPieces { +@@ -1403,11 +1403,11 @@ public class NetherFortressPieces { } public boolean doPlace(int genDepth) { @@ -3012,7 +3000,7 @@ index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa4 } } -@@ -1746,24 +1746,24 @@ public class NetherFortressPieces { +@@ -1545,24 +1545,24 @@ public class NetherFortressPieces { } public static class StartPiece extends NetherFortressPieces.BridgeCrossing { @@ -3043,10 +3031,10 @@ index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa4 } } diff --git a/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java b/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java -index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f19819dfd 100644 +index 1f1ee6e2d020cd06184313d19523ea928cf242c8..ab6d51b60cdbaed7ac7395d2a27eadd6d6b4518f 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java -@@ -63,32 +63,36 @@ public class StrongholdPieces { +@@ -65,32 +65,36 @@ public class StrongholdPieces { } } }; @@ -3094,7 +3082,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f } return flag; -@@ -138,9 +142,11 @@ public class StrongholdPieces { +@@ -140,9 +144,11 @@ public class StrongholdPieces { if (!updatePieceWeight()) { return null; } else { @@ -3109,7 +3097,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f if (strongholdPiece != null) { return strongholdPiece; } -@@ -150,9 +156,9 @@ public class StrongholdPieces { +@@ -152,9 +158,9 @@ public class StrongholdPieces { while (i < 5) { i++; @@ -3121,7 +3109,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f randomInt -= pieceWeight.weight; if (randomInt < 0) { if (!pieceWeight.doPlace(genDepth) || pieceWeight == piece.previousPiece) { -@@ -163,10 +169,10 @@ public class StrongholdPieces { +@@ -165,10 +171,10 @@ public class StrongholdPieces { pieceWeight.pieceClass, pieces, random, x, y, z, direction, genDepth ); if (strongholdPiece1 != null) { @@ -3134,7 +3122,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f } return strongholdPiece1; -@@ -202,7 +208,7 @@ public class StrongholdPieces { +@@ -204,7 +210,7 @@ public class StrongholdPieces { private static final int WIDTH = 5; private static final int HEIGHT = 5; private static final int DEPTH = 7; @@ -3143,7 +3131,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f public ChestCorridor(int genDepth, RandomSource random, BoundingBox box, Direction orientation) { super(StructurePieceType.STRONGHOLD_CHEST_CORRIDOR, genDepth, box); -@@ -723,7 +729,7 @@ public class StrongholdPieces { +@@ -690,7 +696,7 @@ public class StrongholdPieces { static class PieceWeight { public final Class pieceClass; public final int weight; @@ -3152,7 +3140,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f public final int maxPlaceCount; public PieceWeight(Class pieceClass, int weight, int maxPlaceCount) { -@@ -733,11 +739,11 @@ public class StrongholdPieces { +@@ -700,11 +706,11 @@ public class StrongholdPieces { } public boolean doPlace(int genDepth) { @@ -3166,7 +3154,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f } } -@@ -745,7 +751,7 @@ public class StrongholdPieces { +@@ -712,7 +718,7 @@ public class StrongholdPieces { protected static final int WIDTH = 11; protected static final int HEIGHT = 8; protected static final int DEPTH = 16; @@ -3175,7 +3163,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f public PortalRoom(int genDepth, BoundingBox box, Direction orientation) { super(StructurePieceType.STRONGHOLD_PORTAL_ROOM, genDepth, box); -@@ -1273,7 +1279,7 @@ public class StrongholdPieces { +@@ -1174,7 +1180,7 @@ public class StrongholdPieces { @Override public void addChildren(StructurePiece piece, StructurePieceAccessor pieces, RandomSource random) { if (this.isSource) { @@ -3184,7 +3172,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f } this.generateSmallDoorChildForward((StrongholdPieces.StartPiece)piece, pieces, random, 1, 1); -@@ -1322,10 +1328,10 @@ public class StrongholdPieces { +@@ -1223,10 +1229,10 @@ public class StrongholdPieces { } public static class StartPiece extends StrongholdPieces.StairsDown { @@ -3199,7 +3187,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f public StartPiece(RandomSource random, int x, int z) { super(StructurePieceType.STRONGHOLD_START, 0, x, z, getRandomHorizontalDirection(random)); diff --git a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java -index 6c5b6ba8973c88e959d57fec38abcef5f097e9b3..ad44f4915e7a9609445b62664d2a47581de8c169 100644 +index 081fe9509b777bd1f853b662ca8b01c64f27b5e5..9a3d1ed95d201d24374ff15c7a8daa30bc25f777 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java @@ -126,7 +126,7 @@ public class WoodlandMansionPieces { @@ -3261,10 +3249,10 @@ index 05027cc20d174d78bef118cd2ba545ac56e1559c..32bbfe48dee44b0b491aa369dec59cbf private boolean finalizeEntities; diff --git a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -index ab1dcbe416e2c3c94cfddf04b7ed053425a71806..a37eb2e29b4577ebc711e8ef7b47fbbc3bc66897 100644 +index bb8b5ca9044ecb33687e7f20cfb0acbf55f887c7..df3a1b9ed4ad836bd3358b6b440964e497213ea3 100644 --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -71,8 +71,8 @@ public class StructureTemplate { +@@ -69,8 +69,8 @@ public class StructureTemplate { public static final String ENTITY_TAG_BLOCKPOS = "blockPos"; public static final String ENTITY_TAG_NBT = "nbt"; public static final String SIZE_TAG = "size"; @@ -3276,11 +3264,11 @@ index ab1dcbe416e2c3c94cfddf04b7ed053425a71806..a37eb2e29b4577ebc711e8ef7b47fbbc private String author = "?"; // CraftBukkit start - data containers diff --git a/net/minecraft/world/ticks/LevelChunkTicks.java b/net/minecraft/world/ticks/LevelChunkTicks.java -index faf45ac459f7c25309d6ef6dce371d484a0dae7b..0e862e9c0d9d562e77ce02a35deb761c28fa2f90 100644 +index 66d0a6390febe929ef774b0a7813329015bc8cc2..d1917dee4ca6bba5f2c92475811c724caf2948cb 100644 --- a/net/minecraft/world/ticks/LevelChunkTicks.java +++ b/net/minecraft/world/ticks/LevelChunkTicks.java -@@ -18,10 +18,10 @@ import net.minecraft.nbt.ListTag; - import net.minecraft.world.level.ChunkPos; +@@ -14,10 +14,10 @@ import javax.annotation.Nullable; + import net.minecraft.core.BlockPos; public class LevelChunkTicks implements SerializableTickContainer, TickContainerAccess, ca.spottedleaf.moonrise.patches.chunk_system.ticks.ChunkSystemLevelChunkTicks { // Paper - rewrite chunk system - private final Queue> tickQueue = new PriorityQueue<>(ScheduledTick.DRAIN_ORDER); @@ -3292,7 +3280,7 @@ index faf45ac459f7c25309d6ef6dce371d484a0dae7b..0e862e9c0d9d562e77ce02a35deb761c @Nullable private BiConsumer, ScheduledTick> onTickAdded; -@@ -71,10 +71,18 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon +@@ -67,10 +67,18 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon @Nullable public ScheduledTick poll() { @@ -3314,7 +3302,7 @@ index faf45ac459f7c25309d6ef6dce371d484a0dae7b..0e862e9c0d9d562e77ce02a35deb761c return scheduledTick; } -@@ -87,6 +95,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon +@@ -83,6 +91,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon } private void scheduleUnchecked(ScheduledTick tick) { @@ -3322,7 +3310,7 @@ index faf45ac459f7c25309d6ef6dce371d484a0dae7b..0e862e9c0d9d562e77ce02a35deb761c this.tickQueue.add(tick); if (this.onTickAdded != null) { this.onTickAdded.accept(this, tick); -@@ -127,6 +136,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon +@@ -124,6 +133,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon } for (ScheduledTick scheduledTick : this.tickQueue) { diff --git a/patches/unapplied/server/minecraft-patches/features/0011-Optimize-Fluids.patch b/divinemc-server/minecraft-patches/features/0010-Optimize-Fluids.patch similarity index 92% rename from patches/unapplied/server/minecraft-patches/features/0011-Optimize-Fluids.patch rename to divinemc-server/minecraft-patches/features/0010-Optimize-Fluids.patch index 9cb6893..f9ac231 100644 --- a/patches/unapplied/server/minecraft-patches/features/0011-Optimize-Fluids.patch +++ b/divinemc-server/minecraft-patches/features/0010-Optimize-Fluids.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Optimize Fluids diff --git a/net/minecraft/world/level/block/LiquidBlock.java b/net/minecraft/world/level/block/LiquidBlock.java -index 47a7ce88bf4d26408545dcc061aa763311af0dc9..13877d2bd4289652a9627780839b8d879a66d753 100644 +index ae609e0603a78423c4c89b7efb9c41ab8fe7aa52..5c143e3227371c701f36362e24bd3c1fc8061ed2 100644 --- a/net/minecraft/world/level/block/LiquidBlock.java +++ b/net/minecraft/world/level/block/LiquidBlock.java @@ -193,6 +193,7 @@ public class LiquidBlock extends Block implements BucketPickup { Block block = level.getFluidState(pos).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; // CraftBukkit start - if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, block.defaultBlockState())) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, block.defaultBlockState(), 3)) { + level.setBlock(pos, block.defaultBlockState(), 3); // DivineMC - Optimize Fluids this.fizz(level, pos); } // CraftBukkit end diff --git a/net/minecraft/world/level/material/FlowingFluid.java b/net/minecraft/world/level/material/FlowingFluid.java -index 44bc0823e163bb7edee27889201ec76e93e095cf..974e1e5dcb2613c5aaedd3f2f66483c9dcd6cd23 100644 +index 1b06e44a267d2d4af844997ac0c557f30aaf9b15..fa4570dbeba4acad4da6442faebed2401fafe59d 100644 --- a/net/minecraft/world/level/material/FlowingFluid.java +++ b/net/minecraft/world/level/material/FlowingFluid.java @@ -199,6 +199,7 @@ public abstract class FlowingFluid extends Fluid { @@ -68,8 +68,8 @@ index 44bc0823e163bb7edee27889201ec76e93e095cf..974e1e5dcb2613c5aaedd3f2f66483c9 protected FluidState getNewLiquid(ServerLevel level, BlockPos pos, BlockState state) { int i = 0; int i1 = 0; -@@ -341,33 +375,46 @@ public abstract class FlowingFluid extends Fluid { - protected void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, BlockState state, BlockPos source) { beforeDestroyingBlock(level, pos, state); } // Paper - Add BlockBreakBlockEvent +@@ -342,33 +376,46 @@ public abstract class FlowingFluid extends Fluid { + protected abstract void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, BlockState state); + // DivineMC start - Optimize Fluids @@ -132,10 +132,10 @@ index 44bc0823e163bb7edee27889201ec76e93e095cf..974e1e5dcb2613c5aaedd3f2f66483c9 return canPassThroughWall(Direction.DOWN, level, pos, state, belowPos, belowState) && (belowState.getFluidState().getType().isSame(this) || canHoldFluid(level, belowPos, belowState, this.getFlowing())); diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java -index 85629a43f5469a89dd6078d879f475e8212438ec..35b5a33c79c883f28c99c992695b188524593b55 100644 +index 43cdc2f8fdfdeb1426e386e0084087779ef62754..e7ae29a4da3bf36b99fdab39af78f03c06696dbc 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java -@@ -224,6 +224,7 @@ public abstract class LavaFluid extends FlowingFluid { +@@ -236,6 +236,7 @@ public abstract class LavaFluid extends FlowingFluid { // CraftBukkit end } diff --git a/patches/unapplied/server/minecraft-patches/features/0012-Optimize-entity-stupid-brain.patch b/divinemc-server/minecraft-patches/features/0011-Optimize-entity-stupid-brain.patch similarity index 95% rename from patches/unapplied/server/minecraft-patches/features/0012-Optimize-entity-stupid-brain.patch rename to divinemc-server/minecraft-patches/features/0011-Optimize-entity-stupid-brain.patch index 25943dd..f3cddb3 100644 --- a/patches/unapplied/server/minecraft-patches/features/0012-Optimize-entity-stupid-brain.patch +++ b/divinemc-server/minecraft-patches/features/0011-Optimize-entity-stupid-brain.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize entity stupid brain diff --git a/net/minecraft/world/entity/AgeableMob.java b/net/minecraft/world/entity/AgeableMob.java -index 179f4e4b9b1eb57f78bbb2f9fa34b11ea79b7a88..143a4ca51a57934bf545e031b10525dedbe9c3bd 100644 +index 201c6d6e2f5799a7678b16f01c85508bc72e8af5..caa829739e002f28e5c9072fa573efa34da80d4c 100644 --- a/net/minecraft/world/entity/AgeableMob.java +++ b/net/minecraft/world/entity/AgeableMob.java -@@ -121,6 +121,16 @@ public abstract class AgeableMob extends PathfinderMob { +@@ -124,6 +124,16 @@ public abstract class AgeableMob extends PathfinderMob { public void onSyncedDataUpdated(EntityDataAccessor key) { if (DATA_BABY_ID.equals(key)) { this.refreshDimensions(); @@ -26,7 +26,7 @@ index 179f4e4b9b1eb57f78bbb2f9fa34b11ea79b7a88..143a4ca51a57934bf545e031b10525de super.onSyncedDataUpdated(key); diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java -index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc25c6f68b6 100644 +index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca387289be7c 100644 --- a/net/minecraft/world/entity/ai/Brain.java +++ b/net/minecraft/world/entity/ai/Brain.java @@ -45,16 +45,73 @@ public class Brain { @@ -196,7 +196,7 @@ index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc2 } } -@@ -374,11 +444,13 @@ public class Brain { +@@ -383,11 +453,13 @@ public class Brain { .computeIfAbsent(activity, activity1 -> Sets.newLinkedHashSet()) .add((BehaviorControl)pair.getSecond()); } @@ -210,7 +210,7 @@ index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc2 } public boolean isActive(Activity activity) { -@@ -395,6 +467,7 @@ public class Brain { +@@ -404,6 +476,7 @@ public class Brain { } } @@ -218,7 +218,7 @@ index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc2 return brain; } -@@ -429,31 +502,38 @@ public class Brain { +@@ -438,31 +511,38 @@ public class Brain { for (BehaviorControl behaviorControl : this.getRunningBehaviors()) { behaviorControl.doStop(level, owner, gameTime); @@ -327,10 +327,10 @@ index 5b0cadd2544fb2a627822e645ff32fec2e9cfda9..253b9ad671cf0932bb17d468f8b91a15 public static enum Status { STOPPED, diff --git a/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java b/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java -index ec90ea4e66c6c38d7ad41805a16c63e006e44be4..0204fe68c97d152a7c3201620b6709a8bebefdf6 100644 +index 977afa268838304abdb34be253ca36ac1c22e99f..55a20253d139bc997d2b5d0c0d928fe67df2da32 100644 --- a/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java +++ b/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java -@@ -120,6 +120,12 @@ public class LongJumpToRandomPos extends Behavior { +@@ -119,6 +119,12 @@ public class LongJumpToRandomPos extends Behavior { int x = blockPos.getX(); int y = blockPos.getY(); int z = blockPos.getZ(); @@ -343,13 +343,15 @@ index ec90ea4e66c6c38d7ad41805a16c63e006e44be4..0204fe68c97d152a7c3201620b6709a8 this.jumpCandidates = BlockPos.betweenClosedStream( x - this.maxLongJumpWidth, y - this.maxLongJumpHeight, -@@ -175,11 +181,27 @@ public class LongJumpToRandomPos extends Behavior { +@@ -174,12 +180,25 @@ public class LongJumpToRandomPos extends Behavior { } } + // DivineMC start - Optimize entity stupid brain protected Optional getJumpCandidate(ServerLevel level) { -- Optional randomItem = WeightedRandom.getRandomItem(level.random, this.jumpCandidates); +- Optional randomItem = WeightedRandom.getRandomItem( +- level.random, this.jumpCandidates, LongJumpToRandomPos.PossibleJump::weight +- ); - randomItem.ifPresent(this.jumpCandidates::remove); - return randomItem; + Optional optional = getRandomFast(level.random, this.jumpCandidates); @@ -361,7 +363,7 @@ index ec90ea4e66c6c38d7ad41805a16c63e006e44be4..0204fe68c97d152a7c3201620b6709a8 + if (pool instanceof org.bxteam.divinemc.util.collections.LongJumpChoiceList longJumpChoiceList) { + return Optional.ofNullable(longJumpChoiceList.removeRandomWeightedByDistanceSq(random)); + } else { -+ return WeightedRandom.getRandomItem(random, pool); ++ return WeightedRandom.getRandomItem(random, pool, LongJumpToRandomPos.PossibleJump::weight); + } + } + @@ -370,10 +372,8 @@ index ec90ea4e66c6c38d7ad41805a16c63e006e44be4..0204fe68c97d152a7c3201620b6709a8 + result.ifPresent(removeAction); + } } -+ // DivineMC end - Optimize entity stupid brain private boolean isAcceptableLandingPosition(ServerLevel level, E entity, BlockPos pos) { - BlockPos blockPos = entity.blockPosition(); diff --git a/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java b/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java index 24d1928445b5571e040a2b12d5c82e77a880d9bd..dac0a23aebf2dea1972c07d5c82079da7c9837ac 100644 --- a/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java @@ -403,10 +403,10 @@ index 24d1928445b5571e040a2b12d5c82e77a880d9bd..dac0a23aebf2dea1972c07d5c82079da private boolean isVillagerBaby(LivingEntity livingEntity) { return livingEntity.getType() == EntityType.VILLAGER && livingEntity.isBaby(); diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java -index 9b8f5d9926d68fd8b9f1f976e0be0975158cafc3..e21f024d0ed7f936ff17df16bd9666fffbf44a75 100644 +index 6029051a7bade2eb412d7ec4957a4361e7e575b1..01e1712854aaebc59db844045141b25561df8fc3 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java -@@ -96,6 +96,13 @@ public class Goat extends Animal { +@@ -99,6 +99,13 @@ public class Goat extends Animal { this.getNavigation().setCanFloat(true); this.setPathfindingMalus(PathType.POWDER_SNOW, -1.0F); this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F); diff --git a/patches/unapplied/server/minecraft-patches/features/0014-Optimize-explosions.patch b/divinemc-server/minecraft-patches/features/0012-Optimize-explosions.patch similarity index 96% rename from patches/unapplied/server/minecraft-patches/features/0014-Optimize-explosions.patch rename to divinemc-server/minecraft-patches/features/0012-Optimize-explosions.patch index 51ff3d9..adc4bf8 100644 --- a/patches/unapplied/server/minecraft-patches/features/0014-Optimize-explosions.patch +++ b/divinemc-server/minecraft-patches/features/0012-Optimize-explosions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize explosions diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 6bddf42504039f2be5eb9a5a35a0835e0e3239fe..ea6da35e6c38a0b8b67d0b7a1426445eadfb540c 100644 +index a772f2bd7be00172ad41353c6ad42d9239b9ec88..4fcbf5181e9e8053302ae9b75a6d76aa6698a21b 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java -@@ -375,6 +375,11 @@ public class ServerExplosion implements Explosion { +@@ -372,6 +372,11 @@ public class ServerExplosion implements Explosion { } private List calculateExplodedPositions() { @@ -20,7 +20,7 @@ index 6bddf42504039f2be5eb9a5a35a0835e0e3239fe..ea6da35e6c38a0b8b67d0b7a1426445e // Paper start - collision optimisations final ObjectArrayList ret = new ObjectArrayList<>(); -@@ -473,6 +478,157 @@ public class ServerExplosion implements Explosion { +@@ -470,6 +475,157 @@ public class ServerExplosion implements Explosion { // Paper end - collision optimisations } @@ -178,7 +178,7 @@ index 6bddf42504039f2be5eb9a5a35a0835e0e3239fe..ea6da35e6c38a0b8b67d0b7a1426445e private void hurtEntities() { float f = this.radius * 2.0F; int floor = Mth.floor(this.center.x - f - 1.0); -@@ -565,6 +721,11 @@ public class ServerExplosion implements Explosion { +@@ -559,6 +715,11 @@ public class ServerExplosion implements Explosion { } private void interactWithBlocks(List blocks) { diff --git a/divinemc-server/minecraft-patches/features/0013-Option-to-allow-weird-movement-and-disable-teleporti.patch b/divinemc-server/minecraft-patches/features/0013-Option-to-allow-weird-movement-and-disable-teleporti.patch new file mode 100644 index 0000000..f0e3afa --- /dev/null +++ b/divinemc-server/minecraft-patches/features/0013-Option-to-allow-weird-movement-and-disable-teleporti.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Sat, 1 Feb 2025 18:03:13 +0300 +Subject: [PATCH] Option to allow weird movement and disable teleporting + players when they move too quickly + + +diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index b05657f763bbdbc9268c83d78c2da62b97d095e2..a271b76224246f04ad9396a3b3be40f5f7302965 100644 +--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -566,7 +566,7 @@ public class ServerGamePacketListenerImpl + return; + } + // Paper end - Prevent moving into unloaded chunks +- if (d7 - d6 > Math.max(100.0, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed)) && !this.isSingleplayerOwner()) { ++ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && (d7 - d6 > Math.max(100.0, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed)) && !this.isSingleplayerOwner())) { // DivineMC - stop weird movement + // CraftBukkit end + LOGGER.warn( + "{} (vehicle of {}) moved too quickly! {},{},{}", rootVehicle.getName().getString(), this.player.getName().getString(), d3, d4, d5 +@@ -596,7 +596,7 @@ public class ServerGamePacketListenerImpl + d5 = d2 - rootVehicle.getZ(); + d7 = d3 * d3 + d4 * d4 + d5 * d5; + boolean flag2 = false; +- if (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot ++ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold)) { // Spigot // DivineMC - stop weird movement + flag2 = true; // Paper - diff on change, this should be moved wrongly + LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getName().getString(), this.player.getName().getString(), Math.sqrt(d7)); + } +@@ -1510,20 +1510,24 @@ public class ServerGamePacketListenerImpl + if (this.shouldCheckPlayerMovement(isFallFlying)) { + float f2 = isFallFlying ? 300.0F : 100.0F; + if (d7 - d6 > Math.max(f2, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed))) { +- // CraftBukkit end +- // Paper start - Add fail move event +- io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY, ++ // DivineMC start - Stop teleporting players when they move too quickly ++ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && !(org.bxteam.divinemc.DivineConfig.ignoreMovedTooQuicklyWhenLagging && player.serverLevel().getServer().lagging)) { ++ // CraftBukkit end ++ // Paper start - Add fail move event ++ io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY, + toX, toY, toZ, toYaw, toPitch, true); +- if (!event.isAllowed()) { +- if (event.getLogWarning()) { +- LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5); +- } +- this.teleport( ++ if (!event.isAllowed()) { ++ if (event.getLogWarning()) { ++ LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5); ++ } ++ this.teleport( + this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot() +- ); +- return; ++ ); ++ return; ++ } ++ // Paper end - Add fail move event + } +- // Paper end - Add fail move event ++ // DivineMC end - Stop teleporting players when they move too quickly + } + } + } +@@ -1584,6 +1588,7 @@ public class ServerGamePacketListenerImpl + d7 = d3 * d3 + d4 * d4 + d5 * d5; + boolean movedWrongly = false; // Paper - Add fail move event; rename + if (!this.player.isChangingDimension() ++ && !org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement // DivineMC - Stop teleporting players when they move too quickly + && d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold // Spigot + && !this.player.isSleeping() + && !this.player.isCreative() diff --git a/patches/unapplied/server/minecraft-patches/features/0016-Lag-compensation.patch b/divinemc-server/minecraft-patches/features/0014-Lag-compensation.patch similarity index 83% rename from patches/unapplied/server/minecraft-patches/features/0016-Lag-compensation.patch rename to divinemc-server/minecraft-patches/features/0014-Lag-compensation.patch index b19fcea..af6b681 100644 --- a/patches/unapplied/server/minecraft-patches/features/0016-Lag-compensation.patch +++ b/divinemc-server/minecraft-patches/features/0014-Lag-compensation.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Lag compensation diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 5a726da8535aa939f043829a3c60fdd9d4ed154a..0aebdd1cb0e1b63ff9a867bdcda7cbdc3c194b56 100644 +index eb9b9473417a107092b05a9baf467410db32dc49..63ebc5549aafeb3a97ba6c7a8f52460d019d079c 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -289,6 +289,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system -@@ -1558,6 +1559,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop atomicReference = new AtomicReference<>(); +@@ -1543,6 +1544,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop key) { @@ -216,10 +220,10 @@ index 02d64a5ea756b2c91a71b7a0fc0f21219983616a..d515ba4e775e1199e1cbf4f79978d318 public static class BooleanValue extends GameRules.Value { private boolean value; diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java -index b631e35e965b1914cdeeddab8bd6bdbfd2465079..bb7dab597850fba8f0dff4461fc518e0a33b00c7 100644 +index 8db95b74f88f8096de93115ae8d3fb2e6184ad3b..8c0abcbf1af03092b54d2e4bdad8ac152c2431e6 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -346,13 +346,21 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -347,13 +347,21 @@ public abstract class BlockBehaviour implements FeatureElement { protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { } @@ -244,10 +248,10 @@ index b631e35e965b1914cdeeddab8bd6bdbfd2465079..bb7dab597850fba8f0dff4461fc518e0 } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index b245f594ff91e2d29c83f56b9ed5165f37387e7e..534384727e852dc8ea822f49f182af49eb3a40c1 100644 +index 04942e23dd2bc82e4c60110756beedb5e0f074d7..7eb6da13dc47eaeac6e70d4e2935c1cc022c6400 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -907,6 +907,19 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -910,6 +910,19 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p this.ticker = ticker; } @@ -267,7 +271,7 @@ index b245f594ff91e2d29c83f56b9ed5165f37387e7e..534384727e852dc8ea822f49f182af49 @Override public void tick() { if (!this.blockEntity.isRemoved() && this.blockEntity.hasLevel()) { -@@ -915,7 +928,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -918,7 +931,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p try { BlockState blockState = LevelChunk.this.getBlockState(blockPos); if (this.blockEntity.getType().isValid(blockState)) { @@ -281,10 +285,10 @@ index b245f594ff91e2d29c83f56b9ed5165f37387e7e..534384727e852dc8ea822f49f182af49 // Paper start - Remove the Block Entity if it's invalid } else { diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java -index 35b5a33c79c883f28c99c992695b188524593b55..6845a1c3b6038700751312d8beb0f9a2844003a5 100644 +index e7ae29a4da3bf36b99fdab39af78f03c06696dbc..e57c04df4cb5955713d61d8237094041d3f3ca4f 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java -@@ -175,9 +175,22 @@ public abstract class LavaFluid extends FlowingFluid { +@@ -187,9 +187,22 @@ public abstract class LavaFluid extends FlowingFluid { return fluidState.getHeight(blockReader, pos) >= 0.44444445F && fluid.is(FluidTags.WATER); } @@ -309,10 +313,10 @@ index 35b5a33c79c883f28c99c992695b188524593b55..6845a1c3b6038700751312d8beb0f9a2 @Override diff --git a/net/minecraft/world/level/material/WaterFluid.java b/net/minecraft/world/level/material/WaterFluid.java -index 2e4fed7c27910b6c886f710f33b0841c2a175837..89f22ebcbaf21df3afb6a00f60d8e00777875aac 100644 +index b248fe1d66940c05d56fc322df61c52ece72e77f..8fa7883a0fe5fc2651d640ecde20198293afa654 100644 --- a/net/minecraft/world/level/material/WaterFluid.java +++ b/net/minecraft/world/level/material/WaterFluid.java -@@ -113,8 +113,16 @@ public abstract class WaterFluid extends FlowingFluid { +@@ -124,8 +124,16 @@ public abstract class WaterFluid extends FlowingFluid { return 1; } diff --git a/patches/unapplied/server/minecraft-patches/features/0018-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch b/divinemc-server/minecraft-patches/features/0015-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch similarity index 85% rename from patches/unapplied/server/minecraft-patches/features/0018-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch rename to divinemc-server/minecraft-patches/features/0015-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch index 553afe2..becae5b 100644 --- a/patches/unapplied/server/minecraft-patches/features/0018-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch +++ b/divinemc-server/minecraft-patches/features/0015-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch @@ -6,18 +6,18 @@ Subject: [PATCH] Skip EntityScheduler's executeTick checks if there isn't any diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index df07a4a62bd518f3a13995a3ccc7970c714bad7b..851f943cddad03ae12e1ed85f64072682447a367 100644 +index 63ebc5549aafeb3a97ba6c7a8f52460d019d079c..28641e7672c0cf79d3400da36ea3ee3d9f04898e 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -290,6 +290,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // DivineMC - Skip EntityScheduler's executeTick checks if there isn't any tasks to be run public static S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system -@@ -1706,17 +1707,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop atomicReference = new AtomicReference<>(); +@@ -1671,17 +1672,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop imp diff --git a/patches/unapplied/server/minecraft-patches/features/0020-Snowball-and-Egg-knockback.patch b/divinemc-server/minecraft-patches/features/0017-Snowball-and-Egg-knockback.patch similarity index 90% rename from patches/unapplied/server/minecraft-patches/features/0020-Snowball-and-Egg-knockback.patch rename to divinemc-server/minecraft-patches/features/0017-Snowball-and-Egg-knockback.patch index 22cdda0..0606edb 100644 --- a/patches/unapplied/server/minecraft-patches/features/0020-Snowball-and-Egg-knockback.patch +++ b/divinemc-server/minecraft-patches/features/0017-Snowball-and-Egg-knockback.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Snowball and Egg knockback diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java -index 1d399532c67c213c95c06837b0c7855384f1a25c..cad1f8cb68ef9615587e651a3120f68a3c32add0 100644 +index d8f9fb603fd2e3e5c1dfc05face7f42b4844daf4..86e75722b37eaa02858fa4313d8bcc2a72c0f7f6 100644 --- a/net/minecraft/world/entity/projectile/Snowball.java +++ b/net/minecraft/world/entity/projectile/Snowball.java @@ -54,6 +54,12 @@ public class Snowball extends ThrowableItemProjectile { @@ -22,10 +22,10 @@ index 1d399532c67c213c95c06837b0c7855384f1a25c..cad1f8cb68ef9615587e651a3120f68a // Purpur start - options to extinguish fire blocks with snowballs - borrowed and modified code from ThrownPotion#onHitBlock and ThrownPotion#dowseFire diff --git a/net/minecraft/world/entity/projectile/ThrownEgg.java b/net/minecraft/world/entity/projectile/ThrownEgg.java -index 76481c0e77fc3a2e4be8eeb9de8d1e6de5507c64..8f0aa83cc81f36d70a39600a82d0212db70e02ec 100644 +index 73ec34b43f3fb2aa3edc3f1cb48a923d1fa32036..fe605f728020b42a61ea6703401e08f0efc3a69c 100644 --- a/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/net/minecraft/world/entity/projectile/ThrownEgg.java -@@ -52,7 +52,14 @@ public class ThrownEgg extends ThrowableItemProjectile { +@@ -54,7 +54,14 @@ public class ThrownEgg extends ThrowableItemProjectile { @Override protected void onHitEntity(EntityHitResult result) { super.onHitEntity(result); diff --git a/patches/unapplied/server/minecraft-patches/features/0021-Block-Log4Shell-exploit.patch b/divinemc-server/minecraft-patches/features/0018-Block-Log4Shell-exploit.patch similarity index 88% rename from patches/unapplied/server/minecraft-patches/features/0021-Block-Log4Shell-exploit.patch rename to divinemc-server/minecraft-patches/features/0018-Block-Log4Shell-exploit.patch index f848bca..d70cf92 100644 --- a/patches/unapplied/server/minecraft-patches/features/0021-Block-Log4Shell-exploit.patch +++ b/divinemc-server/minecraft-patches/features/0018-Block-Log4Shell-exploit.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Block Log4Shell exploit diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5b8031a45b1f4f6d0e86c2a839d173a6e3f4f697..a3ec8c92dae7735bb0b1ececc9851c829c486a53 100644 +index a271b76224246f04ad9396a3b3be40f5f7302965..c2375c8f7be0b942489193561ceefc48ac8373fa 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2425,6 +2425,7 @@ public class ServerGamePacketListenerImpl +@@ -2487,6 +2487,7 @@ public class ServerGamePacketListenerImpl } private void tryHandleChat(String message, Runnable handler, boolean sync) { // CraftBukkit @@ -16,7 +16,7 @@ index 5b8031a45b1f4f6d0e86c2a839d173a6e3f4f697..a3ec8c92dae7735bb0b1ececc9851c82 if (isChatMessageIllegal(message)) { this.disconnectAsync(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add proper async disconnect } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales -@@ -2453,6 +2454,15 @@ public class ServerGamePacketListenerImpl +@@ -2519,6 +2520,15 @@ public class ServerGamePacketListenerImpl } } diff --git a/patches/unapplied/server/minecraft-patches/features/0022-Re-Fix-MC-117075.patch b/divinemc-server/minecraft-patches/features/0019-Re-Fix-MC-117075.patch similarity index 73% rename from patches/unapplied/server/minecraft-patches/features/0022-Re-Fix-MC-117075.patch rename to divinemc-server/minecraft-patches/features/0019-Re-Fix-MC-117075.patch index aee90a0..c1ebb13 100644 --- a/patches/unapplied/server/minecraft-patches/features/0022-Re-Fix-MC-117075.patch +++ b/divinemc-server/minecraft-patches/features/0019-Re-Fix-MC-117075.patch @@ -5,26 +5,25 @@ Subject: [PATCH] Re-Fix MC-117075 diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 9608aa7231e1e19ac34f7fcf6cc4051da01f2f3e..92fc936c6bdbda909b9cdf157ec9d46a4872098c 100644 +index 2e90bb96ed90f3debbe5803856ed41a5c08003f8..4eedfc61c7e682a44858703b462eecad17a48904 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -113,7 +113,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -104,7 +104,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl public static final int TICKS_PER_DAY = 24000; public static final int MAX_ENTITY_SPAWN_Y = 20000000; public static final int MIN_ENTITY_SPAWN_Y = -20000000; -- public final List blockEntityTickers = Lists.newArrayList(); // Paper - public +- public final List blockEntityTickers = Lists.newArrayList(); + public final org.bxteam.divinemc.util.BlockEntityTickersList blockEntityTickers = new org.bxteam.divinemc.util.BlockEntityTickersList(); // Paper - public // DivineMC - optimize block entity removals - Fix MC-117075 protected final NeighborUpdater neighborUpdater; private final List pendingBlockEntityTickers = Lists.newArrayList(); private boolean tickingBlockEntities; -@@ -1521,14 +1521,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1504,13 +1504,11 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl boolean runsNormally = this.tickRateManager().runsNormally(); int tickedEntities = 0; // Paper - rewrite chunk system - var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet(); // Paper - Fix MC-117075; use removeAll - toRemove.add(null); // Paper - Fix MC-117075 - for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters - this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; + for (this.tileTickPosition = 0; this.tileTickPosition < this.blockEntityTickers.size(); this.tileTickPosition++) { // Paper - Disable tick limiters TickingBlockEntity tickingBlockEntity = this.blockEntityTickers.get(this.tileTickPosition); // Spigot end if (tickingBlockEntity.isRemoved()) { @@ -32,9 +31,9 @@ index 9608aa7231e1e19ac34f7fcf6cc4051da01f2f3e..92fc936c6bdbda909b9cdf157ec9d46a + this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // DivineMC - optimize block entity removals - Fix MC-117075 } else if (runsNormally && this.shouldTickBlocksAt(tickingBlockEntity.getPos())) { tickingBlockEntity.tick(); - // DivineMC start - Parallel world ticking -@@ -1539,7 +1537,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - // DivineMC end - Parallel world ticking + // Paper start - rewrite chunk system +@@ -1520,7 +1518,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl + // Paper end - rewrite chunk system } } - this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 diff --git a/patches/unapplied/server/minecraft-patches/features/0023-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch b/divinemc-server/minecraft-patches/features/0020-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch similarity index 95% rename from patches/unapplied/server/minecraft-patches/features/0023-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch rename to divinemc-server/minecraft-patches/features/0020-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch index c531a69..3b48a34 100644 --- a/patches/unapplied/server/minecraft-patches/features/0023-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch +++ b/divinemc-server/minecraft-patches/features/0020-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Skip distanceToSqr call in ServerEntity#sendChanges if the diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index b6053158f5d9b6ad325ea075ab7c60f9966ba496..c7ad6bf5dd8cb8a27de3e3ed82c6eefaa36c5c08 100644 +index 7748183dd12434693b89d2dbc8325988381857c9..372e33f22d9012348d19cc1a38504d90049a6833 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -203,23 +203,27 @@ public class ServerEntity { +@@ -200,23 +200,27 @@ public class ServerEntity { if (this.entity.hasImpulse || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) { Vec3 deltaMovement = this.entity.getDeltaMovement(); diff --git a/patches/unapplied/server/minecraft-patches/features/0024-Optimize-canSee-checks.patch b/divinemc-server/minecraft-patches/features/0021-Optimize-canSee-checks.patch similarity index 87% rename from patches/unapplied/server/minecraft-patches/features/0024-Optimize-canSee-checks.patch rename to divinemc-server/minecraft-patches/features/0021-Optimize-canSee-checks.patch index 395c9e8..84163de 100644 --- a/patches/unapplied/server/minecraft-patches/features/0024-Optimize-canSee-checks.patch +++ b/divinemc-server/minecraft-patches/features/0021-Optimize-canSee-checks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize canSee checks diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index dccf4d4b1067e1b09e38cabeae82185929494b62..55da7420dc3dfff468529a0f101f864dbefe3c7c 100644 +index fb6e0beb35d1d6bb9a159debeb06e861051821b9..71c7d0186288e5b910d3898f10c5bffb6657e760 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -1258,7 +1258,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1328,7 +1328,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider flag = flag && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z); // Paper end - Configurable entity tracking range by Y // CraftBukkit start - respect vanish API diff --git a/patches/unapplied/server/minecraft-patches/features/0027-Verify-Minecraft-EULA-earlier.patch b/divinemc-server/minecraft-patches/features/0022-Verify-Minecraft-EULA-earlier.patch similarity index 95% rename from patches/unapplied/server/minecraft-patches/features/0027-Verify-Minecraft-EULA-earlier.patch rename to divinemc-server/minecraft-patches/features/0022-Verify-Minecraft-EULA-earlier.patch index bd22335..14749ea 100644 --- a/patches/unapplied/server/minecraft-patches/features/0027-Verify-Minecraft-EULA-earlier.patch +++ b/divinemc-server/minecraft-patches/features/0022-Verify-Minecraft-EULA-earlier.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Verify Minecraft EULA earlier diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java -index 1485186d4989874ef89c4e83830f26358a43759c..c4f9b67c92e4c7e8015f637fe633a9e8da276e5c 100644 +index 29dd9a980bb7dc8457dd9ad6eeaa2c5067e3b954..a0553288d99e94d14345f25ec4672e1ca70950b6 100644 --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java @@ -123,7 +123,6 @@ public class Main { diff --git a/patches/unapplied/server/minecraft-patches/features/0029-Option-to-disable-saving-of-snowball-and-firework.patch b/divinemc-server/minecraft-patches/features/0023-Option-to-disable-saving-of-snowball-and-firework.patch similarity index 87% rename from patches/unapplied/server/minecraft-patches/features/0029-Option-to-disable-saving-of-snowball-and-firework.patch rename to divinemc-server/minecraft-patches/features/0023-Option-to-disable-saving-of-snowball-and-firework.patch index 79a0955..9ec436c 100644 --- a/patches/unapplied/server/minecraft-patches/features/0029-Option-to-disable-saving-of-snowball-and-firework.patch +++ b/divinemc-server/minecraft-patches/features/0023-Option-to-disable-saving-of-snowball-and-firework.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable saving of snowball and firework diff --git a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index c7ae41b2cbc1eb85a6eb9c16813bd326fb8f49f0..e6764ee35f9d9d20a7693d50ea61b703867e3c79 100644 +index e0e193078e550225e163149638bf9e053c0531f8..a3c9421506d1b9d79cb9cac46dbb2f86c83e7036 100644 --- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -@@ -364,4 +364,14 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -354,4 +354,14 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { double d1 = entity.position().z - this.position().z; return DoubleDoubleImmutablePair.of(d, d1); } @@ -24,7 +24,7 @@ index c7ae41b2cbc1eb85a6eb9c16813bd326fb8f49f0..e6764ee35f9d9d20a7693d50ea61b703 + // DivineMC end - Option to disable saving firework } diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java -index cad1f8cb68ef9615587e651a3120f68a3c32add0..18298f3ba544e07110ea8d5b15ae753f7e3de65a 100644 +index 86e75722b37eaa02858fa4313d8bcc2a72c0f7f6..0f611169a4ed2a059b9231bedf94a903600b73f0 100644 --- a/net/minecraft/world/entity/projectile/Snowball.java +++ b/net/minecraft/world/entity/projectile/Snowball.java @@ -100,4 +100,14 @@ public class Snowball extends ThrowableItemProjectile { diff --git a/patches/unapplied/server/minecraft-patches/features/0031-lithium-fast_util.patch b/divinemc-server/minecraft-patches/features/0024-lithium-fast_util.patch similarity index 87% rename from patches/unapplied/server/minecraft-patches/features/0031-lithium-fast_util.patch rename to divinemc-server/minecraft-patches/features/0024-lithium-fast_util.patch index f1df73f..61ad0fc 100644 --- a/patches/unapplied/server/minecraft-patches/features/0031-lithium-fast_util.patch +++ b/divinemc-server/minecraft-patches/features/0024-lithium-fast_util.patch @@ -5,10 +5,10 @@ Subject: [PATCH] lithium: fast_util diff --git a/net/minecraft/core/Direction.java b/net/minecraft/core/Direction.java -index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..05c7de5729466786a0196fa5f91eccc3cfffc675 100644 +index 63fd7b45750430b565d599337d3112cbaa7e7550..4275a2e1e29c15cdda75c29c468255635f5c7bc1 100644 --- a/net/minecraft/core/Direction.java +++ b/net/minecraft/core/Direction.java -@@ -217,7 +217,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa +@@ -222,7 +222,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa } public Direction getOpposite() { @@ -17,7 +17,7 @@ index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..05c7de5729466786a0196fa5f91eccc3 } public Direction getClockWise(Direction.Axis axis) { -@@ -350,7 +350,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa +@@ -355,7 +355,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa } public static Direction getRandom(RandomSource random) { @@ -27,10 +27,10 @@ index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..05c7de5729466786a0196fa5f91eccc3 public static Direction getApproximateNearest(double x, double y, double z) { diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java -index 54807bb4b4189ceaded1f78a1a9ab85ce40ab2b1..977642da91cf3bace9182e36c10512c8a1830503 100644 +index 1866d857cabde481f23e861e0db7994bfa84ac40..de2a22fde8d91f13ccae347de48f4143d5749a6c 100644 --- a/net/minecraft/world/phys/AABB.java +++ b/net/minecraft/world/phys/AABB.java -@@ -18,6 +18,15 @@ public class AABB { +@@ -19,6 +19,15 @@ public class AABB { public final double maxY; public final double maxZ; @@ -46,7 +46,7 @@ index 54807bb4b4189ceaded1f78a1a9ab85ce40ab2b1..977642da91cf3bace9182e36c10512c8 public AABB(double x1, double y1, double z1, double x2, double y2, double z2) { this.minX = Math.min(x1, x2); this.minY = Math.min(y1, y2); -@@ -79,11 +88,33 @@ public class AABB { +@@ -80,11 +89,33 @@ public class AABB { } public double min(Direction.Axis axis) { diff --git a/patches/unapplied/server/minecraft-patches/features/0025-Implement-NoChatReports.patch b/divinemc-server/minecraft-patches/features/0025-Implement-NoChatReports.patch similarity index 94% rename from patches/unapplied/server/minecraft-patches/features/0025-Implement-NoChatReports.patch rename to divinemc-server/minecraft-patches/features/0025-Implement-NoChatReports.patch index 0f7ab96..7c37806 100644 --- a/patches/unapplied/server/minecraft-patches/features/0025-Implement-NoChatReports.patch +++ b/divinemc-server/minecraft-patches/features/0025-Implement-NoChatReports.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement NoChatReports diff --git a/net/minecraft/network/FriendlyByteBuf.java b/net/minecraft/network/FriendlyByteBuf.java -index d1daa3443446f47e2215f0c7c5823da58e053bab..61b1440ee7909946cd2d7a4d8622f79c6f6ac76b 100644 +index 7da7d645f83f351e8c964da01734f3074a877ca1..39426086e1c417758d6ff940c3ab716fcba6cd6c 100644 --- a/net/minecraft/network/FriendlyByteBuf.java +++ b/net/minecraft/network/FriendlyByteBuf.java @@ -105,7 +105,28 @@ public class FriendlyByteBuf extends ByteBuf { @@ -123,7 +123,7 @@ index 1df628ac0b414511aaed6e09d78f884c4170f730..d94858facc06d57139e953796ee09dad } } diff --git a/net/minecraft/network/protocol/status/ServerStatus.java b/net/minecraft/network/protocol/status/ServerStatus.java -index 30bd254542d631676494f349ff3f44f52d54ab2f..6c728ae3b58bc1b8449d34c6c74091612b79f39e 100644 +index 094d1821d298fc228270b2d6cf0445949434f3e2..8f7e3e5f1d3a87ba3528c9dd61e063ecfda4e1ec 100644 --- a/net/minecraft/network/protocol/status/ServerStatus.java +++ b/net/minecraft/network/protocol/status/ServerStatus.java @@ -15,13 +15,7 @@ import net.minecraft.network.chat.CommonComponents; @@ -206,10 +206,10 @@ index 30bd254542d631676494f349ff3f44f52d54ab2f..6c728ae3b58bc1b8449d34c6c7409161 private static final String PREFIX = "data:image/png;base64,"; public static final Codec CODEC = Codec.STRING.comapFlatMap(string -> { diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index 9fcdff2be139296f4e14b54c33cc795efdff0c7f..64c3bbe540599e5195f0cc89635bff2c56d1a320 100644 +index 01d9c1919918bfee7f9bb998916d84f553cb526c..1c343a37dd4dedb99e08fda75434c3fbbf5fa459 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -668,6 +668,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -620,6 +620,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @Override public boolean enforceSecureProfile() { @@ -218,10 +218,10 @@ index 9fcdff2be139296f4e14b54c33cc795efdff0c7f..64c3bbe540599e5195f0cc89635bff2c // Paper start - Add setting for proxy online mode status return properties.enforceSecureProfile diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 801dd76a2c7f76fc6fdb7167cbf3ab1310be36c9..4fa55fac5dab26a505cba2c1876e9459a582da12 100644 +index 482f0b5945a4ea12a805d3b926140a08151e21a6..7eb55fb6828612e63f7d3c14a2fdc7288a256cbd 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -312,10 +312,64 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -311,10 +311,64 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } public void send(Packet packet) { @@ -287,10 +287,10 @@ index 801dd76a2c7f76fc6fdb7167cbf3ab1310be36c9..4fa55fac5dab26a505cba2c1876e9459 if (packet == null || this.processedDisconnect) { // Spigot return; diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 3d8c1c5aa922ec0417388a1ff27d423cdb6d1351..6cbd57650f1f966955ee14039bca8ceb164599cd 100644 +index 3155f2fb46deebf12bcceb8283c6dc57d96ee365..338df3c49e19b7ff3f54ecf93a980d4573b142d7 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -274,7 +274,7 @@ public abstract class PlayerList { +@@ -275,7 +275,7 @@ public abstract class PlayerList { !_boolean, _boolean2, player.createCommonSpawnInfo(serverLevel), @@ -299,10 +299,10 @@ index 3d8c1c5aa922ec0417388a1ff27d423cdb6d1351..6cbd57650f1f966955ee14039bca8ceb ) ); player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit -@@ -1333,6 +1333,7 @@ public abstract class PlayerList { +@@ -1327,6 +1327,7 @@ public abstract class PlayerList { } - public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public + public boolean verifyChatTrusted(PlayerChatMessage message) { + if (org.bxteam.divinemc.DivineConfig.noChatReportsEnabled) return true; // DivineMC - Implement NoChatReports return message.hasSignature() && !message.hasExpiredServer(Instant.now()); } diff --git a/patches/unapplied/server/minecraft-patches/features/0032-Virtual-Threads.patch b/divinemc-server/minecraft-patches/features/0026-Virtual-Threads.patch similarity index 91% rename from patches/unapplied/server/minecraft-patches/features/0032-Virtual-Threads.patch rename to divinemc-server/minecraft-patches/features/0026-Virtual-Threads.patch index 992e250..c592364 100644 --- a/patches/unapplied/server/minecraft-patches/features/0032-Virtual-Threads.patch +++ b/divinemc-server/minecraft-patches/features/0026-Virtual-Threads.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Virtual Threads diff --git a/net/minecraft/Util.java b/net/minecraft/Util.java -index 80a7a85e1a03a1ca406259207e1ae3b909b3284f..aa2d99de3d23d262542bfb1592fe084f94230f85 100644 +index d1fcc73f579d1c4ac79213ad039c8d803ff51b1a..047ce2391a8ec4bab1b8a2020ab3f20953e5b95f 100644 --- a/net/minecraft/Util.java +++ b/net/minecraft/Util.java -@@ -97,7 +97,12 @@ public class Util { +@@ -98,7 +98,12 @@ public class Util { public static final TracingExecutor DIMENSION_DATA_IO_POOL = makeExtraIoExecutor("Dimension-Data-IO-Worker-"); // Paper - Separate dimension data IO pool private static final TracingExecutor DOWNLOAD_POOL = makeIoExecutor("Download-", true); // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread @@ -23,10 +23,10 @@ index 80a7a85e1a03a1ca406259207e1ae3b909b3284f..aa2d99de3d23d262542bfb1592fe084f private final AtomicInteger count = new AtomicInteger(); diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index 212d2bcfd34f7cb14e18a8af2cd296fc01d371f6..ec76e4f29ba96b31a24a5d195b852342a57e0bdb 100644 +index 07e228b620962e507b7db70e5a743daf2e5c82ca..cff86f3a50529a9d1a8873aa6f7f77da248c6c67 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -474,7 +474,7 @@ public class Commands { +@@ -473,7 +473,7 @@ public class Commands { } // Fixed pool, but with discard policy @@ -36,10 +36,10 @@ index 212d2bcfd34f7cb14e18a8af2cd296fc01d371f6..ec76e4f29ba96b31a24a5d195b852342 new java.util.concurrent.LinkedBlockingQueue<>(), new com.google.common.util.concurrent.ThreadFactoryBuilder() diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 5a0c8791495aa522e511918ad0a24d9bbe6b5877..9d6fa3bced0ba5ab3443bdf4ce306598a8e4a31f 100644 +index 28641e7672c0cf79d3400da36ea3ee3d9f04898e..3fe3e36439a750c2614fc94df4bbbe7375c37614 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -2710,8 +2710,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop structureBlockInfos) { } -+ // Quiil end - Optimize Structure Generation ++ // DivineMC end - Optimize Structure Generation } diff --git a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -index a37eb2e29b4577ebc711e8ef7b47fbbc3bc66897..45d6fbeeaac577bb35adb69fd344b9486953ea03 100644 +index df3a1b9ed4ad836bd3358b6b440964e497213ea3..c283d5320c89c0793d59dd107fd9b0ae3b0a9ba6 100644 --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -249,6 +249,12 @@ public class StructureTemplate { +@@ -247,6 +247,12 @@ public class StructureTemplate { return transform(pos, decorator.getMirror(), decorator.getRotation(), decorator.getRotationPivot()); } @@ -247,7 +247,7 @@ index a37eb2e29b4577ebc711e8ef7b47fbbc3bc66897..45d6fbeeaac577bb35adb69fd344b948 public boolean placeInWorld(ServerLevelAccessor serverLevel, BlockPos offset, BlockPos pos, StructurePlaceSettings settings, RandomSource random, int flags) { if (this.palettes.isEmpty()) { return false; -@@ -266,7 +272,11 @@ public class StructureTemplate { +@@ -264,7 +270,11 @@ public class StructureTemplate { } } // CraftBukkit end @@ -260,7 +260,7 @@ index a37eb2e29b4577ebc711e8ef7b47fbbc3bc66897..45d6fbeeaac577bb35adb69fd344b948 if ((!list.isEmpty() || !settings.isIgnoreEntities() && !this.entityInfoList.isEmpty()) && this.size.getX() >= 1 && this.size.getY() >= 1 -@@ -890,7 +900,11 @@ public class StructureTemplate { +@@ -871,7 +881,11 @@ public class StructureTemplate { private List cachedJigsaws; Palette(List blocks) { diff --git a/patches/unapplied/server/minecraft-patches/features/0035-Option-to-disable-disconnect.spam.patch b/divinemc-server/minecraft-patches/features/0029-Option-to-disable-disconnect.spam.patch similarity index 91% rename from patches/unapplied/server/minecraft-patches/features/0035-Option-to-disable-disconnect.spam.patch rename to divinemc-server/minecraft-patches/features/0029-Option-to-disable-disconnect.spam.patch index f7b2376..712b877 100644 --- a/patches/unapplied/server/minecraft-patches/features/0035-Option-to-disable-disconnect.spam.patch +++ b/divinemc-server/minecraft-patches/features/0029-Option-to-disable-disconnect.spam.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable disconnect.spam diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 02b4275d170cc854a7482f0e963394aee21171dd..c3e8da14d4faf560d24f877ef9eeb4a5dcb2aa8d 100644 +index f2d4a2b8881664a45703e2c56e1f59d8373ab1c4..e713e3667dfd0b93bc6277f68b95d204f47ba4ef 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -819,7 +819,7 @@ public class ServerGamePacketListenerImpl +@@ -812,7 +812,7 @@ public class ServerGamePacketListenerImpl public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start @@ -17,7 +17,7 @@ index 02b4275d170cc854a7482f0e963394aee21171dd..c3e8da14d4faf560d24f877ef9eeb4a5 this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause // Paper - add proper async disconnect return; } -@@ -831,7 +831,7 @@ public class ServerGamePacketListenerImpl +@@ -824,7 +824,7 @@ public class ServerGamePacketListenerImpl // Paper end - Don't suggest if tab-complete is disabled // Paper start final int index; @@ -26,7 +26,7 @@ index 02b4275d170cc854a7482f0e963394aee21171dd..c3e8da14d4faf560d24f877ef9eeb4a5 this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - add proper async disconnect return; } -@@ -891,6 +891,7 @@ public class ServerGamePacketListenerImpl +@@ -884,6 +884,7 @@ public class ServerGamePacketListenerImpl ParseResults parseResults = this.server.getCommands().getDispatcher().parse(stringReader, this.player.createCommandSourceStack()); // Paper start - Handle non-recoverable exceptions if (!parseResults.getExceptions().isEmpty() @@ -34,7 +34,7 @@ index 02b4275d170cc854a7482f0e963394aee21171dd..c3e8da14d4faf560d24f877ef9eeb4a5 && parseResults.getExceptions().values().stream().anyMatch(e -> e instanceof io.papermc.paper.brigadier.TagParseCommandSyntaxException)) { this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); return; -@@ -2624,6 +2625,7 @@ public class ServerGamePacketListenerImpl +@@ -2614,6 +2615,7 @@ public class ServerGamePacketListenerImpl // this.chatSpamThrottler.increment(); if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() // CraftBukkit end @@ -42,7 +42,7 @@ index 02b4275d170cc854a7482f0e963394aee21171dd..c3e8da14d4faf560d24f877ef9eeb4a5 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause & add proper async disconnect -@@ -3402,7 +3404,7 @@ public class ServerGamePacketListenerImpl +@@ -3393,7 +3395,7 @@ public class ServerGamePacketListenerImpl public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { // Paper start - auto recipe limit if (!org.bukkit.Bukkit.isPrimaryThread()) { diff --git a/patches/unapplied/server/minecraft-patches/features/0028-Configurable-MC-67.patch b/divinemc-server/minecraft-patches/features/0030-Configurable-MC-67.patch similarity index 85% rename from patches/unapplied/server/minecraft-patches/features/0028-Configurable-MC-67.patch rename to divinemc-server/minecraft-patches/features/0030-Configurable-MC-67.patch index 0804d57..c4728a6 100644 --- a/patches/unapplied/server/minecraft-patches/features/0028-Configurable-MC-67.patch +++ b/divinemc-server/minecraft-patches/features/0030-Configurable-MC-67.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable MC-67 diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 3943789e241f6bb6bc165099b1fb585463cf3d86..07e8bda8eb200d5a7554e0319e1a00dc85454e1a 100644 +index 18718693412f3cc0848c462361c2f06e1ad65a6e..0a23d54a6f03b1d776ab24922f88144762c90875 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -4017,6 +4017,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3961,6 +3961,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public boolean canTeleport(Level fromLevel, Level toLevel) { diff --git a/patches/unapplied/server/minecraft-patches/features/0036-Configurable-MC-59471.patch b/divinemc-server/minecraft-patches/features/0031-Configurable-MC-59471.patch similarity index 82% rename from patches/unapplied/server/minecraft-patches/features/0036-Configurable-MC-59471.patch rename to divinemc-server/minecraft-patches/features/0031-Configurable-MC-59471.patch index fb7d98f..c6d5cfc 100644 --- a/patches/unapplied/server/minecraft-patches/features/0036-Configurable-MC-59471.patch +++ b/divinemc-server/minecraft-patches/features/0031-Configurable-MC-59471.patch @@ -8,10 +8,10 @@ Bring back MC-59471, MC-129055 on 1.21.2+, which fixed in 1.21.2 snapshots 24w33 P.S: This setting is different from skip-tripwire-hook-placement-validation in Paper diff --git a/net/minecraft/world/level/block/TripWireHookBlock.java b/net/minecraft/world/level/block/TripWireHookBlock.java -index 9aace993c6c18f1a50610e4766225485984b8167..0849e0b116845a16792855afdd16de7ec6838542 100644 +index 8a3a8b0fdf9545a41501dc992c6982d9c8ce7b66..52fa81fdce9d7998f4c2d3b90dfc08391218f7fd 100644 --- a/net/minecraft/world/level/block/TripWireHookBlock.java +++ b/net/minecraft/world/level/block/TripWireHookBlock.java -@@ -201,7 +201,6 @@ public class TripWireHookBlock extends Block { +@@ -187,7 +187,6 @@ public class TripWireHookBlock extends Block { if (!cancelledEmitterHook) { // Paper - Call BlockRedstoneEvent emitState(level, pos, flag2, flag3, flag, flag1); if (!attaching) { @@ -19,13 +19,13 @@ index 9aace993c6c18f1a50610e4766225485984b8167..0849e0b116845a16792855afdd16de7e level.setBlock(pos, blockState1.setValue(FACING, direction), 3); if (shouldNotifyNeighbours) { notifyNeighbors(block, level, pos, direction); -@@ -214,10 +213,17 @@ public class TripWireHookBlock extends Block { +@@ -200,10 +199,18 @@ public class TripWireHookBlock extends Block { BlockPos blockPos1 = pos.relative(direction, i2); BlockState blockState2 = blockStates[i2]; if (blockState2 != null) { - BlockState blockState3 = level.getBlockState(blockPos1); - if (blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) { -- if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, Boolean.valueOf(flag2)), 3); // Paper - prevent tripwire from updating +- if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3); // Paper - prevent tripwire from updating + // DivineMC start - Configurable MC-59471 + if (level.divineConfig.allowTripwireDupe) { + level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3); @@ -33,7 +33,8 @@ index 9aace993c6c18f1a50610e4766225485984b8167..0849e0b116845a16792855afdd16de7e + } else { + BlockState blockState3 = level.getBlockState(blockPos1); + if (blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) { -+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, Boolean.valueOf(flag2)), 3); // Paper - prevent tripwire from updating ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) ++ level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3); // Paper - prevent tripwire from updating + } } + // DivineMC end - Configurable MC-59471 diff --git a/patches/unapplied/server/minecraft-patches/features/0037-ModernFix-compact_bit_storage.patch b/divinemc-server/minecraft-patches/features/0032-ModernFix-compact_bit_storage.patch similarity index 92% rename from patches/unapplied/server/minecraft-patches/features/0037-ModernFix-compact_bit_storage.patch rename to divinemc-server/minecraft-patches/features/0032-ModernFix-compact_bit_storage.patch index e0e5e34..900a716 100644 --- a/patches/unapplied/server/minecraft-patches/features/0037-ModernFix-compact_bit_storage.patch +++ b/divinemc-server/minecraft-patches/features/0032-ModernFix-compact_bit_storage.patch @@ -10,12 +10,12 @@ As part of: ModernFix (https://github.com/embeddedt/ModernFix) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java -index 712d3d1669aecd38934957c81835e1f38289539a..810e61913aece5a8158f83b6dd56a7b6cb083c19 100644 +index a512609aaa823b940ed269c981fc9beec49a126e..2829ebdda8e9ad8945fe7d3f96c3cdaad798a40a 100644 --- a/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/net/minecraft/world/level/chunk/PalettedContainer.java @@ -275,6 +275,28 @@ public class PalettedContainer implements PaletteResize, PalettedContainer data.palette.read(buffer); - buffer.readLongArray(data.storage.getRaw()); + buffer.readFixedSizeLongArray(data.storage.getRaw()); this.data = data; + // DivineMC start - ModernFix: compact_bit_storage + if (org.bxteam.divinemc.DivineConfig.useCompactBitStorage && _byte > 1) { diff --git a/patches/unapplied/server/minecraft-patches/features/0038-Command-block-parse-results-caching.patch b/divinemc-server/minecraft-patches/features/0033-Command-block-parse-results-caching.patch similarity index 93% rename from patches/unapplied/server/minecraft-patches/features/0038-Command-block-parse-results-caching.patch rename to divinemc-server/minecraft-patches/features/0033-Command-block-parse-results-caching.patch index 3c5abb6..a764925 100644 --- a/patches/unapplied/server/minecraft-patches/features/0038-Command-block-parse-results-caching.patch +++ b/divinemc-server/minecraft-patches/features/0033-Command-block-parse-results-caching.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Command block parse results caching diff --git a/net/minecraft/world/level/BaseCommandBlock.java b/net/minecraft/world/level/BaseCommandBlock.java -index 8c883ff13866d6416bd70cc61ab1e37dd1a5b33c..7bd3507837862b8afb8227a85a44c879692a9631 100644 +index 0eb88c24c66b521fd34d2fda6e6e21e3ecc6ac88..d27eca05abcfd524ff3c22770ce94505ce2ad233 100644 --- a/net/minecraft/world/level/BaseCommandBlock.java +++ b/net/minecraft/world/level/BaseCommandBlock.java -@@ -32,6 +32,10 @@ public abstract class BaseCommandBlock implements CommandSource { +@@ -37,6 +37,10 @@ public abstract class BaseCommandBlock implements CommandSource { private String command = ""; @Nullable private Component customName; @@ -19,7 +19,7 @@ index 8c883ff13866d6416bd70cc61ab1e37dd1a5b33c..7bd3507837862b8afb8227a85a44c879 // CraftBukkit start @Override public abstract org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper); -@@ -131,7 +135,35 @@ public abstract class BaseCommandBlock implements CommandSource { +@@ -119,7 +123,35 @@ public abstract class BaseCommandBlock implements CommandSource { this.successCount++; } }); @@ -56,7 +56,7 @@ index 8c883ff13866d6416bd70cc61ab1e37dd1a5b33c..7bd3507837862b8afb8227a85a44c879 } catch (Throwable var6) { CrashReport crashReport = CrashReport.forThrowable(var6, "Executing command block"); CrashReportCategory crashReportCategory = crashReport.addCategory("Command to be executed"); -@@ -151,6 +183,13 @@ public abstract class BaseCommandBlock implements CommandSource { +@@ -139,6 +171,13 @@ public abstract class BaseCommandBlock implements CommandSource { } } diff --git a/patches/unapplied/server/minecraft-patches/features/0044-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch b/divinemc-server/minecraft-patches/features/0034-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch similarity index 90% rename from patches/unapplied/server/minecraft-patches/features/0044-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch rename to divinemc-server/minecraft-patches/features/0034-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch index 5f6f427..f7f6c0f 100644 --- a/patches/unapplied/server/minecraft-patches/features/0044-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch +++ b/divinemc-server/minecraft-patches/features/0034-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Leaf: Improve BlockEntity ticking isRemoved check diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 0337f4b9ca3c9c9a1e2a7cf19fcbad5e78b949dc..1820069a7c5833b0a13e034c232f06af234788e3 100644 +index 7eb6da13dc47eaeac6e70d4e2935c1cc022c6400..d2eed7a0cf0c2c9dbcfb272cf89194f11d37151c 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -989,13 +989,26 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -992,13 +992,26 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p public static class RebindableTickingBlockEntityWrapper implements TickingBlockEntity { public TickingBlockEntity ticker; @@ -35,7 +35,7 @@ index 0337f4b9ca3c9c9a1e2a7cf19fcbad5e78b949dc..1820069a7c5833b0a13e034c232f06af } @Override -@@ -1005,6 +1018,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -1008,6 +1021,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @Override public boolean isRemoved() { diff --git a/patches/unapplied/server/minecraft-patches/features/0047-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch b/divinemc-server/minecraft-patches/features/0035-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch similarity index 89% rename from patches/unapplied/server/minecraft-patches/features/0047-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch rename to divinemc-server/minecraft-patches/features/0035-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch index d4445d0..c901fc4 100644 --- a/patches/unapplied/server/minecraft-patches/features/0047-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch +++ b/divinemc-server/minecraft-patches/features/0035-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch @@ -7,10 +7,10 @@ Subject: [PATCH] SparklyPaper: Allow throttling hopper checks if the target Original project: https://github.com/SparklyPower/SparklyPaper diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 5cd1326ad5d046c88b2b3449d610a78fa880b4cd..6ad3388ac45a4d2ef85fc0fafece7de6e387f738 100644 +index 15d4f60942c0cc612c1468b4c0fda886867a67cb..d701952d940c0da245aa4f9e3664dd5cfcc8771e 100644 --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -419,6 +419,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -423,6 +423,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen } else { Direction opposite = blockEntity.facing.getOpposite(); if (isFullContainer(attachedContainer, opposite)) { diff --git a/patches/unapplied/server/minecraft-patches/features/0039-Linear-region-file-format.patch b/divinemc-server/minecraft-patches/features/0036-Linear-region-file-format.patch similarity index 93% rename from patches/unapplied/server/minecraft-patches/features/0039-Linear-region-file-format.patch rename to divinemc-server/minecraft-patches/features/0036-Linear-region-file-format.patch index bb7a6fd..1b7d312 100644 --- a/patches/unapplied/server/minecraft-patches/features/0039-Linear-region-file-format.patch +++ b/divinemc-server/minecraft-patches/features/0036-Linear-region-file-format.patch @@ -21,7 +21,7 @@ index a814512fcfb85312474ae2c2c21443843bf57831..fdccc27c528b01b16a72e614ffd96523 public MoonriseRegionFileIO.RegionDataController.WriteData moonrise$startWrite( final int chunkX, final int chunkZ, final CompoundTag compound diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java -index 98fbc5c8044bd945d64569f13412a6e7e49a4e7f..34682217252cb98a70511a8cb25f077ec9f872b8 100644 +index 709df35246fb328cda21679b53d44d9f96206cb3..72c5463cbdd78bfa215b0c1f9baeb3be089dcde7 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java @@ -1260,7 +1260,7 @@ public final class MoonriseRegionFileIO { @@ -54,10 +54,10 @@ index 51c126735ace8fdde89ad97b5cab62f244212db0..8713d00d767c9225a0823d2fdbb0b479 + public void moonrise$write(final org.bxteam.divinemc.region.IRegionFile regionFile) throws IOException; // DivineMC - Linear region file format } diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 26a4a279122bb03a83dd4a34e780d6a4567ba3a8..51b79f614417f231951e9ba05b29ff0044e081e7 100644 +index 3fe3e36439a750c2614fc94df4bbbe7375c37614..0270e0045a76927e156f7bf54fed7ca406a113f8 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -947,10 +947,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> progressMap = Reference2FloatMaps.synchronize(new Reference2FloatOpenHashMap<>()); volatile Component status = Component.translatable("optimizeWorld.stage.counting"); @@ -83,7 +83,7 @@ index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c7 final DimensionDataStorage overworldDataStorage; public WorldUpgrader( -@@ -261,7 +261,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -272,7 +272,7 @@ public class WorldUpgrader implements AutoCloseable { } private static List getAllChunkPositions(RegionStorageInfo regionStorageInfo, Path path) { @@ -92,7 +92,7 @@ index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c7 if (files == null) { return List.of(); } else { -@@ -274,7 +274,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -285,7 +285,7 @@ public class WorldUpgrader implements AutoCloseable { int i1 = Integer.parseInt(matcher.group(2)) << 5; List list1 = Lists.newArrayList(); @@ -101,7 +101,7 @@ index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c7 for (int i2 = 0; i2 < 32; i2++) { for (int i3 = 0; i3 < 32; i3++) { ChunkPos chunkPos = new ChunkPos(i2 + i, i3 + i1); -@@ -322,7 +322,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -333,7 +333,7 @@ public class WorldUpgrader implements AutoCloseable { protected abstract boolean tryProcessOnePosition(T chunkStorage, ChunkPos chunkPos, ResourceKey dimension); @@ -110,7 +110,7 @@ index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c7 if (WorldUpgrader.this.recreateRegionFiles) { if (this.previousWriteFuture != null) { this.previousWriteFuture.join(); -@@ -424,7 +424,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -438,7 +438,7 @@ public class WorldUpgrader implements AutoCloseable { } } @@ -120,7 +120,7 @@ index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c7 class PoiUpgrader extends WorldUpgrader.SimpleRegionStorageUpgrader { diff --git a/net/minecraft/world/level/chunk/storage/RegionFile.java b/net/minecraft/world/level/chunk/storage/RegionFile.java -index c72494e757a9dc50e053dbc873f7b30e83d5cb8c..2988084cf2d72557dd304dcb904d09441e79863d 100644 +index ae0a893498d0bfe90c14508f15b431d4885e06ff..6fba4d36377359dbcf8c804b194c4aefdde53b01 100644 --- a/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -22,7 +22,7 @@ import net.minecraft.util.profiling.jfr.JvmProfiler; @@ -132,7 +132,7 @@ index c72494e757a9dc50e053dbc873f7b30e83d5cb8c..2988084cf2d72557dd304dcb904d0944 private static final Logger LOGGER = LogUtils.getLogger(); public static final int MAX_CHUNK_SIZE = 500 * 1024 * 1024; // Paper - don't write garbage data to disk if writing serialization fails private static final int SECTOR_BYTES = 4096; -@@ -904,7 +904,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche +@@ -912,7 +912,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche } @Override @@ -142,7 +142,7 @@ index c72494e757a9dc50e053dbc873f7b30e83d5cb8c..2988084cf2d72557dd304dcb904d0944 } // Paper end - rewrite chunk system diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb1f14d256 100644 +index c98cb390bda4b536f97445f228e06aaebcd84609..3b07e9e355032b9f797935df16435a45b68866c7 100644 --- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -18,7 +18,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @@ -236,7 +236,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb final DataInputStream input = regionFile == null ? null : regionFile.getChunkDataInputStream(new ChunkPos(chunkX, chunkZ)); -@@ -237,7 +243,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -262,7 +268,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise } // Paper end - rewrite chunk system // Paper start - rewrite chunk system @@ -245,7 +245,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb return this.getRegionFile(chunkcoordintpair, false); } // Paper end - rewrite chunk system -@@ -249,7 +255,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -274,7 +280,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise this.isChunkData = isChunkDataFolder(this.folder); // Paper - recalculate region file headers } @@ -254,7 +254,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb // Paper start - rewrite chunk system if (existingOnly) { return this.moonrise$getRegionFileIfExists(chunkPos.x, chunkPos.z); -@@ -257,7 +263,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -282,7 +288,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise synchronized (this) { final long key = ChunkPos.asLong(chunkPos.x >> REGION_SHIFT, chunkPos.z >> REGION_SHIFT); @@ -263,7 +263,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb if (ret != null) { return ret; } -@@ -272,7 +278,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -297,7 +303,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise FileUtil.createDirectoriesSafe(this.folder); @@ -272,7 +272,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb this.regionCache.putAndMoveToFirst(key, ret); -@@ -286,7 +292,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -311,7 +317,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 DIVINEMC - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // DivineMC - Rebrand } @@ -281,7 +281,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb synchronized (regionfile) { try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z); -@@ -321,7 +327,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -346,7 +352,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @Nullable public CompoundTag read(ChunkPos chunkPos) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -290,7 +290,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb if (regionFile == null) { return null; } -@@ -360,7 +366,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -385,7 +391,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise public void scanChunk(ChunkPos chunkPos, StreamTagVisitor visitor) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -299,7 +299,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb if (regionFile == null) { return; } -@@ -374,7 +380,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -399,7 +405,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise } public void write(ChunkPos chunkPos, @Nullable CompoundTag chunkData) throws IOException { // Paper - rewrite chunk system - public @@ -308,7 +308,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb // Paper start - rewrite chunk system if (regionFile == null) { // if the RegionFile doesn't exist, no point in deleting from it -@@ -404,7 +410,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -429,7 +435,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); @@ -317,7 +317,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb try { regionFile.close(); } catch (final IOException ex) { -@@ -420,7 +426,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -445,7 +451,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); diff --git a/patches/unapplied/server/minecraft-patches/features/0042-Configurable-movement-speed-for-entities.patch b/divinemc-server/minecraft-patches/features/0037-Configurable-movement-speed-for-entities.patch similarity index 87% rename from patches/unapplied/server/minecraft-patches/features/0042-Configurable-movement-speed-for-entities.patch rename to divinemc-server/minecraft-patches/features/0037-Configurable-movement-speed-for-entities.patch index 3a73717..b803080 100644 --- a/patches/unapplied/server/minecraft-patches/features/0042-Configurable-movement-speed-for-entities.patch +++ b/divinemc-server/minecraft-patches/features/0037-Configurable-movement-speed-for-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable movement speed for entities diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java -index 2686df57d9d48db1438278d0d053bdbd3c65c0a7..44fa660cbe277c2b2dd5cce3e508b61848b2cccc 100644 +index ea90e3d7ad84e301f975ff91fade63c5429972cf..d3d8e140eb597d054bb6ca7a2b6f2fe4903e48ae 100644 --- a/net/minecraft/world/entity/monster/Drowned.java +++ b/net/minecraft/world/entity/monster/Drowned.java @@ -97,6 +97,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @@ -17,7 +17,7 @@ index 2686df57d9d48db1438278d0d053bdbd3c65c0a7..44fa660cbe277c2b2dd5cce3e508b618 @Override diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java -index a5bfc6f5caba1da8cfcb345524e05e8676672cb0..02ba60f5624c99c6360fa5f08aa2d518e34772ab 100644 +index a4ce65911a5d778f60bcedb3acd9fe59a5094c96..f359bfedd2d6fbd1c2d77d664157c4725fef014b 100644 --- a/net/minecraft/world/entity/monster/Husk.java +++ b/net/minecraft/world/entity/monster/Husk.java @@ -43,6 +43,7 @@ public class Husk extends Zombie { @@ -29,10 +29,10 @@ index a5bfc6f5caba1da8cfcb345524e05e8676672cb0..02ba60f5624c99c6360fa5f08aa2d518 @Override diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java -index 7af71c777dca26cd94b1807a2a77ea0d30e92976..5a86d217f9f8374c4ca8846fa22e721ad1f3f11b 100644 +index 783f8b9a05939b9f42fc77065f6347e3c6ddf8f5..b914cf4f62a1e729e12c2b2c4e5bae8f349e9bd9 100644 --- a/net/minecraft/world/entity/monster/Zombie.java +++ b/net/minecraft/world/entity/monster/Zombie.java -@@ -123,6 +123,7 @@ public class Zombie extends Monster { +@@ -127,6 +127,7 @@ public class Zombie extends Monster { public void initAttributes() { this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieMaxHealth); this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.zombieScale); @@ -40,7 +40,7 @@ index 7af71c777dca26cd94b1807a2a77ea0d30e92976..5a86d217f9f8374c4ca8846fa22e721a } // Purpur end - Configurable entity base attributes -@@ -190,7 +191,6 @@ public class Zombie extends Monster { +@@ -194,7 +195,6 @@ public class Zombie extends Monster { public static AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.FOLLOW_RANGE, 35.0) @@ -49,10 +49,10 @@ index 7af71c777dca26cd94b1807a2a77ea0d30e92976..5a86d217f9f8374c4ca8846fa22e721a .add(Attributes.ARMOR, 2.0) .add(Attributes.SPAWN_REINFORCEMENTS_CHANCE); diff --git a/net/minecraft/world/entity/monster/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java -index 2d5ddf98b79f97bdd15593a5989f978155375e99..a053f42a1ffa7285ddf18f3f92dea803f4fe9461 100644 +index e201b8348d3f816e73b9dc43b2c30681199ec767..b9291d89b06e58c02afa088fd20369ed9901e741 100644 --- a/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/ZombieVillager.java -@@ -99,6 +99,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { +@@ -98,6 +98,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { @Override public void initAttributes() { this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieVillagerMaxHealth); @@ -61,7 +61,7 @@ index 2d5ddf98b79f97bdd15593a5989f978155375e99..a053f42a1ffa7285ddf18f3f92dea803 @Override diff --git a/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/ZombifiedPiglin.java -index fddbbffafea275dad187b7908386cf4c05c86743..05256fefd6b015d84adadd877110440ac31a48b4 100644 +index 39489c8a347031fb4f73faca46039786e35762ac..701311b6988cd7d349d3e0fade665a9d4448c544 100644 --- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java +++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java @@ -85,6 +85,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { diff --git a/patches/unapplied/server/minecraft-patches/features/0043-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch b/divinemc-server/minecraft-patches/features/0038-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch similarity index 96% rename from patches/unapplied/server/minecraft-patches/features/0043-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch rename to divinemc-server/minecraft-patches/features/0038-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch index ab22096..dec3fd2 100644 --- a/patches/unapplied/server/minecraft-patches/features/0043-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch +++ b/divinemc-server/minecraft-patches/features/0038-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Paper PR: Add FillBottleEvents for player and dispenser diff --git a/net/minecraft/core/cauldron/CauldronInteraction.java b/net/minecraft/core/cauldron/CauldronInteraction.java -index b402f6a6ecb8047bbb791b212fba375f4c9e6af5..f381f3ecd27315e06ca6883006a8a4c3eb443c34 100644 +index a1ce1548bb008f1854baa4c5d6cd963c3a3f7a36..12f3875ed5638ca25787d5307de0b22cf0b63b64 100644 --- a/net/minecraft/core/cauldron/CauldronInteraction.java +++ b/net/minecraft/core/cauldron/CauldronInteraction.java @@ -63,7 +63,12 @@ public interface CauldronInteraction { @@ -23,10 +23,10 @@ index b402f6a6ecb8047bbb791b212fba375f4c9e6af5..f381f3ecd27315e06ca6883006a8a4c3 player.awardStat(Stats.ITEM_USED.get(item)); // level.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState()); // CraftBukkit diff --git a/net/minecraft/core/dispenser/DispenseItemBehavior.java b/net/minecraft/core/dispenser/DispenseItemBehavior.java -index c8c8351f5645cf4041d26b0e02c072546ad329c6..75a695aaf0dd2f58e1fa5e1c532ae298c2a2abdb 100644 +index 582e012222123e5001c34153f2ee1ab1d08935fd..ac27ff24f018d8798921c5152e679ceed1e88d8d 100644 --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -727,13 +727,25 @@ public interface DispenseItemBehavior { +@@ -569,13 +569,25 @@ public interface DispenseItemBehavior { blockStateBase -> blockStateBase.hasProperty(BeehiveBlock.HONEY_LEVEL) && blockStateBase.getBlock() instanceof BeehiveBlock ) && blockState.getValue(BeehiveBlock.HONEY_LEVEL) >= 5) { @@ -111,10 +111,10 @@ index 105f9166297de2bfa6bdcfa9f6a0ffb00c0242ac..111f43fc5c74577f8f3067a4f84be7a6 } diff --git a/net/minecraft/world/level/block/BeehiveBlock.java b/net/minecraft/world/level/block/BeehiveBlock.java -index fd49500f735e3482a0118316bd7a4340f41fe8be..4160c0649be830476b5bbea97557d9a505672abc 100644 +index 3cec4c5a40c569d848bbf503501d8c8d38ecf3ce..1e92dbb04445596e3adee0ef5f1db47b7cec908e 100644 --- a/net/minecraft/world/level/block/BeehiveBlock.java +++ b/net/minecraft/world/level/block/BeehiveBlock.java -@@ -158,12 +158,26 @@ public class BeehiveBlock extends BaseEntityBlock { +@@ -155,12 +155,26 @@ public class BeehiveBlock extends BaseEntityBlock { flag = true; level.gameEvent(player, GameEvent.SHEAR, pos); } else if (stack.is(Items.GLASS_BOTTLE)) { diff --git a/patches/unapplied/server/minecraft-patches/features/0045-Paper-PR-Throttle-failed-spawn-attempts.patch b/divinemc-server/minecraft-patches/features/0039-Paper-PR-Throttle-failed-spawn-attempts.patch similarity index 88% rename from patches/unapplied/server/minecraft-patches/features/0045-Paper-PR-Throttle-failed-spawn-attempts.patch rename to divinemc-server/minecraft-patches/features/0039-Paper-PR-Throttle-failed-spawn-attempts.patch index 7adef18..586cd6c 100644 --- a/patches/unapplied/server/minecraft-patches/features/0045-Paper-PR-Throttle-failed-spawn-attempts.patch +++ b/divinemc-server/minecraft-patches/features/0039-Paper-PR-Throttle-failed-spawn-attempts.patch @@ -22,13 +22,13 @@ Example config in paper-world-defaults.yml: ``` diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070e1cbaf1f 100644 +index 345d4b80bd4383e0fb66d744d87bc8ef4100fd32..68a074a1eb11b158af773a2c44aa49d5d8462080 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -175,29 +175,52 @@ public final class NaturalSpawner { +@@ -158,29 +158,52 @@ public final class NaturalSpawner { // Copied from getFilteredSpawningCategories int limit = mobCategory.getMaxInstancesPerChunk(); - SpawnCategory spawnCategory = CraftSpawnCategory.toBukkit(mobCategory); + org.bukkit.entity.SpawnCategory spawnCategory = org.bukkit.craftbukkit.util.CraftSpawnCategory.toBukkit(mobCategory); + // Paper start - throttle failed spawn attempts + boolean spawnThisTick = true; + long ticksPerSpawn = level.ticksPerSpawnCategory.getLong(spawnCategory); @@ -38,7 +38,7 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 + ticksPerSpawn = Math.max(ticksPerSpawn, spawningThrottle.throttledTicksPerSpawn.getOrDefault(mobCategory, -1)); + } + // Paper end - throttle failed spawn attempts - if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { + if (org.bukkit.craftbukkit.util.CraftSpawnCategory.isValidForLimits(spawnCategory)) { + spawnThisTick = ticksPerSpawnTmp != 0 && level.getGameTime() % ticksPerSpawn == 0; // Paper - throttle failed spawn attempts limit = level.getWorld().getSpawnLimit(spawnCategory); } @@ -91,7 +91,7 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 // Paper end - Optional per player mob spawns } } -@@ -221,12 +244,21 @@ public final class NaturalSpawner { +@@ -204,12 +227,21 @@ public final class NaturalSpawner { } public static void spawnCategoryForChunk( MobCategory category, ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback, final int maxSpawns, final Consumer trackEntity @@ -114,7 +114,7 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 } @VisibleForDebug -@@ -246,16 +278,22 @@ public final class NaturalSpawner { +@@ -229,16 +261,22 @@ public final class NaturalSpawner { } public static void spawnCategoryForPosition( MobCategory category, ServerLevel level, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback, final int maxSpawns, final @Nullable Consumer trackEntity @@ -139,23 +139,24 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 for (int i1 = 0; i1 < 3; i1++) { int x = pos.getX(); int z = pos.getZ(); -@@ -295,13 +333,13 @@ public final class NaturalSpawner { +@@ -278,14 +316,14 @@ public final class NaturalSpawner { } // Paper end - per player mob count backoff if (doSpawning == PreSpawnStatus.ABORT) { - return; + return i; // Paper - throttle failed spawn attempts } - if (doSpawning == PreSpawnStatus.SUCCESS && filter.test(spawnerData.type, mutableBlockPos, chunk)) { - // Paper end - PreCreatureSpawnEvent - Mob mobForSpawn = getMobForSpawn(level, spawnerData.type); + if (doSpawning == PreSpawnStatus.SUCCESS + // Paper end - PreCreatureSpawnEvent + && filter.test(spawnerData.type(), mutableBlockPos, chunk)) { + Mob mobForSpawn = getMobForSpawn(level, spawnerData.type()); if (mobForSpawn == null) { - return; + return i; // Paper - throttle failed spawn attempts } - mobForSpawn.moveTo(d, y, d1, level.random.nextFloat() * 360.0F, 0.0F); -@@ -324,7 +362,7 @@ public final class NaturalSpawner { + mobForSpawn.snapTo(d, y, d1, level.random.nextFloat() * 360.0F, 0.0F); +@@ -308,7 +346,7 @@ public final class NaturalSpawner { } // CraftBukkit end if (i >= mobForSpawn.getMaxSpawnClusterSize() || i >= maxSpawns) { // Paper - Optional per player mob spawns @@ -164,7 +165,7 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 } if (mobForSpawn.isMaxGroupSizeReached(i3)) { -@@ -337,6 +375,8 @@ public final class NaturalSpawner { +@@ -321,6 +359,8 @@ public final class NaturalSpawner { } } } @@ -174,7 +175,7 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel level, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double distance) { diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java -index 80a0f5524e91e55d716e93c29e199d9816b0072a..3ba674ca0656d42b7d9e445cf25166253bf11f2e 100644 +index 42458418e6217adba28f729f04904814542eaa17..d4f95214ffbdedfee9e22f4a76d207ba538c6557 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java @@ -91,6 +91,7 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh @@ -186,7 +187,7 @@ index 80a0f5524e91e55d716e93c29e199d9816b0072a..3ba674ca0656d42b7d9e445cf2516625 // Paper start - rewrite chunk system private volatile ca.spottedleaf.moonrise.patches.starlight.light.SWMRNibbleArray[] blockNibbles; diff --git a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java -index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69e71f45ff 100644 +index 749096358fccbd5d1d13801092255c51096eb001..23b54c108c99b40f8ac8a695b18525a4f349c4a7 100644 --- a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +++ b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java @@ -92,6 +92,7 @@ public record SerializableChunkData( @@ -197,35 +198,35 @@ index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69 ) { public static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW( Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null // Paper - Anti-Xray -@@ -216,6 +217,19 @@ public record SerializableChunkData( - lists[i] = list4; +@@ -188,6 +189,19 @@ public record SerializableChunkData( + lists[i] = list2; } + // Paper start - throttle failed spawn attempts + long[] failedSpawnAttemptsData = null; -+ if (tag.contains("Paper.FailedSpawnAttempts", net.minecraft.nbt.Tag.TAG_COMPOUND)) { ++ if (tag.contains("Paper.FailedSpawnAttempts")) { + failedSpawnAttemptsData = new long[net.minecraft.world.entity.MobCategory.values().length]; -+ CompoundTag failedSpawnAttemptsTag = tag.getCompound("Paper.FailedSpawnAttempts"); ++ CompoundTag failedSpawnAttemptsTag = tag.getCompoundOrEmpty("Paper.FailedSpawnAttempts"); + for (net.minecraft.world.entity.MobCategory mobCategory : net.minecraft.world.level.NaturalSpawner.SPAWNING_CATEGORIES) { -+ if (failedSpawnAttemptsTag.contains(mobCategory.getSerializedName(), net.minecraft.nbt.Tag.TAG_LONG)) { -+ failedSpawnAttemptsData[mobCategory.ordinal()] = failedSpawnAttemptsTag.getLong(mobCategory.getSerializedName()); ++ if (failedSpawnAttemptsTag.contains(mobCategory.getSerializedName())) { ++ failedSpawnAttemptsData[mobCategory.ordinal()] = failedSpawnAttemptsTag.getLongOr(mobCategory.getSerializedName(), 0); + } + } + } + // Paper end - throttle failed spawn attempts + - List list5 = Lists.transform(tag.getList("entities", 10), tag1 -> (CompoundTag)tag1); - List list6 = Lists.transform(tag.getList("block_entities", 10), tag1 -> (CompoundTag)tag1); - CompoundTag compound1 = tag.getCompound("structures"); -@@ -294,6 +308,7 @@ public record SerializableChunkData( - list6, - compound1 + List list3 = tag.getList("entities").stream().flatMap(ListTag::compoundStream).toList(); + List list4 = tag.getList("block_entities").stream().flatMap(ListTag::compoundStream).toList(); + CompoundTag compoundOrEmpty = tag.getCompoundOrEmpty("structures"); +@@ -268,6 +282,7 @@ public record SerializableChunkData( + list4, + compoundOrEmpty , tag.get("ChunkBukkitValues") // CraftBukkit - ChunkBukkitValues + , failedSpawnAttemptsData // Paper - throttle failed spawn attempts ); } } -@@ -450,6 +465,15 @@ public record SerializableChunkData( +@@ -424,6 +439,15 @@ public record SerializableChunkData( chunkAccess.addPackedPostProcess(this.postProcessingSections[i], i); } @@ -241,7 +242,7 @@ index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69 if (chunkType == ChunkType.LEVELCHUNK) { return this.loadStarlightLightData(level, new ImposterProtoChunk((LevelChunk)chunkAccess, false)); // Paper - starlight } else { -@@ -587,6 +611,7 @@ public record SerializableChunkData( +@@ -554,6 +578,7 @@ public record SerializableChunkData( persistentDataContainer = chunk.persistentDataContainer.toTagCompound(); } // CraftBukkit end @@ -249,7 +250,7 @@ index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69 return new SerializableChunkData( level.registryAccess().lookupOrThrow(Registries.BIOME), pos, -@@ -607,6 +632,7 @@ public record SerializableChunkData( +@@ -574,6 +599,7 @@ public record SerializableChunkData( list1, compoundTag , persistentDataContainer // CraftBukkit - persistentDataContainer @@ -257,7 +258,7 @@ index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69 ); } } -@@ -703,6 +729,21 @@ public record SerializableChunkData( +@@ -658,6 +684,21 @@ public record SerializableChunkData( compoundTag.put("ChunkBukkitValues", this.persistentDataContainer); } // CraftBukkit end @@ -279,7 +280,7 @@ index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69 // Paper start - starlight if (this.lightCorrect && !this.chunkStatus.isBefore(net.minecraft.world.level.chunk.status.ChunkStatus.LIGHT)) { // clobber vanilla value to force vanilla to relight -@@ -931,4 +972,49 @@ public record SerializableChunkData( +@@ -865,4 +906,49 @@ public record SerializableChunkData( } // Paper end - starlight - convert from record } diff --git a/patches/unapplied/server/minecraft-patches/features/0040-Async-mob-spawning.patch b/divinemc-server/minecraft-patches/features/0040-Async-mob-spawning.patch similarity index 79% rename from patches/unapplied/server/minecraft-patches/features/0040-Async-mob-spawning.patch rename to divinemc-server/minecraft-patches/features/0040-Async-mob-spawning.patch index ccd9bae..5d69edc 100644 --- a/patches/unapplied/server/minecraft-patches/features/0040-Async-mob-spawning.patch +++ b/divinemc-server/minecraft-patches/features/0040-Async-mob-spawning.patch @@ -5,22 +5,22 @@ Subject: [PATCH] Async mob spawning diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 51b79f614417f231951e9ba05b29ff0044e081e7..dee93ae262a2a06e68dfe8ae1b7193172c436990 100644 +index 0270e0045a76927e156f7bf54fed7ca406a113f8..d19337ce45a8ab7f6438f9101d61d17b70d68a47 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -291,6 +291,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // DivineMC - Skip EntityScheduler's executeTick checks if there isn't any tasks to be run + public org.bxteam.divinemc.util.AsyncProcessor mobSpawnExecutor = new org.bxteam.divinemc.util.AsyncProcessor("mob_spawning"); // DivineMC - Async mob spawning public static S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system + AtomicReference atomicReference = new AtomicReference<>(); diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f7c17a7db 100644 +index 9a65321ce62f21b150d29be30dbae7dba0ff40be..3bbaa9bdc7d49b456b5749e4880354c9f793a8b6 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -183,6 +183,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -182,6 +182,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - chunk tick iteration optimisations @@ -31,7 +31,7 @@ index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f public ServerChunkCache( ServerLevel level, -@@ -581,6 +585,35 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -505,6 +509,35 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon this.broadcastChangedChunks(); } @@ -57,7 +57,7 @@ index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f + MinecraftServer.getServer().mobSpawnExecutor.submit(() -> { + int mapped = distanceManager.getNaturalSpawnChunkCount(); + try { -+ lastSpawnState = NaturalSpawner.createState(mapped, new ArrayList<>(level.entityTickList.entities), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap), true); ++ lastSpawnState = NaturalSpawner.createState(mapped, new java.util.ArrayList<>(level.entityTickList.entities), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap), true); + } finally { } + spawnCountsReady.set(true); + }); @@ -67,7 +67,7 @@ index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f } private void broadcastChangedChunks() { -@@ -621,27 +654,31 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -522,27 +555,31 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - Optional per player mob spawns NaturalSpawner.SpawnState spawnState; @@ -113,7 +113,7 @@ index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); List filteredSpawningCategories; -@@ -655,7 +692,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -556,7 +593,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - PlayerNaturallySpawnCreaturesEvent boolean flag = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit @@ -122,24 +122,36 @@ index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f } else { filteredSpawningCategories = List.of(); } -@@ -663,8 +700,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - for (LevelChunk levelChunk : chunks) { - ChunkPos pos = levelChunk.getPos(); - levelChunk.incrementInhabitedTime(timeInhabited); -- if (!filteredSpawningCategories.isEmpty() && this.level.getWorldBorder().isWithinBounds(pos) && this.chunkMap.anyPlayerCloseEnoughForSpawning(pos, true)) { // Spigot -- NaturalSpawner.spawnForChunk(this.level, levelChunk, spawnState, filteredSpawningCategories); -+ // DivineMC start - Async mob spawning -+ if (!filteredSpawningCategories.isEmpty() && this.level.getWorldBorder().isWithinBounds(pos) && (!org.bxteam.divinemc.DivineConfig.enableAsyncSpawning || spawnCountsReady.get()) && this.chunkMap.anyPlayerCloseEnoughForSpawning(pos, true)) { // Spigot -+ NaturalSpawner.spawnForChunk(this.level, levelChunk, lastSpawnState, filteredSpawningCategories); -+ // DivineMC end - Async mob spawning - } +@@ -571,7 +608,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper end - chunk tick iteration optimisation - if (true) { // Paper - rewrite chunk system + for (LevelChunk levelChunk : list) { +- this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, spawnState); ++ this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, lastSpawnState); // DivineMC - Async mob spawning + } + } finally { + list.clear(); +@@ -590,11 +627,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + this.level.tickThunder(chunk); + } + +- if (!spawnCategories.isEmpty()) { +- if (this.level.getWorldBorder().isWithinBounds(pos)) { // Paper - rewrite chunk system +- NaturalSpawner.spawnForChunk(this.level, chunk, spawnState, spawnCategories); +- } ++ // DivineMC start - Async mob spawning ++ if (!spawnCategories.isEmpty() && this.level.getWorldBorder().isWithinBounds(pos) && (!org.bxteam.divinemc.DivineConfig.enableAsyncSpawning || spawnCountsReady.get())) { // Paper - rewrite chunk system ++ NaturalSpawner.spawnForChunk(this.level, chunk, spawnState, spawnCategories); + } ++ // DivineMC end - Async mob spawning + } + + private void getFullChunk(long chunkPos, Consumer fullChunkGetter) { diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index d3f5242fc66529bf3137da4d505a6cf55e749e43..650dfce05bfc68d4c664471b430bd5c0f9629283 100644 +index 68a074a1eb11b158af773a2c44aa49d5d8462080..a5f6f50ad1e276a908347d9c21527fb583734538 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -155,7 +155,18 @@ public final class NaturalSpawner { +@@ -149,7 +149,18 @@ public final class NaturalSpawner { return list; } @@ -158,7 +170,7 @@ index d3f5242fc66529bf3137da4d505a6cf55e749e43..650dfce05bfc68d4c664471b430bd5c0 for (MobCategory mobCategory : categories) { // Paper start - Optional per player mob spawns final boolean canSpawn; -@@ -642,6 +653,13 @@ public final class NaturalSpawner { +@@ -680,6 +691,13 @@ public final class NaturalSpawner { } boolean canSpawnForCategoryLocal(MobCategory category, ChunkPos chunkPos) { @@ -173,7 +185,7 @@ index d3f5242fc66529bf3137da4d505a6cf55e749e43..650dfce05bfc68d4c664471b430bd5c0 } } diff --git a/net/minecraft/world/level/entity/EntityTickList.java b/net/minecraft/world/level/entity/EntityTickList.java -index 018a04674897cfcec0e8de5cb2ab06243a994ae3..8c1de4654a3a29e75716a03efd476b8a3b7fe9e9 100644 +index c89701d7bdc9b889038d3c52f2232fb17624b113..9e75320e51886e0f93c23683d8614128f44a613e 100644 --- a/net/minecraft/world/level/entity/EntityTickList.java +++ b/net/minecraft/world/level/entity/EntityTickList.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; @@ -182,10 +194,10 @@ index 018a04674897cfcec0e8de5cb2ab06243a994ae3..8c1de4654a3a29e75716a03efd476b8a public class EntityTickList { - public final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system + public final java.util.concurrent.ConcurrentLinkedQueue entities = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - rewrite chunk system // DivineMC - Async mob spawning - // DivineMC start - Parallel world ticking - private final net.minecraft.server.level.ServerLevel serverLevel; -@@ -43,13 +43,13 @@ public class EntityTickList { + private void ensureActiveIsNotIterated() { + // Paper - rewrite chunk system +@@ -33,13 +33,13 @@ public class EntityTickList { // Paper start - rewrite chunk system // To ensure nothing weird happens with dimension travelling, do not iterate over new entries... // (by dfl iterator() is configured to not iterate over new entries) diff --git a/patches/unapplied/server/minecraft-patches/features/0046-Optimize-Raids.patch b/divinemc-server/minecraft-patches/features/0041-Optimize-Raids.patch similarity index 80% rename from patches/unapplied/server/minecraft-patches/features/0046-Optimize-Raids.patch rename to divinemc-server/minecraft-patches/features/0041-Optimize-Raids.patch index c380052..449edc8 100644 --- a/patches/unapplied/server/minecraft-patches/features/0046-Optimize-Raids.patch +++ b/divinemc-server/minecraft-patches/features/0041-Optimize-Raids.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Optimize Raids diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 92e35158b68dcb8d1f34fb1b748c12d1d39468c7..c87d1f81bd1b4b9756bd2f4c1dbc58a2dc85c63b 100644 +index 9c64da096bfd8325e0c8f692b8ae7f420096728a..d7ec2dd011a6728e7a1adb5a84f587904166df79 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -219,6 +219,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -214,6 +214,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current) public boolean hasRidableMoveEvent = false; // Purpur - Ridables public org.bxteam.divinemc.util.tps.TPSCalculator tpsCalculator = new org.bxteam.divinemc.util.tps.TPSCalculator(); // DivineMC - Lag Compensation + public net.minecraft.world.item.ItemStack ominousBanner; // DivineMC - Optimize Raids - public LevelChunk getChunkIfLoaded(int x, int z) { - return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately -@@ -714,6 +715,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - this.tickExecutor = java.util.concurrent.Executors.newSingleThreadExecutor(new org.bxteam.divinemc.server.ServerLevelTickExecutorThreadFactory(getWorld().getName())); // DivineMC - Parallel world ticking + @Override + public @Nullable LevelChunk getChunkIfLoaded(int x, int z) { +@@ -696,6 +697,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle this.chunkSystemPriorities = new org.bxteam.divinemc.server.chunk.PriorityHandler(this); // DivineMC - Chunk System optimizations + this.ominousBanner = Objects.requireNonNullElse(this.registryAccess(), net.minecraft.core.RegistryAccess.EMPTY).lookup(Registries.BANNER_PATTERN).map(Raid::getOminousBannerInstance).orElse(null); // DivineMC - Optimize Raids @@ -25,21 +25,21 @@ index 92e35158b68dcb8d1f34fb1b748c12d1d39468c7..c87d1f81bd1b4b9756bd2f4c1dbc58a2 // Paper start diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java -index 41b0db439b425b052bd1469daa6620a435ca852b..4e53cb7ad7c787fd7581763ae3e77c988277887c 100644 +index eb7208b03240d647ace22c41ac665d3030407196..f19ae5318b7d8e1225b19228bcdc7a93dd11c747 100644 --- a/net/minecraft/world/entity/raid/Raid.java +++ b/net/minecraft/world/entity/raid/Raid.java -@@ -109,6 +109,7 @@ public class Raid { - private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry PDC_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); - public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(PDC_TYPE_REGISTRY); - // Paper end +@@ -125,6 +125,7 @@ public class Raid { + private Raid.RaidStatus status; + private int celebrationTicks; + private Optional waveSpawnPos = Optional.empty(); + private boolean isBarDirty; // DivineMC - Optimize Raids - public Raid(int id, ServerLevel level, BlockPos center) { - this.id = id; -@@ -263,6 +264,12 @@ public class Raid { + public Raid(BlockPos center, Difficulty difficulty) { + this.active = true; +@@ -277,6 +278,12 @@ public class Raid { } - public void tick() { + public void tick(ServerLevel level) { + // DivineMC start - Optimize Raids + if (this.isBarDirty) { + this.raidEvent.setProgress(Mth.clamp(this.getHealthOfLivingRaiders() / this.totalHealth, 0.0F, 1.0F)); @@ -49,7 +49,7 @@ index 41b0db439b425b052bd1469daa6620a435ca852b..4e53cb7ad7c787fd7581763ae3e77c98 if (!this.isStopped()) { if (this.status == Raid.RaidStatus.ONGOING) { boolean flag = this.active; -@@ -581,7 +588,7 @@ public class Raid { +@@ -587,7 +594,7 @@ public class Raid { } public void updateBossbar() { @@ -59,7 +59,7 @@ index 41b0db439b425b052bd1469daa6620a435ca852b..4e53cb7ad7c787fd7581763ae3e77c98 public float getHealthOfLivingRaiders() { diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java -index c06b589e669b055a26f662df60070d5908256220..7f954bab6e8a1b25abcb3aa6c2d26315dacec930 100644 +index 77bb3aa7ff042aab6464aac55c846cb9082e5b97..b822905c38818434f3d406067d71b1db13e7efc8 100644 --- a/net/minecraft/world/entity/raid/Raider.java +++ b/net/minecraft/world/entity/raid/Raider.java @@ -42,9 +42,25 @@ import net.minecraft.world.phys.Vec3; @@ -88,10 +88,10 @@ index c06b589e669b055a26f662df60070d5908256220..7f954bab6e8a1b25abcb3aa6c2d26315 + return ominousBanner; + } + // DivineMC end - Optimize Raids + private static final int DEFAULT_WAVE = 0; + private static final boolean DEFAULT_CAN_JOIN_RAID = false; @Nullable - protected Raid raid; - private int wave; -@@ -147,7 +163,7 @@ public abstract class Raider extends PatrollingMonster { +@@ -149,7 +165,7 @@ public abstract class Raider extends PatrollingMonster { public boolean isCaptain() { ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD); boolean flag = !itemBySlot.isEmpty() @@ -100,7 +100,7 @@ index c06b589e669b055a26f662df60070d5908256220..7f954bab6e8a1b25abcb3aa6c2d26315 boolean isPatrolLeader = this.isPatrolLeader(); return flag && isPatrolLeader; } -@@ -211,7 +227,7 @@ public abstract class Raider extends PatrollingMonster { +@@ -212,7 +228,7 @@ public abstract class Raider extends PatrollingMonster { boolean flag = this.hasActiveRaid() && this.getCurrentRaid().getLeader(this.getWave()) != null; if (this.hasActiveRaid() && !flag @@ -109,7 +109,7 @@ index c06b589e669b055a26f662df60070d5908256220..7f954bab6e8a1b25abcb3aa6c2d26315 // Paper start - EntityPickupItemEvent fixes if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entity, 0, false).isCancelled()) { return; -@@ -398,6 +414,16 @@ public abstract class Raider extends PatrollingMonster { +@@ -399,6 +415,16 @@ public abstract class Raider extends PatrollingMonster { && !this.cannotPickUpBanner(); } @@ -126,7 +126,7 @@ index c06b589e669b055a26f662df60070d5908256220..7f954bab6e8a1b25abcb3aa6c2d26315 private boolean cannotPickUpBanner() { if (!this.mob.level().purpurConfig.pillagerBypassMobGriefing == !getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items // Purpur - Add mobGriefing bypass to everything affected if (!this.mob.hasActiveRaid()) { -@@ -407,7 +433,7 @@ public abstract class Raider extends PatrollingMonster { +@@ -408,7 +434,7 @@ public abstract class Raider extends PatrollingMonster { } else if (!this.mob.canBeLeader()) { return true; } else if (ItemStack.matches( diff --git a/patches/unapplied/server/minecraft-patches/features/0041-Dynamic-Activation-of-Brain.patch b/divinemc-server/minecraft-patches/features/0042-Dynamic-Activation-of-Brain.patch similarity index 87% rename from patches/unapplied/server/minecraft-patches/features/0041-Dynamic-Activation-of-Brain.patch rename to divinemc-server/minecraft-patches/features/0042-Dynamic-Activation-of-Brain.patch index 48e1f64..1318575 100644 --- a/patches/unapplied/server/minecraft-patches/features/0041-Dynamic-Activation-of-Brain.patch +++ b/divinemc-server/minecraft-patches/features/0042-Dynamic-Activation-of-Brain.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Dynamic Activation of Brain diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java -index ae0a3c3d9d6300293a6d0dff5cae49ebe7c11dab..3b08dad7a9fac7ac9acec0bfb85d4826452bdc99 100644 +index 265f20fd771df850a0bb0029e699d3146d883837..e9269a5ecf1eb95f1b41a090820d898bde86c3ec 100644 --- a/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java @@ -161,6 +161,21 @@ public final class ActivationRange { @@ -31,10 +31,10 @@ index ae0a3c3d9d6300293a6d0dff5cae49ebe7c11dab..3b08dad7a9fac7ac9acec0bfb85d4826 } } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 561066a2cf769e13ef3cea0881f7a2010ecbf2ec..5fe908ce51f95e1eab024dcd41ed108373f17fea 100644 +index d7ec2dd011a6728e7a1adb5a84f587904166df79..27ff3ae4400de969c95eb337cfd88f8137c77d3b 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -818,6 +818,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -802,6 +802,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.entityTickList .forEach( entity -> { @@ -43,10 +43,10 @@ index 561066a2cf769e13ef3cea0881f7a2010ecbf2ec..5fe908ce51f95e1eab024dcd41ed1083 if (!tickRateManager.isEntityFrozen(entity)) { entity.checkDespawn(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 04ae7636d14a40a427b5d9b746632b0c489efa21..f1cd66d7d96771bc4967e214f70c756fec30efe5 100644 +index 0a23d54a6f03b1d776ab24922f88144762c90875..b98010d6d3d369c680ccc8f15da9574e4f6a139c 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -336,6 +336,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -344,6 +344,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public boolean fixedPose = false; // Paper - Expand Pose API private final int despawnTime; // Paper - entity despawn time limit public int totalEntityAge; // Paper - age-like counter for all entities @@ -56,10 +56,10 @@ index 04ae7636d14a40a427b5d9b746632b0c489efa21..f1cd66d7d96771bc4967e214f70c756f // Paper start - EAR 2 public final boolean defaultActivationState; diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java -index 4186db5cb8d2cd29ebc230d704dd125ae0dfa358..79593dc0e42e4cf0aee5e7b8cac4aca186887d6f 100644 +index d6a0ad078fd1f0350afaac3f1743896d73b015e1..50bc352f4d918678a479a39b218973f7cd0500c7 100644 --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -1063,6 +1063,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -1075,6 +1075,7 @@ public class EntityType implements FeatureElement, EntityTypeT private final boolean canSpawnFarFromPlayer; private final int clientTrackingRange; private final int updateInterval; @@ -68,10 +68,10 @@ index 4186db5cb8d2cd29ebc230d704dd125ae0dfa358..79593dc0e42e4cf0aee5e7b8cac4aca1 @Nullable private Component description; diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index b4e19cc65701d5ef94e1cc0a7473225c222725c3..00daf8de01bf23f55ba8af12d3e3e551d981c61c 100644 +index d618752727e2f2f5c0c1afa97f455e349cb7e76c..ed89fe2ccfb5ce3e8384a108243288f6e542bc1d 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -218,10 +218,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -206,10 +206,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void inactiveTick() { super.inactiveTick(); @@ -84,7 +84,7 @@ index b4e19cc65701d5ef94e1cc0a7473225c222725c3..00daf8de01bf23f55ba8af12d3e3e551 this.targetSelector.tick(); } } -@@ -888,13 +888,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -754,13 +754,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab // Paper end - Allow nerfed mobs to jump and float this.sensing.tick(); int i = this.tickCount + this.getId(); @@ -147,10 +147,10 @@ index b816b2de8eb327060ca6ea7c4afc17373fa77ff6..4eed0bd3670fdcb0a156c29e7db63233 public boolean hasTasks() { for (WrappedGoal task : this.availableGoals) { diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java -index b2c9da89ae6044536f4996fdbd37e2cabf22ca12..fa9672e890f327dbdec57eadc258bbae8e98e91e 100644 +index 29c22b464705f1b50ec0e423c5df40d8f21e57b7..76d99e4a89fe7df736b836a165d829def489c07b 100644 --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -118,6 +118,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS +@@ -116,6 +116,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS private float spinningAnimationTicks0; public boolean forceDancing = false; // CraftBukkit private org.purpurmc.purpur.controller.FlyingMoveControllerWASD purpurController; // Purpur - Ridables @@ -158,7 +158,7 @@ index b2c9da89ae6044536f4996fdbd37e2cabf22ca12..fa9672e890f327dbdec57eadc258bbae public Allay(EntityType entityType, Level level) { super(entityType, level); -@@ -287,9 +288,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS +@@ -283,9 +284,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -176,10 +176,10 @@ index b2c9da89ae6044536f4996fdbd37e2cabf22ca12..fa9672e890f327dbdec57eadc258bbae @Override diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index bbfe48fd278cda9926793d0d2de743558fefd622..3f7c48282577a2de20e78b69ddcbc08347318fd3 100644 +index 0b787911c929f1564d859dcba1ee04510b4a9b7f..b3c09fe1a86f6a47448d4e71261ff34664758c17 100644 --- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -105,6 +105,7 @@ public class Axolotl extends Animal implements VariantHolder, B +@@ -110,6 +110,7 @@ public class Axolotl extends Animal implements Bucketable { public final BinaryAnimator onGroundAnimator = new BinaryAnimator(10, Mth::easeInOutSine); public final BinaryAnimator movingAnimator = new BinaryAnimator(10, Mth::easeInOutSine); private static final int REGEN_BUFF_BASE_DURATION = 100; @@ -187,7 +187,7 @@ index bbfe48fd278cda9926793d0d2de743558fefd622..3f7c48282577a2de20e78b69ddcbc083 public Axolotl(EntityType entityType, Level level) { super(entityType, level); -@@ -347,12 +348,16 @@ public class Axolotl extends Animal implements VariantHolder, B +@@ -372,12 +373,16 @@ public class Axolotl extends Animal implements Bucketable { @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -210,10 +210,10 @@ index bbfe48fd278cda9926793d0d2de743558fefd622..3f7c48282577a2de20e78b69ddcbc083 public static AttributeSupplier.Builder createAttributes() { diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index dfcba5c2c8a489ebe74c2d5c1fa980c401806757..1827dead0a0a1d8e9dfbcc44038c9dbfbefddd48 100644 +index 3ccc48afb7a9eb2290f16c6a3218515bee59c2bd..617d47d61dd97fd1c7b56db71e47f4e334a4f491 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -106,6 +106,7 @@ public class Frog extends Animal implements VariantHolder> { +@@ -105,6 +105,7 @@ public class Frog extends Animal { public final AnimationState swimIdleAnimationState = new AnimationState(); private org.purpurmc.purpur.controller.MoveControllerWASD purpurLandController; // Purpur - Ridables private org.purpurmc.purpur.controller.WaterMoveControllerWASD purpurWaterController; // Purpur - Ridables @@ -221,7 +221,7 @@ index dfcba5c2c8a489ebe74c2d5c1fa980c401806757..1827dead0a0a1d8e9dfbcc44038c9dbf public Frog(EntityType entityType, Level level) { super(entityType, level); -@@ -242,9 +243,13 @@ public class Frog extends Animal implements VariantHolder> { +@@ -259,9 +260,13 @@ public class Frog extends Animal { @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -239,10 +239,10 @@ index dfcba5c2c8a489ebe74c2d5c1fa980c401806757..1827dead0a0a1d8e9dfbcc44038c9dbf @Override diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java -index 78d256f6a95acb367efd690bc368d2106a928b8f..b32fabed65f929cb8d2c8c93667f2e45b9bef0b8 100644 +index 63645451495dffd87362fd37cf91a90717ae4470..615655b41eb51b18b9517110e463ef44837ff8dc 100644 --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -62,6 +62,7 @@ public class Tadpole extends AbstractFish { +@@ -63,6 +63,7 @@ public class Tadpole extends AbstractFish { ); public boolean ageLocked; // Paper private org.purpurmc.purpur.controller.WaterMoveControllerWASD purpurController; // Purpur - Ridables @@ -250,7 +250,7 @@ index 78d256f6a95acb367efd690bc368d2106a928b8f..b32fabed65f929cb8d2c8c93667f2e45 public Tadpole(EntityType entityType, Level level) { super(entityType, level); -@@ -133,9 +134,13 @@ public class Tadpole extends AbstractFish { +@@ -134,9 +135,13 @@ public class Tadpole extends AbstractFish { @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -268,18 +268,18 @@ index 78d256f6a95acb367efd690bc368d2106a928b8f..b32fabed65f929cb8d2c8c93667f2e45 public static AttributeSupplier.Builder createAttributes() { diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java -index e21f024d0ed7f936ff17df16bd9666fffbf44a75..1f46d9e9def33458001c4c30bf2e37486646d23f 100644 +index 01e1712854aaebc59db844045141b25561df8fc3..45aac1f956a54368f33e1292ba2dbfdd3e426bd0 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java -@@ -90,6 +90,7 @@ public class Goat extends Animal { - public static final EntityDataAccessor DATA_HAS_RIGHT_HORN = SynchedEntityData.defineId(Goat.class, EntityDataSerializers.BOOLEAN); +@@ -93,6 +93,7 @@ public class Goat extends Animal { + private static final boolean DEFAULT_HAS_RIGHT_HORN = true; private boolean isLoweringHead; private int lowerHeadTick; + private int behaviorTick = 0; // DivineMC - Dynamic Activation of Brain public Goat(EntityType entityType, Level level) { super(entityType, level); -@@ -230,9 +231,13 @@ public class Goat extends Animal { +@@ -233,9 +234,13 @@ public class Goat extends Animal { @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -297,10 +297,10 @@ index e21f024d0ed7f936ff17df16bd9666fffbf44a75..1f46d9e9def33458001c4c30bf2e3748 @Override diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index a5ee49e35b0825c03af058347ee189a7962e8027..4a02ff2dbea64cf6fb867872c08ad1b80fc5145b 100644 +index 0644f425cddebe8e5a65e69acae57db867380981..56fb3c23a265403a20cfab551aa002792cd942ea 100644 --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -84,6 +84,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -87,6 +87,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { MemoryModuleType.PACIFIED, MemoryModuleType.IS_PANICKING ); @@ -308,7 +308,7 @@ index a5ee49e35b0825c03af058347ee189a7962e8027..4a02ff2dbea64cf6fb867872c08ad1b8 public Hoglin(EntityType entityType, Level level) { super(entityType, level); -@@ -203,17 +204,21 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -206,17 +207,21 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -340,18 +340,18 @@ index a5ee49e35b0825c03af058347ee189a7962e8027..4a02ff2dbea64cf6fb867872c08ad1b8 @Override diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java -index b2e64c0d4c1943f8a50a03ba59318fc2e6b9e26a..a7f2c0aec77a8b196c9207b071ac904c30f34ee6 100644 +index 73049e486fbf8411819551b43e3ca641ed7a5578..acbbe69df488b085de44e7825e9713bdeb600308 100644 --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -143,6 +143,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento - public Set allowedBarterItems = new HashSet<>(); - public Set interestItems = new HashSet<>(); +@@ -128,6 +128,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento + private static final com.mojang.serialization.Codec> ITEM_SET_CODEC = net.minecraft.core.registries.BuiltInRegistries.ITEM + .byNameCodec().listOf().xmap(java.util.HashSet::new, List::copyOf); // CraftBukkit end + private int behaviorTick; // DivineMC - Dynamic Activation of Brain public Piglin(EntityType entityType, Level level) { super(entityType, level); -@@ -382,9 +383,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -357,9 +358,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -369,10 +369,10 @@ index b2e64c0d4c1943f8a50a03ba59318fc2e6b9e26a..a7f2c0aec77a8b196c9207b071ac904c @Override diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index 59a12809e5c7f5ee85ca1f587f6b77383a1ff062..9777f5e99909790b49b05ea64fe12dedaaba6a0a 100644 +index 97ee07ebbba5ad29f766dff5eb4e51fc0e12cfcb..0898a7ea98b60edb31828d91afb92db44f63f85e 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -113,6 +113,7 @@ public class Warden extends Monster implements VibrationSystem { +@@ -110,6 +110,7 @@ public class Warden extends Monster implements VibrationSystem { private final VibrationSystem.User vibrationUser; private VibrationSystem.Data vibrationData; AngerManagement angerManagement = new AngerManagement(this::canTargetEntity, Collections.emptyList()); @@ -380,7 +380,7 @@ index 59a12809e5c7f5ee85ca1f587f6b77383a1ff062..9777f5e99909790b49b05ea64fe12ded public Warden(EntityType entityType, Level level) { super(entityType, level); -@@ -306,18 +307,22 @@ public class Warden extends Monster implements VibrationSystem { +@@ -303,18 +304,22 @@ public class Warden extends Monster implements VibrationSystem { @Override protected void customServerAiStep(ServerLevel level) { @@ -414,10 +414,10 @@ index 59a12809e5c7f5ee85ca1f587f6b77383a1ff062..9777f5e99909790b49b05ea64fe12ded @Override diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java -index fec90e482c8935dfca609bbf90e67f86a1586221..2ac8a11e9afc6f776eba3dbe852d7b680ed21705 100644 +index a08818450ed6fd78bb429743ee044726fc7994e7..abf7308a41e7c28e1d9fd82d5f86022a80159bff 100644 --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java -@@ -179,6 +179,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -178,6 +178,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler ); private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur - Lobotomize stuck villagers private int notLobotomizedCount = 0; // Purpur - Lobotomize stuck villagers @@ -426,7 +426,7 @@ index fec90e482c8935dfca609bbf90e67f86a1586221..2ac8a11e9afc6f776eba3dbe852d7b68 public Villager(EntityType entityType, Level level) { this(entityType, level, VillagerType.PLAINS); -@@ -397,7 +399,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -400,7 +402,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } // Purpur end - Lobotomize stuck villagers // Pufferfish start diff --git a/patches/unapplied/server/minecraft-patches/features/0008-Parallel-world-ticking.patch b/patches/unapplied/server/0008-Parallel-world-ticking.patch similarity index 100% rename from patches/unapplied/server/minecraft-patches/features/0008-Parallel-world-ticking.patch rename to patches/unapplied/server/0008-Parallel-world-ticking.patch diff --git a/patches/unapplied/server/minecraft-patches/features/0013-Clump-experience-orbs.patch b/patches/unapplied/server/0013-Clump-experience-orbs.patch similarity index 98% rename from patches/unapplied/server/minecraft-patches/features/0013-Clump-experience-orbs.patch rename to patches/unapplied/server/0013-Clump-experience-orbs.patch index 63ef6ba..260b449 100644 --- a/patches/unapplied/server/minecraft-patches/features/0013-Clump-experience-orbs.patch +++ b/patches/unapplied/server/0013-Clump-experience-orbs.patch @@ -53,7 +53,7 @@ index a43e5190c0f9ae14ccecccd5b58dc0e17f18b0a1..06ffba13f211851e8f6d630a72b41474 private boolean canMerge(ExperienceOrb orb) { - return orb != this && canMerge(orb, this.getId(), this.value); -+ return org.bxteam.divinemc.DivineConfig.clumpOrbs ? orb.isAlive() && !this.is(orb) : orb != this && ExperienceOrb.canMerge(orb, this.getId(), this.value); // DivineMC - Clump experience orbs ++ return org.bxteam.divinemc.DivineConfig.clumpOrbs ? orb.isAlive() && !this.is(orb) : orb != this && canMerge(orb, this.getId(), this.value); // DivineMC - Clump experience orbs } private static boolean canMerge(ExperienceOrb orb, int amount, int other) { diff --git a/patches/unapplied/server/minecraft-patches/features/0017-MSPT-Tracking-for-each-world.patch b/patches/unapplied/server/0017-MSPT-Tracking-for-each-world.patch similarity index 100% rename from patches/unapplied/server/minecraft-patches/features/0017-MSPT-Tracking-for-each-world.patch rename to patches/unapplied/server/0017-MSPT-Tracking-for-each-world.patch diff --git a/patches/unapplied/server/minecraft-patches/features/0030-Catch-update-suppressors.patch b/patches/unapplied/server/0030-Catch-update-suppressors.patch similarity index 100% rename from patches/unapplied/server/minecraft-patches/features/0030-Catch-update-suppressors.patch rename to patches/unapplied/server/0030-Catch-update-suppressors.patch diff --git a/patches/unapplied/server/minecraft-patches/features/0033-Regionized-Chunk-Ticking.patch b/patches/unapplied/server/0033-Regionized-Chunk-Ticking.patch similarity index 100% rename from patches/unapplied/server/minecraft-patches/features/0033-Regionized-Chunk-Ticking.patch rename to patches/unapplied/server/0033-Regionized-Chunk-Ticking.patch diff --git a/patches/unapplied/server/minecraft-patches/features/0015-Option-to-allow-weird-movement-and-disable-teleporti.patch b/patches/unapplied/server/minecraft-patches/features/0015-Option-to-allow-weird-movement-and-disable-teleporti.patch deleted file mode 100644 index e2ea80b..0000000 --- a/patches/unapplied/server/minecraft-patches/features/0015-Option-to-allow-weird-movement-and-disable-teleporti.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 1 Feb 2025 18:03:13 +0300 -Subject: [PATCH] Option to allow weird movement and disable teleporting - players when they move too quickly - - -diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f8c76bb2c9fa625e191036dc58ef3dfb1d4ee930..5b8031a45b1f4f6d0e86c2a839d173a6e3f4f697 100644 ---- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -574,7 +574,7 @@ public class ServerGamePacketListenerImpl - return; - } - // Paper end - Prevent moving into unloaded chunks -- if (d7 - d6 > Math.max(100.0, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { -+ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && (d7 - d6 > Math.max(100.0, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner())) { // DivineMC - stop weird movement - // CraftBukkit end - LOGGER.warn( - "{} (vehicle of {}) moved too quickly! {},{},{}", rootVehicle.getName().getString(), this.player.getName().getString(), d3, d4, d5 -@@ -604,7 +604,7 @@ public class ServerGamePacketListenerImpl - d5 = d2 - rootVehicle.getZ(); - d7 = d3 * d3 + d4 * d4 + d5 * d5; - boolean flag2 = false; -- if (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot -+ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold)) { // Spigot // DivineMC - stop weird movement - flag2 = true; // Paper - diff on change, this should be moved wrongly - LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getName().getString(), this.player.getName().getString(), Math.sqrt(d7)); - } -@@ -1453,18 +1453,22 @@ public class ServerGamePacketListenerImpl - if (this.shouldCheckPlayerMovement(isFallFlying)) { - float f2 = isFallFlying ? 300.0F : 100.0F; - if (d7 - d6 > Math.max(f2, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed))) { -- // CraftBukkit end -- // Paper start - Add fail move event -- io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY, -- toX, toY, toZ, toYaw, toPitch, true); -- if (!event.isAllowed()) { -- if (event.getLogWarning()) { -- LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5); -+ // DivineMC start - Stop teleporting players when they move too quickly -+ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && !(org.bxteam.divinemc.DivineConfig.ignoreMovedTooQuicklyWhenLagging && player.serverLevel().getServer().lagging)) { -+ // CraftBukkit end -+ // Paper start - Add fail move event -+ io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY, -+ toX, toY, toZ, toYaw, toPitch, true); -+ if (!event.isAllowed()) { -+ if (event.getLogWarning()) { -+ LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5); -+ } -+ this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot()); -+ return; - } -- this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot()); -- return; -+ // Paper end - Add fail move event - } -- // Paper end - Add fail move event -+ // DivineMC end - Stop teleporting players when they move too quickly - } - } - } -@@ -1525,6 +1529,7 @@ public class ServerGamePacketListenerImpl - d7 = d3 * d3 + d4 * d4 + d5 * d5; - boolean movedWrongly = false; // Paper - Add fail move event; rename - if (!this.player.isChangingDimension() -+ && !org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement // DivineMC - Stop teleporting players when they move too quickly - && d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold // Spigot - && !this.player.isSleeping() - && !this.player.gameMode.isCreative()