diff --git a/LICENSE.md b/LICENSE.md index be435f08..dce2fa9d 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,5 +1,10 @@ # Leaf license +Leaf inherits licenses from upstream projects. + Paperweight files are licensed under [MIT](https://opensource.org/licenses/MIT) (included in `license/MIT.txt`). -Patches are licensed under MIT, unless indicated differently in their header (some patches are licensed under [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.html) (included in `license/GPL-3.0.txt`) or [LGPL-3.0](https://www.gnu.org/licenses/lgpl-3.0.html) (included in `license/LGPL-3.0.txt`)). +Patches are licensed under MIT, unless indicated differently in their header (some patches are licensed under [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.html) (included in `license/GPL-3.0.txt`), [LGPL-3.0](https://www.gnu.org/licenses/lgpl-3.0.html) (included in `license/LGPL-3.0.txt`), or [Apache-2.0](https://www.apache.org/licenses/) (included in `license/Apache-2.0.txt`)). +Certain patches are derived from other projects and retain the original licenses, as noted in the patch header. Binaries are licensed under GPL-3.0. + +Also see [PaperMC/Paper](https://github.com/PaperMC/Paper), [PaperMC/paperweight](https://github.com/PaperMC/paperweight), and the repositories of other dependencies used by this project for their respective licenses. diff --git a/README.md b/README.md index 86cae39d..448e318a 100644 --- a/README.md +++ b/README.md @@ -87,11 +87,9 @@ java { ``` ## ⚖️ License -Paperweight files are licensed under [MIT](licenses/MIT.txt). -Patches are licensed under [MIT](licenses/MIT.txt), unless indicated differently in their header. -Binaries are licensed under [GPL-3.0](licenses/GPL-3.0.txt). +Leaf is licensed under multiple open source licenses depending on upstream projects and other materials, -Also see [PaperMC/Paper](https://github.com/PaperMC/Paper) and [PaperMC/paperweight](https://github.com/PaperMC/paperweight) for the licenses of some materials used by this project. +see [LICENSE.md](LICENSE.md) for full license information. ## 📜 Credits Thanks to these projects below. Leaf includes some patches taken from them.
diff --git a/leaf-server/minecraft-patches/features/0272-preload-mob-spawning-position.patch b/leaf-archived-patches/removed/hardfork/server/0184-preload-mob-spawning-position.patch similarity index 79% rename from leaf-server/minecraft-patches/features/0272-preload-mob-spawning-position.patch rename to leaf-archived-patches/removed/hardfork/server/0184-preload-mob-spawning-position.patch index a3da41d9..911a1dbf 100644 --- a/leaf-server/minecraft-patches/features/0272-preload-mob-spawning-position.patch +++ b/leaf-archived-patches/removed/hardfork/server/0184-preload-mob-spawning-position.patch @@ -3,23 +3,20 @@ From: hayanesuru Date: Wed, 4 Jun 2025 20:54:32 +0900 Subject: [PATCH] preload mob spawning position +Removed since Leaf 1.21.4, No need diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index a55abb08093847a8bfec446659f9af5fb1df2824..555983c7fa7b1f2d72ebbc148ca3dcb7cd217c56 100644 +index 458b17dca84c87591b030679c5aac6259c0f8308..c69922ac2b831d8af35c9e98a34825e6b8a268da 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -243,12 +243,61 @@ public final class NaturalSpawner { - // Paper end - throttle failed spawn attempts - ) { +@@ -257,9 +257,57 @@ public final class NaturalSpawner { // Paper end - Optional per player mob spawns -- BlockPos randomPosWithin = getRandomPosWithin(level, chunk); -- if (randomPosWithin.getY() >= level.getMinY() + 1) { -- return spawnCategoryForPosition(category, level, chunk, randomPosWithin, filter, callback, maxSpawns, trackEntity, false); // Paper - Optional per player mob spawns // Paper - throttle failed spawn attempts -- } + // Leaf start - optimize mob spawning + BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); +- mutableRandomPosWithin(pos, level, chunk); +- if (pos.getY() < level.getMinY() + 1) { +- return 0; + // Leaf start - preload mob spawning position -+ BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); - -- return 0; // Paper - throttle failed spawn attempts + if (org.dreeam.leaf.config.modules.opt.PreloadNaturalMobSpawning.enabled) { + if (chunk.cacheSpawnPosIndex == 16 || chunk.cacheSpawnPosIndex == -1) { + if (chunk.cacheSpawnPos == null) { @@ -69,13 +66,11 @@ index a55abb08093847a8bfec446659f9af5fb1df2824..555983c7fa7b1f2d72ebbc148ca3dcb7 + if (bs == null || bs.isRedstoneConductor(level, pos)) { + return 0; + } -+ } -+ return spawnCategoryForPosition(category, level, chunk, pos, filter, callback, maxSpawns, trackEntity, false); // Paper - Optional per player mob spawns // Paper - throttle failed spawn attempts -+ // Leaf end - preload mob spawning position - } - - @VisibleForDebug -@@ -270,7 +319,12 @@ public final class NaturalSpawner { ++ // Leaf end - preload mob spawning position + } + return spawnCategoryForPosition(category, level, chunk, pos, filter, callback, maxSpawns, trackEntity, false); // Paper - Optional per player mob spawns // Paper - throttle failed spawn attempts + // Leaf end - optimize mob spawning +@@ -284,7 +332,12 @@ public final class NaturalSpawner { MobCategory category, ServerLevel level, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback, final int maxSpawns, final @Nullable Consumer trackEntity // Paper start - throttle failed spawn attempts ) { @@ -89,25 +84,25 @@ index a55abb08093847a8bfec446659f9af5fb1df2824..555983c7fa7b1f2d72ebbc148ca3dcb7 } public static int spawnCategoryForPosition( MobCategory category, ServerLevel level, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback, final int maxSpawns, final @Nullable Consumer trackEntity, final boolean nothing -@@ -281,8 +335,8 @@ public final class NaturalSpawner { - ChunkGenerator generator = level.getChunkSource().getGenerator(); - int y = pos.getY(); +@@ -297,8 +350,8 @@ public final class NaturalSpawner { + int posX = pos.getX(); // Leaf - optimize mob spawning + int posZ = pos.getZ(); // Leaf - optimize mob spawning int i = 0; // Paper - throttle failed spawn attempts - BlockState blockState = level.getBlockStateIfLoadedAndInBounds(pos); // Paper - don't load chunks for mob spawn - if (blockState != null && !blockState.isRedstoneConductor(chunk, pos)) { // Paper - don't load chunks for mob spawn + //BlockState blockState = level.getBlockStateIfLoadedAndInBounds(pos); // Paper - don't load chunks for mob spawn // Leaf - preload mob spawning position + if (true /*blockState != null && !blockState.isRedstoneConductor(chunk, pos)*/) { // Paper - don't load chunks for mob spawn // Leaf - preload mob spawning position - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); + BlockPos.MutableBlockPos mutableBlockPos = pos instanceof BlockPos.MutableBlockPos pos2 ? pos2 : new BlockPos.MutableBlockPos(); // Leaf - optimize mob spawning //int i = 0; // Paper - throttle failed spawn attempts - move up diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 31f19dfe16e270b55f3b44754c97ed8d9fa422cf..b79eefb182b0a9e9f22ccb649c4659483228082c 100644 +index a90bf0d80ae4dac9b19b8e467b402917cc19a271..804f2118167b1607c50ca8378119254e8760427a 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -107,6 +107,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -106,6 +106,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p // Paper start - rewrite chunk system private boolean postProcessingDone; - private ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkAndHolder; + private net.minecraft.server.level.ServerChunkCache.ChunkAndHolder chunkAndHolder; + public long[] cacheSpawnPos = null; // Leaf - preload mob spawning position + public int cacheSpawnPosIndex = -1; // Leaf - preload mob spawning position diff --git a/leaf-server/minecraft-patches/features/0190-Lithium-equipment-tracking.patch b/leaf-archived-patches/work/server/0190-Lithium-equipment-tracking.patch similarity index 99% rename from leaf-server/minecraft-patches/features/0190-Lithium-equipment-tracking.patch rename to leaf-archived-patches/work/server/0190-Lithium-equipment-tracking.patch index d0b7d3a5..2de0f74e 100644 --- a/leaf-server/minecraft-patches/features/0190-Lithium-equipment-tracking.patch +++ b/leaf-archived-patches/work/server/0190-Lithium-equipment-tracking.patch @@ -3,6 +3,9 @@ From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com> Date: Tue, 9 Nov 2077 00:00:00 +0800 Subject: [PATCH] Lithium: equipment tracking +TODO: needs to fix issues related to Piglins lose the crossbow animation +original report is in discord. + Should have special treatment to ArmorStand, since Paper introduced the configurable ArmorStand no-tick, and still gives it ability to update equipment changes. Thus added a bypass condition in LivingEntity#collectEquipmentChanges, always send diff --git a/leaf-server/minecraft-patches/features/0008-Simpler-ShapelessRecipe-comparison-for-vanilla.patch b/leaf-server/minecraft-patches/features/0008-Simpler-ShapelessRecipe-comparison-for-vanilla.patch index c445a7a1..b26bf08d 100644 --- a/leaf-server/minecraft-patches/features/0008-Simpler-ShapelessRecipe-comparison-for-vanilla.patch +++ b/leaf-server/minecraft-patches/features/0008-Simpler-ShapelessRecipe-comparison-for-vanilla.patch @@ -34,7 +34,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/net/minecraft/world/item/crafting/ShapelessRecipe.java b/net/minecraft/world/item/crafting/ShapelessRecipe.java index d601b54b1de2f2ae44fe2b20c8116c71a6340e45..6a53e97d27d746621892ced4ca5b4a56b6bc4c23 100644 diff --git a/leaf-server/minecraft-patches/features/0009-Reduce-projectile-chunk-loading.patch b/leaf-server/minecraft-patches/features/0009-Reduce-projectile-chunk-loading.patch index 1ba64462..ded97942 100644 --- a/leaf-server/minecraft-patches/features/0009-Reduce-projectile-chunk-loading.patch +++ b/leaf-server/minecraft-patches/features/0009-Reduce-projectile-chunk-loading.patch @@ -28,7 +28,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java index 4487c03183d20a187d391dd124abb7b926508b5b..84c846d2ef4990befb2891631ac5ae16d881401b 100644 diff --git a/leaf-server/minecraft-patches/features/0012-Optimize-random-calls-in-chunk-ticking.patch b/leaf-server/minecraft-patches/features/0012-Optimize-random-calls-in-chunk-ticking.patch index b554ad69..c9bfc054 100644 --- a/leaf-server/minecraft-patches/features/0012-Optimize-random-calls-in-chunk-ticking.patch +++ b/leaf-server/minecraft-patches/features/0012-Optimize-random-calls-in-chunk-ticking.patch @@ -49,10 +49,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 4167b46148fc370f20b35c2a261e38c0698855d4..52cef9fed4a68d16d89eabacbad073ead0685972 100644 +index 5005ad97fe4830c6563bca50a77a6abd36c984df..3d7d336c2043b533012ee390e6da02ac4f64e1f2 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java @@ -499,6 +499,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon @@ -64,7 +64,7 @@ index 4167b46148fc370f20b35c2a261e38c0698855d4..52cef9fed4a68d16d89eabacbad073ea this.tickChunks(l); // Gale - Purpur - remove vanilla profiler } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 3941d15753aef952ad1fd5b5f96cb810f4f251e3..06439db58ecec0ead6c0a4e30357a9a3b3ebd120 100644 +index 28377b1d568e70f4ff1e5a6eea39e7fb9e1233e7..606dee544c669dcaa0eb02808c5786545b5519eb 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -879,13 +879,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe diff --git a/leaf-server/minecraft-patches/features/0013-Reduce-enderman-teleport-chunk-lookups.patch b/leaf-server/minecraft-patches/features/0013-Reduce-enderman-teleport-chunk-lookups.patch index c6ed42a6..0c241dc7 100644 --- a/leaf-server/minecraft-patches/features/0013-Reduce-enderman-teleport-chunk-lookups.patch +++ b/leaf-server/minecraft-patches/features/0013-Reduce-enderman-teleport-chunk-lookups.patch @@ -28,10 +28,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java -index ab7f7846d3fc0252c6f71277b3e67d7a785a96b5..6c2bfad0ad7a5c20cd6eeba9fdc713c85c357ef4 100644 +index 5ae08be75ca01924fc78bdd8d6bb6747ddc21aea..84a9dbf5898fb519fad5fdc3ea1d9a2054d1e0eb 100644 --- a/net/minecraft/world/entity/monster/EnderMan.java +++ b/net/minecraft/world/entity/monster/EnderMan.java @@ -300,11 +300,19 @@ public class EnderMan extends Monster implements NeutralMob { diff --git a/leaf-server/minecraft-patches/features/0014-Reduce-acquire-POI-for-stuck-entities.patch b/leaf-server/minecraft-patches/features/0014-Reduce-acquire-POI-for-stuck-entities.patch index 5ae54663..d7b0e8f7 100644 --- a/leaf-server/minecraft-patches/features/0014-Reduce-acquire-POI-for-stuck-entities.patch +++ b/leaf-server/minecraft-patches/features/0014-Reduce-acquire-POI-for-stuck-entities.patch @@ -28,7 +28,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java index b9174ae7e3a3e2de2d570b95ab5012ac3c3a2eda..751e91a922b20c96f27885c3eb085ec4ae39091b 100644 diff --git a/leaf-server/minecraft-patches/features/0015-Check-targeting-range-before-getting-visibility.patch b/leaf-server/minecraft-patches/features/0015-Check-targeting-range-before-getting-visibility.patch index a182c1e0..3690c8b4 100644 --- a/leaf-server/minecraft-patches/features/0015-Check-targeting-range-before-getting-visibility.patch +++ b/leaf-server/minecraft-patches/features/0015-Check-targeting-range-before-getting-visibility.patch @@ -28,7 +28,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/net/minecraft/world/entity/ai/targeting/TargetingConditions.java index 2f8920d8ee765d057a22d76f24f7d7dc1b0b17ca..17a08a3af468093668a41f154c2beb69c6617efa 100644 diff --git a/leaf-server/minecraft-patches/features/0016-Cache-on-climbable-check.patch b/leaf-server/minecraft-patches/features/0016-Cache-on-climbable-check.patch index 18fe815a..57ea3a6c 100644 --- a/leaf-server/minecraft-patches/features/0016-Cache-on-climbable-check.patch +++ b/leaf-server/minecraft-patches/features/0016-Cache-on-climbable-check.patch @@ -28,7 +28,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java index 2ebee223085fe7926c7f3e555df19ae69f36157e..602ed4c5556723e54a80ccc3481af31109d5a0a6 100644 @@ -44,7 +44,7 @@ index 2ebee223085fe7926c7f3e555df19ae69f36157e..602ed4c5556723e54a80ccc3481af311 } if (entity instanceof final Mob mob && mob.getTarget() != null) { diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 07df62b79a4ee9c9da77cac8615fad5463628204..bb687f048be9edfde75d13354dd3265593e83e9f 100644 +index 79f499fea47a9c675da1aed718c713290bc008d0..f019571b4b6b5e2d1953030911449a02e459591c 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java @@ -2083,6 +2083,21 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/leaf-server/minecraft-patches/features/0017-Make-EntityCollisionContext-a-live-representation.patch b/leaf-server/minecraft-patches/features/0017-Make-EntityCollisionContext-a-live-representation.patch index dd87d0d1..050a9800 100644 --- a/leaf-server/minecraft-patches/features/0017-Make-EntityCollisionContext-a-live-representation.patch +++ b/leaf-server/minecraft-patches/features/0017-Make-EntityCollisionContext-a-live-representation.patch @@ -37,7 +37,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/net/minecraft/world/phys/shapes/EntityCollisionContext.java b/net/minecraft/world/phys/shapes/EntityCollisionContext.java index ebc9360ea64a248418fcac8b446664b0dd019335..b09d1b7c76410580663f2419e3b5e917fedabd54 100644 diff --git a/leaf-server/minecraft-patches/features/0018-Better-checking-for-useless-move-packets.patch b/leaf-server/minecraft-patches/features/0018-Better-checking-for-useless-move-packets.patch index c6ecca67..5f4def86 100644 --- a/leaf-server/minecraft-patches/features/0018-Better-checking-for-useless-move-packets.patch +++ b/leaf-server/minecraft-patches/features/0018-Better-checking-for-useless-move-packets.patch @@ -28,10 +28,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index b118e91f1e0b5a8b8c0b2a4a32faabc5a34a5954..0db57c334bef3b6473ae1b734f953e150862eab5 100644 +index 7360914a6f4dc43758c38f2c6c7f8d458cc14c4d..7fe21b10eefce56dde19baebf9cb6d2d0a8d73ec 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java @@ -189,19 +189,25 @@ public class ServerEntity { diff --git a/leaf-server/minecraft-patches/features/0019-Block-goal-does-not-load-chunks.patch b/leaf-server/minecraft-patches/features/0019-Block-goal-does-not-load-chunks.patch index 09985875..d8628407 100644 --- a/leaf-server/minecraft-patches/features/0019-Block-goal-does-not-load-chunks.patch +++ b/leaf-server/minecraft-patches/features/0019-Block-goal-does-not-load-chunks.patch @@ -28,7 +28,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java index d0ab3db7bbd2942db19f473474371b20ce822608..3f080b15543bf8c5fa0774b62d7f12e13b82511a 100644 diff --git a/leaf-server/minecraft-patches/features/0020-Remove-lambda-from-ticking-guard.patch b/leaf-server/minecraft-patches/features/0020-Remove-lambda-from-ticking-guard.patch index 8a863b8b..cc1e7a2a 100644 --- a/leaf-server/minecraft-patches/features/0020-Remove-lambda-from-ticking-guard.patch +++ b/leaf-server/minecraft-patches/features/0020-Remove-lambda-from-ticking-guard.patch @@ -28,7 +28,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java index 606dee544c669dcaa0eb02808c5786545b5519eb..f14aab66d200828952b647fa8424caec757a9e9c 100644 diff --git a/leaf-server/minecraft-patches/features/0096-Pufferfish-Dynamic-Activation-of-Brain.patch b/leaf-server/minecraft-patches/features/0096-Pufferfish-Dynamic-Activation-of-Brain.patch index 8462c0cf..f6d2ac4f 100644 --- a/leaf-server/minecraft-patches/features/0096-Pufferfish-Dynamic-Activation-of-Brain.patch +++ b/leaf-server/minecraft-patches/features/0096-Pufferfish-Dynamic-Activation-of-Brain.patch @@ -29,7 +29,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java index bdbbbc5e0c06c71584e7514623d0c8be168befd7..f3ca86e09a4a076d143fb21eac529967ff004df4 100644 diff --git a/leaf-server/minecraft-patches/features/0138-Cache-player-profileResult.patch b/leaf-server/minecraft-patches/features/0138-Cache-player-profileResult.patch index 93d00529..b73d51c8 100644 --- a/leaf-server/minecraft-patches/features/0138-Cache-player-profileResult.patch +++ b/leaf-server/minecraft-patches/features/0138-Cache-player-profileResult.patch @@ -3,6 +3,23 @@ From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Thu, 28 Mar 2024 13:36:09 -0400 Subject: [PATCH] Cache player profileResult +This patch includes code that references the Caffeine caching library, +which is licensed under the Apache License, Version 2.0. + +Caffeine (https://github.com/ben-manes/caffeine) +Copyright (c) Ben Manes + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java index 9dce1d22c7de3a3dd0e0e8f117cfbb54d1b15042..6b0b0ccc18a5da05685867656705e1fcf94b5891 100644 diff --git a/leaf-server/minecraft-patches/features/0163-Use-caffeine-cache-for-kickPermission-instead-of-usi.patch b/leaf-server/minecraft-patches/features/0163-Use-caffeine-cache-for-kickPermission-instead-of-usi.patch index 3b1a91d0..5651cb40 100644 --- a/leaf-server/minecraft-patches/features/0163-Use-caffeine-cache-for-kickPermission-instead-of-usi.patch +++ b/leaf-server/minecraft-patches/features/0163-Use-caffeine-cache-for-kickPermission-instead-of-usi.patch @@ -4,6 +4,23 @@ Date: Sun, 23 Jun 2024 11:26:20 +0800 Subject: [PATCH] Use caffeine cache for kickPermission instead of using google.common.cache +This patch includes code that references the Caffeine caching library, +which is licensed under the Apache License, Version 2.0. + +Caffeine (https://github.com/ben-manes/caffeine) +Copyright (c) Ben Manes + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 3c14d32ec9caf3dba9d99afe86a3ca053de70958..155e2047659111f68e27d3517e5178afa233dfe4 100644 diff --git a/leaf-server/minecraft-patches/features/0191-C2ME-Optimize-world-gen-math.patch b/leaf-server/minecraft-patches/features/0190-C2ME-Optimize-world-gen-math.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0191-C2ME-Optimize-world-gen-math.patch rename to leaf-server/minecraft-patches/features/0190-C2ME-Optimize-world-gen-math.patch diff --git a/leaf-server/minecraft-patches/features/0192-Cache-chunk-key.patch b/leaf-server/minecraft-patches/features/0191-Cache-chunk-key.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0192-Cache-chunk-key.patch rename to leaf-server/minecraft-patches/features/0191-Cache-chunk-key.patch diff --git a/leaf-server/minecraft-patches/features/0193-Cache-random-tick-block-status.patch b/leaf-server/minecraft-patches/features/0192-Cache-random-tick-block-status.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0193-Cache-random-tick-block-status.patch rename to leaf-server/minecraft-patches/features/0192-Cache-random-tick-block-status.patch diff --git a/leaf-server/minecraft-patches/features/0194-Cache-part-of-canHoldFluid-result.patch b/leaf-server/minecraft-patches/features/0193-Cache-part-of-canHoldFluid-result.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0194-Cache-part-of-canHoldFluid-result.patch rename to leaf-server/minecraft-patches/features/0193-Cache-part-of-canHoldFluid-result.patch diff --git a/leaf-server/minecraft-patches/features/0195-Configurable-tripwire-dupe.patch b/leaf-server/minecraft-patches/features/0194-Configurable-tripwire-dupe.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0195-Configurable-tripwire-dupe.patch rename to leaf-server/minecraft-patches/features/0194-Configurable-tripwire-dupe.patch diff --git a/leaf-server/minecraft-patches/features/0196-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch b/leaf-server/minecraft-patches/features/0195-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0196-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch rename to leaf-server/minecraft-patches/features/0195-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch diff --git a/leaf-server/minecraft-patches/features/0197-Sepals-Rearrange-the-attackable-conditions.patch b/leaf-server/minecraft-patches/features/0196-Sepals-Rearrange-the-attackable-conditions.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0197-Sepals-Rearrange-the-attackable-conditions.patch rename to leaf-server/minecraft-patches/features/0196-Sepals-Rearrange-the-attackable-conditions.patch diff --git a/leaf-server/minecraft-patches/features/0198-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch b/leaf-server/minecraft-patches/features/0197-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0198-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch rename to leaf-server/minecraft-patches/features/0197-SparklyPaper-Skip-dirty-stats-copy-when-requesting-p.patch diff --git a/leaf-server/minecraft-patches/features/0199-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch b/leaf-server/minecraft-patches/features/0198-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0199-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch rename to leaf-server/minecraft-patches/features/0198-SparklyPaper-Reset-dirty-flag-when-loading-maps-from.patch diff --git a/leaf-server/minecraft-patches/features/0200-Optimize-checking-nearby-players-for-spawning.patch b/leaf-server/minecraft-patches/features/0199-Optimize-checking-nearby-players-for-spawning.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0200-Optimize-checking-nearby-players-for-spawning.patch rename to leaf-server/minecraft-patches/features/0199-Optimize-checking-nearby-players-for-spawning.patch diff --git a/leaf-server/minecraft-patches/features/0201-Cache-supporting-block-check.patch b/leaf-server/minecraft-patches/features/0200-Cache-supporting-block-check.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0201-Cache-supporting-block-check.patch rename to leaf-server/minecraft-patches/features/0200-Cache-supporting-block-check.patch diff --git a/leaf-server/minecraft-patches/features/0202-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch b/leaf-server/minecraft-patches/features/0201-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0202-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch rename to leaf-server/minecraft-patches/features/0201-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch diff --git a/leaf-server/minecraft-patches/features/0203-Replace-brain-activity-maps-with-optimized-collectio.patch b/leaf-server/minecraft-patches/features/0202-Replace-brain-activity-maps-with-optimized-collectio.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0203-Replace-brain-activity-maps-with-optimized-collectio.patch rename to leaf-server/minecraft-patches/features/0202-Replace-brain-activity-maps-with-optimized-collectio.patch diff --git a/leaf-server/minecraft-patches/features/0204-Remove-stream-in-villagers.patch b/leaf-server/minecraft-patches/features/0203-Remove-stream-in-villagers.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0204-Remove-stream-in-villagers.patch rename to leaf-server/minecraft-patches/features/0203-Remove-stream-in-villagers.patch diff --git a/leaf-server/minecraft-patches/features/0205-Optimize-baby-villager-sensor.patch b/leaf-server/minecraft-patches/features/0204-Optimize-baby-villager-sensor.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0205-Optimize-baby-villager-sensor.patch rename to leaf-server/minecraft-patches/features/0204-Optimize-baby-villager-sensor.patch diff --git a/leaf-server/minecraft-patches/features/0206-Only-player-pushable.patch b/leaf-server/minecraft-patches/features/0205-Only-player-pushable.patch similarity index 92% rename from leaf-server/minecraft-patches/features/0206-Only-player-pushable.patch rename to leaf-server/minecraft-patches/features/0205-Only-player-pushable.patch index 4f83389d..3b48cc2a 100644 --- a/leaf-server/minecraft-patches/features/0206-Only-player-pushable.patch +++ b/leaf-server/minecraft-patches/features/0205-Only-player-pushable.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Only player pushable Useful for extreme cases like massive entities collide together in a small area diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index a927e8a7d9149f5b7abaae50ba8d4fdc6ec87b55..0f717ee9e977ece4f30e66d9d1caf6bb7beecda7 100644 +index b3e9ad0669bb4b91d5d991f106b225e914a4e68f..d19d253ce100aee5e2a12eeb4ea50065760ed702 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -3635,7 +3635,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3630,7 +3630,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.checkAutoSpinAttack(boundingBox, this.getBoundingBox()); } @@ -18,7 +18,7 @@ index a927e8a7d9149f5b7abaae50ba8d4fdc6ec87b55..0f717ee9e977ece4f30e66d9d1caf6bb // Paper start - Add EntityMoveEvent // Purpur start - Ridables if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { -@@ -3778,7 +3778,12 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3773,7 +3773,12 @@ public abstract class LivingEntity extends Entity implements Attackable { return; } // Paper end - don't run getEntities if we're not going to use its result @@ -32,7 +32,7 @@ index a927e8a7d9149f5b7abaae50ba8d4fdc6ec87b55..0f717ee9e977ece4f30e66d9d1caf6bb if (!pushableEntities.isEmpty()) { if (this.level() instanceof ServerLevel serverLevel) { // Paper - don't run getEntities if we're not going to use its result; moved up -@@ -3812,6 +3817,44 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3807,6 +3812,44 @@ public abstract class LivingEntity extends Entity implements Attackable { } } @@ -78,7 +78,7 @@ index a927e8a7d9149f5b7abaae50ba8d4fdc6ec87b55..0f717ee9e977ece4f30e66d9d1caf6bb AABB aabb = boundingBoxBeforeSpin.minmax(boundingBoxAfterSpin); List entities = this.level().getEntities(this, aabb); diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java -index cb2a8f9cff99a7a906bc7be09d301728742bc11e..f3ef1c11f1f5fe02c0b38f327b527221a5a45b0f 100644 +index 0417175c7beabbca53cd080d158001eabe3941f0..2bfc578b7080b93e99daa45905e1890d3f7c5cbc 100644 --- a/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/net/minecraft/world/entity/decoration/ArmorStand.java @@ -247,7 +247,7 @@ public class ArmorStand extends LivingEntity { diff --git a/leaf-server/minecraft-patches/features/0207-Remove-iterators-from-Inventory.patch b/leaf-server/minecraft-patches/features/0206-Remove-iterators-from-Inventory.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0207-Remove-iterators-from-Inventory.patch rename to leaf-server/minecraft-patches/features/0206-Remove-iterators-from-Inventory.patch diff --git a/leaf-server/minecraft-patches/features/0208-Cache-eligible-players-for-despawn-checks.patch b/leaf-server/minecraft-patches/features/0207-Cache-eligible-players-for-despawn-checks.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0208-Cache-eligible-players-for-despawn-checks.patch rename to leaf-server/minecraft-patches/features/0207-Cache-eligible-players-for-despawn-checks.patch diff --git a/leaf-server/minecraft-patches/features/0209-Slightly-optimise-getNearestPlayer.patch b/leaf-server/minecraft-patches/features/0208-Slightly-optimise-getNearestPlayer.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0209-Slightly-optimise-getNearestPlayer.patch rename to leaf-server/minecraft-patches/features/0208-Slightly-optimise-getNearestPlayer.patch diff --git a/leaf-server/minecraft-patches/features/0210-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch b/leaf-server/minecraft-patches/features/0209-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0210-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch rename to leaf-server/minecraft-patches/features/0209-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch diff --git a/leaf-server/minecraft-patches/features/0211-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch b/leaf-server/minecraft-patches/features/0210-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0211-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch rename to leaf-server/minecraft-patches/features/0210-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch diff --git a/leaf-server/minecraft-patches/features/0212-Bulk-writes-to-writeLongArray-during-chunk-loading.patch b/leaf-server/minecraft-patches/features/0211-Bulk-writes-to-writeLongArray-during-chunk-loading.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0212-Bulk-writes-to-writeLongArray-during-chunk-loading.patch rename to leaf-server/minecraft-patches/features/0211-Bulk-writes-to-writeLongArray-during-chunk-loading.patch diff --git a/leaf-server/minecraft-patches/features/0213-Improve-sorting-in-SortedArraySet.patch b/leaf-server/minecraft-patches/features/0212-Improve-sorting-in-SortedArraySet.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0213-Improve-sorting-in-SortedArraySet.patch rename to leaf-server/minecraft-patches/features/0212-Improve-sorting-in-SortedArraySet.patch diff --git a/leaf-server/minecraft-patches/features/0214-Make-removeIf-slightly-faster.patch b/leaf-server/minecraft-patches/features/0213-Make-removeIf-slightly-faster.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0214-Make-removeIf-slightly-faster.patch rename to leaf-server/minecraft-patches/features/0213-Make-removeIf-slightly-faster.patch diff --git a/leaf-server/minecraft-patches/features/0215-Optimize-LinearPalette.patch b/leaf-server/minecraft-patches/features/0214-Optimize-LinearPalette.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0215-Optimize-LinearPalette.patch rename to leaf-server/minecraft-patches/features/0214-Optimize-LinearPalette.patch diff --git a/leaf-server/minecraft-patches/features/0216-Slightly-optimized-VarInt-write.patch b/leaf-server/minecraft-patches/features/0215-Slightly-optimized-VarInt-write.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0216-Slightly-optimized-VarInt-write.patch rename to leaf-server/minecraft-patches/features/0215-Slightly-optimized-VarInt-write.patch diff --git a/leaf-server/minecraft-patches/features/0217-Rewrite-ClientboundLightUpdatePacketData.patch b/leaf-server/minecraft-patches/features/0216-Rewrite-ClientboundLightUpdatePacketData.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0217-Rewrite-ClientboundLightUpdatePacketData.patch rename to leaf-server/minecraft-patches/features/0216-Rewrite-ClientboundLightUpdatePacketData.patch diff --git a/leaf-server/minecraft-patches/features/0218-Async-chunk-send.patch b/leaf-server/minecraft-patches/features/0217-Async-chunk-send.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0218-Async-chunk-send.patch rename to leaf-server/minecraft-patches/features/0217-Async-chunk-send.patch diff --git a/leaf-server/minecraft-patches/features/0219-Spawner-Configurations.patch b/leaf-server/minecraft-patches/features/0218-Spawner-Configurations.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0219-Spawner-Configurations.patch rename to leaf-server/minecraft-patches/features/0218-Spawner-Configurations.patch diff --git a/leaf-server/minecraft-patches/features/0220-SparklyPaper-Parallel-world-ticking.patch b/leaf-server/minecraft-patches/features/0219-SparklyPaper-Parallel-world-ticking.patch similarity index 99% rename from leaf-server/minecraft-patches/features/0220-SparklyPaper-Parallel-world-ticking.patch rename to leaf-server/minecraft-patches/features/0219-SparklyPaper-Parallel-world-ticking.patch index 0fec1bf7..87733019 100644 --- a/leaf-server/minecraft-patches/features/0220-SparklyPaper-Parallel-world-ticking.patch +++ b/leaf-server/minecraft-patches/features/0219-SparklyPaper-Parallel-world-ticking.patch @@ -992,10 +992,10 @@ index c4721eb0efe34f5e313bc890b4e960144eca4fe1..9dd3187fd968ab95e9d55b4c8cc74e78 this.containerId = containerId; } diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java -index d1c8b4a2a32d49d90f2f2aa460915d319a781535..aed9baa4e0f01e8844a774ab8d0bc08acd3c5271 100644 +index 07f1b27116baf2a06e6cd4eeaa8639e166fb362d..1a5f65a32882aa43828305113f35a9cdb0bdb870 100644 --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -411,8 +411,8 @@ public final class ItemStack implements DataComponentHolder, net.caffeinemc.mods +@@ -406,8 +406,8 @@ public final class ItemStack implements DataComponentHolder { if (interactionResult.consumesAction() && serverLevel.captureTreeGeneration && !serverLevel.capturedBlockStates.isEmpty()) { serverLevel.captureTreeGeneration = false; org.bukkit.Location location = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(clickedPos, serverLevel.getWorld()); diff --git a/leaf-server/minecraft-patches/features/0221-SparklyPaper-Track-each-world-MSPT.patch b/leaf-server/minecraft-patches/features/0220-SparklyPaper-Track-each-world-MSPT.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0221-SparklyPaper-Track-each-world-MSPT.patch rename to leaf-server/minecraft-patches/features/0220-SparklyPaper-Track-each-world-MSPT.patch diff --git a/leaf-server/minecraft-patches/features/0222-PaperPR-Fix-cancelled-Projectile-Events-still-consum.patch b/leaf-server/minecraft-patches/features/0221-PaperPR-Fix-cancelled-Projectile-Events-still-consum.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0222-PaperPR-Fix-cancelled-Projectile-Events-still-consum.patch rename to leaf-server/minecraft-patches/features/0221-PaperPR-Fix-cancelled-Projectile-Events-still-consum.patch diff --git a/leaf-server/minecraft-patches/features/0223-Optimize-SetLookAndInteract-and-NearestVisibleLiving.patch b/leaf-server/minecraft-patches/features/0222-Optimize-SetLookAndInteract-and-NearestVisibleLiving.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0223-Optimize-SetLookAndInteract-and-NearestVisibleLiving.patch rename to leaf-server/minecraft-patches/features/0222-Optimize-SetLookAndInteract-and-NearestVisibleLiving.patch diff --git a/leaf-server/minecraft-patches/features/0224-Remove-streams-on-InsideBrownianWalk.patch b/leaf-server/minecraft-patches/features/0223-Remove-streams-on-InsideBrownianWalk.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0224-Remove-streams-on-InsideBrownianWalk.patch rename to leaf-server/minecraft-patches/features/0223-Remove-streams-on-InsideBrownianWalk.patch diff --git a/leaf-server/minecraft-patches/features/0225-Use-BFS-on-getSlopeDistance.patch b/leaf-server/minecraft-patches/features/0224-Use-BFS-on-getSlopeDistance.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0225-Use-BFS-on-getSlopeDistance.patch rename to leaf-server/minecraft-patches/features/0224-Use-BFS-on-getSlopeDistance.patch diff --git a/leaf-server/minecraft-patches/features/0226-Paper-PR-Throttle-failed-spawn-attempts.patch b/leaf-server/minecraft-patches/features/0225-Paper-PR-Throttle-failed-spawn-attempts.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0226-Paper-PR-Throttle-failed-spawn-attempts.patch rename to leaf-server/minecraft-patches/features/0225-Paper-PR-Throttle-failed-spawn-attempts.patch diff --git a/leaf-server/minecraft-patches/features/0227-Improve-BlockEntity-ticking-isRemoved-check.patch b/leaf-server/minecraft-patches/features/0226-Improve-BlockEntity-ticking-isRemoved-check.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0227-Improve-BlockEntity-ticking-isRemoved-check.patch rename to leaf-server/minecraft-patches/features/0226-Improve-BlockEntity-ticking-isRemoved-check.patch diff --git a/leaf-server/minecraft-patches/features/0228-Raytrace-AntiXray-SDK-integration.patch b/leaf-server/minecraft-patches/features/0227-Raytrace-AntiXray-SDK-integration.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0228-Raytrace-AntiXray-SDK-integration.patch rename to leaf-server/minecraft-patches/features/0227-Raytrace-AntiXray-SDK-integration.patch diff --git a/leaf-server/minecraft-patches/features/0229-Optimize-addOrUpdateTransientModifier.patch b/leaf-server/minecraft-patches/features/0228-Optimize-addOrUpdateTransientModifier.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0229-Optimize-addOrUpdateTransientModifier.patch rename to leaf-server/minecraft-patches/features/0228-Optimize-addOrUpdateTransientModifier.patch diff --git a/leaf-server/minecraft-patches/features/0230-Optimize-ContextMap.create.patch b/leaf-server/minecraft-patches/features/0229-Optimize-ContextMap.create.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0230-Optimize-ContextMap.create.patch rename to leaf-server/minecraft-patches/features/0229-Optimize-ContextMap.create.patch diff --git a/leaf-server/minecraft-patches/features/0231-Micro-optimizations-for-random-tick.patch b/leaf-server/minecraft-patches/features/0230-Micro-optimizations-for-random-tick.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0231-Micro-optimizations-for-random-tick.patch rename to leaf-server/minecraft-patches/features/0230-Micro-optimizations-for-random-tick.patch diff --git a/leaf-server/minecraft-patches/features/0232-Remove-streams-on-updateConnectedPlayersWithinRange.patch b/leaf-server/minecraft-patches/features/0231-Remove-streams-on-updateConnectedPlayersWithinRange.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0232-Remove-streams-on-updateConnectedPlayersWithinRange.patch rename to leaf-server/minecraft-patches/features/0231-Remove-streams-on-updateConnectedPlayersWithinRange.patch diff --git a/leaf-server/minecraft-patches/features/0233-Remove-streams-on-PlayerDetector.patch b/leaf-server/minecraft-patches/features/0232-Remove-streams-on-PlayerDetector.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0233-Remove-streams-on-PlayerDetector.patch rename to leaf-server/minecraft-patches/features/0232-Remove-streams-on-PlayerDetector.patch diff --git a/leaf-server/minecraft-patches/features/0234-Use-direct-iteration-on-Sensing.tick.patch b/leaf-server/minecraft-patches/features/0233-Use-direct-iteration-on-Sensing.tick.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0234-Use-direct-iteration-on-Sensing.tick.patch rename to leaf-server/minecraft-patches/features/0233-Use-direct-iteration-on-Sensing.tick.patch diff --git a/leaf-server/minecraft-patches/features/0235-Optimise-non-flush-packet-sending.patch b/leaf-server/minecraft-patches/features/0234-Optimise-non-flush-packet-sending.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0235-Optimise-non-flush-packet-sending.patch rename to leaf-server/minecraft-patches/features/0234-Optimise-non-flush-packet-sending.patch diff --git a/leaf-server/minecraft-patches/features/0236-Prevent-double-chunk-retrieving-in-entity-fluid-push.patch b/leaf-server/minecraft-patches/features/0235-Prevent-double-chunk-retrieving-in-entity-fluid-push.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0236-Prevent-double-chunk-retrieving-in-entity-fluid-push.patch rename to leaf-server/minecraft-patches/features/0235-Prevent-double-chunk-retrieving-in-entity-fluid-push.patch diff --git a/leaf-server/minecraft-patches/features/0237-Null-handling-on-MultifaceSpreader.patch b/leaf-server/minecraft-patches/features/0236-Null-handling-on-MultifaceSpreader.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0237-Null-handling-on-MultifaceSpreader.patch rename to leaf-server/minecraft-patches/features/0236-Null-handling-on-MultifaceSpreader.patch diff --git a/leaf-server/minecraft-patches/features/0238-More-virtual-threads.patch b/leaf-server/minecraft-patches/features/0237-More-virtual-threads.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0238-More-virtual-threads.patch rename to leaf-server/minecraft-patches/features/0237-More-virtual-threads.patch diff --git a/leaf-server/minecraft-patches/features/0239-Async-target-finding.patch b/leaf-server/minecraft-patches/features/0238-Async-target-finding.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0239-Async-target-finding.patch rename to leaf-server/minecraft-patches/features/0238-Async-target-finding.patch diff --git a/leaf-server/minecraft-patches/features/0240-Optimize-ThreadedTicketLevelPropagator.patch b/leaf-server/minecraft-patches/features/0239-Optimize-ThreadedTicketLevelPropagator.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0240-Optimize-ThreadedTicketLevelPropagator.patch rename to leaf-server/minecraft-patches/features/0239-Optimize-ThreadedTicketLevelPropagator.patch diff --git a/leaf-server/minecraft-patches/features/0241-Optimise-MobEffectUtil-getDigSpeedAmplification.patch b/leaf-server/minecraft-patches/features/0240-Optimise-MobEffectUtil-getDigSpeedAmplification.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0241-Optimise-MobEffectUtil-getDigSpeedAmplification.patch rename to leaf-server/minecraft-patches/features/0240-Optimise-MobEffectUtil-getDigSpeedAmplification.patch diff --git a/leaf-server/minecraft-patches/features/0242-Optimise-chunkUnloads.patch b/leaf-server/minecraft-patches/features/0241-Optimise-chunkUnloads.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0242-Optimise-chunkUnloads.patch rename to leaf-server/minecraft-patches/features/0241-Optimise-chunkUnloads.patch diff --git a/leaf-server/minecraft-patches/features/0243-Optimize-BlockEntityType-isValid.patch b/leaf-server/minecraft-patches/features/0242-Optimize-BlockEntityType-isValid.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0243-Optimize-BlockEntityType-isValid.patch rename to leaf-server/minecraft-patches/features/0242-Optimize-BlockEntityType-isValid.patch diff --git a/leaf-server/minecraft-patches/features/0244-PaperPR-Add-ticket-on-player-join-to-avoid-chunk-loa.patch b/leaf-server/minecraft-patches/features/0243-PaperPR-Add-ticket-on-player-join-to-avoid-chunk-loa.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0244-PaperPR-Add-ticket-on-player-join-to-avoid-chunk-loa.patch rename to leaf-server/minecraft-patches/features/0243-PaperPR-Add-ticket-on-player-join-to-avoid-chunk-loa.patch diff --git a/leaf-server/minecraft-patches/features/0245-Sakura-Optimise-check-inside-blocks-and-traverse-blo.patch b/leaf-server/minecraft-patches/features/0244-Sakura-Optimise-check-inside-blocks-and-traverse-blo.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0245-Sakura-Optimise-check-inside-blocks-and-traverse-blo.patch rename to leaf-server/minecraft-patches/features/0244-Sakura-Optimise-check-inside-blocks-and-traverse-blo.patch diff --git a/leaf-server/minecraft-patches/features/0246-Sakura-copy-EntityList-implementation-to-BasicEntity.patch b/leaf-server/minecraft-patches/features/0245-Sakura-copy-EntityList-implementation-to-BasicEntity.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0246-Sakura-copy-EntityList-implementation-to-BasicEntity.patch rename to leaf-server/minecraft-patches/features/0245-Sakura-copy-EntityList-implementation-to-BasicEntity.patch diff --git a/leaf-server/minecraft-patches/features/0247-Protocol-Core.patch b/leaf-server/minecraft-patches/features/0246-Protocol-Core.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0247-Protocol-Core.patch rename to leaf-server/minecraft-patches/features/0246-Protocol-Core.patch diff --git a/leaf-server/minecraft-patches/features/0248-Reduce-PlayerChunk-Updates.patch b/leaf-server/minecraft-patches/features/0247-Reduce-PlayerChunk-Updates.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0248-Reduce-PlayerChunk-Updates.patch rename to leaf-server/minecraft-patches/features/0247-Reduce-PlayerChunk-Updates.patch diff --git a/leaf-server/minecraft-patches/features/0249-Async-switch-connection-state.patch b/leaf-server/minecraft-patches/features/0248-Async-switch-connection-state.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0249-Async-switch-connection-state.patch rename to leaf-server/minecraft-patches/features/0248-Async-switch-connection-state.patch diff --git a/leaf-server/minecraft-patches/features/0250-Optimize-BlockEntities-tickersInLevel.patch b/leaf-server/minecraft-patches/features/0249-Optimize-BlockEntities-tickersInLevel.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0250-Optimize-BlockEntities-tickersInLevel.patch rename to leaf-server/minecraft-patches/features/0249-Optimize-BlockEntities-tickersInLevel.patch diff --git a/leaf-server/minecraft-patches/features/0251-Pluto-Check-if-the-cactus-can-even-survive-being-pla.patch b/leaf-server/minecraft-patches/features/0250-Pluto-Check-if-the-cactus-can-even-survive-being-pla.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0251-Pluto-Check-if-the-cactus-can-even-survive-being-pla.patch rename to leaf-server/minecraft-patches/features/0250-Pluto-Check-if-the-cactus-can-even-survive-being-pla.patch diff --git a/leaf-server/minecraft-patches/features/0252-Flush-location-while-knockback.patch b/leaf-server/minecraft-patches/features/0251-Flush-location-while-knockback.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0252-Flush-location-while-knockback.patch rename to leaf-server/minecraft-patches/features/0251-Flush-location-while-knockback.patch diff --git a/leaf-server/minecraft-patches/features/0253-Only-tick-items-at-hand.patch b/leaf-server/minecraft-patches/features/0252-Only-tick-items-at-hand.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0253-Only-tick-items-at-hand.patch rename to leaf-server/minecraft-patches/features/0252-Only-tick-items-at-hand.patch diff --git a/leaf-server/minecraft-patches/features/0254-Smart-sort-items-in-NearestItemSensor.patch b/leaf-server/minecraft-patches/features/0253-Smart-sort-items-in-NearestItemSensor.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0254-Smart-sort-items-in-NearestItemSensor.patch rename to leaf-server/minecraft-patches/features/0253-Smart-sort-items-in-NearestItemSensor.patch diff --git a/leaf-server/minecraft-patches/features/0255-Optimise-player-movement-checks.patch b/leaf-server/minecraft-patches/features/0254-Optimise-player-movement-checks.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0255-Optimise-player-movement-checks.patch rename to leaf-server/minecraft-patches/features/0254-Optimise-player-movement-checks.patch diff --git a/leaf-server/minecraft-patches/features/0256-Remove-streams-in-MobSensor.patch b/leaf-server/minecraft-patches/features/0255-Remove-streams-in-MobSensor.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0256-Remove-streams-in-MobSensor.patch rename to leaf-server/minecraft-patches/features/0255-Remove-streams-in-MobSensor.patch diff --git a/leaf-server/minecraft-patches/features/0257-Remove-streams-in-TemptingSensor.patch b/leaf-server/minecraft-patches/features/0256-Remove-streams-in-TemptingSensor.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0257-Remove-streams-in-TemptingSensor.patch rename to leaf-server/minecraft-patches/features/0256-Remove-streams-in-TemptingSensor.patch diff --git a/leaf-server/minecraft-patches/features/0258-Use-HashedList-on-WeightedList.patch b/leaf-server/minecraft-patches/features/0257-Use-HashedList-on-WeightedList.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0258-Use-HashedList-on-WeightedList.patch rename to leaf-server/minecraft-patches/features/0257-Use-HashedList-on-WeightedList.patch diff --git a/leaf-server/minecraft-patches/features/0259-Add-configurable-death-item-drop-knockback-settings.patch b/leaf-server/minecraft-patches/features/0258-Add-configurable-death-item-drop-knockback-settings.patch similarity index 94% rename from leaf-server/minecraft-patches/features/0259-Add-configurable-death-item-drop-knockback-settings.patch rename to leaf-server/minecraft-patches/features/0258-Add-configurable-death-item-drop-knockback-settings.patch index 034c7c7b..ad499e0e 100644 --- a/leaf-server/minecraft-patches/features/0259-Add-configurable-death-item-drop-knockback-settings.patch +++ b/leaf-server/minecraft-patches/features/0258-Add-configurable-death-item-drop-knockback-settings.patch @@ -18,10 +18,10 @@ index 0c81dca5905c2d4c166661dc3473b0c1e9aa5265..373059fcccdab0a918aa1d1a4a613fb6 } } diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 0f717ee9e977ece4f30e66d9d1caf6bb7beecda7..620ddc31b4ff91713aaa6f4c54998ea66670951d 100644 +index d19d253ce100aee5e2a12eeb4ea50065760ed702..ae4d93515a28fb97e7abdfc06ce9ae31ec986fa8 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -4088,9 +4088,9 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4083,9 +4083,9 @@ public abstract class LivingEntity extends Entity implements Attackable { } if (randomizeMotion) { diff --git a/leaf-server/minecraft-patches/features/0260-Optimize-getScaledTrackingDistance.patch b/leaf-server/minecraft-patches/features/0259-Optimize-getScaledTrackingDistance.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0260-Optimize-getScaledTrackingDistance.patch rename to leaf-server/minecraft-patches/features/0259-Optimize-getScaledTrackingDistance.patch diff --git a/leaf-server/minecraft-patches/features/0261-Optimize-SynchedEntityData-packDirty.patch b/leaf-server/minecraft-patches/features/0260-Optimize-SynchedEntityData-packDirty.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0261-Optimize-SynchedEntityData-packDirty.patch rename to leaf-server/minecraft-patches/features/0260-Optimize-SynchedEntityData-packDirty.patch diff --git a/leaf-server/minecraft-patches/features/0262-Optimize-isEyeInFluid.patch b/leaf-server/minecraft-patches/features/0261-Optimize-isEyeInFluid.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0262-Optimize-isEyeInFluid.patch rename to leaf-server/minecraft-patches/features/0261-Optimize-isEyeInFluid.patch diff --git a/leaf-server/minecraft-patches/features/0263-Cache-block-path-type.patch b/leaf-server/minecraft-patches/features/0262-Cache-block-path-type.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0263-Cache-block-path-type.patch rename to leaf-server/minecraft-patches/features/0262-Cache-block-path-type.patch diff --git a/leaf-server/minecraft-patches/features/0264-optimize-getEntityStatus.patch b/leaf-server/minecraft-patches/features/0263-optimize-getEntityStatus.patch similarity index 65% rename from leaf-server/minecraft-patches/features/0264-optimize-getEntityStatus.patch rename to leaf-server/minecraft-patches/features/0263-optimize-getEntityStatus.patch index b32c3afa..683dc0b1 100644 --- a/leaf-server/minecraft-patches/features/0264-optimize-getEntityStatus.patch +++ b/leaf-server/minecraft-patches/features/0263-optimize-getEntityStatus.patch @@ -41,23 +41,3 @@ index 2d24d03bbdb5ee0d862cbfff2219f58afffafe12..703bf9c2a56b262e2719a1787584de53 } protected boolean addEntity(final Entity entity, final boolean fromDisk, final boolean event) { -diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index e1a722c3ec74c0967d089ad469d7b3305bf66195..74794efea55ce1874730c8a2de5fdd9277065d10 100644 ---- a/net/minecraft/world/entity/Entity.java -+++ b/net/minecraft/world/entity/Entity.java -@@ -374,6 +374,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - // Paper end - // Paper start - rewrite chunk system - private final boolean isHardColliding = this.moonrise$isHardCollidingUncached(); -+ @org.jetbrains.annotations.Nullable // Leaf - optimize getEntityStatus - private net.minecraft.server.level.FullChunkStatus chunkStatus; - private ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkData chunkData; - private int sectionX = Integer.MIN_VALUE; -@@ -387,6 +388,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - - @Override -+ @org.jetbrains.annotations.Nullable // Leaf - optimize getEntityStatus - public final net.minecraft.server.level.FullChunkStatus moonrise$getChunkStatus() { - return this.chunkStatus; - } diff --git a/leaf-server/minecraft-patches/features/0266-Rail-Optimization-optimized-PoweredRailBlock-logic.patch b/leaf-server/minecraft-patches/features/0264-Rail-Optimization-optimized-PoweredRailBlock-logic.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0266-Rail-Optimization-optimized-PoweredRailBlock-logic.patch rename to leaf-server/minecraft-patches/features/0264-Rail-Optimization-optimized-PoweredRailBlock-logic.patch diff --git a/leaf-server/minecraft-patches/features/0267-optimise-ChunkGenerator-getMobsAt.patch b/leaf-server/minecraft-patches/features/0265-optimise-ChunkGenerator-getMobsAt.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0267-optimise-ChunkGenerator-getMobsAt.patch rename to leaf-server/minecraft-patches/features/0265-optimise-ChunkGenerator-getMobsAt.patch diff --git a/leaf-server/minecraft-patches/features/0268-optimise-getBiome.patch b/leaf-server/minecraft-patches/features/0266-optimise-getBiome.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0268-optimise-getBiome.patch rename to leaf-server/minecraft-patches/features/0266-optimise-getBiome.patch diff --git a/leaf-server/minecraft-patches/features/0269-optimize-mob-spawning.patch b/leaf-server/minecraft-patches/features/0267-optimize-mob-spawning.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0269-optimize-mob-spawning.patch rename to leaf-server/minecraft-patches/features/0267-optimize-mob-spawning.patch diff --git a/leaf-server/minecraft-patches/features/0270-optimize-structure-map.patch b/leaf-server/minecraft-patches/features/0268-optimize-structure-map.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0270-optimize-structure-map.patch rename to leaf-server/minecraft-patches/features/0268-optimize-structure-map.patch diff --git a/leaf-server/minecraft-patches/features/0271-throttle-mob-spawning.patch b/leaf-server/minecraft-patches/features/0269-throttle-mob-spawning.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0271-throttle-mob-spawning.patch rename to leaf-server/minecraft-patches/features/0269-throttle-mob-spawning.patch diff --git a/leaf-server/minecraft-patches/features/0273-Add-BlockExplosionHitEvent.patch b/leaf-server/minecraft-patches/features/0270-Add-BlockExplosionHitEvent.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0273-Add-BlockExplosionHitEvent.patch rename to leaf-server/minecraft-patches/features/0270-Add-BlockExplosionHitEvent.patch diff --git a/leaf-server/minecraft-patches/features/0274-Old-Blast-Protection-explosion-knockback.patch b/leaf-server/minecraft-patches/features/0271-Old-Blast-Protection-explosion-knockback.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0274-Old-Blast-Protection-explosion-knockback.patch rename to leaf-server/minecraft-patches/features/0271-Old-Blast-Protection-explosion-knockback.patch diff --git a/leaf-server/minecraft-patches/features/0276-Use-UUID-for-cure-reputation.patch b/leaf-server/minecraft-patches/features/0272-Use-UUID-for-cure-reputation.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0276-Use-UUID-for-cure-reputation.patch rename to leaf-server/minecraft-patches/features/0272-Use-UUID-for-cure-reputation.patch diff --git a/leaf-server/minecraft-patches/features/0277-Cache-potential-behaviors-in-Brain.patch b/leaf-server/minecraft-patches/features/0273-Cache-potential-behaviors-in-Brain.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0277-Cache-potential-behaviors-in-Brain.patch rename to leaf-server/minecraft-patches/features/0273-Cache-potential-behaviors-in-Brain.patch diff --git a/leaf-server/minecraft-patches/features/0278-Use-ActivationList-on-runningBehaviors.patch b/leaf-server/minecraft-patches/features/0274-Use-ActivationList-on-runningBehaviors.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0278-Use-ActivationList-on-runningBehaviors.patch rename to leaf-server/minecraft-patches/features/0274-Use-ActivationList-on-runningBehaviors.patch diff --git a/leaf-server/minecraft-patches/features/0275-PaperPR-Fix-excess-slot-updates-inventory-state-id-d.patch b/leaf-server/minecraft-patches/features/0275-PaperPR-Fix-excess-slot-updates-inventory-state-id-d.patch new file mode 100644 index 00000000..24f71905 --- /dev/null +++ b/leaf-server/minecraft-patches/features/0275-PaperPR-Fix-excess-slot-updates-inventory-state-id-d.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leymooo +Date: Wed, 11 Jun 2025 05:30:39 +0300 +Subject: [PATCH] PaperPR: Fix excess slot updates / inventory state id desync + +Original license: GPLv3 +Original project: https://github.com/SparklyPower/SparklyPaper +Paper pull request: https://github.com/PaperMC/Paper/pull/12654 + +Fixes inventory state id desync with high ping causing inventory to be "buggy" (ghost items, items jumping to/from cursor, etc) + +Without patch: https://youtu.be/hOXt3Rpkgtg +With patch: https://youtu.be/MtOYD7uieS4 + +https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/df01cf867a2255024aacf9ac2ff6a56b2ffb7ce5#nms-patches/net/minecraft/world/inventory/Container.patch + +https://discord.com/channels/289587909051416579/555462289851940864/1382165293308182699 + +diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java +index 9dd3187fd968ab95e9d55b4c8cc74e782cc0f241..c5ede24d00f444d04c835af3a7f0154227492be4 100644 +--- a/net/minecraft/world/inventory/AbstractContainerMenu.java ++++ b/net/minecraft/world/inventory/AbstractContainerMenu.java +@@ -559,7 +559,7 @@ public abstract class AbstractContainerMenu { + + slot.setChanged(); + // CraftBukkit start - Make sure the client has the right slot contents +- if (player instanceof ServerPlayer serverPlayer && slot.getMaxStackSize() != 64) { ++ if (player instanceof ServerPlayer serverPlayer && slot.getMaxStackSize() != net.minecraft.world.Container.MAX_STACK) { // Paper - Fix excess slot updates / inventory state id desync + serverPlayer.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket(this.containerId, this.incrementStateId(), slot.index, slot.getItem())); + // Updating a crafting inventory makes the client reset the result slot, have to send it again + if (this.getBukkitView().getType() == org.bukkit.event.inventory.InventoryType.WORKBENCH || this.getBukkitView().getType() == org.bukkit.event.inventory.InventoryType.CRAFTING) { diff --git a/leaf-server/minecraft-patches/features/0265-Paper-Rewrite-dataconverter-system.patch b/leaf-server/minecraft-patches/features/0276-Paper-Rewrite-dataconverter-system.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0265-Paper-Rewrite-dataconverter-system.patch rename to leaf-server/minecraft-patches/features/0276-Paper-Rewrite-dataconverter-system.patch diff --git a/leaf-server/minecraft-patches/features/0279-do-not-log-invalid-flatten-text-component-parse.patch b/leaf-server/minecraft-patches/features/0277-do-not-log-invalid-flatten-text-component-parse.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0279-do-not-log-invalid-flatten-text-component-parse.patch rename to leaf-server/minecraft-patches/features/0277-do-not-log-invalid-flatten-text-component-parse.patch diff --git a/leaf-server/minecraft-patches/features/0280-Fast-BiomeManager-seed-obfuscation.patch b/leaf-server/minecraft-patches/features/0278-Fast-BiomeManager-seed-obfuscation.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0280-Fast-BiomeManager-seed-obfuscation.patch rename to leaf-server/minecraft-patches/features/0278-Fast-BiomeManager-seed-obfuscation.patch diff --git a/leaf-server/minecraft-patches/features/0275-Paw-optimization.patch b/leaf-server/minecraft-patches/features/0279-Paw-optimization.patch similarity index 98% rename from leaf-server/minecraft-patches/features/0275-Paw-optimization.patch rename to leaf-server/minecraft-patches/features/0279-Paw-optimization.patch index 8a75e4e4..a1fe2d5a 100644 --- a/leaf-server/minecraft-patches/features/0275-Paw-optimization.patch +++ b/leaf-server/minecraft-patches/features/0279-Paw-optimization.patch @@ -149,10 +149,10 @@ index c0044f4013520fd617ec365012b10862571744f3..14d23006d3ec15bb3ec6f976bff6c097 private void tickPassenger(Entity ridingEntity, Entity passengerEntity, final boolean isActive) { // Paper - EAR 2 diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 74794efea55ce1874730c8a2de5fdd9277065d10..834ee8d360cbfb044ac7405c49f952c1ec43b64d 100644 +index e1a722c3ec74c0967d089ad469d7b3305bf66195..5fda5eadd37ec52ca6470d4aeb18a20c192811be 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -1146,16 +1146,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1144,16 +1144,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.onGround; } @@ -169,7 +169,7 @@ index 74794efea55ce1874730c8a2de5fdd9277065d10..834ee8d360cbfb044ac7405c49f952c1 public void move(MoverType type, Vec3 movement) { // Gale start - VMP - skip entity move if movement is zero if (!this.boundingBoxChanged && movement.equals(Vec3.ZERO)) { -@@ -1163,16 +1153,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1161,16 +1151,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Gale end - VMP - skip entity move if movement is zero final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity @@ -186,7 +186,7 @@ index 74794efea55ce1874730c8a2de5fdd9277065d10..834ee8d360cbfb044ac7405c49f952c1 if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { -@@ -1306,13 +1287,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1304,13 +1285,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // Gale end - skip negligible planar movement multiplication } } @@ -200,7 +200,7 @@ index 74794efea55ce1874730c8a2de5fdd9277065d10..834ee8d360cbfb044ac7405c49f952c1 } private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) { -@@ -4864,9 +4838,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4862,9 +4836,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void setDeltaMovement(Vec3 deltaMovement) { @@ -210,7 +210,7 @@ index 74794efea55ce1874730c8a2de5fdd9277065d10..834ee8d360cbfb044ac7405c49f952c1 } public void addDeltaMovement(Vec3 addend) { -@@ -4974,9 +4946,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4972,9 +4944,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper end - Fix MC-4 if (this.position.x != x || this.position.y != y || this.position.z != z) { diff --git a/leaf-server/paper-patches/features/0057-optimise-ReferenceList.patch b/leaf-server/paper-patches/features/0056-optimise-ReferenceList.patch similarity index 100% rename from leaf-server/paper-patches/features/0057-optimise-ReferenceList.patch rename to leaf-server/paper-patches/features/0056-optimise-ReferenceList.patch diff --git a/leaf-server/paper-patches/features/0058-cache-getBiome.patch b/leaf-server/paper-patches/features/0057-cache-getBiome.patch similarity index 100% rename from leaf-server/paper-patches/features/0058-cache-getBiome.patch rename to leaf-server/paper-patches/features/0057-cache-getBiome.patch diff --git a/leaf-server/paper-patches/features/0059-Paper-Optimise-CraftWorld-getLoadedChunks.patch b/leaf-server/paper-patches/features/0058-Paper-Optimise-CraftWorld-getLoadedChunks.patch similarity index 100% rename from leaf-server/paper-patches/features/0059-Paper-Optimise-CraftWorld-getLoadedChunks.patch rename to leaf-server/paper-patches/features/0058-Paper-Optimise-CraftWorld-getLoadedChunks.patch diff --git a/leaf-server/paper-patches/features/0060-Paper-Update-CraftWorld-getForceLoadedChunks-to-avoi.patch b/leaf-server/paper-patches/features/0059-Paper-Update-CraftWorld-getForceLoadedChunks-to-avoi.patch similarity index 100% rename from leaf-server/paper-patches/features/0060-Paper-Update-CraftWorld-getForceLoadedChunks-to-avoi.patch rename to leaf-server/paper-patches/features/0059-Paper-Update-CraftWorld-getForceLoadedChunks-to-avoi.patch diff --git a/leaf-server/paper-patches/features/0061-dump-pwt-thread.patch b/leaf-server/paper-patches/features/0060-dump-pwt-thread.patch similarity index 100% rename from leaf-server/paper-patches/features/0061-dump-pwt-thread.patch rename to leaf-server/paper-patches/features/0060-dump-pwt-thread.patch diff --git a/leaf-server/paper-patches/features/0056-Paw-optimization.patch b/leaf-server/paper-patches/features/0061-Paw-optimization.patch similarity index 100% rename from leaf-server/paper-patches/features/0056-Paw-optimization.patch rename to leaf-server/paper-patches/features/0061-Paw-optimization.patch diff --git a/leaf-server/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java b/leaf-server/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java index 2b57a863..85d37d3d 100644 --- a/leaf-server/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java +++ b/leaf-server/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java @@ -13,7 +13,7 @@ public class AsyncExecutor implements Runnable { private final Logger LOGGER = LogManager.getLogger("Leaf"); private final PriorityQueue jobs = PriorityQueues.synchronize(new ObjectArrayFIFOQueue<>()); - private final Thread thread; + public final Thread thread; private volatile boolean killswitch = false; public AsyncExecutor(String threadName) { diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java b/leaf-server/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java index b67eda75..0c88f00d 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java @@ -32,7 +32,8 @@ public class AsyncPlayerDataSaving { new ThreadPoolExecutor.DiscardPolicy() ); } else { - throw new IllegalStateException(); + // Temp no-op + //throw new IllegalStateException(); } } diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/ShutdownExecutors.java b/leaf-server/src/main/java/org/dreeam/leaf/async/ShutdownExecutors.java index be79ba70..3103e125 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/async/ShutdownExecutors.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/async/ShutdownExecutors.java @@ -14,7 +14,7 @@ public class ShutdownExecutors { public static final Logger LOGGER = LogManager.getLogger("Leaf"); public static void shutdown(MinecraftServer server) { - if (server.mobSpawnExecutor != null) { + if (server.mobSpawnExecutor != null && server.mobSpawnExecutor.thread.isAlive()) { LOGGER.info("Waiting for mob spawning thread to shutdown..."); try { server.mobSpawnExecutor.join(3000L); diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java b/leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java index a1f2fb95..a3ab0bac 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java @@ -43,7 +43,8 @@ public class AsyncPathProcessor { getRejectedPolicy() ); } else { - throw new IllegalStateException(); + // Temp no-op + //throw new IllegalStateException(); } } diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java b/leaf-server/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java index 7e37d3e1..7f542a29 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java @@ -46,7 +46,8 @@ public class MultithreadedTracker { getRejectedPolicy() ); } else { - throw new IllegalStateException(); + // Temp no-op + //throw new IllegalStateException(); } } @@ -129,13 +130,13 @@ public class MultithreadedTracker { // Original ChunkMap#newTrackerTick of Paper // Just for diff usage for future update private static void tickOriginal(ServerLevel level) { - final ServerEntityLookup entityLookup = (ServerEntityLookup) ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel) level).moonrise$getEntityLookup(); + final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup entityLookup = (ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup) ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel) level).moonrise$getEntityLookup(); - final ReferenceList trackerEntities = entityLookup.trackerEntities; + final ca.spottedleaf.moonrise.common.list.ReferenceList trackerEntities = entityLookup.trackerEntities; final Entity[] trackerEntitiesRaw = trackerEntities.getRawDataUnchecked(); for (int i = 0, len = trackerEntities.size(); i < len; ++i) { final Entity entity = trackerEntitiesRaw[i]; - final ChunkMap.TrackedEntity tracker = ((EntityTrackerEntity) entity).moonrise$getTrackedEntity(); + final ChunkMap.TrackedEntity tracker = ((ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity) entity).moonrise$getTrackedEntity(); if (tracker == null) { continue; } diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java b/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java index ad14e420..604140f4 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java @@ -71,7 +71,7 @@ public class LeafConfig { Command.broadcastCommandMessage(sender, Component.text(success, NamedTextColor.GREEN)); } catch (Exception e) { Command.broadcastCommandMessage(sender, Component.text("Failed to reload config. See error in console!", NamedTextColor.RED)); - LOGGER.error(e); + LOGGER.error("Failed to reload config!", e); } }, Util.ioPool()); } @@ -87,7 +87,7 @@ public class LeafConfig { LOGGER.info("Successfully loaded config in {}ms.", (System.nanoTime() - begin) / 1_000_000); } catch (Exception e) { - LeafConfig.LOGGER.error("Failed to load config modules!", e); + LOGGER.error("Failed to load config modules!", e); } } @@ -95,7 +95,7 @@ public class LeafConfig { private static void loadConfig(boolean init) throws Exception { // Create config folder - createDirectory(LeafConfig.I_CONFIG_FOLDER); + createDirectory(I_CONFIG_FOLDER); leafGlobalConfig = new LeafGlobalConfig(init); diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/PreloadNaturalMobSpawning.java b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/PreloadNaturalMobSpawning.java deleted file mode 100644 index 50a5742e..00000000 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/PreloadNaturalMobSpawning.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.dreeam.leaf.config.modules.opt; - -import org.dreeam.leaf.config.ConfigModules; -import org.dreeam.leaf.config.EnumConfigCategory; - -public class PreloadNaturalMobSpawning extends ConfigModules { - public String getBasePath() { - return EnumConfigCategory.PERF.getBaseKeyName() + ".preload-mob-spawning-position"; - } - - public static boolean enabled = false; - - @Override - public void onLoaded() { - enabled = config.getBoolean(getBasePath() + ".enabled", enabled); - } -} diff --git a/leaf-server/src/main/java/org/dreeam/leaf/world/block/OptimizedPoweredRails.java b/leaf-server/src/main/java/org/dreeam/leaf/world/block/OptimizedPoweredRails.java index f888ff94..f4f3c7be 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/world/block/OptimizedPoweredRails.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/world/block/OptimizedPoweredRails.java @@ -1,5 +1,6 @@ package org.dreeam.leaf.world.block; +import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; @@ -8,8 +9,6 @@ import net.minecraft.world.level.block.PoweredRailBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.RailShape; -import java.util.HashMap; - import static net.minecraft.world.level.block.Block.*; import static net.minecraft.world.level.block.PoweredRailBlock.POWERED; import static net.minecraft.world.level.block.PoweredRailBlock.SHAPE; @@ -23,6 +22,8 @@ public class OptimizedPoweredRails { private static int RAIL_POWER_LIMIT = 8; + private static final Object2BooleanOpenHashMap CHECKED_POS_POOL = new Object2BooleanOpenHashMap<>(); + private static void giveShapeUpdate(Level level, BlockState state, BlockPos pos, BlockPos fromPos, Direction direction) { BlockState oldState = level.getBlockState(pos); Block.updateOrDestroy( @@ -45,8 +46,8 @@ public class OptimizedPoweredRails { public static void updateState(PoweredRailBlock self, BlockState state, Level level, BlockPos pos) { boolean shouldBePowered = level.hasNeighborSignal(pos) || - self.findPoweredRailSignal(level, pos, state, true, 0) || - self.findPoweredRailSignal(level, pos, state, false, 0); + findPoweredRailSignalFaster(self, level, pos, state, true, 0, CHECKED_POS_POOL) || + findPoweredRailSignalFaster(self, level, pos, state, false, 0, CHECKED_POS_POOL); if (shouldBePowered != state.getValue(POWERED)) { RailShape railShape = state.getValue(SHAPE); if (railShape.isSlope()) { @@ -61,14 +62,14 @@ public class OptimizedPoweredRails { } } - private static boolean findPoweredRailSignalFaster(PoweredRailBlock self, Level world, BlockPos pos, - boolean bl, int distance, RailShape shape, - HashMap checkedPos) { - BlockState blockState = world.getBlockState(pos); - boolean speedCheck = checkedPos.containsKey(pos) && checkedPos.get(pos); + private static boolean findPoweredRailSignalFaster(PoweredRailBlock self, Level level, BlockPos pos, + boolean searchForward, int distance, RailShape shape, + Object2BooleanOpenHashMap checkedPos) { + BlockState blockState = level.getBlockState(pos); + boolean speedCheck = checkedPos.containsKey(pos) && checkedPos.getBoolean(pos); if (speedCheck) { - return world.hasNeighborSignal(pos) || - findPoweredRailSignalFaster(self, world, pos, blockState, bl, distance + 1, checkedPos); + return level.hasNeighborSignal(pos) || + findPoweredRailSignalFaster(self, level, pos, blockState, searchForward, distance + 1, checkedPos); } else { if (blockState.is(self)) { RailShape railShape = blockState.getValue(SHAPE); @@ -83,8 +84,8 @@ public class OptimizedPoweredRails { )) { return false; } else if (blockState.getValue(POWERED)) { - return world.hasNeighborSignal(pos) || - findPoweredRailSignalFaster(self, world, pos, blockState, bl, distance + 1, checkedPos); + return level.hasNeighborSignal(pos) || + findPoweredRailSignalFaster(self, level, pos, blockState, searchForward, distance + 1, checkedPos); } else { return false; } @@ -94,191 +95,200 @@ public class OptimizedPoweredRails { } private static boolean findPoweredRailSignalFaster(PoweredRailBlock self, Level level, - BlockPos pos, BlockState state, boolean bl, int distance, - HashMap checkedPos) { + BlockPos pos, BlockState state, boolean searchForward, int distance, + Object2BooleanOpenHashMap checkedPos) { if (distance >= RAIL_POWER_LIMIT - 1) return false; - int i = pos.getX(); - int j = pos.getY(); - int k = pos.getZ(); - boolean bl2 = true; + int x = pos.getX(); + int y = pos.getY(); + int z = pos.getZ(); + boolean flag = true; RailShape railShape = state.getValue(SHAPE); switch (railShape.ordinal()) { case 0 -> { - if (bl) ++k; - else --k; + if (searchForward) ++z; + else --z; } case 1 -> { - if (bl) --i; - else ++i; + if (searchForward) --x; + else ++x; } case 2 -> { - if (bl) { - --i; + if (searchForward) { + --x; } else { - ++i; - ++j; - bl2 = false; + ++x; + ++y; + flag = false; } railShape = RailShape.EAST_WEST; } case 3 -> { - if (bl) { - --i; - ++j; - bl2 = false; + if (searchForward) { + --x; + ++y; + flag = false; } else { - ++i; + ++x; } railShape = RailShape.EAST_WEST; } case 4 -> { - if (bl) { - ++k; + if (searchForward) { + ++z; } else { - --k; - ++j; - bl2 = false; + --z; + ++y; + flag = false; } railShape = RailShape.NORTH_SOUTH; } case 5 -> { - if (bl) { - ++k; - ++j; - bl2 = false; + if (searchForward) { + ++z; + ++y; + flag = false; } else { - --k; + --z; } railShape = RailShape.NORTH_SOUTH; } } return findPoweredRailSignalFaster( - self, level, new BlockPos(i, j, k), - bl, distance, railShape, checkedPos + self, level, new BlockPos(x, y, z), + searchForward, distance, railShape, checkedPos ) || - (bl2 && findPoweredRailSignalFaster( - self, level, new BlockPos(i, j - 1, k), - bl, distance, railShape, checkedPos + (flag && findPoweredRailSignalFaster( + self, level, new BlockPos(x, y - 1, z), + searchForward, distance, railShape, checkedPos )); } - private static void powerLane(PoweredRailBlock self, Level world, BlockPos pos, + private static void powerLane(PoweredRailBlock self, Level level, BlockPos pos, BlockState mainState, RailShape railShape) { - world.setBlock(pos, mainState.setValue(POWERED, true), UPDATE_FORCE_PLACE); - HashMap checkedPos = new HashMap<>(); + level.setBlock(pos, mainState.setValue(POWERED, true), UPDATE_FORCE_PLACE); + Object2BooleanOpenHashMap checkedPos = CHECKED_POS_POOL; + checkedPos.clear(); checkedPos.put(pos, true); int[] count = new int[2]; if (railShape == RailShape.NORTH_SOUTH) { // Order: +z, -z for (int i = 0; i < NORTH_SOUTH_DIR.length; ++i) { - setRailPositionsPower(self, world, pos, checkedPos, count, i, NORTH_SOUTH_DIR[i]); + setRailPositionsPower(self, level, pos, checkedPos, count, i, NORTH_SOUTH_DIR[i]); } - updateRails(self, false, world, pos, mainState, count); + updateRails(self, false, level, pos, mainState, count); } else if (railShape == RailShape.EAST_WEST) { // Order: -x, +x for (int i = 0; i < EAST_WEST_DIR.length; ++i) { - setRailPositionsPower(self, world, pos, checkedPos, count, i, EAST_WEST_DIR[i]); + setRailPositionsPower(self, level, pos, checkedPos, count, i, EAST_WEST_DIR[i]); } - updateRails(self, true, world, pos, mainState, count); + updateRails(self, true, level, pos, mainState, count); } + checkedPos.clear(); } - private static void dePowerLane(PoweredRailBlock self, Level world, BlockPos pos, + private static void dePowerLane(PoweredRailBlock self, Level level, BlockPos pos, BlockState mainState, RailShape railShape) { - world.setBlock(pos, mainState.setValue(POWERED, false), UPDATE_FORCE_PLACE); + level.setBlock(pos, mainState.setValue(POWERED, false), UPDATE_FORCE_PLACE); int[] count = new int[2]; if (railShape == RailShape.NORTH_SOUTH) { // Order: +z, -z for (int i = 0; i < NORTH_SOUTH_DIR.length; ++i) { - setRailPositionsDePower(self, world, pos, count, i, NORTH_SOUTH_DIR[i]); + setRailPositionsDePower(self, level, pos, count, i, NORTH_SOUTH_DIR[i]); } - updateRails(self, false, world, pos, mainState, count); + updateRails(self, false, level, pos, mainState, count); } else if (railShape == RailShape.EAST_WEST) { // Order: -x, +x for (int i = 0; i < EAST_WEST_DIR.length; ++i) { - setRailPositionsDePower(self, world, pos, count, i, EAST_WEST_DIR[i]); + setRailPositionsDePower(self, level, pos, count, i, EAST_WEST_DIR[i]); } - updateRails(self, true, world, pos, mainState, count); + updateRails(self, true, level, pos, mainState, count); } } - private static void setRailPositionsPower(PoweredRailBlock self, Level world, BlockPos pos, - HashMap checkedPos, int[] count, int i, Direction dir) { + private static void setRailPositionsPower(PoweredRailBlock self, Level level, BlockPos pos, + Object2BooleanOpenHashMap checkedPos, int[] count, int i, Direction dir) { for (int z = 1; z < RAIL_POWER_LIMIT; z++) { BlockPos newPos = pos.relative(dir, z); - BlockState state = world.getBlockState(newPos); + BlockState state = level.getBlockState(newPos); if (checkedPos.containsKey(newPos)) { - if (!checkedPos.get(newPos)) break; + if (!checkedPos.getBoolean(newPos)) + break; count[i]++; - } else if (!state.is(self) || state.getValue(POWERED) || !( - world.hasNeighborSignal(newPos) || - findPoweredRailSignalFaster(self, world, newPos, state, true, 0, checkedPos) || - findPoweredRailSignalFaster(self, world, newPos, state, false, 0, checkedPos) - )) { + } else if (!state.is(self) || state.getValue(POWERED) || !(level.hasNeighborSignal(newPos) || + findPoweredRailSignalFaster(self, level, newPos, state, true, 0, checkedPos) || + findPoweredRailSignalFaster(self, level, newPos, state, false, 0, checkedPos))) { checkedPos.put(newPos, false); break; } else { checkedPos.put(newPos, true); - world.setBlock(newPos, state.setValue(POWERED, true), UPDATE_FORCE_PLACE); + if (!state.getValue(POWERED)) { + level.setBlock(newPos, state.setValue(POWERED, true), UPDATE_FORCE_PLACE); + } count[i]++; } } } - private static void setRailPositionsDePower(PoweredRailBlock self, Level world, BlockPos pos, - int[] count, int i, Direction dir) { + private static void setRailPositionsDePower(PoweredRailBlock self, Level level, BlockPos pos, + int[] count, int i, Direction dir) { + Object2BooleanOpenHashMap checkedPos = CHECKED_POS_POOL; + checkedPos.clear(); for (int z = 1; z < RAIL_POWER_LIMIT; z++) { BlockPos newPos = pos.relative(dir, z); - BlockState state = world.getBlockState(newPos); - if (!state.is(self) || !state.getValue(POWERED) || world.hasNeighborSignal(newPos) || - self.findPoweredRailSignal(world, newPos, state, true, 0) || - self.findPoweredRailSignal(world, newPos, state, false, 0)) break; - world.setBlock(newPos, state.setValue(POWERED, false), UPDATE_FORCE_PLACE); + BlockState state = level.getBlockState(newPos); + if (!state.is(self) || !state.getValue(POWERED) || level.hasNeighborSignal(newPos) || + findPoweredRailSignalFaster(self, level, newPos, state, true, 0, checkedPos) || + findPoweredRailSignalFaster(self, level, newPos, state, false, 0, checkedPos)) + break; + if (state.getValue(POWERED)) { + level.setBlock(newPos, state.setValue(POWERED, false), UPDATE_FORCE_PLACE); + } count[i]++; } + checkedPos.clear(); } - private static void shapeUpdateEnd(PoweredRailBlock self, Level world, BlockPos pos, BlockState mainState, + private static void shapeUpdateEnd(PoweredRailBlock self, Level level, BlockPos pos, BlockState mainState, int endPos, Direction direction, int currentPos, BlockPos blockPos) { if (currentPos == endPos) { BlockPos newPos = pos.relative(direction, currentPos + 1); - giveShapeUpdate(world, mainState, newPos, pos, direction); - BlockState state = world.getBlockState(blockPos); - if (state.is(self) && state.getValue(SHAPE).isSlope()) giveShapeUpdate(world, mainState, newPos.above(), pos, direction); + giveShapeUpdate(level, mainState, newPos, pos, direction); + BlockState state = level.getBlockState(blockPos); + if (state.is(self) && state.getValue(SHAPE).isSlope()) giveShapeUpdate(level, mainState, newPos.above(), pos, direction); } } - private static void neighborUpdateEnd(PoweredRailBlock self, Level world, BlockPos pos, int endPos, + private static void neighborUpdateEnd(PoweredRailBlock self, Level level, BlockPos pos, int endPos, Direction direction, Block block, int currentPos, BlockPos blockPos) { if (currentPos == endPos) { BlockPos newPos = pos.relative(direction, currentPos + 1); - world.neighborChanged(newPos, block, null); - BlockState state = world.getBlockState(blockPos); - if (state.is(self) && state.getValue(SHAPE).isSlope()) world.neighborChanged(newPos.above(), block, null); + level.neighborChanged(newPos, block, null); + BlockState state = level.getBlockState(blockPos); + if (state.is(self) && state.getValue(SHAPE).isSlope()) level.neighborChanged(newPos.above(), block, null); } } - private static void updateRailsSectionEastWestShape(PoweredRailBlock self, Level world, BlockPos pos, + private static void updateRailsSectionEastWestShape(PoweredRailBlock self, Level level, BlockPos pos, int c, BlockState mainState, Direction dir, int[] count, int countAmt) { BlockPos pos1 = pos.relative(dir, c); - if (c == 0 && count[1] == 0) giveShapeUpdate(world, mainState, pos1.relative(dir.getOpposite()), pos, dir.getOpposite()); - shapeUpdateEnd(self, world, pos, mainState, countAmt, dir, c, pos1); - giveShapeUpdate(world, mainState, pos1.below(), pos, Direction.DOWN); - giveShapeUpdate(world, mainState, pos1.above(), pos, Direction.UP); - giveShapeUpdate(world, mainState, pos1.north(), pos, Direction.NORTH); - giveShapeUpdate(world, mainState, pos1.south(), pos, Direction.SOUTH); + if (c == 0 && count[1] == 0) giveShapeUpdate(level, mainState, pos1.relative(dir.getOpposite()), pos, dir.getOpposite()); + shapeUpdateEnd(self, level, pos, mainState, countAmt, dir, c, pos1); + giveShapeUpdate(level, mainState, pos1.below(), pos, Direction.DOWN); + giveShapeUpdate(level, mainState, pos1.above(), pos, Direction.UP); + giveShapeUpdate(level, mainState, pos1.north(), pos, Direction.NORTH); + giveShapeUpdate(level, mainState, pos1.south(), pos, Direction.SOUTH); } - private static void updateRailsSectionNorthSouthShape(PoweredRailBlock self, Level world, BlockPos pos, + private static void updateRailsSectionNorthSouthShape(PoweredRailBlock self, Level level, BlockPos pos, int c, BlockState mainState, Direction dir, int[] count, int countAmt) { BlockPos pos1 = pos.relative(dir, c); - giveShapeUpdate(world, mainState, pos1.west(), pos, Direction.WEST); - giveShapeUpdate(world, mainState, pos1.east(), pos, Direction.EAST); - giveShapeUpdate(world, mainState, pos1.below(), pos, Direction.DOWN); - giveShapeUpdate(world, mainState, pos1.above(), pos, Direction.UP); - shapeUpdateEnd(self, world, pos, mainState, countAmt, dir, c, pos1); - if (c == 0 && count[1] == 0) giveShapeUpdate(world, mainState, pos1.relative(dir.getOpposite()), pos, dir.getOpposite()); + giveShapeUpdate(level, mainState, pos1.west(), pos, Direction.WEST); + giveShapeUpdate(level, mainState, pos1.east(), pos, Direction.EAST); + giveShapeUpdate(level, mainState, pos1.below(), pos, Direction.DOWN); + giveShapeUpdate(level, mainState, pos1.above(), pos, Direction.UP); + shapeUpdateEnd(self, level, pos, mainState, countAmt, dir, c, pos1); + if (c == 0 && count[1] == 0) giveShapeUpdate(level, mainState, pos1.relative(dir.getOpposite()), pos, dir.getOpposite()); } - private static void updateRails(PoweredRailBlock self, boolean eastWest, Level world, + private static void updateRails(PoweredRailBlock self, boolean eastWest, Level level, BlockPos pos, BlockState mainState, int[] count) { if (eastWest) { for (int i = 0; i < EAST_WEST_DIR.length; ++i) { @@ -288,21 +298,21 @@ public class OptimizedPoweredRails { Block block = mainState.getBlock(); for (int c = countAmt; c >= i; c--) { BlockPos p = pos.relative(dir, c); - if (c == 0 && count[1] == 0) world.neighborChanged(p.relative(dir.getOpposite()), block, null); - neighborUpdateEnd(self, world, pos, countAmt, dir, block, c, p); - world.neighborChanged(p.below(), block, null); - world.neighborChanged(p.above(), block, null); - world.neighborChanged(p.north(), block, null); - world.neighborChanged(p.south(), block, null); + if (c == 0 && count[1] == 0) level.neighborChanged(p.relative(dir.getOpposite()), block, null); + neighborUpdateEnd(self, level, pos, countAmt, dir, block, c, p); + level.neighborChanged(p.below(), block, null); + level.neighborChanged(p.above(), block, null); + level.neighborChanged(p.north(), block, null); + level.neighborChanged(p.south(), block, null); BlockPos pos2 = pos.relative(dir, c).below(); - world.neighborChanged(pos2.below(), block, null); - world.neighborChanged(pos2.north(), block, null); - world.neighborChanged(pos2.south(), block, null); - if (c == countAmt) world.neighborChanged(pos.relative(dir, c + 1).below(), block, null); - if (c == 0 && count[1] == 0) world.neighborChanged(p.relative(dir.getOpposite()).below(), block, null); + level.neighborChanged(pos2.below(), block, null); + level.neighborChanged(pos2.north(), block, null); + level.neighborChanged(pos2.south(), block, null); + if (c == countAmt) level.neighborChanged(pos.relative(dir, c + 1).below(), block, null); + if (c == 0 && count[1] == 0) level.neighborChanged(p.relative(dir.getOpposite()).below(), block, null); } for (int c = countAmt; c >= i; c--) - updateRailsSectionEastWestShape(self, world, pos, c, mainState, dir, count, countAmt); + updateRailsSectionEastWestShape(self, level, pos, c, mainState, dir, count, countAmt); } } else { for (int i = 0; i < NORTH_SOUTH_DIR.length; ++i) { @@ -312,21 +322,21 @@ public class OptimizedPoweredRails { Block block = mainState.getBlock(); for (int c = countAmt; c >= i; c--) { BlockPos p = pos.relative(dir, c); - world.neighborChanged(p.west(), block, null); - world.neighborChanged(p.east(), block, null); - world.neighborChanged(p.below(), block, null); - world.neighborChanged(p.above(), block, null); - neighborUpdateEnd(self, world, pos, countAmt, dir, block, c, p); - if (c == 0 && count[1] == 0) world.neighborChanged(p.relative(dir.getOpposite()), block, null); + level.neighborChanged(p.west(), block, null); + level.neighborChanged(p.east(), block, null); + level.neighborChanged(p.below(), block, null); + level.neighborChanged(p.above(), block, null); + neighborUpdateEnd(self, level, pos, countAmt, dir, block, c, p); + if (c == 0 && count[1] == 0) level.neighborChanged(p.relative(dir.getOpposite()), block, null); BlockPos pos2 = pos.relative(dir, c).below(); - world.neighborChanged(pos2.west(), block, null); - world.neighborChanged(pos2.east(), block, null); - world.neighborChanged(pos2.below(), block, null); - if (c == countAmt) world.neighborChanged(pos.relative(dir, c + 1).below(), block, null); - if (c == 0 && count[1] == 0) world.neighborChanged(p.relative(dir.getOpposite()).below(), block, null); + level.neighborChanged(pos2.west(), block, null); + level.neighborChanged(pos2.east(), block, null); + level.neighborChanged(pos2.below(), block, null); + if (c == countAmt) level.neighborChanged(pos.relative(dir, c + 1).below(), block, null); + if (c == 0 && count[1] == 0) level.neighborChanged(p.relative(dir.getOpposite()).below(), block, null); } for (int c = countAmt; c >= i; c--) - updateRailsSectionNorthSouthShape(self, world, pos, c, mainState, dir, count, countAmt); + updateRailsSectionNorthSouthShape(self, level, pos, c, mainState, dir, count, countAmt); } } } diff --git a/licenses/Apache-2.0.txt b/licenses/Apache-2.0.txt new file mode 100644 index 00000000..62589edd --- /dev/null +++ b/licenses/Apache-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/public/readme/README_CN.md b/public/readme/README_CN.md index 4b1be0f8..74545273 100644 --- a/public/readme/README_CN.md +++ b/public/readme/README_CN.md @@ -94,8 +94,9 @@ Paperweight 文件基于 [MIT](licenses/MIT.txt) 许可证。 另请参阅 [PaperMC/Paper](https://github.com/PaperMC/Paper) 和 [PaperMC/paperweight](https://github.com/PaperMC/paperweight) 了解本项目使用的一些材料的许可证。 ## 📜 致谢 -感谢以下项目。Leaf 包含了一些取自这些项目的补丁。
-如果没有这些优秀的项目,Leaf 就不会变得如此出色。 +Leaf 根据其上游项目及其他材料,采用多种开源许可证授权, + +请参阅 [LICENSE.md](../../LICENSE.md) 获取完整的许可信息。 - [Gale](https://github.com/Dreeam-qwq/Gale) ([原始仓库](https://github.com/GaleMC/Gale)) - [Pufferfish](https://github.com/pufferfish-gg/Pufferfish) diff --git a/todos.md b/todos.md index 6cabe23d..de89cfb7 100644 --- a/todos.md +++ b/todos.md @@ -9,4 +9,4 @@ # 1.21.5 - [ ] Remove stream in Inventory and check new changes - [ ] Check SparklyPaper's mapitem update skip -- [ ] Update from Leaf 1.21.4 (curr commit: `ccab3256c296857eeacd4d0c23f2e1b8aae3b36c`) +- [ ] Update from Leaf 1.21.4 (curr commit: `03de21f0f4c0aa696d052113990ca9ee6884be0e`)