diff --git a/gradle.properties b/gradle.properties index 661038b..6d12ef3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,4 @@ org.gradle.vfs.watch=false group=dev.etil.mirai version=1.19.2-R0.1-SNAPSHOT mcVersion=1.19.2 -pufferfishRef=69bd43d2afe35e28c58f72f2957c25a4d2e2f059 +pufferfishRef=deb9638cd5243286685c20d254fdec9c2754979b diff --git a/patches/server/0004-Reduce-constants-allocations.patch b/patches/server/0004-Reduce-constants-allocations.patch index b58525a..9332bdb 100644 --- a/patches/server/0004-Reduce-constants-allocations.patch +++ b/patches/server/0004-Reduce-constants-allocations.patch @@ -237,7 +237,7 @@ index a2920b8a9eff77d9c5d1d7f70ad3abdacba8f0fa..f7f19e360d712211625ff28e92f83949 protected CipherBase(Cipher cipher) { this.cipher = cipher; diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 6967c90c50ea75fb9dd5da808b2c8c8ea046ecec..2852c47afcba5633a747977e250e60a5d28b0e1e 100644 +index cd386a13d8c0909d4ac971a5df751cd23e609b1b..5344f1f81797344130bd48f16689161af8261882 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -311,7 +311,7 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -304,10 +304,10 @@ index 1eb912ad97f9663bf6bd336ad739f2552b0a5c9b..9901ffe9de585a73e9ef32c700b1e870 for (int j = 0; j < i; ++j) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 917cf327f3f9d824ec0da70fd9204624e7cf96fb..c8941cdcebf7b3d09a67a7213ef6eab3feef1cab 100644 +index e802ee2b2dc458f52dbce9746fc9891eebb6dcc1..f4280eb9f77568e4f3af6f264fc60901e667a936 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -907,7 +907,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -909,7 +909,7 @@ public class ServerLevel extends Level implements WorldGenLevel { BlockPos blockposition2 = blockposition.set(j + randomX, randomY, k + randomZ); BlockState iblockdata = com.destroystokyo.paper.util.maplist.IBlockDataList.getBlockDataFromRaw(raw); @@ -316,7 +316,7 @@ index 917cf327f3f9d824ec0da70fd9204624e7cf96fb..c8941cdcebf7b3d09a67a7213ef6eab3 // We drop the fluid tick since LAVA is ALREADY TICKED by the above method (See LiquidBlock). // TODO CHECK ON UPDATE } -@@ -1162,7 +1162,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1164,7 +1164,7 @@ public class ServerLevel extends Level implements WorldGenLevel { public static List getCurrentlyTickingEntities() { Entity ticking = currentlyTickingEntity.get(); @@ -326,7 +326,7 @@ index 917cf327f3f9d824ec0da70fd9204624e7cf96fb..c8941cdcebf7b3d09a67a7213ef6eab3 return ret; } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 59608a53bbf0eccf118b4d65557444f6532fedb4..50cbd7ca6394cc486b673fcf0d2bc4dc8c1f32de 100644 +index 4e615e5d5b8d79f6eaac2136be03961415fd093e..633fe61c98c1fc181f38b4195651c3ed6fc1db42 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -410,7 +410,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -354,7 +354,7 @@ index 59608a53bbf0eccf118b4d65557444f6532fedb4..50cbd7ca6394cc486b673fcf0d2bc4dc return; } // Paper end -@@ -3397,7 +3397,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3398,7 +3398,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { @@ -364,7 +364,7 @@ index 59608a53bbf0eccf118b4d65557444f6532fedb4..50cbd7ca6394cc486b673fcf0d2bc4dc } } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index b607f5ccbce10570f827dd21eb38504f42781d2f..d6f1cbea24de82ada6083749f079401dbcca1ced 100644 +index ea9b56fd6ae1d5577da5bd3e0c38abfeec8f3646..f1105edce8484cac39d8fb33a42c9ed8d44fe5c0 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -269,8 +269,8 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se diff --git a/patches/server/0036-Alternative-Keepalive-Handling.patch b/patches/server/0036-Alternative-Keepalive-Handling.patch index c6ca60d..7ad2d34 100644 --- a/patches/server/0036-Alternative-Keepalive-Handling.patch +++ b/patches/server/0036-Alternative-Keepalive-Handling.patch @@ -24,7 +24,7 @@ index 9379fd91df73ac482064a89462764dac9835c71f..432ba1293419dea0903e31043f68f5ad } \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 40d0d7bc43e8c1465088408efe7eeed845eeb9f7..3bd4fd4a0b197bde9b254ec8f264e396064bf583 100644 +index 79c56946cecba2a6308a0a67b7da036d348a97a8..dfacc5d6b7eb30292f59b25752d2c7ee1ff9534f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -260,6 +260,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -57,7 +57,7 @@ index 40d0d7bc43e8c1465088408efe7eeed845eeb9f7..3bd4fd4a0b197bde9b254ec8f264e396 if (this.keepAlivePending) { if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info -@@ -3597,6 +3613,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3598,6 +3614,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleKeepAlive(ServerboundKeepAlivePacket packet) { diff --git a/patches/server/0037-Logger-settings-suppressing-pointless-logs.patch b/patches/server/0037-Logger-settings-suppressing-pointless-logs.patch index d08097e..0f7d4f7 100644 --- a/patches/server/0037-Logger-settings-suppressing-pointless-logs.patch +++ b/patches/server/0037-Logger-settings-suppressing-pointless-logs.patch @@ -66,10 +66,10 @@ index 80c1e0e47818486a68e0114b063395290365346b..91b273d058d2fe83207cc562a25711e4 hasSetFarWarned = true; if (this.getServer() != null && this.getServer().isDebugging()) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3bd4fd4a0b197bde9b254ec8f264e396064bf583..f2e61291dccffb76c73bd7d53eb2eb84307407c2 100644 +index dfacc5d6b7eb30292f59b25752d2c7ee1ff9534f..ed98aab3df24bbefc1adc0e21ec7f1deab8d8aa1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2627,7 +2627,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2628,7 +2628,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } if (playerchatmessage.hasExpiredServer(Instant.now())) { diff --git a/patches/server/0056-lithium-entity.fast_hand_swing.patch b/patches/server/0055-lithium-entity.fast_hand_swing.patch similarity index 100% rename from patches/server/0056-lithium-entity.fast_hand_swing.patch rename to patches/server/0055-lithium-entity.fast_hand_swing.patch diff --git a/patches/server/0055-lithium-profiler.patch b/patches/server/0055-lithium-profiler.patch deleted file mode 100644 index a5b5b61..0000000 --- a/patches/server/0055-lithium-profiler.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: 2No2Name <2No2Name@web.de> -Date: Sat, 8 Jan 2022 04:56:54 +0100 -Subject: [PATCH] lithium: profiler - -Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0 -You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 413c5891e1affc89f2d4e63214ef6621d63f83b3..aef9c28228be51e217b068e8731665cceff17717 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -224,6 +224,13 @@ public class ServerLevel extends Level implements WorldGenLevel { - return new Throwable(entity + " Added to world at " + new java.util.Date()); - } - -+ // Mirai start -+ @Override -+ public ProfilerFiller getProfiler() { -+ return this.getServer().getProfiler(); -+ } -+ // Mirai end -+ - @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI - return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - } diff --git a/patches/server/0057-c2me-opts-math.patch b/patches/server/0056-c2me-opts-math.patch similarity index 100% rename from patches/server/0057-c2me-opts-math.patch rename to patches/server/0056-c2me-opts-math.patch diff --git a/patches/server/0058-lithium-entity.fast_powder_snow_check.patch b/patches/server/0057-lithium-entity.fast_powder_snow_check.patch similarity index 100% rename from patches/server/0058-lithium-entity.fast_powder_snow_check.patch rename to patches/server/0057-lithium-entity.fast_powder_snow_check.patch diff --git a/patches/server/0059-lithium-collections.attributes.patch b/patches/server/0058-lithium-collections.attributes.patch similarity index 100% rename from patches/server/0059-lithium-collections.attributes.patch rename to patches/server/0058-lithium-collections.attributes.patch diff --git a/patches/server/0060-lithium-collections.entity_by_type.patch b/patches/server/0059-lithium-collections.entity_by_type.patch similarity index 100% rename from patches/server/0060-lithium-collections.entity_by_type.patch rename to patches/server/0059-lithium-collections.entity_by_type.patch diff --git a/patches/server/0061-lithium-collections.entity_filtering.patch b/patches/server/0060-lithium-collections.entity_filtering.patch similarity index 100% rename from patches/server/0061-lithium-collections.entity_filtering.patch rename to patches/server/0060-lithium-collections.entity_filtering.patch diff --git a/patches/server/0062-lithium-chunk.serialization.patch b/patches/server/0061-lithium-chunk.serialization.patch similarity index 100% rename from patches/server/0062-lithium-chunk.serialization.patch rename to patches/server/0061-lithium-chunk.serialization.patch diff --git a/patches/server/0063-Configurable-criterion-triggers.patch b/patches/server/0062-Configurable-criterion-triggers.patch similarity index 97% rename from patches/server/0063-Configurable-criterion-triggers.patch rename to patches/server/0062-Configurable-criterion-triggers.patch index a48e815..da33c88 100644 --- a/patches/server/0063-Configurable-criterion-triggers.patch +++ b/patches/server/0062-Configurable-criterion-triggers.patch @@ -31,7 +31,7 @@ index 929ccc5cf475a5b3d19e44d8d6b324e1d647b5d1..dde09a19916798afabe28902636a2ced } \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 63e222d8a981a391b1dd01a8a10bb5df8099f922..d83093e1d6c09d643242a5baa4a73eeb20cd72e0 100644 +index 33cb9a669fed30509d2737898dbd15ce16193da4..d1a6a21bfe93882e23a0bad742abd6fedcac29d0 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -619,7 +619,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0064-Set-item-stuck-sleep-to-15-ticks.patch b/patches/server/0063-Set-item-stuck-sleep-to-15-ticks.patch similarity index 100% rename from patches/server/0064-Set-item-stuck-sleep-to-15-ticks.patch rename to patches/server/0063-Set-item-stuck-sleep-to-15-ticks.patch diff --git a/patches/server/0065-Smarter-statistics-ticking.patch b/patches/server/0064-Smarter-statistics-ticking.patch similarity index 100% rename from patches/server/0065-Smarter-statistics-ticking.patch rename to patches/server/0064-Smarter-statistics-ticking.patch diff --git a/patches/server/0066-some-entity-micro-opts.patch b/patches/server/0065-some-entity-micro-opts.patch similarity index 97% rename from patches/server/0066-some-entity-micro-opts.patch rename to patches/server/0065-some-entity-micro-opts.patch index f6a1a8b..7dac484 100644 --- a/patches/server/0066-some-entity-micro-opts.patch +++ b/patches/server/0065-some-entity-micro-opts.patch @@ -7,7 +7,7 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0 You can find the original code on https://gitlab.com/Titaniumtown/JettPack diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4aae8f6dc6f06ca9bc30b86a4dac57f38560e395..6e094f495dd4cdc13645b7593399ba14bfd2a81e 100644 +index fc71a56fd84d975890b0e5e44f2ad020718bcc8a..8e88ae24d7e3299d7250a2021cb3604c045eaac9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1880,12 +1880,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0067-Dont-eat-blocks-in-non-ticking-chunks.patch b/patches/server/0066-Dont-eat-blocks-in-non-ticking-chunks.patch similarity index 96% rename from patches/server/0067-Dont-eat-blocks-in-non-ticking-chunks.patch rename to patches/server/0066-Dont-eat-blocks-in-non-ticking-chunks.patch index db6ab0e..2c7240d 100644 --- a/patches/server/0067-Dont-eat-blocks-in-non-ticking-chunks.patch +++ b/patches/server/0066-Dont-eat-blocks-in-non-ticking-chunks.patch @@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT You can find the original code on https://github.com/PurpurMC/Purpur diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 9ac645e08275bb7943dd1edcd635c179c0620d89..4748828f84f7d5f2dd79945dd65f3fa55cd43010 100644 +index 9ce60dd72dee4d3ceef38f425b13aed18fd5e002..9976630fad886392057f642e84f919f0b95cc040 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -983,7 +983,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0068-Fast-speed-check.patch b/patches/server/0067-Fast-speed-check.patch similarity index 100% rename from patches/server/0068-Fast-speed-check.patch rename to patches/server/0067-Fast-speed-check.patch diff --git a/patches/server/0069-lithium-cache-iterate-outwards.patch b/patches/server/0068-lithium-cache-iterate-outwards.patch similarity index 100% rename from patches/server/0069-lithium-cache-iterate-outwards.patch rename to patches/server/0068-lithium-cache-iterate-outwards.patch diff --git a/patches/server/0070-lithium-ai.raid.patch b/patches/server/0069-lithium-ai.raid.patch similarity index 100% rename from patches/server/0070-lithium-ai.raid.patch rename to patches/server/0069-lithium-ai.raid.patch diff --git a/patches/server/0071-lithium-block.moving_block_shapes.patch b/patches/server/0070-lithium-block.moving_block_shapes.patch similarity index 100% rename from patches/server/0071-lithium-block.moving_block_shapes.patch rename to patches/server/0070-lithium-block.moving_block_shapes.patch diff --git a/patches/server/0072-lithium-shapes.blockstate_cache.patch b/patches/server/0071-lithium-shapes.blockstate_cache.patch similarity index 100% rename from patches/server/0072-lithium-shapes.blockstate_cache.patch rename to patches/server/0071-lithium-shapes.blockstate_cache.patch diff --git a/patches/server/0073-lithium-gen.patch b/patches/server/0072-lithium-gen.patch similarity index 99% rename from patches/server/0073-lithium-gen.patch rename to patches/server/0072-lithium-gen.patch index 7310c98..10d4022 100644 --- a/patches/server/0073-lithium-gen.patch +++ b/patches/server/0072-lithium-gen.patch @@ -106,7 +106,7 @@ index 0000000000000000000000000000000000000000..c99eff34c1be07508c88fe9525c3ae1a +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index 1194c501a82e0e84d961d4ccb62f0c6092db559e..8afacc53a673567cead4c6e49966f07f1d5da754 100644 +index 91b273d058d2fe83207cc562a25711e4d621c862..982ebf0fe6aa4d4f42e8e3b8820fbaf1f7736849 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java @@ -54,6 +54,7 @@ import net.minecraft.world.phys.Vec3; diff --git a/patches/server/0074-PaperPR-Add-more-collision-code-skipping-logic.patch b/patches/server/0073-PaperPR-Add-more-collision-code-skipping-logic.patch similarity index 100% rename from patches/server/0074-PaperPR-Add-more-collision-code-skipping-logic.patch rename to patches/server/0073-PaperPR-Add-more-collision-code-skipping-logic.patch diff --git a/patches/server/0075-vmp-use-linked-map-for-entity-trackers-for-faster-it.patch b/patches/server/0074-vmp-use-linked-map-for-entity-trackers-for-faster-it.patch similarity index 94% rename from patches/server/0075-vmp-use-linked-map-for-entity-trackers-for-faster-it.patch rename to patches/server/0074-vmp-use-linked-map-for-entity-trackers-for-faster-it.patch index 7ad07c2..46dc227 100644 --- a/patches/server/0075-vmp-use-linked-map-for-entity-trackers-for-faster-it.patch +++ b/patches/server/0074-vmp-use-linked-map-for-entity-trackers-for-faster-it.patch @@ -9,7 +9,7 @@ Original code by RelativityMC, licensed under MIT You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 4748828f84f7d5f2dd79945dd65f3fa55cd43010..a83b5520b0210d82e26cb6ec490fe30778ea92ab 100644 +index 9976630fad886392057f642e84f919f0b95cc040..c01c22b6fda9e36a2336a992c760b813b71469ce 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -111,6 +111,7 @@ import org.bukkit.entity.Player; diff --git a/patches/server/0076-c2me-reduce_allocs.patch b/patches/server/0075-c2me-reduce_allocs.patch similarity index 100% rename from patches/server/0076-c2me-reduce_allocs.patch rename to patches/server/0075-c2me-reduce_allocs.patch diff --git a/patches/server/0077-lithium-ai.sensor.secondary_poi.patch b/patches/server/0076-lithium-ai.sensor.secondary_poi.patch similarity index 100% rename from patches/server/0077-lithium-ai.sensor.secondary_poi.patch rename to patches/server/0076-lithium-ai.sensor.secondary_poi.patch diff --git a/patches/server/0078-Fix-tick-function-tag-running-before-load.patch b/patches/server/0077-Fix-tick-function-tag-running-before-load.patch similarity index 100% rename from patches/server/0078-Fix-tick-function-tag-running-before-load.patch rename to patches/server/0077-Fix-tick-function-tag-running-before-load.patch diff --git a/patches/server/0079-lithium-suffocation.patch b/patches/server/0078-lithium-suffocation.patch similarity index 98% rename from patches/server/0079-lithium-suffocation.patch rename to patches/server/0078-lithium-suffocation.patch index c20f5ac..64bfb53 100644 --- a/patches/server/0079-lithium-suffocation.patch +++ b/patches/server/0078-lithium-suffocation.patch @@ -9,7 +9,7 @@ Original license: GNU Lesser General Public License v3.0 Original project: https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index bbb555d367e5c8b59c43f9169ed43a10294f97c8..c235a5415ded3d2626edf0d9f04d8ff1458d7bb9 100644 +index d2bffae52474883488a05534273dff9450a1634c..b19d4b2fec798c13601b5e46f8e77ed95917c2f0 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2607,39 +2607,64 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0080-Optimize-default-values-for-configs.patch b/patches/server/0079-Optimize-default-values-for-configs.patch similarity index 100% rename from patches/server/0080-Optimize-default-values-for-configs.patch rename to patches/server/0079-Optimize-default-values-for-configs.patch diff --git a/patches/server/0081-Fix-hunger-saturation-depleting-on-peaceful.patch b/patches/server/0080-Fix-hunger-saturation-depleting-on-peaceful.patch similarity index 100% rename from patches/server/0081-Fix-hunger-saturation-depleting-on-peaceful.patch rename to patches/server/0080-Fix-hunger-saturation-depleting-on-peaceful.patch diff --git a/patches/server/0082-Fix-mobs-attacking-themselves.patch b/patches/server/0081-Fix-mobs-attacking-themselves.patch similarity index 100% rename from patches/server/0082-Fix-mobs-attacking-themselves.patch rename to patches/server/0081-Fix-mobs-attacking-themselves.patch diff --git a/patches/server/0083-Fix-brewing-stands-resetting-their-brewTime-when-bei.patch b/patches/server/0082-Fix-brewing-stands-resetting-their-brewTime-when-bei.patch similarity index 100% rename from patches/server/0083-Fix-brewing-stands-resetting-their-brewTime-when-bei.patch rename to patches/server/0082-Fix-brewing-stands-resetting-their-brewTime-when-bei.patch diff --git a/patches/server/0084-lithium-world.tick_scheduler.patch b/patches/server/0083-lithium-world.tick_scheduler.patch similarity index 100% rename from patches/server/0084-lithium-world.tick_scheduler.patch rename to patches/server/0083-lithium-world.tick_scheduler.patch diff --git a/patches/server/0085-Save-Json-list-asynchronously.patch b/patches/server/0084-Save-Json-list-asynchronously.patch similarity index 100% rename from patches/server/0085-Save-Json-list-asynchronously.patch rename to patches/server/0084-Save-Json-list-asynchronously.patch diff --git a/patches/server/0086-Swaps-the-predicate-order-of-collision.patch b/patches/server/0085-Swaps-the-predicate-order-of-collision.patch similarity index 93% rename from patches/server/0086-Swaps-the-predicate-order-of-collision.patch rename to patches/server/0085-Swaps-the-predicate-order-of-collision.patch index 98826ef..81c45a0 100644 --- a/patches/server/0086-Swaps-the-predicate-order-of-collision.patch +++ b/patches/server/0085-Swaps-the-predicate-order-of-collision.patch @@ -8,7 +8,7 @@ Original license: GPLv3 Original project: https://github.com/Akarin-project/Akarin diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c235a5415ded3d2626edf0d9f04d8ff1458d7bb9..4010e136b5050c524f131d36b05ebcf9a95067ef 100644 +index b19d4b2fec798c13601b5e46f8e77ed95917c2f0..9f2d0ec15afb8192ea06bfdd473ffca42e887072 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1997,8 +1997,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0087-Fix-head-rotation-packet-spam.patch b/patches/server/0086-Fix-head-rotation-packet-spam.patch similarity index 92% rename from patches/server/0087-Fix-head-rotation-packet-spam.patch rename to patches/server/0086-Fix-head-rotation-packet-spam.patch index fe24349..95738f4 100644 --- a/patches/server/0087-Fix-head-rotation-packet-spam.patch +++ b/patches/server/0086-Fix-head-rotation-packet-spam.patch @@ -7,7 +7,7 @@ Original license: GPLv3 Original project: https://github.com/Electroid/SportPaper diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index aa1bd3423829900729d413a5f98f4a0b9aaf6135..82604712640140dbc5ec632233b937b2e073e28e 100644 +index bf314a8ea0145a82c5ff4fdff23444b8978845fe..3a0ff721e01e5bb2b2d05459019f8bba5f5d0737 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -342,8 +342,10 @@ public class ServerEntity { diff --git a/patches/server/0088-Cache-block-break-animation-packet.patch b/patches/server/0087-Cache-block-break-animation-packet.patch similarity index 86% rename from patches/server/0088-Cache-block-break-animation-packet.patch rename to patches/server/0087-Cache-block-break-animation-packet.patch index b6805e7..f5181c9 100644 --- a/patches/server/0088-Cache-block-break-animation-packet.patch +++ b/patches/server/0087-Cache-block-break-animation-packet.patch @@ -7,10 +7,10 @@ Original license: GPLv3 Original project: https://github.com/Electroid/SportPaper diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index aef9c28228be51e217b068e8731665cceff17717..b0b881eed06b1963c639b1a2c0808ab47fb34ac0 100644 +index f4280eb9f77568e4f3af6f264fc60901e667a936..42166dbec3154b9ebf26d9eda1752f80a9350764 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1570,6 +1570,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1565,6 +1565,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (entity instanceof Player) entityhuman = (Player) entity; // CraftBukkit end @@ -18,7 +18,7 @@ index aef9c28228be51e217b068e8731665cceff17717..b0b881eed06b1963c639b1a2c0808ab4 while (iterator.hasNext()) { ServerPlayer entityplayer = (ServerPlayer) iterator.next(); -@@ -1585,7 +1586,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1580,7 +1581,10 @@ public class ServerLevel extends Level implements WorldGenLevel { // CraftBukkit end if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { diff --git a/patches/server/0089-Use-more-fastutil-data-structures.patch b/patches/server/0088-Use-more-fastutil-data-structures.patch similarity index 100% rename from patches/server/0089-Use-more-fastutil-data-structures.patch rename to patches/server/0088-Use-more-fastutil-data-structures.patch diff --git a/patches/server/0090-Optimize-Math.round-and-Math.hypot-functions.patch b/patches/server/0089-Optimize-Math.round-and-Math.hypot-functions.patch similarity index 100% rename from patches/server/0090-Optimize-Math.round-and-Math.hypot-functions.patch rename to patches/server/0089-Optimize-Math.round-and-Math.hypot-functions.patch diff --git a/patches/server/0091-Faster-Sheep.getOffspringColor.patch b/patches/server/0090-Faster-Sheep.getOffspringColor.patch similarity index 100% rename from patches/server/0091-Faster-Sheep.getOffspringColor.patch rename to patches/server/0090-Faster-Sheep.getOffspringColor.patch diff --git a/patches/server/0092-PaperPR-Optimize-VarInts.patch b/patches/server/0091-PaperPR-Optimize-VarInts.patch similarity index 100% rename from patches/server/0092-PaperPR-Optimize-VarInts.patch rename to patches/server/0091-PaperPR-Optimize-VarInts.patch diff --git a/patches/server/0093-reduce-work-done-by-game-event-system.patch b/patches/server/0092-reduce-work-done-by-game-event-system.patch similarity index 97% rename from patches/server/0093-reduce-work-done-by-game-event-system.patch rename to patches/server/0092-reduce-work-done-by-game-event-system.patch index 2ac2ee6..4264620 100644 --- a/patches/server/0093-reduce-work-done-by-game-event-system.patch +++ b/patches/server/0092-reduce-work-done-by-game-event-system.patch @@ -11,10 +11,10 @@ Original project: https://github.com/Bloom-host/Petal 2. euclideangameeventdispatcher is not used concurrently so we ban that usage for improved performance with allays diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index b0b881eed06b1963c639b1a2c0808ab47fb34ac0..7dc341e91aaa581e499dfa3823712fcece9d5756 100644 +index 42166dbec3154b9ebf26d9eda1752f80a9350764..ac96f90d2f89fa449907108700db327ca5c798d5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1648,6 +1648,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1643,6 +1643,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (chunk != null) { for (int j2 = k; j2 <= j1; ++j2) { flag |= chunk.getEventDispatcher(j2).walkListeners(event, emitterPos, emitter, (gameeventlistener, vec3d1) -> { @@ -41,7 +41,7 @@ index 22c309343299e60ed8028229b7f134109001ff35..d5947d29295ddc93ba8ac1c0fc61f7ba org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = blockEntity.getBlockPos(); // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep. blockEntity.sculkSpreader.updateCursors(world, pos, world.getRandom(), true); diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 34334c139176e0aa9f6d93a87821508d17567cfc..6ba7d8c32cdd51c2c291ccafe0a9d145c88155f5 100644 +index f5adadb2e29ed8b52a502489ba06df4551cd06dc..5153dc3dcec63dc8063c7dd17d774d129dc0b67c 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -84,7 +84,18 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0094-reduce-sensor-work.patch b/patches/server/0093-reduce-sensor-work.patch similarity index 100% rename from patches/server/0094-reduce-sensor-work.patch rename to patches/server/0093-reduce-sensor-work.patch diff --git a/patches/server/0095-Configurable-chat-message-signatures.patch b/patches/server/0094-Configurable-chat-message-signatures.patch similarity index 98% rename from patches/server/0095-Configurable-chat-message-signatures.patch rename to patches/server/0094-Configurable-chat-message-signatures.patch index 5e52aa3..0761011 100644 --- a/patches/server/0095-Configurable-chat-message-signatures.patch +++ b/patches/server/0094-Configurable-chat-message-signatures.patch @@ -47,7 +47,7 @@ index 54a53a65130919b68f9cd8fd2d580fd8b9d2dfb3..7d7d88d2f920446a98c63229a351dc0d } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f2e61291dccffb76c73bd7d53eb2eb84307407c2..c1f40592ee346e610d018542a65a79f2c9f5e8bd 100644 +index ed98aab3df24bbefc1adc0e21ec7f1deab8d8aa1..e4abcd2f58dabe919a41162470386a6322f91f05 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2165,10 +2165,34 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0096-PaperPR-Fix-exact-choice-recipe-book-clicks.patch b/patches/server/0095-PaperPR-Fix-exact-choice-recipe-book-clicks.patch similarity index 100% rename from patches/server/0096-PaperPR-Fix-exact-choice-recipe-book-clicks.patch rename to patches/server/0095-PaperPR-Fix-exact-choice-recipe-book-clicks.patch diff --git a/patches/server/0097-Fix-MC-238526.patch b/patches/server/0096-Fix-MC-238526.patch similarity index 100% rename from patches/server/0097-Fix-MC-238526.patch rename to patches/server/0096-Fix-MC-238526.patch diff --git a/patches/server/0098-Lobotomize-stuck-villagers.patch b/patches/server/0097-Lobotomize-stuck-villagers.patch similarity index 100% rename from patches/server/0098-Lobotomize-stuck-villagers.patch rename to patches/server/0097-Lobotomize-stuck-villagers.patch diff --git a/patches/server/0099-Fix-legacy-colors-in-console.patch b/patches/server/0098-Fix-legacy-colors-in-console.patch similarity index 100% rename from patches/server/0099-Fix-legacy-colors-in-console.patch rename to patches/server/0098-Fix-legacy-colors-in-console.patch diff --git a/patches/server/0100-Set-multiple-Team-settings-at-once.patch b/patches/server/0099-Set-multiple-Team-settings-at-once.patch similarity index 100% rename from patches/server/0100-Set-multiple-Team-settings-at-once.patch rename to patches/server/0099-Set-multiple-Team-settings-at-once.patch diff --git a/patches/server/0101-Smooth-Teleports.patch b/patches/server/0100-Smooth-Teleports.patch similarity index 94% rename from patches/server/0101-Smooth-Teleports.patch rename to patches/server/0100-Smooth-Teleports.patch index 1a49b5b..7c45804 100644 --- a/patches/server/0101-Smooth-Teleports.patch +++ b/patches/server/0100-Smooth-Teleports.patch @@ -9,7 +9,7 @@ Original license: MIT Original project: https://github.com/Cryptite/Slice diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 48e195a6c8005a64cb286cfae39e54745f83affe..9afedb53289cbdeb62e3e14f8f58b4b77e241a49 100644 +index d1a6a21bfe93882e23a0bad742abd6fedcac29d0..bbe39f0fab243c763ee9c9a0629d17bdb167cd72 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -266,6 +266,7 @@ public class ServerPlayer extends Player { @@ -21,7 +21,7 @@ index 48e195a6c8005a64cb286cfae39e54745f83affe..9afedb53289cbdeb62e3e14f8f58b4b7 public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, @Nullable ProfilePublicKey publicKey) { super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile, publicKey); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 631cb49918cb0eef97407ffc95a0b001ecd31a62..2441cda53d8d0197abf49e53ef101dd5bf63185e 100644 +index 1b0e26afd4cbc8daec655513fe78933abb4a2151..790b25582f4fe78a681c0bf8281892e7545af1d6 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -970,12 +970,12 @@ public abstract class PlayerList { @@ -40,7 +40,7 @@ index 631cb49918cb0eef97407ffc95a0b001ecd31a62..2441cda53d8d0197abf49e53ef101dd5 // entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d0fc98ed0530a99adeb3c126b1040e40bb97685b..f20d307cc9cf684c181b5e7e9f32625452fea93d 100644 +index cfbabdcade291b2fcdbe83206b060b8762f50f41..f81c16884f8e517ceccb832bdff8840f24d52982 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1212,6 +1212,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0102-Unfreeze-MappedRegistry.patch b/patches/server/0101-Unfreeze-MappedRegistry.patch similarity index 100% rename from patches/server/0102-Unfreeze-MappedRegistry.patch rename to patches/server/0101-Unfreeze-MappedRegistry.patch diff --git a/patches/server/0103-Don-t-double-save-the-json-lists.patch b/patches/server/0102-Don-t-double-save-the-json-lists.patch similarity index 100% rename from patches/server/0103-Don-t-double-save-the-json-lists.patch rename to patches/server/0102-Don-t-double-save-the-json-lists.patch diff --git a/patches/server/0104-Don-t-wander-into-non-ticking-chunks.patch b/patches/server/0103-Don-t-wander-into-non-ticking-chunks.patch similarity index 100% rename from patches/server/0104-Don-t-wander-into-non-ticking-chunks.patch rename to patches/server/0103-Don-t-wander-into-non-ticking-chunks.patch diff --git a/patches/server/0105-Optimize-CraftServer.getWorld-UUID.patch b/patches/server/0104-Optimize-CraftServer.getWorld-UUID.patch similarity index 100% rename from patches/server/0105-Optimize-CraftServer.getWorld-UUID.patch rename to patches/server/0104-Optimize-CraftServer.getWorld-UUID.patch diff --git a/patches/server/0106-Configurable-mobs-from-spawners-picking-up-loot.patch b/patches/server/0105-Configurable-mobs-from-spawners-picking-up-loot.patch similarity index 100% rename from patches/server/0106-Configurable-mobs-from-spawners-picking-up-loot.patch rename to patches/server/0105-Configurable-mobs-from-spawners-picking-up-loot.patch diff --git a/patches/server/0107-Async-Pathfinding.patch b/patches/server/0106-Async-Pathfinding.patch similarity index 96% rename from patches/server/0107-Async-Pathfinding.patch rename to patches/server/0106-Async-Pathfinding.patch index 3034973..60339b9 100644 --- a/patches/server/0107-Async-Pathfinding.patch +++ b/patches/server/0106-Async-Pathfinding.patch @@ -8,10 +8,10 @@ This patch was ported downstream from the Petal fork. Makes most pathfinding-related work happen asynchronously diff --git a/src/main/java/dev/etil/mirai/MiraiConfig.java b/src/main/java/dev/etil/mirai/MiraiConfig.java -index 24e2c81fe0de5eb2e9a17554d81cfd14a36f90c4..8e755ea4d26756843850cbd17ac8383e45695adf 100644 +index 24e2c81fe0de5eb2e9a17554d81cfd14a36f90c4..8dffa2fadd615cfd59cc85630b4a1454c87e5aa9 100644 --- a/src/main/java/dev/etil/mirai/MiraiConfig.java +++ b/src/main/java/dev/etil/mirai/MiraiConfig.java -@@ -263,4 +263,15 @@ public class MiraiConfig { +@@ -263,4 +263,16 @@ public class MiraiConfig { "pick up items on the ground."); } @@ -19,7 +19,8 @@ index 24e2c81fe0de5eb2e9a17554d81cfd14a36f90c4..8e755ea4d26756843850cbd17ac8383e + public static boolean enableAsyncPathfindingInitialized; + private static void asyncPathfinding() { + boolean temp = getBoolean("enable-async-pathfinding", true, -+ "Whether or not async pathfinding should be enabled."); ++ "Whether or not async pathfinding should be enabled.", ++ "You may encounter issues with water interactions."); + if (!enableAsyncPathfindingInitialized) { + enableAsyncPathfindingInitialized = true; + enableAsyncPathfinding = temp; @@ -319,7 +320,7 @@ index 0000000000000000000000000000000000000000..2ecf19f9623a4c6c99a7b97e950387e8 \ No newline at end of file diff --git a/src/main/java/dev/etil/mirai/path/AsyncPathProcessor.java b/src/main/java/dev/etil/mirai/path/AsyncPathProcessor.java new file mode 100644 -index 0000000000000000000000000000000000000000..050a4f73b49002b54a07a61d3435d1f84ba98191 +index 0000000000000000000000000000000000000000..6dc8f7bb7ba6b78b5db50801a61abe526c17c939 --- /dev/null +++ b/src/main/java/dev/etil/mirai/path/AsyncPathProcessor.java @@ -0,0 +1,44 @@ @@ -343,7 +344,7 @@ index 0000000000000000000000000000000000000000..050a4f73b49002b54a07a61d3435d1f8 + + private static final Executor mainThreadExecutor = MinecraftServer.getServer(); + private static final Executor pathProcessingExecutor = Executors.newCachedThreadPool(new ThreadFactoryBuilder() -+ .setNameFormat("puff-path-processor-%d") ++ .setNameFormat("mirai-path-processor-%d") + .setPriority(Thread.NORM_PRIORITY - 2) + .build()); + @@ -517,7 +518,7 @@ index bf3b8ccb3e031e0ad24cd51e28ea8cbd4f8a8030..8efe9dfe75e1dfc430cd011f9dbeb3d1 @Nullable diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java b/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java -index 18364ce4c60172529b10bc9e3a813dcedc4b766f..771a8c7477ac2335f8858f97befd0b13d9710d2a 100644 +index 18364ce4c60172529b10bc9e3a813dcedc4b766f..fd2abf5a865518b12d2a64d52596015aede1177e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java @@ -21,6 +21,7 @@ public class MoveToTargetSink extends Behavior { @@ -581,10 +582,10 @@ index 18364ce4c60172529b10bc9e3a813dcedc4b766f..771a8c7477ac2335f8858f97befd0b13 + } else if (brain.hasMemoryValue(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE)) { + brain.setMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, time); + } -+ ++ + if (!canReach) { + Optional walkTarget = brain.getMemory(MemoryModuleType.WALK_TARGET); -+ ++ + if (walkTarget.isPresent()) { + BlockPos blockPos = walkTarget.get().getTarget().currentBlockPosition(); + Vec3 vec3 = DefaultRandomPos.getPosTowards((PathfinderMob)entity, 10, 7, Vec3.atBottomCenterOf(blockPos), (double)((float)Math.PI / 2F)); @@ -595,13 +596,13 @@ index 18364ce4c60172529b10bc9e3a813dcedc4b766f..771a8c7477ac2335f8858f97befd0b13 + return; + } + } -+ ++ + brain.eraseMemory(MemoryModuleType.WALK_TARGET); + this.path = null; -+ ++ + return; + } -+ ++ + entity.getBrain().setMemory(MemoryModuleType.PATH, this.path); + entity.getNavigation().moveTo(this.path, (double)this.speedModifier); + } @@ -648,7 +649,7 @@ index 18364ce4c60172529b10bc9e3a813dcedc4b766f..771a8c7477ac2335f8858f97befd0b13 private boolean tryComputePath(Mob entity, WalkTarget walkTarget, long time) { BlockPos blockPos = walkTarget.getTarget().currentBlockPosition(); diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java b/src/main/java/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java -index 9bd6d4f7b86daaaa9cfbad454dde06b797e3f667..f25787989e9c4c7ffef5a8d31f6dc0a5c671b39c 100644 +index 9bd6d4f7b86daaaa9cfbad454dde06b797e3f667..9aca3f84b60273a0eb0ab657ff8403f21b46d4d5 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java @@ -71,19 +71,41 @@ public class SetClosestHomeAsWalkTarget extends Behavior { @@ -669,7 +670,7 @@ index 9bd6d4f7b86daaaa9cfbad454dde06b797e3f667..f25787989e9c4c7ffef5a8d31f6dc0a5 + // Mirai start - await on path async + if (dev.etil.mirai.MiraiConfig.enableAsyncPathfinding) { + Path possiblePath = AcquirePoi.findPathToPois(pathfinderMob, set); -+ ++ + // Mirai - wait on the path to be processed + dev.etil.mirai.path.AsyncPathProcessor.awaitProcessing(possiblePath, path -> { + if (path == null || !path.canReach() || this.triedCount < 5) { // Mirai - readd canReach check @@ -678,7 +679,7 @@ index 9bd6d4f7b86daaaa9cfbad454dde06b797e3f667..f25787989e9c4c7ffef5a8d31f6dc0a5 + }); + return; + } -+ ++ + BlockPos blockPos = path.getTarget(); + Optional> optional = poiManager.getType(blockPos); + if (optional.isPresent()) { @@ -823,7 +824,7 @@ index f0248d839255763005ba333b0bfcf691407fb69b..dd627d720320b09ac909a19646f50435 @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index c1781c92ff59f0c9eb47cbbef01e3252c5e1a1bf..e3e1b75653088bd9d32a5312b45188e352e117d4 100644 +index c1781c92ff59f0c9eb47cbbef01e3252c5e1a1bf..3803d5b79b4bb99d1a87c1af4d7e20ae4128a416 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -150,6 +150,9 @@ public abstract class PathNavigation { @@ -904,11 +905,20 @@ index c1781c92ff59f0c9eb47cbbef01e3252c5e1a1bf..e3e1b75653088bd9d32a5312b45188e3 protected void followThePath() { Vec3 vec3 = this.getTempMobPos(); this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F; +@@ -419,7 +448,7 @@ public abstract class PathNavigation { + public boolean shouldRecomputePath(BlockPos pos) { + if (this.hasDelayedRecomputation) { + return false; +- } else if (this.path != null && !this.path.isDone() && this.path.getNodeCount() != 0) { ++ } else if (this.path != null && this.path.isProcessed() && !this.path.isDone() && this.path.getNodeCount() != 0) { // Mirai + Node node = this.path.getEndNode(); + Vec3 vec3 = new Vec3(((double)node.x + this.mob.getX()) / 2.0D, ((double)node.y + this.mob.getY()) / 2.0D, ((double)node.z + this.mob.getZ()) / 2.0D); + return pos.closerToCenterThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex())); diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java -index 8db20db72cd51046213625fac46c35854c59ec5d..7b9c47dc06a98add8b11ab7fccee2b33819d6bcb 100644 +index 8db20db72cd51046213625fac46c35854c59ec5d..39b95ecb2b9dd313d2e58ee98349af0d665e7f01 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java -@@ -57,20 +57,41 @@ public class NearestBedSensor extends Sensor { +@@ -57,20 +57,42 @@ public class NearestBedSensor extends Sensor { java.util.List, BlockPos>> poiposes = new java.util.ArrayList<>(); // don't ask me why it's unbounded. ask mojang. io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes); @@ -923,6 +933,7 @@ index 8db20db72cd51046213625fac46c35854c59ec5d..7b9c47dc06a98add8b11ab7fccee2b33 - } else if (this.triedCount < 5) { - this.batchCache.long2LongEntrySet().removeIf((entry) -> { - return entry.getLongValue() < this.lastUpdate; ++ + // Mirai start - await on path async + if (dev.etil.mirai.MiraiConfig.enableAsyncPathfinding) { + Path possiblePath = AcquirePoi.findPathToPois(entity, new java.util.HashSet<>(poiposes)); @@ -936,7 +947,7 @@ index 8db20db72cd51046213625fac46c35854c59ec5d..7b9c47dc06a98add8b11ab7fccee2b33 + }); + return; + } -+ ++ + BlockPos blockPos = path.getTarget(); + Optional> optional = poiManager.getType(blockPos); + if (optional.isPresent()) { diff --git a/patches/server/0107-Multithreaded-Tracker.patch b/patches/server/0107-Multithreaded-Tracker.patch new file mode 100644 index 0000000..e18e7ac --- /dev/null +++ b/patches/server/0107-Multithreaded-Tracker.patch @@ -0,0 +1,378 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: peaches94 +Date: Sat, 2 Jul 2022 00:35:56 -0500 +Subject: [PATCH] Multithreaded Tracker + +This patch was ported downstream from the Petal fork, and is derived from +the Airplane fork by Paul Sauve + +Based off the Airplane multithreaded tracker, this patch properly handles +concurrent accesses everywhere, as well as being much simpler to maintain + +Some things are too unsafe to run off the main thread so we don't attempt to do +that. This multithreaded tracker remains accurate, non-breaking and fast. + +diff --git a/src/main/java/dev/etil/mirai/MiraiConfig.java b/src/main/java/dev/etil/mirai/MiraiConfig.java +index 8dffa2fadd615cfd59cc85630b4a1454c87e5aa9..4c8dd8b1a3355578f067d547ab1d0151314f7ddf 100644 +--- a/src/main/java/dev/etil/mirai/MiraiConfig.java ++++ b/src/main/java/dev/etil/mirai/MiraiConfig.java +@@ -275,4 +275,16 @@ public class MiraiConfig { + } + } + ++ public static boolean enableAsyncEntityTracker; ++ public static boolean enableAsyncEntityTrackerInitialized; ++ private static void asyncEntityTracker() { ++ boolean temp = getBoolean("enable-async-entity-tracker", true, ++ "Whether or not async entity tracking should be enabled.", ++ "You may encounter issues with NPCs."); ++ if (!enableAsyncEntityTrackerInitialized) { ++ enableAsyncEntityTrackerInitialized = true; ++ enableAsyncEntityTracker = temp; ++ } ++ } ++ + } +\ No newline at end of file +diff --git a/src/main/java/dev/etil/mirai/tracker/MultithreadedTracker.java b/src/main/java/dev/etil/mirai/tracker/MultithreadedTracker.java +new file mode 100644 +index 0000000000000000000000000000000000000000..613bd104762755395e86101decaf1cb7dc74d2ad +--- /dev/null ++++ b/src/main/java/dev/etil/mirai/tracker/MultithreadedTracker.java +@@ -0,0 +1,154 @@ ++package dev.etil.mirai.tracker; ++ ++import com.google.common.util.concurrent.ThreadFactoryBuilder; ++import io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet; ++import io.papermc.paper.world.ChunkEntitySlices; ++import net.minecraft.server.MinecraftServer; ++import net.minecraft.server.level.ChunkMap; ++import net.minecraft.world.entity.Entity; ++import net.minecraft.world.level.chunk.LevelChunk; ++ ++import java.util.concurrent.ConcurrentLinkedQueue; ++import java.util.concurrent.Executor; ++import java.util.concurrent.Executors; ++import java.util.concurrent.atomic.AtomicInteger; ++ ++public class MultithreadedTracker { ++ ++ private enum TrackerStage { ++ UPDATE_PLAYERS, ++ SEND_CHANGES ++ } ++ ++ private static final int parallelism = Math.max(4, Runtime.getRuntime().availableProcessors()); ++ private static final Executor trackerExecutor = Executors.newFixedThreadPool(parallelism, new ThreadFactoryBuilder() ++ .setNameFormat("mirai-tracker-%d") ++ .setPriority(Thread.NORM_PRIORITY - 2) ++ .build()); ++ ++ private final IteratorSafeOrderedReferenceSet entityTickingChunks; ++ private final AtomicInteger taskIndex = new AtomicInteger(); ++ ++ private final ConcurrentLinkedQueue mainThreadTasks; ++ private final AtomicInteger finishedTasks = new AtomicInteger(); ++ ++ public MultithreadedTracker(IteratorSafeOrderedReferenceSet entityTickingChunks, ConcurrentLinkedQueue mainThreadTasks) { ++ this.entityTickingChunks = entityTickingChunks; ++ this.mainThreadTasks = mainThreadTasks; ++ } ++ ++ public void tick() { ++ int iterator = this.entityTickingChunks.createRawIterator(); ++ ++ if (iterator == -1) { ++ return; ++ } ++ ++ // start with updating players ++ try { ++ this.taskIndex.set(iterator); ++ this.finishedTasks.set(0); ++ ++ for (int i = 0; i < parallelism; i++) { ++ trackerExecutor.execute(this::runUpdatePlayers); ++ } ++ ++ while (this.taskIndex.get() < this.entityTickingChunks.getListSize()) { ++ this.runMainThreadTasks(); ++ this.handleChunkUpdates(5); // assist ++ } ++ ++ while (this.finishedTasks.get() != parallelism) { ++ this.runMainThreadTasks(); ++ } ++ ++ this.runMainThreadTasks(); // finish any remaining tasks ++ } finally { ++ this.entityTickingChunks.finishRawIterator(); ++ } ++ ++ // then send changes ++ iterator = this.entityTickingChunks.createRawIterator(); ++ ++ if (iterator == -1) { ++ return; ++ } ++ ++ try { ++ do { ++ LevelChunk chunk = this.entityTickingChunks.rawGet(iterator); ++ ++ if (chunk != null) { ++ this.updateChunkEntities(chunk, TrackerStage.SEND_CHANGES); ++ } ++ } while (++iterator < this.entityTickingChunks.getListSize()); ++ } finally { ++ this.entityTickingChunks.finishRawIterator(); ++ } ++ } ++ ++ private void runMainThreadTasks() { ++ try { ++ Runnable task; ++ while ((task = this.mainThreadTasks.poll()) != null) { ++ task.run(); ++ } ++ } catch (Throwable throwable) { ++ MinecraftServer.LOGGER.warn("Tasks failed while ticking track queue", throwable); ++ } ++ } ++ ++ private void runUpdatePlayers() { ++ try { ++ while (handleChunkUpdates(10)); ++ } finally { ++ this.finishedTasks.incrementAndGet(); ++ } ++ } ++ ++ private boolean handleChunkUpdates(int tasks) { ++ int index; ++ while ((index = this.taskIndex.getAndAdd(tasks)) < this.entityTickingChunks.getListSize()) { ++ for (int i = index; i < index + tasks && i < this.entityTickingChunks.getListSize(); i++) { ++ LevelChunk chunk = this.entityTickingChunks.rawGet(i); ++ if (chunk != null) { ++ try { ++ this.updateChunkEntities(chunk, TrackerStage.UPDATE_PLAYERS); ++ } catch (Throwable throwable) { ++ MinecraftServer.LOGGER.warn("Ticking tracker failed", throwable); ++ } ++ ++ } ++ } ++ ++ return true; ++ } ++ ++ return false; ++ } ++ ++ private void updateChunkEntities(LevelChunk chunk, TrackerStage trackerStage) { ++ final ChunkEntitySlices entitySlices = chunk.level.getEntityLookup().getChunk(chunk.locX, chunk.locZ); ++ if (entitySlices == null) { ++ return; ++ } ++ ++ final Entity[] rawEntities = entitySlices.entities.getRawData(); ++ final ChunkMap chunkMap = chunk.level.chunkSource.chunkMap; ++ ++ for (int i = 0; i < rawEntities.length; i++) { ++ Entity entity = rawEntities[i]; ++ if (entity != null) { ++ ChunkMap.TrackedEntity entityTracker = chunkMap.entityMap.get(entity.getId()); ++ if (entityTracker != null) { ++ if (trackerStage == TrackerStage.SEND_CHANGES) { ++ entityTracker.serverEntity.sendChanges(); ++ } else if (trackerStage == TrackerStage.UPDATE_PLAYERS) { ++ entityTracker.updatePlayers(entityTracker.entity.getPlayersInTrackRange()); ++ } ++ } ++ } ++ } ++ } ++ ++} +\ No newline at end of file +diff --git a/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java b/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java +index 0fd814f1d65c111266a2b20f86561839a4cef755..dc06747df171678c8531e1153c5fa9b80b70baed 100644 +--- a/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java ++++ b/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java +@@ -15,7 +15,7 @@ public final class IteratorSafeOrderedReferenceSet { + + /* list impl */ + protected E[] listElements; +- protected int listSize; ++ protected int listSize; public int getListSize() { return this.listSize; } // Mirai - expose listSize + + protected final double maxFragFactor; + +diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java +index 209c4f0b25470bff7278c0a8dcd30576900b9933..603eb6ca629796cfd00c831a509fb71ad0fba360 100644 +--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java ++++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java +@@ -35,7 +35,7 @@ public final class ChunkEntitySlices { + protected final EntityCollectionBySection allEntities; + protected final EntityCollectionBySection hardCollidingEntities; + protected final Reference2ObjectOpenHashMap, EntityCollectionBySection> entitiesByClass; +- protected final EntityList entities = new EntityList(); ++ public final EntityList entities = new EntityList(); + + public ChunkHolder.FullChunkStatus status; + +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index c01c22b6fda9e36a2336a992c760b813b71469ce..9f0fe4672abcfe417fd5f160ca497ad323434d5f 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -1237,8 +1237,36 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + entity.tracker = null; // Paper - We're no longer tracked + } + ++ // Mirai start - multithreaded tracker ++ private @Nullable dev.etil.mirai.tracker.MultithreadedTracker multithreadedTracker; ++ private final java.util.concurrent.ConcurrentLinkedQueue trackerMainThreadTasks = new java.util.concurrent.ConcurrentLinkedQueue<>(); ++ private boolean tracking = false; ++ ++ public void runOnTrackerMainThread(final Runnable runnable) { ++ if (this.tracking) { ++ this.trackerMainThreadTasks.add(runnable); ++ } else { ++ runnable.run(); ++ } ++ } ++ + // Paper start - optimised tracker + private final void processTrackQueue() { ++ if (dev.etil.mirai.MiraiConfig.enableAsyncEntityTracker) { ++ if (this.multithreadedTracker == null) { ++ this.multithreadedTracker = new dev.etil.mirai.tracker.MultithreadedTracker(this.level.chunkSource.entityTickingChunks, this.trackerMainThreadTasks); ++ } ++ ++ this.tracking = true; ++ try { ++ this.multithreadedTracker.tick(); ++ } finally { ++ this.tracking = false; ++ } ++ return; ++ } ++ // Mirai end ++ + this.level.timings.tracker1.startTiming(); + try { + for (TrackedEntity tracker : this.entityMap.values()) { +@@ -1462,11 +1490,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + + public class TrackedEntity { + +- final ServerEntity serverEntity; +- final Entity entity; ++ public final ServerEntity serverEntity; // Mirai -> public ++ public final Entity entity; // Mirai -> public + private final int range; + SectionPos lastSectionPos; +- public final Set seenBy = new ReferenceOpenHashSet<>(); // Paper - optimise map impl ++ public final Set seenBy = it.unimi.dsi.fastutil.objects.ReferenceSets.synchronize(new ReferenceOpenHashSet<>()); // Paper - optimise map impl // Mirai - sync + + public TrackedEntity(Entity entity, int i, int j, boolean flag) { + this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit +@@ -1478,7 +1506,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + // Paper start - use distance map to optimise tracker + com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet lastTrackerCandidates; + +- final void updatePlayers(com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet newTrackerCandidates) { ++ public final void updatePlayers(com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet newTrackerCandidates) { // Mirai -> public + com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet oldTrackerCandidates = this.lastTrackerCandidates; + this.lastTrackerCandidates = newTrackerCandidates; + +@@ -1550,7 +1578,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + } + + public void removePlayer(ServerPlayer player) { +- org.spigotmc.AsyncCatcher.catchOp("player tracker clear"); // Spigot ++ //org.spigotmc.AsyncCatcher.catchOp("player tracker clear"); // Spigot // Mirai - we can remove async too + if (this.seenBy.remove(player.connection)) { + this.serverEntity.removePairing(player); + } +@@ -1558,7 +1586,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + } + + public void updatePlayer(ServerPlayer player) { +- org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot ++ //org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot // Mirai - we can update async + if (player != this.entity) { + // Paper start - remove allocation of Vec3D here + // Vec3 vec3d = player.position().subtract(this.entity.position()); +diff --git a/src/main/java/net/minecraft/server/level/ServerBossEvent.java b/src/main/java/net/minecraft/server/level/ServerBossEvent.java +index ca42c2642a729b90d22b968af7258f3aee72e14b..c4d6d5be09c788bbc062c50d8547538eb84530b4 100644 +--- a/src/main/java/net/minecraft/server/level/ServerBossEvent.java ++++ b/src/main/java/net/minecraft/server/level/ServerBossEvent.java +@@ -13,7 +13,7 @@ import net.minecraft.util.Mth; + import net.minecraft.world.BossEvent; + + public class ServerBossEvent extends BossEvent { +- private final Set players = Sets.newHashSet(); ++ private final Set players = Sets.newConcurrentHashSet(); // Mirai - players can be removed in async tracking + private final Set unmodifiablePlayers = Collections.unmodifiableSet(this.players); + public boolean visible = true; + +diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java +index 3a0ff721e01e5bb2b2d05459019f8bba5f5d0737..52697f4907d63b975c2d5045f7d11bc76dd6b78d 100644 +--- a/src/main/java/net/minecraft/server/level/ServerEntity.java ++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +@@ -266,14 +266,18 @@ public class ServerEntity { + + public void removePairing(ServerPlayer player) { + this.entity.stopSeenByPlayer(player); +- player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()})); ++ // Mirai start - ensure main thread ++ ((ServerLevel) this.entity.level).chunkSource.chunkMap.runOnTrackerMainThread(() -> ++ player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()})) ++ ); ++ // Mirai end + } + + public void addPairing(ServerPlayer player) { + ServerGamePacketListenerImpl playerconnection = player.connection; + + Objects.requireNonNull(player.connection); +- this.sendPairingData(playerconnection::send, player); // CraftBukkit - add player ++ ((ServerLevel) this.entity.level).chunkSource.chunkMap.runOnTrackerMainThread(() -> this.sendPairingData(playerconnection::send, player)); // CraftBukkit - add player // Mirai - main thread + this.entity.startSeenByPlayer(player); + } + +@@ -381,19 +385,30 @@ public class ServerEntity { + SynchedEntityData datawatcher = this.entity.getEntityData(); + + if (datawatcher.isDirty()) { +- this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false)); ++ // Mirai start - sync ++ ((ServerLevel) this.entity.level).chunkSource.chunkMap.runOnTrackerMainThread(() -> ++ this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false)) ++ ); ++ // Mirai end + } + + if (this.entity instanceof LivingEntity) { + Set set = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); + + if (!set.isEmpty()) { ++ // Mirai start - sync ++ final var copy = Lists.newArrayList(set); ++ ((ServerLevel) this.entity.level).chunkSource.chunkMap.runOnTrackerMainThread(() -> { ++ + // CraftBukkit start - Send scaled max health + if (this.entity instanceof ServerPlayer) { +- ((ServerPlayer) this.entity).getBukkitEntity().injectScaledMaxHealth(set, false); ++ ((ServerPlayer) this.entity).getBukkitEntity().injectScaledMaxHealth(copy, false); + } + // CraftBukkit end +- this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), set)); ++ this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), copy)); ++ ++ }); ++ // Mirai end + } + + set.clear();