diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0037-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/features/0037-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch deleted file mode 100644 index dd6cb21a..00000000 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0037-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MrPowerGamerBR -Date: Fri, 17 Nov 2023 14:22:41 -0300 -Subject: [PATCH] SparklyPaper: Skip "MapItem#update()" if the map does not - have the CraftMapRenderer present - -Original project: https://github.com/SparklyPower/SparklyPaper - -Optimizes "image in map" maps, without requiring the map to be locked, which some old map plugins may not do - -This has the disadvantage that the vanilla map data will never be updated while the CraftMapRenderer is not present, but that's not a huuuge problem for u - -diff --git a/net/minecraft/world/item/MapItem.java b/net/minecraft/world/item/MapItem.java -index 309392d414ecbe60474abd0af534184740951707..fd8418fc1487b0669907569142955887257f81c0 100644 ---- a/net/minecraft/world/item/MapItem.java -+++ b/net/minecraft/world/item/MapItem.java -@@ -278,7 +278,7 @@ public class MapItem extends Item { - savedData.tickCarriedBy(player, stack); - } - -- if (!savedData.locked && (isSelected || entity instanceof Player && ((Player)entity).getOffhandItem() == stack)) { -+ if (!savedData.locked && (!org.dreeam.leaf.config.modules.opt.SkipMapItemDataUpdates.enabled || savedData.mapView.getRenderers().stream().anyMatch(mapRenderer -> mapRenderer.getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class)) && (isSelected || entity instanceof Player && ((Player)entity).getOffhandItem() == stack)) { // SparklyPaper - don't update maps if they don't have the CraftMapRenderer in the render list - this.update(level, entity, savedData); - } - } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0081-Skip-unnecessary-mob-spawning-computations.patch b/leaf-archived-patches/work/server/0081-Skip-unnecessary-mob-spawning-computations.patch similarity index 100% rename from leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0081-Skip-unnecessary-mob-spawning-computations.patch rename to leaf-archived-patches/work/server/0081-Skip-unnecessary-mob-spawning-computations.patch diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/1004-Pufferfish-Optimize-mob-spawning.patch b/leaf-server/minecraft-patches/features/0096-Pufferfish-Optimize-mob-spawning.patch similarity index 76% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/1004-Pufferfish-Optimize-mob-spawning.patch rename to leaf-server/minecraft-patches/features/0096-Pufferfish-Optimize-mob-spawning.patch index ab709291..04738eaf 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/1004-Pufferfish-Optimize-mob-spawning.patch +++ b/leaf-server/minecraft-patches/features/0096-Pufferfish-Optimize-mob-spawning.patch @@ -22,22 +22,22 @@ and, in my opinion, worth the low risk of minor mob-spawning-related inconsistencies. diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 4ba85d704ffebae38f7a76a97a182e3674730c6f..a76b67a846b12a7b3d0c41b6ac4833d4f0372531 100644 +index 99e9fe7562520e37f8b0fa938b53a973b23c65c3..ff1f5943cb99353df6069060c67da86516c9c956 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -286,6 +286,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation + public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize 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/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index bd7f792c45059f0652e530608ef0c77c5caf7cfa..649403ef1d5d898052412d6d47783769f291b94f 100644 +index cd266af35c7b8455af19adc9b0874cdd7572217f..349eafa321c955c6bda7a5aa6931311d85867565 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -363,6 +363,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -320,6 +320,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface LOGGER.info("JMX monitoring enabled"); } @@ -47,10 +47,10 @@ index bd7f792c45059f0652e530608ef0c77c5caf7cfa..649403ef1d5d898052412d6d47783769 } } diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 7a18b11782b2524280fddf20e6b1cabdddf07c49..55f708438e5d71cf14f4e632fc20a65b4bfb7d25 100644 +index 52cef9fed4a68d16d89eabacbad073ead0685972..229e115447b06db3e3b440ee8ea0505979656846 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -179,6 +179,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -182,6 +182,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - chunk tick iteration optimisations @@ -59,17 +59,7 @@ index 7a18b11782b2524280fddf20e6b1cabdddf07c49..55f708438e5d71cf14f4e632fc20a65b public ServerChunkCache( ServerLevel level, -@@ -503,7 +505,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - this.collectTickingChunks(list); - // 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 -+ 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(l, list); // Gale - Purpur - remove vanilla profiler - } finally { -@@ -513,6 +516,54 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -506,6 +508,54 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon this.broadcastChangedChunks(); // Gale - Purpur - remove vanilla profiler } @@ -124,15 +114,15 @@ index 7a18b11782b2524280fddf20e6b1cabdddf07c49..55f708438e5d71cf14f4e632fc20a65b } private void broadcastChangedChunks() { // Gale - Purpur - remove vanilla profiler -@@ -560,6 +611,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount(); +@@ -524,6 +574,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon // Paper start - Optional per player mob spawns + NaturalSpawner.SpawnState spawnState; if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled + if (!org.dreeam.leaf.config.modules.async.AsyncMobSpawning.enabled) { // Pufferfish - moved down when async processing // re-set mob counts for (ServerPlayer player : this.level.players) { // Paper start - per player mob spawning backoff -@@ -574,12 +626,16 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -538,12 +589,16 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - per player mob spawning backoff } @@ -149,10 +139,10 @@ index 7a18b11782b2524280fddf20e6b1cabdddf07c49..55f708438e5d71cf14f4e632fc20a65b // Paper end - Optional per player mob spawns - this.lastSpawnState = spawnState; + //this.lastSpawnState = spawnState; // Pufferfish - this is managed asynchronously - // Gale start - MultiPaper - skip unnecessary mob spawning computations - } else { - spawnState = null; -@@ -597,7 +653,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + 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; +@@ -557,7 +612,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 @@ -161,17 +151,24 @@ index 7a18b11782b2524280fddf20e6b1cabdddf07c49..55f708438e5d71cf14f4e632fc20a65b } else { filteredSpawningCategories = List.of(); } -@@ -605,8 +661,8 @@ 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); -+ if (!filteredSpawningCategories.isEmpty() && this.level.getWorldBorder().isWithinBounds(pos) && (!org.dreeam.leaf.config.modules.async.AsyncMobSpawning.enabled || _pufferfish_spawnCountsReady.get()) && this.chunkMap.anyPlayerCloseEnoughForSpawning(pos, true)) { // Spigot // Pufferfish -+ NaturalSpawner.spawnForChunk(this.level, levelChunk, lastSpawnState, filteredSpawningCategories); // Pufferfish - } +@@ -572,7 +627,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); // Pufferfish + } + } finally { + list.clear(); +@@ -592,7 +647,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + + if (!spawnCategories.isEmpty()) { +- if (this.level.getWorldBorder().isWithinBounds(pos)) { // Paper - rewrite chunk system ++ if (this.level.getWorldBorder().isWithinBounds(pos) && (!org.dreeam.leaf.config.modules.async.AsyncMobSpawning.enabled || _pufferfish_spawnCountsReady.get())) { // Paper - rewrite chunk system // Pufferfish + NaturalSpawner.spawnForChunk(this.level, chunk, spawnState, spawnCategories); + } + } diff --git a/net/minecraft/world/level/entity/EntityTickList.java b/net/minecraft/world/level/entity/EntityTickList.java index 423779a2b690f387a4f0bd07b97b50e0baefda76..dec51066fc3f57b7bdc56195313c219f45a7fbee 100644 --- a/net/minecraft/world/level/entity/EntityTickList.java diff --git a/leaf-server/minecraft-patches/features/0096-Pufferfish-Dynamic-Activation-of-Brain.patch b/leaf-server/minecraft-patches/features/0097-Pufferfish-Dynamic-Activation-of-Brain.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0096-Pufferfish-Dynamic-Activation-of-Brain.patch rename to leaf-server/minecraft-patches/features/0097-Pufferfish-Dynamic-Activation-of-Brain.patch diff --git a/leaf-server/minecraft-patches/features/0097-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch b/leaf-server/minecraft-patches/features/0098-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0097-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch rename to leaf-server/minecraft-patches/features/0098-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch diff --git a/leaf-server/minecraft-patches/features/0098-Purpur-Configurable-server-mod-name.patch b/leaf-server/minecraft-patches/features/0099-Purpur-Configurable-server-mod-name.patch similarity index 84% rename from leaf-server/minecraft-patches/features/0098-Purpur-Configurable-server-mod-name.patch rename to leaf-server/minecraft-patches/features/0099-Purpur-Configurable-server-mod-name.patch index c2381aba..f680e9dc 100644 --- a/leaf-server/minecraft-patches/features/0098-Purpur-Configurable-server-mod-name.patch +++ b/leaf-server/minecraft-patches/features/0099-Purpur-Configurable-server-mod-name.patch @@ -7,10 +7,10 @@ Original license: MIT Original project: https://github.com/PurpurMC/Purpur diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 99e9fe7562520e37f8b0fa938b53a973b23c65c3..c84f187395d6b2d4c2e891aa545324f213902457 100644 +index ff1f5943cb99353df6069060c67da86516c9c956..0c4c76eb3fe04a67784997a19678f081eb86d00e 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1804,7 +1804,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop CompletableFuture> sequence(List> futures) { + return sequence(futures, false); + } -+ + public static CompletableFuture> sequence(List> futures, boolean useFaster) { + // Leaf end - Faster sequencing of futures for chunk structure gen if (futures.isEmpty()) { @@ -27,16 +26,14 @@ index 80a7a85e1a03a1ca406259207e1ae3b909b3284f..b097f685e826e70008e3a096ee5f1d4f return futures.get(0).thenApply(List::of); } else { CompletableFuture completableFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); -+ + if (useFaster) return sequenceFaster(futures, completableFuture); // Leaf - Faster sequencing of futures for chunk structure gen -+ return completableFuture.thenApply(_void -> futures.stream().map(CompletableFuture::join).toList()); } } + // Leaf start - Faster sequencing of futures for chunk structure gen + private static CompletableFuture> sequenceFaster(List> futures, CompletableFuture completableFuture) { -+ return completableFuture.thenCompose(void_ -> ++ return completableFuture.thenCompose($ -> + CompletableFuture.supplyAsync(() -> { + List list = new java.util.ArrayList<>(); + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/1032-Reduce-active-items-finding-hopper-nearby-check.patch b/leaf-server/minecraft-patches/features/0116-Reduce-active-items-finding-hopper-nearby-check.patch similarity index 90% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/1032-Reduce-active-items-finding-hopper-nearby-check.patch rename to leaf-server/minecraft-patches/features/0116-Reduce-active-items-finding-hopper-nearby-check.patch index a6298b8f..f911917a 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/1032-Reduce-active-items-finding-hopper-nearby-check.patch +++ b/leaf-server/minecraft-patches/features/0116-Reduce-active-items-finding-hopper-nearby-check.patch @@ -9,10 +9,10 @@ But still recommend to turn-off `checkForMinecartNearItemWhileActive` Since `Reduce-hopper-item-checks.patch` will cause lag under massive dropped items diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java -index 6436afc0e59a8efdc9551fdde4d03d245548f3ef..280d9d5a23f5fc8560ca8eeb4f3652ea9c1505b2 100644 +index 6d01f8f8d95573cc545a0c1058cea87f40a39f05..8773952bb271158ca5387a2e8813c16116d8ee64 100644 --- a/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java -@@ -241,7 +241,11 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -242,7 +242,11 @@ public class ItemEntity extends Entity implements TraceableEntity { this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause return; // Gale - EMC - reduce hopper item checks } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0036-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch b/leaf-server/minecraft-patches/features/0117-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch similarity index 90% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0036-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch rename to leaf-server/minecraft-patches/features/0117-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch index dbaec233..24771d94 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0036-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch +++ b/leaf-server/minecraft-patches/features/0117-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch @@ -11,10 +11,10 @@ The "distanceToSqr" call is a bit expensive, so avoiding it is pretty nice, arou We could also check if the x,y,z coordinates are equal, but for now, let's just keep the identity check, which also helps us since Minecraft's code does reuse the original delta movement Vec3 object diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index d985555a029d06ffc73dd10115df47b83c9afafd..ddf2a5e2cfeaa666a081dd857d6a6003d65d0e00 100644 +index bcbc25c6dc5a2063b1ad410194a25b0d5ff7c8d8..936429fd17d8649329e6258a4e10c9e6bf62f6de 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -201,6 +201,7 @@ public class ServerEntity { +@@ -206,6 +206,7 @@ public class ServerEntity { if (this.entity.hasImpulse || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) { Vec3 deltaMovement = this.entity.getDeltaMovement(); @@ -22,7 +22,7 @@ index d985555a029d06ffc73dd10115df47b83c9afafd..ddf2a5e2cfeaa666a081dd857d6a6003 double d = deltaMovement.distanceToSqr(this.lastSentMovement); if (d > 1.0E-7 || d > 0.0 && deltaMovement.lengthSqr() == 0.0) { this.lastSentMovement = deltaMovement; -@@ -218,6 +219,7 @@ public class ServerEntity { +@@ -223,6 +224,7 @@ public class ServerEntity { this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); } } diff --git a/leaf-server/minecraft-patches/features/0118-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch b/leaf-server/minecraft-patches/features/0118-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch new file mode 100644 index 00000000..976d2def --- /dev/null +++ b/leaf-server/minecraft-patches/features/0118-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Fri, 17 Nov 2023 14:22:41 -0300 +Subject: [PATCH] SparklyPaper: Skip "MapItem#update()" if the map does not + have the CraftMapRenderer present + +Original project: https://github.com/SparklyPower/SparklyPaper + +Optimizes "image in map" maps, without requiring the map to be locked, which some old map plugins may not do + +This has the disadvantage that the vanilla map data will never be updated while the CraftMapRenderer is not present, but that's not a huuuge problem for u + +diff --git a/net/minecraft/world/item/MapItem.java b/net/minecraft/world/item/MapItem.java +index ba0b254d43651bca1f29b5272af05d068fc37ba8..2c6349285f598a4fbbc891eca1fb05efab109458 100644 +--- a/net/minecraft/world/item/MapItem.java ++++ b/net/minecraft/world/item/MapItem.java +@@ -274,7 +274,7 @@ public class MapItem extends Item { + savedData.tickCarriedBy(player, stack); + } + +- if (!savedData.locked && slot != null && slot.getType() == EquipmentSlot.Type.HAND) { ++ if (!savedData.locked && slot != null && slot.getType() == EquipmentSlot.Type.HAND && (!org.dreeam.leaf.config.modules.opt.SkipMapItemDataUpdates.enabled || savedData.mapView.getRenderers().stream().anyMatch(mapRenderer -> mapRenderer.getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class))) { // SparklyPaper - don't update maps if they don't have the CraftMapRenderer in the render list + this.update(level, entity, savedData); + } + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0038-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch b/leaf-server/minecraft-patches/features/0119-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch similarity index 83% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0038-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch rename to leaf-server/minecraft-patches/features/0119-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch index f3ddd0b8..c302250c 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0038-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch +++ b/leaf-server/minecraft-patches/features/0119-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch @@ -13,18 +13,18 @@ To avoid the hefty ArrayDeque's size() call, we check if we *really* need to exe Most entities won't have any scheduled tasks, so this is a nice performance bonus. These optimizations, however, wouldn't work in a Folia environment, but because in SparklyPaper executeTick is always executed on the main thread, it ain't an issue for us (yay). diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 30747b30596208bc02dfb4a6c31f8afb5c1aba8e..ed8d4f54ea49123cd60eda4fec4d0612e1478c38 100644 +index 0c4c76eb3fe04a67784997a19678f081eb86d00e..6685763f33a86c7faf7d26d58685e8402d399980 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -290,6 +290,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation - protected boolean upnp = false; // Purpur - UPnP Port Forwarding - public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("Leaf Async Mob Spawn Thread"); // Pufferfish - optimize mob spawning // Leaf - Fix Pufferfish and Purpur patches - Unify thread name + public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning + public final Set entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // SparklyPaper - skip EntityScheduler's executeTick checks if there isn't any tasks to be run (concurrent because plugins may schedule tasks async) public static S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system -@@ -1674,6 +1675,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop atomicReference = new AtomicReference<>(); +@@ -1629,6 +1630,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { for (final net.minecraft.world.entity.Entity entity : level.getEntities().getAll()) { if (entity.isRemoved()) { -@@ -1685,6 +1702,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= 0 ? entity.level().purpurConfig.snowballDamage : entity instanceof Blaze ? 3 : 0; // Purpur - Add configurable snowball damage + int i = entity instanceof Blaze ? 3 : 0; entity.hurt(this.damageSources().thrown(this, this.getOwner()), i); + // Leaf start - Polpot - Make snowball can knockback player + if (org.dreeam.leaf.config.modules.gameplay.Knockback.snowballCanKnockback && entity instanceof net.minecraft.server.level.ServerPlayer serverPlayer) { @@ -21,12 +21,12 @@ index 1d399532c67c213c95c06837b0c7855384f1a25c..16fc473415872a626c130c90b1fc76c4 + // Leaf end - Polpot - Make snowball can knockback player } - // Purpur start - options to extinguish fire blocks with snowballs - borrowed and modified code from ThrownPotion#onHitBlock and ThrownPotion#dowseFire + @Override diff --git a/net/minecraft/world/entity/projectile/ThrownEgg.java b/net/minecraft/world/entity/projectile/ThrownEgg.java -index 76481c0e77fc3a2e4be8eeb9de8d1e6de5507c64..46628c2cc23488b921f5ce1fa787712c996d9e21 100644 +index 73ec34b43f3fb2aa3edc3f1cb48a923d1fa32036..0e4cba55c15d17af2dff7d9e10cecaf821853475 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/leaf-archived-patches/unapplied/server/minecraft-patches/features/0042-Redirect-vanilla-getProfiler-to-inactive-in-PathNavi.patch b/leaf-server/minecraft-patches/features/0123-Redirect-vanilla-getProfiler-to-inactive-in-PathNavi.patch similarity index 86% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0042-Redirect-vanilla-getProfiler-to-inactive-in-PathNavi.patch rename to leaf-server/minecraft-patches/features/0123-Redirect-vanilla-getProfiler-to-inactive-in-PathNavi.patch index 6a7b2c60..a42381f0 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0042-Redirect-vanilla-getProfiler-to-inactive-in-PathNavi.patch +++ b/leaf-server/minecraft-patches/features/0123-Redirect-vanilla-getProfiler-to-inactive-in-PathNavi.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Redirect vanilla getProfiler to inactive in To fix compatibility with some plugins, e.g. Citizens, ModelEngine, etc. diff --git a/net/minecraft/world/level/PathNavigationRegion.java b/net/minecraft/world/level/PathNavigationRegion.java -index 97a1cb8f30eb1668b1054912789bd100b96bee18..89b293acd22c3f9b324b30d9b1919a8765b11fe7 100644 +index 21dee87c792dcba52d9dff637e4729a2ec377ac0..89571b56618ad83b8fd1c218f0f2bb0a72ea3d49 100644 --- a/net/minecraft/world/level/PathNavigationRegion.java +++ b/net/minecraft/world/level/PathNavigationRegion.java -@@ -150,4 +150,10 @@ public class PathNavigationRegion implements CollisionGetter { +@@ -153,4 +153,10 @@ public class PathNavigationRegion implements CollisionGetter { public int getHeight() { return this.level.getHeight(); } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0043-Remove-useless-creating-stats-json-bases-on-player-n.patch b/leaf-server/minecraft-patches/features/0124-Remove-useless-creating-stats-json-bases-on-player-n.patch similarity index 85% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0043-Remove-useless-creating-stats-json-bases-on-player-n.patch rename to leaf-server/minecraft-patches/features/0124-Remove-useless-creating-stats-json-bases-on-player-n.patch index dd7876a9..ecb871ce 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0043-Remove-useless-creating-stats-json-bases-on-player-n.patch +++ b/leaf-server/minecraft-patches/features/0124-Remove-useless-creating-stats-json-bases-on-player-n.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove useless creating stats json bases on player name logic diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 4c172e2aee3e48d42009cd39b28f694aa71e20e3..386423589443051b8c461926c570352dd612a051 100644 +index 8bbf8d660a68c8c74204e101ec3ec0b775883090..68d8bb239c2e48e5b3e280676274067e1f597620 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -1561,6 +1561,8 @@ public abstract class PlayerList { +@@ -1377,6 +1377,8 @@ public abstract class PlayerList { if (serverStatsCounter == null) { File file = this.server.getWorldPath(LevelResource.PLAYER_STATS_DIR).toFile(); File file1 = new File(file, uuid + ".json"); @@ -17,7 +17,7 @@ index 4c172e2aee3e48d42009cd39b28f694aa71e20e3..386423589443051b8c461926c570352d if (!file1.exists()) { File file2 = new File(file, displayName + ".json"); // CraftBukkit Path path = file2.toPath(); -@@ -1568,6 +1570,8 @@ public abstract class PlayerList { +@@ -1384,6 +1386,8 @@ public abstract class PlayerList { file2.renameTo(file1); } } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0045-Virtual-thread-for-chat-executor.patch b/leaf-server/minecraft-patches/features/0125-Virtual-thread-for-chat-executor.patch similarity index 90% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0045-Virtual-thread-for-chat-executor.patch rename to leaf-server/minecraft-patches/features/0125-Virtual-thread-for-chat-executor.patch index 96a0d06c..92ac237f 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0045-Virtual-thread-for-chat-executor.patch +++ b/leaf-server/minecraft-patches/features/0125-Virtual-thread-for-chat-executor.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Virtual thread for chat executor diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index ed8d4f54ea49123cd60eda4fec4d0612e1478c38..5a0d30b8ff5e377224de67c9f464bd1c694a4397 100644 +index 6685763f33a86c7faf7d26d58685e8402d399980..8d8e6cc29a783810a27483ad213f020979ede359 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -2678,7 +2678,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop true) ++ Codec.BOOL.lenientOptionalFieldOf("enforcesSecureChat", false).forGetter(x -> true) + ) + .apply(instance, ServerStatus::new) + // Leaf end- Mirai - Configurable chat message signatures @@ -91,10 +91,10 @@ index 30bd254542d631676494f349ff3f44f52d54ab2f..63e6411d8bac1629e143cc620fe35dba public record Favicon(byte[] iconBytes) { diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index 5151c24697ceb01b4728d7d3fda5fee31db682d7..d4048661575ebfaf128ba25da365843774364e0e 100644 +index 349eafa321c955c6bda7a5aa6931311d85867565..f1bd860f9ab3ac2e2a09be9232550e627f3c1040 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 +@@ -580,6 +580,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @Override public boolean enforceSecureProfile() { @@ -103,10 +103,10 @@ index 5151c24697ceb01b4728d7d3fda5fee31db682d7..d4048661575ebfaf128ba25da3658437 // 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 285af1576d6bef09f094b7e990b5bcd6eafda71f..96b70c1384834a8e22925c8e2af85ab7606dde20 100644 +index 8c3255661221f8afbccb661bec3afb47e4059403..0450c85bf7c7af1c863514f7c13b5fe15233dac6 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -321,10 +321,30 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -308,10 +308,30 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } public void send(Packet packet) { @@ -138,10 +138,10 @@ index 285af1576d6bef09f094b7e990b5bcd6eafda71f..96b70c1384834a8e22925c8e2af85ab7 if (packet == null || this.processedDisconnect) { // Spigot return; diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 84f9a8a606ede4ef8361a2683d775121e57b6d9b..e8683f45823cac55e3e68ccc500f10f0632e72fd 100644 +index 68d8bb239c2e48e5b3e280676274067e1f597620..a6340714eab6d7eafae639c6aeb2aeb75a0e6c07 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -1521,7 +1521,7 @@ public abstract class PlayerList { +@@ -1336,7 +1336,7 @@ public abstract class PlayerList { public void broadcastChatMessage(PlayerChatMessage message, Predicate shouldFilterMessageTo, @Nullable ServerPlayer sender, ChatType.Bound boundChatType, @Nullable Function unsignedFunction) { // Paper end boolean flag = this.verifyChatTrusted(message); @@ -150,10 +150,10 @@ index 84f9a8a606ede4ef8361a2683d775121e57b6d9b..e8683f45823cac55e3e68ccc500f10f0 OutgoingChatMessage outgoingChatMessage = OutgoingChatMessage.create(message); boolean flag1 = false; -@@ -1546,6 +1546,7 @@ public abstract class PlayerList { +@@ -1361,6 +1361,7 @@ public abstract class PlayerList { } - public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public + public boolean verifyChatTrusted(PlayerChatMessage message) { + if (!org.dreeam.leaf.config.modules.network.ChatMessageSignature.enabled) return true; // Leaf - Mirai - Configurable chat message signatures return message.hasSignature() && !message.hasExpiredServer(Instant.now()); } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0048-Cache-player-profileResult.patch b/leaf-server/minecraft-patches/features/0128-Cache-player-profileResult.patch similarity index 93% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0048-Cache-player-profileResult.patch rename to leaf-server/minecraft-patches/features/0128-Cache-player-profileResult.patch index 22f7af70..a04dc465 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0048-Cache-player-profileResult.patch +++ b/leaf-server/minecraft-patches/features/0128-Cache-player-profileResult.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cache player profileResult diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 069477e524a28b20a0289221858bdc802704a890..21ecbbdd97204477dadd2ade1d93f64cf91c7dfe 100644 +index 451a8b9f4deda749b0cb08adb4b5408c2e3ffd93..0aa72ed879e9f7199b75defca884bf8242caae99 100644 --- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -71,6 +71,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -70,6 +70,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, private net.minecraft.server.level.ServerPlayer player; // CraftBukkit public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding private int velocityLoginMessageId = -1; // Paper - Add Velocity IP Forwarding Support @@ -20,7 +20,7 @@ index 069477e524a28b20a0289221858bdc802704a890..21ecbbdd97204477dadd2ade1d93f64c public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection, boolean transferred) { this.server = server; -@@ -304,9 +309,23 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -303,9 +308,23 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, String string1 = Objects.requireNonNull(ServerLoginPacketListenerImpl.this.requestedUsername, "Player name not initialized"); try { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0049-Matter-Secure-Seed.patch b/leaf-server/minecraft-patches/features/0129-Matter-Secure-Seed.patch similarity index 94% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0049-Matter-Secure-Seed.patch rename to leaf-server/minecraft-patches/features/0129-Matter-Secure-Seed.patch index 6278be9a..9488654c 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0049-Matter-Secure-Seed.patch +++ b/leaf-server/minecraft-patches/features/0129-Matter-Secure-Seed.patch @@ -13,10 +13,10 @@ Co-authored-by: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Co-authored-by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com> diff --git a/net/minecraft/server/dedicated/DedicatedServerProperties.java b/net/minecraft/server/dedicated/DedicatedServerProperties.java -index 5748658abf0b90812005ae9d426df92daf5532f0..4a0eed7d7645ed539857592d233214e9a74499f1 100644 +index f6518e29f805018c72222f5aaa7b662071665b65..1bf57875cb363e08734222ed59f3b77a2d0dfba5 100644 --- a/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java -@@ -114,7 +114,17 @@ public class DedicatedServerProperties extends Settings 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 54895ed9ad9b9b2c4c12cfcce89af453c430e3e6..721d89144074c5749642feb0a08d21fbcce4b2fe 100644 +index 229e115447b06db3e3b440ee8ea0505979656846..a9acfc3ba6c3447b4632d32fe24e9a09d55ba1e2 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -710,6 +710,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -674,6 +674,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } public ChunkGenerator getGenerator() { @@ -48,10 +48,10 @@ index 54895ed9ad9b9b2c4c12cfcce89af453c430e3e6..721d89144074c5749642feb0a08d21fb } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index f8bd39ddd7b6948734254acfb8b0235eff774133..3c92508724bd2c8244ee4591c6b00b01657216f2 100644 +index cce8c151e46873c2de9be77d832bf695ee44ee24..27b9669330e43c9a5679a44cc105e8de0b36d184 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -633,6 +633,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -604,6 +604,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe chunkGenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkGenerator, gen); } // CraftBukkit end @@ -60,25 +60,24 @@ index f8bd39ddd7b6948734254acfb8b0235eff774133..3c92508724bd2c8244ee4591c6b00b01 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..c562af16e20c2127482ea1f769ad042d36dbb1f6 100644 +index 6a8a5a76400beeaf69a17d53105a7a522ec5791e..cd6b9c40658b5caf804ebfe5419581894b067d59 100644 --- a/net/minecraft/world/entity/monster/Slime.java +++ b/net/minecraft/world/entity/monster/Slime.java -@@ -424,7 +424,12 @@ public class Slime extends Mob implements Enemy { +@@ -328,7 +328,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 +- 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 + // Leaf start - Matter - Secure Seed -+ boolean isSlimeChunk = org.dreeam.leaf.config.modules.misc.SecureSeed.enabled ++ boolean flag = level.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || org.dreeam.leaf.config.modules.misc.SecureSeed.enabled + ? 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; ++ : WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel) level).getSeed(), level.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Paper + // Leaf end - Matter - 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..3a6db5bc0c8be7d68e15317a621c1965fdc3a9bd 100644 +index 3b7f0d5fe40bdda65ab859a0c22bf0d369dc0f01..6683df8d0f5a61ab094393f761a3d3a22d6e0455 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java @@ -87,6 +87,10 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh @@ -108,13 +107,13 @@ index 6d565b52552534ce9cacfc35ad1bf4adcb69eac3..3a6db5bc0c8be7d68e15317a621c1965 + // Leaf end - Matter - 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..8a4ce8b3b050ad9fb7de007129f5f460110d0b09 100644 +index 857aa6e29b57a0a8eea4d7c14971b9dde59bb0d0..23806f5f0c6c4ec9a86a6ea13b89b4f57372e6f1 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(); @@ -127,7 +126,7 @@ index 6ed51cf42b5864194d671b5b56f5b9bdf0291dc0..8a4ce8b3b050ad9fb7de007129f5f460 long l = worldgenRandom.setDecorationSeed(level.getSeed(), blockPos.getX(), blockPos.getZ()); Set> set = new ObjectArraySet<>(); ChunkPos.rangeClosed(sectionPos.chunk(), 1).forEach(chunkPos -> { -@@ -556,8 +560,15 @@ public abstract class ChunkGenerator { +@@ -551,8 +555,15 @@ public abstract class ChunkGenerator { } else { ArrayList list1 = new ArrayList<>(list.size()); list1.addAll(list); @@ -309,7 +308,7 @@ index c92508741439a8d0d833ea02d0104416adb83c92..c05da7cfcd3d97a1716cb305be36ba9c 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..f73bd2d86b2fcffa55cd8cc82aa1febe3467c87a 100644 +index 4e72eb49dbf4c70ae7556ba6eb210fcd5ef36aaa..8df6dadfeb2c282bc3c3f521d31f7277caa77790 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 { @@ -364,10 +363,10 @@ index ee0d9dddb36b6879fa113299e24f1aa3b2b151cc..6584c9320361dbbdea1899ab9e43b444 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..aaf80406af22af288b1b2e36a7a5d00c26c5afa5 100644 +index 1f939b325ec5291b3c4aabc4735c863f9436a6f8..ee60717e39928a9f89ad6c7a9b3b52ac156871e6 100644 --- a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java +++ b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -@@ -118,8 +118,16 @@ public abstract class StructurePlacement { +@@ -119,8 +119,16 @@ 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 @@ -387,7 +386,7 @@ index 670335a7bbfbc9da64c389977498c22dfcd03251..aaf80406af22af288b1b2e36a7a5d00c } diff --git a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java -index eb85edaa3b7fab4f11545b0fa8bfea882dedb67d..4a5012400cd23590bd8e64670222995a200c93ea 100644 +index 1cfa0fcd28685736fcdce4aef817e4d4cc4061cb..400e5d1c415835a87648ae0d1aa92ac4063ae93c 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/leaf-archived-patches/unapplied/server/minecraft-patches/features/0050-Matter-Secure-Seed-command.patch b/leaf-server/minecraft-patches/features/0130-Matter-Secure-Seed-command.patch similarity index 100% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0050-Matter-Secure-Seed-command.patch rename to leaf-server/minecraft-patches/features/0130-Matter-Secure-Seed-command.patch diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0051-Faster-random-generator.patch b/leaf-server/minecraft-patches/features/0131-Faster-random-generator.patch similarity index 92% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0051-Faster-random-generator.patch rename to leaf-server/minecraft-patches/features/0131-Faster-random-generator.patch index 6e5d78c8..bbc36a6e 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0051-Faster-random-generator.patch +++ b/leaf-server/minecraft-patches/features/0131-Faster-random-generator.patch @@ -14,23 +14,23 @@ ThreadUnsafeRandom (Moonrise): 102,265,100 ns SimpleThreadUnsafeRandom (Moonrise): 97,054,600 ns diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 4070a6eb52f6097e38c2d85c231d39ea3785cf46..bb76dbf98979fdc725676c98dafe64ea941cb290 100644 +index a9acfc3ba6c3447b4632d32fe24e9a09d55ba1e2..0f9d18dd29e210ad656da211a3cb1cb25cd4efb1 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -150,7 +150,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -154,7 +154,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - rewrite chunk system // Paper start - chunk tick iteration optimisations - private final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom shuffleRandom = new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(0L); + private final net.minecraft.world.level.levelgen.BitRandomSource shuffleRandom = org.dreeam.leaf.config.modules.opt.FastRNG.enabled ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0L) : new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(0L); // Leaf - Faster random generator - private boolean isChunkNearPlayer(final ChunkMap chunkMap, final ChunkPos chunkPos, final LevelChunk levelChunk) { - final ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkData chunkData = ((ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkSystemChunkHolder)((ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkSystemLevelChunk)levelChunk).moonrise$getChunkAndHolder().holder()) - .moonrise$getRealChunkHolder().holderData; + private void iterateTickingChunksFaster() { + final ServerLevel world = this.level; + final int randomTickSpeed = world.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 3c92508724bd2c8244ee4591c6b00b01657216f2..0290e1f0c45677d337f77a0c8269894b32a43ca9 100644 +index 27b9669330e43c9a5679a44cc105e8de0b36d184..2c65987f7dda5b46a232a69e46b91090801fc246 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -902,7 +902,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -847,7 +847,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe private void optimiseRandomTick(final LevelChunk chunk, final int tickSpeed) { final LevelChunkSection[] sections = chunk.getSections(); final int minSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMinSection((ServerLevel)(Object)this); @@ -39,17 +39,17 @@ index 3c92508724bd2c8244ee4591c6b00b01657216f2..0290e1f0c45677d337f77a0c8269894b final boolean doubleTickFluids = !ca.spottedleaf.moonrise.common.PlatformHooks.get().configFixMC224294(); final ChunkPos cpos = chunk.getPos(); -@@ -951,7 +951,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -896,7 +896,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe private int currentIceAndSnowTick = 0; protected void resetIceAndSnowTick() { this.currentIceAndSnowTick = this.simpleRandom.nextInt(16); } // Gale - Airplane - optimize random calls in chunk ticking public void tickChunk(LevelChunk chunk, int randomTickSpeed) { - final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = this.simpleRandom; // Paper - optimise random ticking + final net.minecraft.world.level.levelgen.BitRandomSource simpleRandom = this.simpleRandom; // Paper - optimise random ticking // Leaf - Faster random generator - upcasting ChunkPos pos = chunk.getPos(); - boolean isRaining = this.isRaining(); int minBlockX = pos.getMinBlockX(); + int minBlockZ = pos.getMinBlockZ(); diff --git a/net/minecraft/util/RandomSource.java b/net/minecraft/util/RandomSource.java -index 98a54bc4de251014342cda6d0951b7fea79ce553..d6e86369689e5651698a569ef32d6e4cf4bb6229 100644 +index 8516d47b0ba79d91638837199e7ae0fb6cb44a79..4f4b55dd099dd2c2fea118b18b53588147e59bba 100644 --- a/net/minecraft/util/RandomSource.java +++ b/net/minecraft/util/RandomSource.java @@ -15,18 +15,40 @@ public interface RandomSource { @@ -97,10 +97,10 @@ index 98a54bc4de251014342cda6d0951b7fea79ce553..d6e86369689e5651698a569ef32d6e4c RandomSource fork(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index f500f4e32e676712fcd0c877498acc2722baae98..18dfaa60da8de12aea95cda21ee55636bf66f487 100644 +index 209d897fdf5a5d19990f6dd8ee11d42d74bd0e92..8ac90cc10625f395dba660e2358bbac79431b0cf 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 +@@ -148,7 +148,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper start - Share random for entities to make them more random @@ -110,10 +110,10 @@ index f500f4e32e676712fcd0c877498acc2722baae98..18dfaa60da8de12aea95cda21ee55636 private static final class RandomRandomSource extends ca.spottedleaf.moonrise.common.util.ThreadUnsafeRandom { public RandomRandomSource() { diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index b39d67ab9ed446885111a5387d3332c36b4f3cc9..53cabe7dabc83618c8941c95e95c5b7e23ee694e 100644 +index d56283aaf6726a5d71fb89f2c059db76c211d402..6b7efd6466d16276c37abfa1fd64df84b546f227 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -126,7 +126,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -117,7 +117,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl public float rainLevel; protected float oThunderLevel; public float thunderLevel; @@ -122,20 +122,20 @@ index b39d67ab9ed446885111a5387d3332c36b4f3cc9..53cabe7dabc83618c8941c95e95c5b7e @Deprecated private final RandomSource threadSafeRandom = RandomSource.createThreadSafe(); private final Holder dimensionTypeRegistration; -@@ -182,7 +182,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions +@@ -168,7 +168,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl + private int tileTickPosition; + public final Map explosionDensityCache = new java.util.HashMap<>(); // Paper - Optimize explosions public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here - - public final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed()); // Gale - Pufferfish - move random tick random + public final net.minecraft.world.level.levelgen.BitRandomSource simpleRandom = org.dreeam.leaf.config.modules.opt.FastRNG.enabled ? new org.dreeam.leaf.util.math.random.FasterRandomSource(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed()) : new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed()); // Gale - Pufferfish - move random tick random // Leaf - Faster random generator - // Purpur start - Add adjustable breeding cooldown to config - private com.google.common.cache.Cache playerBreedingCooldowns; + public CraftWorld getWorld() { + return this.world; diff --git a/net/minecraft/world/level/biome/Biome.java b/net/minecraft/world/level/biome/Biome.java -index f44461f92a10cbfdb8fcdbc3a2442e526b9d3d33..b4c5eea26e87ee6f466c53a6dd0867909df7e848 100644 +index bad1a03167f7586e5279592adcb43350c9b528cd..336d42d4e85716843633030ba1aa21b7901ca601 100644 --- a/net/minecraft/world/level/biome/Biome.java +++ b/net/minecraft/world/level/biome/Biome.java -@@ -54,14 +54,14 @@ public final class Biome { +@@ -55,14 +55,14 @@ public final class Biome { ); public static final Codec> CODEC = RegistryFileCodec.create(Registries.BIOME, DIRECT_CODEC); public static final Codec> LIST_CODEC = RegistryCodecs.homogeneousList(Registries.BIOME, DIRECT_CODEC); @@ -154,10 +154,10 @@ index f44461f92a10cbfdb8fcdbc3a2442e526b9d3d33..b4c5eea26e87ee6f466c53a6dd086790 public final Biome.ClimateSettings climateSettings; private final BiomeGenerationSettings generationSettings; diff --git a/net/minecraft/world/level/chunk/ChunkGenerator.java b/net/minecraft/world/level/chunk/ChunkGenerator.java -index 8a4ce8b3b050ad9fb7de007129f5f460110d0b09..176adfcaa0fc458043d4bc05ead1861864b63606 100644 +index 23806f5f0c6c4ec9a86a6ea13b89b4f57372e6f1..e1ebbfab87aed9cc633f2fedb1e6edeca4ddc2ec 100644 --- a/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -458,7 +458,7 @@ public abstract class ChunkGenerator { +@@ -455,7 +455,7 @@ public abstract class ChunkGenerator { int x = chunk.getPos().x; int z = chunk.getPos().z; for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) { @@ -166,7 +166,7 @@ index 8a4ce8b3b050ad9fb7de007129f5f460110d0b09..176adfcaa0fc458043d4bc05ead18618 seededrandom.setDecorationSeed(level.getSeed(), x, z); populator.populate(world, new org.bukkit.craftbukkit.util.RandomSourceWrapper.RandomWrapper(seededrandom), x, z, limitedRegion); } -@@ -565,7 +565,7 @@ public abstract class ChunkGenerator { +@@ -560,7 +560,7 @@ public abstract class ChunkGenerator { if (org.dreeam.leaf.config.modules.misc.SecureSeed.enabled) { worldgenRandom = new su.plo.matter.WorldgenCryptoRandom(pos.x, pos.z, su.plo.matter.Globals.Salt.GENERATE_FEATURE, 0); } else { @@ -237,7 +237,7 @@ index c2d7cd788071e25b8ba2503c30ae80c7a9f353ed..a22508c50b34ca48328595cc7b69e008 public static enum Algorithm { diff --git a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java -index f73bd2d86b2fcffa55cd8cc82aa1febe3467c87a..0ebdc328a6884ab5898681c7d74714bd137d1351 100644 +index 8df6dadfeb2c282bc3c3f521d31f7277caa77790..e30dc383695727c31bee46f7dbaf82619bb8a6fa 100644 --- a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java @@ -44,7 +44,7 @@ public class GeodeFeature extends Feature { @@ -302,10 +302,10 @@ index 6584c9320361dbbdea1899ab9e43b444de5006a6..06083cc7612ef28bcd9264bb21ab0bbb } // Leaf end - Matter - Secure Seed diff --git a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -index aaf80406af22af288b1b2e36a7a5d00c26c5afa5..c74313a305fffadb85c84d8746e9d338ce55ea80 100644 +index ee60717e39928a9f89ad6c7a9b3b52ac156871e6..daed7cc619d5a0b7d7a75e013cb72ed88d57de6c 100644 --- a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java +++ b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -@@ -123,7 +123,7 @@ public abstract class StructurePlacement { +@@ -124,7 +124,7 @@ public abstract class StructurePlacement { if (org.dreeam.leaf.config.modules.misc.SecureSeed.enabled) { worldgenRandom = new su.plo.matter.WorldgenCryptoRandom(regionX, regionZ, su.plo.matter.Globals.Salt.UNDEFINED, salt); } else { @@ -314,7 +314,7 @@ index aaf80406af22af288b1b2e36a7a5d00c26c5afa5..c74313a305fffadb85c84d8746e9d338 worldgenRandom.setLargeFeatureWithSalt(levelSeed, salt, regionX, regionZ); } // Leaf end - Matter - Secure Seed -@@ -132,7 +132,7 @@ public abstract class StructurePlacement { +@@ -133,7 +133,7 @@ public abstract class StructurePlacement { } private static boolean legacyProbabilityReducerWithDouble(long baseSeed, int salt, int chunkX, int chunkZ, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs @@ -323,7 +323,7 @@ index aaf80406af22af288b1b2e36a7a5d00c26c5afa5..c74313a305fffadb85c84d8746e9d338 if (saltOverride == null) { // Paper - Add missing structure set seed configs worldgenRandom.setLargeFeatureSeed(baseSeed, chunkX, chunkZ); // Paper start - Add missing structure set seed configs -@@ -144,7 +144,7 @@ public abstract class StructurePlacement { +@@ -145,7 +145,7 @@ public abstract class StructurePlacement { } private static boolean legacyArbitrarySaltProbabilityReducer(long levelSeed, int salt, int regionX, int regionZ, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs @@ -332,7 +332,7 @@ index aaf80406af22af288b1b2e36a7a5d00c26c5afa5..c74313a305fffadb85c84d8746e9d338 worldgenRandom.setLargeFeatureWithSalt(levelSeed, regionX, regionZ, saltOverride != null ? saltOverride : HIGHLY_ARBITRARY_RANDOM_SALT); // Paper - Add missing structure set seed configs return worldgenRandom.nextFloat() < probability; } -@@ -152,7 +152,7 @@ public abstract class StructurePlacement { +@@ -153,7 +153,7 @@ public abstract class StructurePlacement { private static boolean legacyPillagerOutpostReducer(long levelSeed, int salt, int regionX, int regionZ, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs; ignore here int i = regionX >> 4; int i1 = regionZ >> 4; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0052-Don-t-save-primed-tnt-entity.patch b/leaf-server/minecraft-patches/features/0132-Don-t-save-primed-tnt-entity.patch similarity index 68% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0052-Don-t-save-primed-tnt-entity.patch rename to leaf-server/minecraft-patches/features/0132-Don-t-save-primed-tnt-entity.patch index 7086a23b..8276fce8 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0052-Don-t-save-primed-tnt-entity.patch +++ b/leaf-server/minecraft-patches/features/0132-Don-t-save-primed-tnt-entity.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Don't save primed tnt entity diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index 40f5534b425ef57c435b365f156d3b988b74f911..c96f458994818392857642282ec3d492124885da 100644 +index 5d23d8754b304d5e2fd54400cc81c7fe5c14a804..edc003e4f0cc4280c90fda9c42a3faacc0f5c94d 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -279,4 +279,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { - return super.interact(player, hand); +@@ -253,4 +253,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { + return !this.level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid(); } - // Purpur end - Shears can defuse TNT + // Paper end - Option to prevent TNT from moving in water + + // Leaf start - PMC - Don't save primed tnt entity + @Override diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0053-Don-t-save-falling-block-entity.patch b/leaf-server/minecraft-patches/features/0133-Don-t-save-falling-block-entity.patch similarity index 85% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0053-Don-t-save-falling-block-entity.patch rename to leaf-server/minecraft-patches/features/0133-Don-t-save-falling-block-entity.patch index 602ff53e..b8c6533c 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0053-Don-t-save-falling-block-entity.patch +++ b/leaf-server/minecraft-patches/features/0133-Don-t-save-falling-block-entity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't save falling block entity diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index 5746587666c7cb788764aab2f6ccf0f3ac5c282f..fd2f93b070f96d28a8c694a6d943d92d257d0c9e 100644 +index 31edd0d45ac6c38887e4cebffe5a7cf377b47466..149d5845480c03fe4e29b09cac7fcd1bec147507 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -404,4 +404,11 @@ public class FallingBlockEntity extends Entity { +@@ -385,4 +385,11 @@ public class FallingBlockEntity extends Entity { this.forceTickAfterTeleportToDuplicate = entity != null && flag && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation; // Paper return entity; } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0054-Configurable-connection-message.patch b/leaf-server/minecraft-patches/features/0134-Configurable-connection-message.patch similarity index 93% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0054-Configurable-connection-message.patch rename to leaf-server/minecraft-patches/features/0134-Configurable-connection-message.patch index 9a1aea24..7ea410e9 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0054-Configurable-connection-message.patch +++ b/leaf-server/minecraft-patches/features/0134-Configurable-connection-message.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable connection message diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index e8683f45823cac55e3e68ccc500f10f0632e72fd..c9a3dd3e2b17ef8d5457766bdc2bea19a1948426 100644 +index a6340714eab6d7eafae639c6aeb2aeb75a0e6c07..0bc3908c8ab41fa11c8698dd8d87c1b52c6767da 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -434,7 +434,7 @@ public abstract class PlayerList { +@@ -336,7 +336,7 @@ public abstract class PlayerList { // Ensure that player inventory is populated with its viewer player.containerMenu.transferTo(player.containerMenu, bukkitPlayer); @@ -17,7 +17,7 @@ index e8683f45823cac55e3e68ccc500f10f0632e72fd..c9a3dd3e2b17ef8d5457766bdc2bea19 this.cserver.getPluginManager().callEvent(playerJoinEvent); if (!player.connection.isAcceptingMessages()) { -@@ -447,7 +447,7 @@ public abstract class PlayerList { +@@ -347,7 +347,7 @@ public abstract class PlayerList { final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage(); @@ -26,7 +26,7 @@ index e8683f45823cac55e3e68ccc500f10f0632e72fd..c9a3dd3e2b17ef8d5457766bdc2bea19 joinMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(jm); // Paper - Adventure this.server.getPlayerList().broadcastSystemMessage(joinMessage, false); // Paper - Adventure } -@@ -677,7 +677,7 @@ public abstract class PlayerList { +@@ -530,7 +530,7 @@ public abstract class PlayerList { player.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper - Inventory close reason } @@ -35,7 +35,7 @@ index e8683f45823cac55e3e68ccc500f10f0632e72fd..c9a3dd3e2b17ef8d5457766bdc2bea19 this.cserver.getPluginManager().callEvent(playerQuitEvent); player.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); -@@ -1673,4 +1673,34 @@ public abstract class PlayerList { +@@ -1488,4 +1488,34 @@ public abstract class PlayerList { public boolean isAllowCommandsForAllPlayers() { return this.allowCommandsForAllPlayers; } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0055-Configurable-unknown-command-message.patch b/leaf-server/minecraft-patches/features/0135-Configurable-unknown-command-message.patch similarity index 92% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0055-Configurable-unknown-command-message.patch rename to leaf-server/minecraft-patches/features/0135-Configurable-unknown-command-message.patch index 24d85d98..a467beb3 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0055-Configurable-unknown-command-message.patch +++ b/leaf-server/minecraft-patches/features/0135-Configurable-unknown-command-message.patch @@ -5,21 +5,20 @@ Subject: [PATCH] Configurable unknown command message diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index fb18f69cb26132fc8c53b185454c6aadb8a5f7e5..eff6d524c8acfc62d1fcf6b5552754e794a22735 100644 +index 287edc8caecfd1ebb399d52789161f4d57d0801c..2d3a0d7735983065a41212b202bcb010ba0bf014 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -404,31 +404,9 @@ public class Commands { +@@ -394,31 +394,8 @@ public class Commands { // Paper start - Add UnknownCommandEvent final net.kyori.adventure.text.TextComponent.Builder builder = net.kyori.adventure.text.Component.text(); // source.sendFailure(ComponentUtils.fromMessage(var7.getRawMessage())); - builder.color(net.kyori.adventure.text.format.NamedTextColor.RED).append(io.papermc.paper.command.brigadier.MessageComponentSerializer.message().deserialize(var7.getRawMessage())); -+ final net.kyori.adventure.text.TextComponent message = getUnknownCommandMessage(builder, var7, label); // Leaf - Configurable unknown command message // Paper end - Add UnknownCommandEvent - if (var7.getInput() != null && var7.getCursor() >= 0) { - int min = Math.min(var7.getInput().length(), var7.getCursor()); - MutableComponent mutableComponent = Component.empty() - .withStyle(ChatFormatting.GRAY) -- .withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/" + label))); // CraftBukkit // Paper +- .withStyle(style -> style.withClickEvent(new ClickEvent.SuggestCommand("/" + label))); // CraftBukkit // Paper - if (min > 10) { - mutableComponent.append(CommonComponents.ELLIPSIS); - } @@ -38,11 +37,11 @@ index fb18f69cb26132fc8c53b185454c6aadb8a5f7e5..eff6d524c8acfc62d1fcf6b5552754e7 - .append(io.papermc.paper.adventure.PaperAdventure.asAdventure(mutableComponent)); - } - org.bukkit.event.command.UnknownCommandEvent event = new org.bukkit.event.command.UnknownCommandEvent(source.getBukkitSender(), command, org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty() ? null : builder.build()); -+ org.bukkit.event.command.UnknownCommandEvent event = new org.bukkit.event.command.UnknownCommandEvent(source.getBukkitSender(), command, message); // Leaf - Configurable unknown command message ++ org.bukkit.event.command.UnknownCommandEvent event = new org.bukkit.event.command.UnknownCommandEvent(source.getBukkitSender(), command, getUnknownCommandMessage(builder, var7, label)); // Leaf - Configurable unknown command message org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event); if (event.message() != null) { source.sendFailure(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false); -@@ -680,6 +658,86 @@ public class Commands { +@@ -668,6 +645,86 @@ public class Commands { }; } @@ -103,7 +102,7 @@ index fb18f69cb26132fc8c53b185454c6aadb8a5f7e5..eff6d524c8acfc62d1fcf6b5552754e7 + int min = Math.min(var7.getInput().length(), var7.getCursor()); + MutableComponent mutableComponent = Component.empty() + .withStyle(ChatFormatting.GRAY) -+ .withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/" + label))); // CraftBukkit // Paper ++ .withStyle(style -> style.withClickEvent(new ClickEvent.SuggestCommand("/" + label))); // CraftBukkit // Paper + if (min > 10) { + mutableComponent.append(CommonComponents.ELLIPSIS); + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0056-Remove-stream-in-BlockBehaviour-cache-blockstate.patch b/leaf-server/minecraft-patches/features/0136-Remove-stream-in-BlockBehaviour-cache-blockstate.patch similarity index 90% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0056-Remove-stream-in-BlockBehaviour-cache-blockstate.patch rename to leaf-server/minecraft-patches/features/0136-Remove-stream-in-BlockBehaviour-cache-blockstate.patch index e5a97395..620df3e0 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0056-Remove-stream-in-BlockBehaviour-cache-blockstate.patch +++ b/leaf-server/minecraft-patches/features/0136-Remove-stream-in-BlockBehaviour-cache-blockstate.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove stream in BlockBehaviour cache blockstate diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java -index bf77d02d8fc58b5a16c67a305fe0991ad08a795c..117c7cedb9f355b5139b9aa9b15f4459453e3675 100644 +index 3741afd1b2a5cb5cfce5e14cb78aa5ff5c3b218e..331474bb33c8612283a0ec478c1ae8768180b22d 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -1067,8 +1067,14 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -1064,8 +1064,14 @@ public abstract class BlockBehaviour implements FeatureElement { ) ); } else { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0057-Remove-stream-in-entity-visible-effects-filter.patch b/leaf-server/minecraft-patches/features/0137-Remove-stream-in-entity-visible-effects-filter.patch similarity index 89% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0057-Remove-stream-in-entity-visible-effects-filter.patch rename to leaf-server/minecraft-patches/features/0137-Remove-stream-in-entity-visible-effects-filter.patch index 0e7a3551..08432772 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0057-Remove-stream-in-entity-visible-effects-filter.patch +++ b/leaf-server/minecraft-patches/features/0137-Remove-stream-in-entity-visible-effects-filter.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove stream in entity visible effects filter diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index ca1d8c9ea018368cc85da46185aee71df8d48ce0..a307ee08f12cb21d17cfbaf969db7c46f10040fb 100644 +index e65914c2623197031d50508af5c45a4db6b98836..d55a701d1f9a39b4734c8b02b655e1f1a53e616b 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -988,12 +988,15 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -975,12 +975,15 @@ public abstract class LivingEntity extends Entity implements Attackable { } private void updateSynchronizedMobEffectParticles() { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0058-Remove-stream-and-double-iteration-in-enough-deep-sl.patch b/leaf-server/minecraft-patches/features/0138-Remove-stream-and-double-iteration-in-enough-deep-sl.patch similarity index 87% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0058-Remove-stream-and-double-iteration-in-enough-deep-sl.patch rename to leaf-server/minecraft-patches/features/0138-Remove-stream-and-double-iteration-in-enough-deep-sl.patch index f180fce3..a1f13784 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0058-Remove-stream-and-double-iteration-in-enough-deep-sl.patch +++ b/leaf-server/minecraft-patches/features/0138-Remove-stream-and-double-iteration-in-enough-deep-sl.patch @@ -6,14 +6,14 @@ Subject: [PATCH] Remove stream and double iteration in enough deep sleeping diff --git a/net/minecraft/server/players/SleepStatus.java b/net/minecraft/server/players/SleepStatus.java -index 3a3e6992563236141db687084aeec9684437a7db..e6827e90b685f88d945010f2c8c5aead52b0856e 100644 +index 2a7ae521654ad5c9f392baa5562e64bb71b13097..2d0033b18f46fb05df12536d68b4bce455abfeed 100644 --- a/net/minecraft/server/players/SleepStatus.java +++ b/net/minecraft/server/players/SleepStatus.java @@ -15,9 +15,24 @@ public class SleepStatus { public boolean areEnoughDeepSleeping(int requiredSleepPercentage, List sleepingPlayers) { // CraftBukkit start -- int i = (int) sleepingPlayers.stream().filter(player -> player.isSleepingLongEnough() || player.fauxSleeping || (player.level().purpurConfig.idleTimeoutCountAsSleeping && player.isAfk())).count(); // Purpur - AFK API +- int i = (int) sleepingPlayers.stream().filter(player -> player.isSleepingLongEnough() || player.fauxSleeping).count(); - boolean anyDeepSleep = sleepingPlayers.stream().anyMatch(Player::isSleepingLongEnough); - return anyDeepSleep && i >= this.sleepersNeeded(requiredSleepPercentage); + // Leaf start - Remove stream and double iteration in enough deep sleeping player check diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0059-Remove-stream-in-trial-spawner-ticking.patch b/leaf-server/minecraft-patches/features/0139-Remove-stream-in-trial-spawner-ticking.patch similarity index 97% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0059-Remove-stream-in-trial-spawner-ticking.patch rename to leaf-server/minecraft-patches/features/0139-Remove-stream-in-trial-spawner-ticking.patch index a3f098b6..c469f856 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0059-Remove-stream-in-trial-spawner-ticking.patch +++ b/leaf-server/minecraft-patches/features/0139-Remove-stream-in-trial-spawner-ticking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove stream in trial spawner ticking diff --git a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java -index 3e8d0c8d8409b6ba2e2846d7d64cdcc8fc6094a4..2f8324ce552f982f6b3388d9fa5a63fb9bee625b 100644 +index 6b3d92e76a16358c89ee07e1970c764ba4a8e2dc..5edc7278387c3fc61909582ebf34e905abc68fc4 100644 --- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java +++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java @@ -173,17 +173,21 @@ public enum TrialSpawnerState implements StringRepresentable { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0060-Remove-stream-in-Brain.patch b/leaf-server/minecraft-patches/features/0140-Remove-stream-in-Brain.patch similarity index 97% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0060-Remove-stream-in-Brain.patch rename to leaf-server/minecraft-patches/features/0140-Remove-stream-in-Brain.patch index e5b6cb0c..b41d28dd 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0060-Remove-stream-in-Brain.patch +++ b/leaf-server/minecraft-patches/features/0140-Remove-stream-in-Brain.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove stream in Brain diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java -index 450396468b23fd90cb8036dbbdd0927051f907af..083eb9a7a0bc14d30db944f356d98ca552fa1784 100644 +index 98652c2c549bd7657a606d25ba4fe3cffa0548da..29fdf94db0308031edfe7915fc587a2aa5a1a18a 100644 --- a/net/minecraft/world/entity/ai/Brain.java +++ b/net/minecraft/world/entity/ai/Brain.java @@ -70,13 +70,22 @@ public class Brain { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0061-Remove-stream-in-BehaviorUtils.patch b/leaf-server/minecraft-patches/features/0141-Remove-stream-in-BehaviorUtils.patch similarity index 100% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0061-Remove-stream-in-BehaviorUtils.patch rename to leaf-server/minecraft-patches/features/0141-Remove-stream-in-BehaviorUtils.patch diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0062-Remove-stream-in-YieldJobSite.patch b/leaf-server/minecraft-patches/features/0142-Remove-stream-in-YieldJobSite.patch similarity index 97% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0062-Remove-stream-in-YieldJobSite.patch rename to leaf-server/minecraft-patches/features/0142-Remove-stream-in-YieldJobSite.patch index 45e51900..55ff7c36 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0062-Remove-stream-in-YieldJobSite.patch +++ b/leaf-server/minecraft-patches/features/0142-Remove-stream-in-YieldJobSite.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove stream in YieldJobSite diff --git a/net/minecraft/world/entity/ai/behavior/YieldJobSite.java b/net/minecraft/world/entity/ai/behavior/YieldJobSite.java -index 37ad79e201e36a1a9520219e3faa4dcffa7b4dfd..d174bb065911c22526b8d6c58f2c748e4f816894 100644 +index 44340aa26bc89faaf8842bb36048cf61dba34314..811cbeafaf907b1fc96cc0916073c5f0100c555e 100644 --- a/net/minecraft/world/entity/ai/behavior/YieldJobSite.java +++ b/net/minecraft/world/entity/ai/behavior/YieldJobSite.java @@ -38,23 +38,26 @@ public class YieldJobSite { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0063-Remove-stream-in-PlayerSensor.patch b/leaf-server/minecraft-patches/features/0143-Remove-stream-in-PlayerSensor.patch similarity index 81% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0063-Remove-stream-in-PlayerSensor.patch rename to leaf-server/minecraft-patches/features/0143-Remove-stream-in-PlayerSensor.patch index f6c2b118..ef8a6776 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0063-Remove-stream-in-PlayerSensor.patch +++ b/leaf-server/minecraft-patches/features/0143-Remove-stream-in-PlayerSensor.patch @@ -9,10 +9,10 @@ Before: 164ms After: 18ms diff --git a/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/net/minecraft/world/entity/ai/sensing/PlayerSensor.java -index 6233e6b48aaa69ba9f577d0b480b1cdf2f55d16e..996c93f2b7ffd83134535f75c0ead45cc34ef13c 100644 +index eb3ec4be63e1710d0ed9021eb8158d56eae89f8d..fa438315b4ed8e9394383b82b89ecb04bac3399f 100644 --- a/net/minecraft/world/entity/ai/sensing/PlayerSensor.java +++ b/net/minecraft/world/entity/ai/sensing/PlayerSensor.java -@@ -22,17 +22,40 @@ public class PlayerSensor extends Sensor { +@@ -26,17 +26,39 @@ public class PlayerSensor extends Sensor { @Override protected void doTick(ServerLevel level, LivingEntity entity) { @@ -40,7 +40,7 @@ index 6233e6b48aaa69ba9f577d0b480b1cdf2f55d16e..996c93f2b7ffd83134535f75c0ead45c brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list); - List list1 = list.stream().filter(player -> isEntityTargetable(level, entity, player)).collect(Collectors.toList()); + // Leaf start - Remove stream in PlayerSensor -+ List list1 = new java.util.ArrayList<>(); ++ List list1 = new java.util.ArrayList<>(list.size()); + for (Player player : list) { + if (isEntityTargetable(level, entity, player)) { + list1.add(player); @@ -48,16 +48,15 @@ index 6233e6b48aaa69ba9f577d0b480b1cdf2f55d16e..996c93f2b7ffd83134535f75c0ead45c + } + // Leaf end - Remove stream in PlayerSensor brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, list1.isEmpty() ? null : list1.get(0)); -- Optional optional = list1.stream().filter(player -> isEntityAttackable(level, entity, player)).findFirst(); +- List list2 = list1.stream().filter(player -> isEntityAttackable(level, entity, player)).toList(); + // Leaf start - Remove stream in PlayerSensor -+ Optional optional = Optional.empty(); ++ List list2 = new java.util.ArrayList<>(list1.size()); + for (Player player : list1) { + if (isEntityAttackable(level, entity, player)) { -+ optional = Optional.of(player); -+ break; ++ list2.add(player); + } + } + // Leaf end - Remove stream in PlayerSensor - brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, optional); + brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYERS, list2); + brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, list2.isEmpty() ? null : list2.get(0)); } - diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0064-Remove-stream-in-GolemSensor.patch b/leaf-server/minecraft-patches/features/0144-Remove-stream-in-GolemSensor.patch similarity index 100% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0064-Remove-stream-in-GolemSensor.patch rename to leaf-server/minecraft-patches/features/0144-Remove-stream-in-GolemSensor.patch diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0065-Remove-stream-in-GateBehavior.patch b/leaf-server/minecraft-patches/features/0145-Remove-stream-in-GateBehavior.patch similarity index 100% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0065-Remove-stream-in-GateBehavior.patch rename to leaf-server/minecraft-patches/features/0145-Remove-stream-in-GateBehavior.patch diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0066-Remove-stream-in-updateFluidOnEyes.patch b/leaf-server/minecraft-patches/features/0146-Remove-stream-in-updateFluidOnEyes.patch similarity index 84% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0066-Remove-stream-in-updateFluidOnEyes.patch rename to leaf-server/minecraft-patches/features/0146-Remove-stream-in-updateFluidOnEyes.patch index ff4f9d28..515a900d 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0066-Remove-stream-in-updateFluidOnEyes.patch +++ b/leaf-server/minecraft-patches/features/0146-Remove-stream-in-updateFluidOnEyes.patch @@ -46,10 +46,10 @@ index 6c7edbbf3935c40ccb78bee680ea75431718b9bd..a1b4dc70d555cce5e06c0298736d8b89 public String toString() { return "Reference{" + this.key + "=" + this.value + "}"; diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 970420761b2c3b82a60479c556e76e385bf211e1..4d88aa70c01e03baf8aea897b00f335c7be91f46 100644 +index 8ac90cc10625f395dba660e2358bbac79431b0cf..f71ab3764aa3bb8b2c48bcae8c7331b4d821e4b1 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -1984,7 +1984,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1930,7 +1930,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess FluidState fluidState = this.level().getFluidState(blockPos); double d = blockPos.getY() + fluidState.getHeight(this.level(), blockPos); if (d > eyeY) { @@ -59,17 +59,19 @@ index 970420761b2c3b82a60479c556e76e385bf211e1..4d88aa70c01e03baf8aea897b00f335c } } diff --git a/net/minecraft/world/level/material/FluidState.java b/net/minecraft/world/level/material/FluidState.java -index 481cb46973acb9785fdee5732e98aac560c6ec08..06581fe010ca722d62d0b6d3c44d845f9db0231f 100644 +index 0a5ae623a636923f3bbd3c01974497f39b7c4b62..f5bdd78b44881bd2b36b552165eca23d7dfac6b2 100644 --- a/net/minecraft/world/level/material/FluidState.java +++ b/net/minecraft/world/level/material/FluidState.java -@@ -158,4 +158,10 @@ public final class FluidState extends StateHolder implements - public Stream> getTags() { +@@ -167,6 +167,12 @@ public final class FluidState extends StateHolder implements return this.owner.builtInRegistryHolder().tags(); } -+ + + // Leaf start - Remove stream in updateFluidOnEyes + public java.util.Set> getTagsAsSet() { + return this.owner.builtInRegistryHolder().tagsAsSet(); + } + // Leaf end - Remove stream in updateFluidOnEyes - } ++ + public void entityInside(Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) { + this.getType().entityInside(level, pos, entity, effectApplier); + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0067-Remove-stream-in-matchingSlot.patch b/leaf-server/minecraft-patches/features/0147-Remove-stream-in-matchingSlot.patch similarity index 100% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0067-Remove-stream-in-matchingSlot.patch rename to leaf-server/minecraft-patches/features/0147-Remove-stream-in-matchingSlot.patch diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0068-Replace-Entity-active-effects-map-with-optimized-col.patch b/leaf-server/minecraft-patches/features/0148-Replace-Entity-active-effects-map-with-optimized-col.patch similarity index 84% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0068-Replace-Entity-active-effects-map-with-optimized-col.patch rename to leaf-server/minecraft-patches/features/0148-Replace-Entity-active-effects-map-with-optimized-col.patch index 237d0012..05646746 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0068-Replace-Entity-active-effects-map-with-optimized-col.patch +++ b/leaf-server/minecraft-patches/features/0148-Replace-Entity-active-effects-map-with-optimized-col.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Replace Entity active effects map with optimized collection Dreeam TODO: check this diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index a307ee08f12cb21d17cfbaf969db7c46f10040fb..4f0da30fa659ecabdfbd1d17e50888c32501b6e7 100644 +index d55a701d1f9a39b4734c8b02b655e1f1a53e616b..82289f1b8b3097fe20c3508461c79ab42fbef0f6 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -211,6 +211,10 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -196,6 +196,10 @@ public abstract class LivingEntity extends Entity implements Attackable { }; private final AttributeMap attributes; public CombatTracker combatTracker = new CombatTracker(this); @@ -18,9 +18,9 @@ index a307ee08f12cb21d17cfbaf969db7c46f10040fb..4f0da30fa659ecabdfbd1d17e50888c3 + // Also need to check whether call from out of main using bukkit api + //public final Map, MobEffectInstance> activeEffects = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(0); // Leaf - Replace Entity active effects map with optimized collection public final Map, MobEffectInstance> activeEffects = Maps.newHashMap(); - private final NonNullList lastHandItemStacks = NonNullList.withSize(2, ItemStack.EMPTY); - private final NonNullList lastArmorItemStacks = NonNullList.withSize(4, ItemStack.EMPTY); -@@ -990,15 +994,16 @@ public abstract class LivingEntity extends Entity implements Attackable { + private final Map lastEquipmentItems = Util.makeEnumMap(EquipmentSlot.class, slot -> ItemStack.EMPTY); + public boolean swinging; +@@ -977,15 +981,16 @@ public abstract class LivingEntity extends Entity implements Attackable { private void updateSynchronizedMobEffectParticles() { // Leaf start - Remove stream in entity visible effects filter List list = new ArrayList<>(); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0069-Replace-criterion-map-with-optimized-collection.patch b/leaf-server/minecraft-patches/features/0149-Replace-criterion-map-with-optimized-collection.patch similarity index 93% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0069-Replace-criterion-map-with-optimized-collection.patch rename to leaf-server/minecraft-patches/features/0149-Replace-criterion-map-with-optimized-collection.patch index 4501508c..141ab0f4 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0069-Replace-criterion-map-with-optimized-collection.patch +++ b/leaf-server/minecraft-patches/features/0149-Replace-criterion-map-with-optimized-collection.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Replace criterion map with optimized collection diff --git a/net/minecraft/server/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java -index e4ea26ae84efde7ce54e08a246a6ea2ae2a17151..ddd1eac136fc3327aea8286769efd2d7309f67ec 100644 +index 741894ed6df81fce41d9f906d6198d038aab44a8..83ed64b9253f1fcde58267a510256cc18dfd8f8d 100644 --- a/net/minecraft/server/PlayerAdvancements.java +++ b/net/minecraft/server/PlayerAdvancements.java @@ -60,7 +60,7 @@ public class PlayerAdvancements { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0070-Replace-brain-maps-with-optimized-collection.patch b/leaf-server/minecraft-patches/features/0150-Replace-brain-maps-with-optimized-collection.patch similarity index 96% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0070-Replace-brain-maps-with-optimized-collection.patch rename to leaf-server/minecraft-patches/features/0150-Replace-brain-maps-with-optimized-collection.patch index 7e942c78..fa9cc8ba 100644 --- a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0070-Replace-brain-maps-with-optimized-collection.patch +++ b/leaf-server/minecraft-patches/features/0150-Replace-brain-maps-with-optimized-collection.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Replace brain maps with optimized collection diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java -index 083eb9a7a0bc14d30db944f356d98ca552fa1784..c561b749fb9b76ba9b1e9689089b743248c65d50 100644 +index 29fdf94db0308031edfe7915fc587a2aa5a1a18a..b946faf899561b9e4f8399e16600eede54bb55a5 100644 --- a/net/minecraft/world/entity/ai/Brain.java +++ b/net/minecraft/world/entity/ai/Brain.java @@ -45,14 +45,18 @@ public class Brain { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/features/0071-Reduce-worldgen-allocations.patch b/leaf-server/minecraft-patches/features/0151-Reduce-worldgen-allocations.patch similarity index 100% rename from leaf-archived-patches/unapplied/server/minecraft-patches/features/0071-Reduce-worldgen-allocations.patch rename to leaf-server/minecraft-patches/features/0151-Reduce-worldgen-allocations.patch diff --git a/todos.md b/todos.md index 9d44bbff..396eb596 100644 --- a/todos.md +++ b/todos.md @@ -15,4 +15,6 @@ # 1.21.5 - [ ] Reduce array allocations when paper patched all - [ ] Check KeYi: Add an option for spigot item merging mechanism +- [ ] Remove stream in sparklypaper map optimization +- [ ] Check snowball knockback patch, whether need double hurt - [ ] Update from Leaf 1.21.4 (curr commit: `1977a5b12c01f915d7c04a765b18957cbfbeeb24`) \ No newline at end of file