diff --git a/README.md b/README.md
index 91ff52594..d1905ef39 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,8 @@
## Leaf
-[![Github Actions Build](https://img.shields.io/github/actions/workflow/status/Winds-Studio/Leaf/build-1202.yml?branch=ver%2F1.20.2&style=flat-square)](https://github.com/Winds-Studio/Leaf/releases)
+[![Github Actions Build](https://img.shields.io/github/actions/workflow/status/Winds-Studio/Leaf/build-1202.yml?&style=for-the-badge)](https://github.com/Winds-Studio/Leaf/releases)
+[![Discord](https://img.shields.io/discord/1145991395388162119?color=5865F2&label=discord&style=for-the-badge)](https://discord.gg/gfgAwdSEuM)
Leaf is a drop-in replacement designed for removing some checks, customized, and high-performance built on top of Gale with optimization from other forks.
Logo designed by New Bing
@@ -60,6 +61,7 @@ Thanks to these projects below. Leaf just mix some of their patches together. If
- [Mirai](https://github.com/etil2jz/Mirai)
- [Petal](https://github.com/Bloom-host/Petal)
- [Carpet Fixes](https://github.com/fxmorin/carpet-fixes)
+- [Akarin](https://github.com/Akarin-project/Akarin)
- [Slice](https://github.com/Cryptite/Slice)
- [Parchment](https://github.com/ProjectEdenGG/Parchment)
- [Leaves](https://github.com/LeavesMC/Leaves)
diff --git a/gradle.properties b/gradle.properties
index 2529b6c0f..b74f59e15 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,7 +1,7 @@
group = org.dreeam.leaf
version = 1.20.2-R0.1-SNAPSHOT
-galeCommit = aad62370715e63ae83ac395a412d90439767765f
+galeCommit = 81e819d54fcf2975decd3b105c02b46c1c17377a
org.gradle.caching = true
org.gradle.parallel = true
diff --git a/patches/api/0003-Purpur-API-Changes.patch b/patches/api/0003-Purpur-API-Changes.patch
index cb53a04e5..46fd0de8e 100644
--- a/patches/api/0003-Purpur-API-Changes.patch
+++ b/patches/api/0003-Purpur-API-Changes.patch
@@ -6,7 +6,7 @@ Subject: [PATCH] Purpur API Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
-Commit: 69d6fae0647074feeb4eb7a2b98fcc2979cc9f92
+Commit: 6bb7f82f3b685113c92ce6480e2ba698d05ab57c
Patches below are removed in this patch:
Pufferfish-API-Changes.patch
@@ -578,10 +578,10 @@ index a5938b0a960121bd77a13e4c8fc8a053bea481c5..c55819f56b4a3850496feef6900c1ec8
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
-index da524a71af74b02515b037f7fe09ba6988e2c8bf..3679c3b8d31ab8de08ecabd56bf92ffc062f971c 100644
+index 91eb95b04094394e8dc1e3a3343efc63690c87e4..d8ef44761148f928a671ceba74a5d1cb87af81d9 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
-@@ -4008,6 +4008,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -4072,6 +4072,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@Nullable
public DragonBattle getEnderDragonBattle();
diff --git a/patches/api/0004-Remove-Timings.patch b/patches/api/0004-Remove-Timings.patch
index 805727b65..a877b7246 100644
--- a/patches/api/0004-Remove-Timings.patch
+++ b/patches/api/0004-Remove-Timings.patch
@@ -2830,10 +2830,10 @@ index 3e61a926620a67daec3af54b72a1b911eaef2ed4..00000000000000000000000000000000
- }
-}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
-index 9237e2fca0557890b718de9029207a552396e45a..359c72a5fc0a98a71429907a437a1c7be03ed64c 100644
+index a4b38f284d4fea7df7f9df9bf44e4f68fefaf20f..2a5f381e4a755ec5f2692731a5499a8ab95c3b36 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
-@@ -35,7 +35,6 @@ public interface UnsafeValues {
+@@ -36,7 +36,6 @@ public interface UnsafeValues {
net.kyori.adventure.text.Component resolveWithContext(net.kyori.adventure.text.Component component, org.bukkit.command.CommandSender context, org.bukkit.entity.Entity scoreboardSubject, boolean bypassPermissions) throws java.io.IOException;
// Paper end
@@ -2841,7 +2841,7 @@ index 9237e2fca0557890b718de9029207a552396e45a..359c72a5fc0a98a71429907a437a1c7b
Material toLegacy(Material material);
Material fromLegacy(Material material);
-@@ -113,11 +112,6 @@ public interface UnsafeValues {
+@@ -122,11 +121,6 @@ public interface UnsafeValues {
// Paper end
// Paper start
diff --git a/patches/api/0005-Bump-Dependencies.patch b/patches/api/0005-Bump-Dependencies.patch
index 032f22e18..913b0b716 100644
--- a/patches/api/0005-Bump-Dependencies.patch
+++ b/patches/api/0005-Bump-Dependencies.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Bump Dependencies
diff --git a/build.gradle.kts b/build.gradle.kts
-index d0cfdfc846d0d644349ee59c3a9b0ad8d32e4352..f6f8fc879d938d31b184216eaccb477637be5a13 100644
+index d0cfdfc846d0d644349ee59c3a9b0ad8d32e4352..463f4e0851f0bc3d227caaf12acc0dc8573d0010 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -11,8 +11,8 @@ java {
@@ -15,10 +15,19 @@ index d0cfdfc846d0d644349ee59c3a9b0ad8d32e4352..f6f8fc879d938d31b184216eaccb4776
-val slf4jVersion = "1.8.0-beta4"
-val log4jVersion = "2.17.1"
+val slf4jVersion = "2.0.9" // Leaf - Bump Dependencies
-+val log4jVersion = "2.20.0" // Leaf - Bump Dependencies
++val log4jVersion = "2.21.0" // Leaf - Bump Dependencies
val apiAndDocs: Configuration by configurations.creating {
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
+@@ -27,7 +27,7 @@ configurations.api {
+
+ dependencies {
+ // api dependencies are listed transitively to API consumers
+- api("com.google.guava:guava:32.1.2-jre")
++ api("com.google.guava:guava:32.1.3-jre") // Leaf - Bump Dependencies
+ api("com.google.code.gson:gson:2.10.1")
+ api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.14") // Paper
+ api("org.yaml:snakeyaml:2.2")
@@ -36,7 +36,7 @@ dependencies {
api("com.googlecode.json-simple:json-simple:1.1.1") {
isTransitive = false // includes junit
@@ -71,6 +80,15 @@ index d0cfdfc846d0d644349ee59c3a9b0ad8d32e4352..f6f8fc879d938d31b184216eaccb4776
}
configure {
+@@ -123,7 +125,7 @@ tasks.withType {
+ options.use()
+ options.isDocFilesSubDirs = true
+ options.links(
+- "https://guava.dev/releases/32.1.2-jre/api/docs/",
++ "https://guava.dev/releases/32.1.3-jre/api/docs/", // Leaf - Bump Dependencies
+ "https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
+ "https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations
+ // "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/", // Paper - don't link to bungee chat
@@ -141,7 +143,7 @@ tasks.withType {
"https://javadoc.io/doc/org.slf4j/slf4j-api/$slf4jVersion/",
"https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/$log4jVersion/",
diff --git a/patches/server/0001-Rebrand.patch b/patches/server/0001-Rebrand.patch
index 1f7daa4b4..71cdfce06 100644
--- a/patches/server/0001-Rebrand.patch
+++ b/patches/server/0001-Rebrand.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Rebrand
diff --git a/build.gradle.kts b/build.gradle.kts
-index e1a366999943b321c499af95417a029137417af1..aa82a0d55bcd49a752f2c50754c7a3bc915752bc 100644
+index de7a3389c66d5cb3123cf4c85d854bc727528b65..14965728716a69f849c21cfe69954a89cf054ff8 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -15,9 +15,9 @@ val alsoShade: Configuration by configurations.creating
@@ -20,7 +20,7 @@ index e1a366999943b321c499af95417a029137417af1..aa82a0d55bcd49a752f2c50754c7a3bc
exclude("io.papermc.paper", "paper-api")
}
// Gale end - project setup
-@@ -89,7 +89,7 @@ tasks.jar {
+@@ -87,7 +87,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
@@ -89,7 +89,7 @@ index 909e00c433fc869104dbe4a633c82f92304880d0..889886a949df9eb49a26c6fec9a32ddf
while (this.getRunningThread().isAlive()) {
this.getRunningThread().stop();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
-index 931c47eb2926fe2fd8e1b13959d1f4185538adc5..4632619ea57ce3ac36061a727e023b11cb0ca7e4 100644
+index 2cead4143ab152dc96f04b065134d2e46b979ca5..e195fd0a489985eebf432f350d7e84afece1529d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -270,7 +270,7 @@ import javax.annotation.Nullable; // Paper
diff --git a/patches/server/0002-Leaf-Config.patch b/patches/server/0002-Leaf-Config.patch
index c9fe7d4bf..2634be5f1 100644
--- a/patches/server/0002-Leaf-Config.patch
+++ b/patches/server/0002-Leaf-Config.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Leaf Config
diff --git a/build.gradle.kts b/build.gradle.kts
-index aa82a0d55bcd49a752f2c50754c7a3bc915752bc..ab6525f6fb91c7f6d287c5c50a822ed69ecc63f5 100644
+index 14965728716a69f849c21cfe69954a89cf054ff8..b386250d71d47ab5591a9b89ff39b4369ec4e0a3 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
-@@ -58,6 +58,13 @@ dependencies {
+@@ -57,6 +57,13 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
diff --git a/patches/unapplied/server/0005-Pufferfish-Optimize-mob-spawning.patch b/patches/server/0005-Pufferfish-Optimize-mob-spawning.patch
similarity index 73%
rename from patches/unapplied/server/0005-Pufferfish-Optimize-mob-spawning.patch
rename to patches/server/0005-Pufferfish-Optimize-mob-spawning.patch
index 17a34a430..d95b6c36d 100644
--- a/patches/unapplied/server/0005-Pufferfish-Optimize-mob-spawning.patch
+++ b/patches/server/0005-Pufferfish-Optimize-mob-spawning.patch
@@ -44,8 +44,21 @@ index f74efb12626a3f027d716bcd3bdb69d9225b3fac..6ae953902a9ed246246660c8da7654c7
return true;
}
}
+diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
+index f95ee3367a8d1ef400c52660d162c63367648d96..03b3abccf4313d489a7223bd044816a85369f3a0 100644
+--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
+@@ -206,7 +206,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
+ // Paper end
+ // Paper start - optimise chunk tick iteration
+ public final it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet needsChangeBroadcasting = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>();
+- public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
++ public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap = new gg.pufferfish.pufferfish.util.AsyncPlayerAreaMap(this.pooledLinkedPlayerHashSets); // Pufferfish
+ // Paper end - optimise chunk tick iteration
+
+ public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
-index 18e521e77e58a9f786937192249c884aa317988c..f5584de85ca4b95be9b107df562ebf3963ad1b5a 100644
+index 18e521e77e58a9f786937192249c884aa317988c..adc23cbcff21701ef751e39322a1e03a85953077 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -74,6 +74,9 @@ public class ServerChunkCache extends ChunkSource {
@@ -58,26 +71,44 @@ index 18e521e77e58a9f786937192249c884aa317988c..f5584de85ca4b95be9b107df562ebf39
private static int getChunkCacheKey(int x, int z) {
return x & 3 | ((z & 3) << 2);
-@@ -521,6 +524,8 @@ public class ServerChunkCache extends ChunkSource {
+@@ -521,28 +524,35 @@ public class ServerChunkCache extends ChunkSource {
int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
-+ // Pufferfish start - moved down when async processing
-+ if (!org.dreeam.leaf.LeafConfig.enableAsyncMobSpawning) {
- // re-set mob counts
- for (ServerPlayer player : this.level.players) {
- // Paper start - per player mob spawning backoff
-@@ -535,14 +540,19 @@ public class ServerChunkCache extends ChunkSource {
+- // re-set mob counts
+- for (ServerPlayer player : this.level.players) {
+- // Paper start - per player mob spawning backoff
+- for (int ii = 0; ii < ServerPlayer.MOBCATEGORY_TOTAL_ENUMS; ii++) {
+- player.mobCounts[ii] = 0;
+-
+- int newBackoff = player.mobBackoffCounts[ii] - 1; // TODO make configurable bleed // TODO use nonlinear algorithm?
+- if (newBackoff < 0) {
+- newBackoff = 0;
++ // Pufferfish start - moved down when async processing
++ if (!org.dreeam.leaf.LeafConfig.enableAsyncMobSpawning) {
++ // re-set mob counts
++ for (ServerPlayer player : this.level.players) {
++ // Paper start - per player mob spawning backoff
++ for (int ii = 0; ii < ServerPlayer.MOBCATEGORY_TOTAL_ENUMS; ii++) {
++ player.mobCounts[ii] = 0;
++
++ int newBackoff = player.mobBackoffCounts[ii] - 1; // TODO make configurable bleed // TODO use nonlinear algorithm?
++ if (newBackoff < 0) {
++ newBackoff = 0;
++ }
++ player.mobBackoffCounts[ii] = newBackoff;
+ }
+- player.mobBackoffCounts[ii] = newBackoff;
++ // Paper end - per player mob spawning backoff
}
- // Paper end - per player mob spawning backoff
+- // Paper end - per player mob spawning backoff
++ lastSpawnState = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, null, true);
}
- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, null, true);
-+ lastSpawnState = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, null, true);
-+ }
+ // Pufferfish end
} else {
- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false);
-+ // Pufferfish start - this is only implemented for per-player mob spawning so this makes everything work if this setting is disabled.
++ // Pufferfish start
+ lastSpawnState = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false);
+ _pufferfish_spawnCountsReady.set(true);
+ // Pufferfish end
@@ -90,11 +121,13 @@ index 18e521e77e58a9f786937192249c884aa317988c..f5584de85ca4b95be9b107df562ebf39
// Paper - optimise chunk tick iteration
// Paper - optimise chunk tick iteration
// Gale start - MultiPaper - skip unnecessary mob spawning computations
-@@ -637,7 +647,7 @@ public class ServerChunkCache extends ChunkSource {
+@@ -636,8 +646,8 @@ public class ServerChunkCache extends ChunkSource {
+ // Paper end - optimise chunk tick iteration
if (tick && chunk1.chunkStatus.isOrAfter(net.minecraft.server.level.FullChunkStatus.ENTITY_TICKING)) { // Paper - optimise chunk tick iteration
chunk1.incrementInhabitedTime(j);
- if (spawn && flag2AndHasNaturalSpawn && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration // Gale - MultiPaper - skip unnecessary mob spawning computations
+- if (spawn && flag2AndHasNaturalSpawn && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration // Gale - MultiPaper - skip unnecessary mob spawning computations
- NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
++ if (spawn && flag2 && (!org.dreeam.leaf.LeafConfig.enableAsyncMobSpawning || _pufferfish_spawnCountsReady.get()) && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration // Pufferfish
+ NaturalSpawner.spawnForChunk(this.level, chunk1, lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag1); // Pufferfish
}
@@ -122,7 +155,7 @@ index 18e521e77e58a9f786937192249c884aa317988c..f5584de85ca4b95be9b107df562ebf39
+ firstRunSpawnCounts = false;
+ _pufferfish_spawnCountsReady.set(true);
+ }
-+ if (chunkMap.playerMobSpawnMap != null && _pufferfish_spawnCountsReady.getAndSet(false)) {
++ if (_pufferfish_spawnCountsReady.getAndSet(false)) {
+ net.minecraft.server.MinecraftServer.getServer().mobSpawnExecutor.submit(() -> {
+ int mapped = distanceManager.getNaturalSpawnChunkCount();
+ io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator objectiterator =
diff --git a/patches/unapplied/server/0005-Pufferfish-Dynamic-Activation-of-Brain.patch b/patches/server/0006-Pufferfish-Dynamic-Activation-of-Brain.patch
similarity index 95%
rename from patches/unapplied/server/0005-Pufferfish-Dynamic-Activation-of-Brain.patch
rename to patches/server/0006-Pufferfish-Dynamic-Activation-of-Brain.patch
index bd2e2f33b..459b9067e 100644
--- a/patches/unapplied/server/0005-Pufferfish-Dynamic-Activation-of-Brain.patch
+++ b/patches/server/0006-Pufferfish-Dynamic-Activation-of-Brain.patch
@@ -260,7 +260,7 @@ index db09d5c6b709f746e69111cedebd29f82c1f9e32..f172cf9f754b73e44c3688581c984baa
super.customServerAiStep();
if ((this.tickCount + this.getId()) % 120 == 0) {
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
-index e157e11933710e0ceb73c6d41f673332fbeee303..812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2 100644
+index e157e11933710e0ceb73c6d41f673332fbeee303..f4ba301189b8bb77c653725347d4bfdbf5144727 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -144,6 +144,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -280,22 +280,21 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..812313bb3aade49c4afa2eec9be1f9cc
@Override
@Deprecated // Paper
protected void customServerAiStep() {
-@@ -255,7 +258,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -255,7 +258,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
protected void customServerAiStep(final boolean inactive) {
// Paper end
- if (!inactive) this.getBrain().tick((ServerLevel) this.level(), this); // Paper
+ // Pufferfish start
-+ if (!inactive) {
-+ if (this.behaviorTick++ % this.activatedPriority == 0)
-+ this.getBrain().tick((ServerLevel) this.level(), this); // Paper
++ if (!inactive && this.behaviorTick++ % this.activatedPriority == 0) {
++ this.getBrain().tick((ServerLevel) this.level(), this); // Paper
+ }
+ // Pufferfish end
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index b1fcd3588c22143f9852805a6cea3b6cf6c33a1f..7aa266b6cecb7e8d2bed41ec2e68f057deb99d05 100644
+index 5d161351e7517acf57e98203bab8c9f9ab9d4005..634a4e46022f1d63a67c64f19f25553859e73e1f 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -1,7 +1,9 @@
@@ -316,16 +315,23 @@ index b1fcd3588c22143f9852805a6cea3b6cf6c33a1f..7aa266b6cecb7e8d2bed41ec2e68f057
import java.util.List;
import java.util.Map;
-@@ -163,7 +166,33 @@ public class LeafConfig {
- private static void removal() {
- }
+@@ -165,6 +168,12 @@ public class LeafConfig {
+ public static boolean enableAsyncMobSpawning = true;
+ public static boolean asyncMobSpawningInitialized;
+ public static boolean dabEnabled = true;
+ public static int startDistance = 12;
+ public static int startDistanceSquared;
+ public static int maximumActivationPrio = 20;
+ public static int activationDistanceMod = 8;
++
private static void performance() {
+ boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
+ "Whether or not asynchronous mob spawning should be enabled.",
+@@ -177,6 +186,27 @@ public class LeafConfig {
+ asyncMobSpawningInitialized = true;
+ enableAsyncMobSpawning = asyncMobSpawning;
+ }
+ dabEnabled = getBoolean("performance.dab.enabled", "dab.enabled", dabEnabled);
+ startDistance = getInt("performance.dab.start-distance", "dab.start-distance", startDistance,
+ "This value determines how far away an entity has to be",
diff --git a/patches/unapplied/server/0006-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch b/patches/server/0007-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch
similarity index 87%
rename from patches/unapplied/server/0006-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch
rename to patches/server/0007-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch
index 2c30b7a8f..6f59919e8 100644
--- a/patches/unapplied/server/0006-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch
+++ b/patches/server/0007-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch
@@ -26,18 +26,19 @@ index bb32b2d71b65254ccfa6a73e7debc63f801e7dc5..db0fb4cd2041b456269479bd97751bd7
}
if (this.targetSelector.inactiveTick(this.activatedPriority, true)) { // Pufferfish - pass activated priority
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index 7aa266b6cecb7e8d2bed41ec2e68f057deb99d05..9cfa1d626c83a5c2fb1ae7db4746a4cb07262778 100644
+index 634a4e46022f1d63a67c64f19f25553859e73e1f..9a11228726c9a489181fc8a0c511ea83cdcf0f6e 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -171,6 +171,7 @@ public class LeafConfig {
+@@ -173,7 +173,7 @@ public class LeafConfig {
public static int startDistanceSquared;
public static int maximumActivationPrio = 20;
public static int activationDistanceMod = 8;
+-
+ public static boolean throttleInactiveGoalSelectorTick = true;
private static void performance() {
- dabEnabled = getBoolean("performance.dab.enabled", "dab.enabled", dabEnabled);
- startDistance = getInt("performance.dab.start-distance", "dab.start-distance", startDistance,
-@@ -193,6 +194,9 @@ public class LeafConfig {
+ boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
+ "Whether or not asynchronous mob spawning should be enabled.",
+@@ -207,6 +207,9 @@ public class LeafConfig {
entityType.dabEnabled = false;
}, () -> MinecraftServer.LOGGER.warn("Unknown entity \"" + name + "\"")));
setComment("performance.dab", "Optimizes entity brains when", "they're far away from the player");
diff --git a/patches/unapplied/server/0007-Pufferfish-Entity-TTL.patch b/patches/server/0008-Pufferfish-Entity-TTL.patch
similarity index 90%
rename from patches/unapplied/server/0007-Pufferfish-Entity-TTL.patch
rename to patches/server/0008-Pufferfish-Entity-TTL.patch
index 4dedbefe4..effc09d09 100644
--- a/patches/unapplied/server/0007-Pufferfish-Entity-TTL.patch
+++ b/patches/server/0008-Pufferfish-Entity-TTL.patch
@@ -36,7 +36,7 @@ index ebf05a484175548c0e411adfd35fd1f648925fed..2561e74ffdf595a9b6ae13dcd738662c
private String descriptionId;
@Nullable
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index 9cfa1d626c83a5c2fb1ae7db4746a4cb07262778..c135a861217d0ae43cf1b84e5bf259b41a0bf92e 100644
+index 9a11228726c9a489181fc8a0c511ea83cdcf0f6e..9299d2fe1cda71b6881fd8bd65d3d74b1189a196 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -17,6 +17,7 @@ import java.lang.reflect.Method;
@@ -47,15 +47,15 @@ index 9cfa1d626c83a5c2fb1ae7db4746a4cb07262778..c135a861217d0ae43cf1b84e5bf259b4
import java.util.Map;
public class LeafConfig {
-@@ -172,6 +173,7 @@ public class LeafConfig {
+@@ -174,6 +175,7 @@ public class LeafConfig {
public static int maximumActivationPrio = 20;
public static int activationDistanceMod = 8;
public static boolean throttleInactiveGoalSelectorTick = true;
+ public static Map projectileTimeouts;
private static void performance() {
- dabEnabled = getBoolean("performance.dab.enabled", "dab.enabled", dabEnabled);
- startDistance = getInt("performance.dab.start-distance", "dab.start-distance", startDistance,
-@@ -197,6 +199,18 @@ public class LeafConfig {
+ boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
+ "Whether or not asynchronous mob spawning should be enabled.",
+@@ -210,6 +212,18 @@ public class LeafConfig {
throttleInactiveGoalSelectorTick = getBoolean("performance.inactive-goal-selector-throttle", "inactive-goal-selector-throttle", throttleInactiveGoalSelectorTick,
"Throttles the AI goal selector in entity inactive ticks.",
"This can improve performance by a few percent, but has minor gameplay implications.");
diff --git a/patches/server/0005-Purpur-Server-Changes.patch b/patches/server/0009-Purpur-Server-Changes.patch
similarity index 98%
rename from patches/server/0005-Purpur-Server-Changes.patch
rename to patches/server/0009-Purpur-Server-Changes.patch
index 188bc5a9d..c96d06306 100644
--- a/patches/server/0005-Purpur-Server-Changes.patch
+++ b/patches/server/0009-Purpur-Server-Changes.patch
@@ -6,10 +6,11 @@ Subject: [PATCH] Purpur Server Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
-Commit: 69d6fae0647074feeb4eb7a2b98fcc2979cc9f92
+Commit: 6bb7f82f3b685113c92ce6480e2ba698d05ab57c
Patches below are removed in this patch:
-Metrics change in 0002-Purpur-config-files.patch
+Metrics change in Purpur-config-files.patch
+Brand change in Rebrand.patch
Alternative-Keepalive-Handling.patch
Logger-settings-suppressing-pointless-logs.patch
Fix-outdated-server-showing-in-ping-before-server-fu.patch
@@ -26,10 +27,10 @@ Remove-Mojang-Profiler.patch
MC-121706-Fix-mobs-not-looking-up-and-down-when-stra.patch
diff --git a/build.gradle.kts b/build.gradle.kts
-index 2bb82cf44a7db2931f9ecfd0076d16276da38ccf..d356988d21896ac06b5cc2e54785813b7d30233c 100644
+index b386250d71d47ab5591a9b89ff39b4369ec4e0a3..ab5aee09874e2258d05b22ca1be3c273cb1afb34 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
-@@ -65,6 +65,10 @@ dependencies {
+@@ -64,6 +64,10 @@ dependencies {
}
// Pufferfish end
@@ -40,7 +41,7 @@ index 2bb82cf44a7db2931f9ecfd0076d16276da38ccf..d356988d21896ac06b5cc2e54785813b
testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.hamcrest:hamcrest:2.2")
-@@ -180,7 +184,7 @@ fun TaskContainer.registerRunTask(
+@@ -178,7 +182,7 @@ fun TaskContainer.registerRunTask(
name: String,
block: JavaExec.() -> Unit
): TaskProvider = register(name) {
@@ -700,7 +701,7 @@ index 9ec6145fe04ec64bbee8ec6a837719caebdbc6f5..358d610ad020cada1bb83e393deeeaae
public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) {
this.gameTime = time;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
-index 889886a949df9eb49a26c6fec9a32ddfbf938847..bc886017d72ca26655478c5f48f2b79689ab908c 100644
+index a8535f791188b2d8ba8d663372e688a1bfebe3c0..995dd071082e482785448678b9189f0715a75308 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -273,6 +273,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
@@ -809,7 +810,7 @@ index 889886a949df9eb49a26c6fec9a32ddfbf938847..bc886017d72ca26655478c5f48f2b796
/* Drop global time updates
if (this.tickCount % 20 == 0) {
-@@ -2540,6 +2566,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> consumer, Set trackedPlayers) {
this.trackedPlayers = trackedPlayers;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af70c2bbc0f 100644
+index ccbc0c3d4f151194fb937aed75837ca1afa1306b..f925951ec36a020d26c2012589d8d458df297a3c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -213,6 +213,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1188,7 +1189,7 @@ index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af7
// CraftBukkit start
j = this.levelData.getDayTime() + 24000L;
TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (j - j % 24000L) - this.getDayTime());
-@@ -921,6 +942,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -922,6 +943,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.serverLevelData.setGameTime(i);
this.serverLevelData.getScheduledEvents().tick(this.server, i);
if (this.levelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
@@ -1202,7 +1203,7 @@ index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af7
this.setDayTime(this.levelData.getDayTime() + 1L);
}
-@@ -929,8 +957,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -930,8 +958,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void setDayTime(long timeOfDay) {
this.serverLevelData.setDayTime(timeOfDay);
@@ -1225,7 +1226,7 @@ index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af7
public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) {
Iterator iterator = this.customSpawners.iterator();
-@@ -973,10 +1015,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -974,10 +1016,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper
if (flag1) {
@@ -1246,7 +1247,7 @@ index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af7
entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
-@@ -1090,7 +1140,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1091,7 +1141,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
return holder.is(PoiTypes.LIGHTNING_ROD);
}, (blockposition1) -> {
return blockposition1.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockposition1.getX(), blockposition1.getZ()) - 1;
@@ -1255,7 +1256,7 @@ index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af7
return optional.map((blockposition1) -> {
return blockposition1.above(1);
-@@ -1139,11 +1189,27 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1140,11 +1190,27 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (this.canSleepThroughNights()) {
if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) {
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
@@ -1284,7 +1285,7 @@ index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af7
ichatmutablecomponent = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i));
}
-@@ -1282,6 +1348,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1283,6 +1349,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
private void resetWeatherCycle() {
// CraftBukkit start
@@ -1292,7 +1293,7 @@ index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af7
this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - when passing the night
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time....
-@@ -1289,6 +1356,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1290,6 +1357,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.serverLevelData.setRainTime(0);
}
// CraftBukkit end
@@ -1300,7 +1301,7 @@ index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af7
this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - when passing the night
// CraftBukkit start
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
-@@ -2777,7 +2845,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2778,7 +2846,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
// Paper start
@@ -1310,7 +1311,7 @@ index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af7
}
// Paper end
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index 032ae1af757f0241467fddd0c7c735d53a1eb473..e0fdc3156bec8c39a23c322f888826f710e36ddd 100644
+index bbfe261c5b158825a4464c9a8d07c43ca98e3a27..28d58b0b09cc4a694d0a00b378cdc8148bab48d2 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -275,6 +275,10 @@ public class ServerPlayer extends Player {
@@ -1458,7 +1459,7 @@ index 032ae1af757f0241467fddd0c7c735d53a1eb473..e0fdc3156bec8c39a23c322f888826f7
@Override
public void displayClientMessage(Component message, boolean overlay) {
this.sendSystemMessage(message, overlay);
-@@ -2102,8 +2166,68 @@ public class ServerPlayer extends Player {
+@@ -2107,8 +2171,68 @@ public class ServerPlayer extends Player {
public void resetLastActionTime() {
this.lastActionTime = Util.getMillis();
@@ -1527,7 +1528,7 @@ index 032ae1af757f0241467fddd0c7c735d53a1eb473..e0fdc3156bec8c39a23c322f888826f7
public ServerStatsCounter getStats() {
return this.stats;
}
-@@ -2651,4 +2775,50 @@ public class ServerPlayer extends Player {
+@@ -2656,4 +2780,50 @@ public class ServerPlayer extends Player {
return (CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end
@@ -1662,7 +1663,7 @@ index 963cbdff10dd3c2ed8a0737853fa584cfafae29b..1eef67ca260434e8627dba35792a7c5d
try {
String channels = payload.toString(com.google.common.base.Charsets.UTF_8);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 210ee08c071c1504c21f745214dd5484f305664d..9d5f3bd830b547ff238dcef60aa00121038ba5f8 100644
+index c7681c6d6f5c75be8d8dc5a58d7c463dbb9a1b8f..4e67556e1eb0a429a87fd07ae1c593e8bd4b6aab 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -334,6 +334,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1902,7 +1903,7 @@ index 210ee08c071c1504c21f745214dd5484f305664d..9d5f3bd830b547ff238dcef60aa00121
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {
entity.getEntityData().resendPossiblyDesyncedEntity(player); // Paper - The entire mob gets deleted, so resend it.
-@@ -3316,6 +3386,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+@@ -3315,6 +3385,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
}
}
@@ -2372,7 +2373,7 @@ index 1f9e0c139988c4c44a26552881647d36965aa4fa..b8d612d22aca74a08b53393c0723a2ae
@Override
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
-index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca119f85a9b6 100644
+index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389eef5dbd7c6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -155,7 +155,7 @@ import org.bukkit.plugin.PluginManager;
@@ -2402,7 +2403,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
private float eyeHeight;
public boolean isInPowderSnow;
public boolean wasInPowderSnow;
-@@ -488,6 +488,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -493,6 +493,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return false;
}
@@ -2428,7 +2429,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
public final boolean hardCollides() {
return this.hardCollides;
}
-@@ -538,7 +557,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -543,7 +562,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.bb = Entity.INITIAL_AABB;
this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F;
@@ -2437,7 +2438,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
this.remainingFireTicks = -this.getFireImmuneTicks();
this.fluidHeight = new Object2DoubleArrayMap(2);
this.fluidOnEyes = new HashSet();
-@@ -854,10 +873,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -865,10 +884,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public void checkBelowWorld() {
// Paper start - Configurable nether ceiling damage
@@ -2450,7 +2451,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
this.onBelowWorld();
}
-@@ -1834,7 +1854,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -1845,7 +1865,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return this.isInWater() || flag;
}
@@ -2459,7 +2460,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
Entity entity = this.getVehicle();
if (entity instanceof Boat) {
-@@ -2955,6 +2975,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -2966,6 +2986,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.passengers = ImmutableList.copyOf(list);
}
@@ -2473,7 +2474,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
this.gameEvent(GameEvent.ENTITY_MOUNT, passenger);
}
}
-@@ -2995,6 +3022,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -3006,6 +3033,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return false;
}
// Spigot end
@@ -2488,7 +2489,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
-@@ -3074,12 +3109,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -3085,12 +3120,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return Vec3.directionFromRotation(this.getRotationVector());
}
@@ -2505,7 +2506,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
}
this.isInsidePortal = true;
-@@ -3128,7 +3166,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -3139,7 +3177,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
this.processPortalCooldown();
@@ -2514,7 +2515,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
}
}
-@@ -3318,7 +3356,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -3329,7 +3367,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public int getMaxAirSupply() {
@@ -2523,7 +2524,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
}
public int getAirSupply() {
-@@ -3782,7 +3820,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -3793,7 +3831,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public boolean canChangeDimensions() {
@@ -2532,7 +2533,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
}
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
-@@ -4080,6 +4118,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -4091,6 +4129,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return SlotAccess.NULL;
}
@@ -2553,7 +2554,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
@Override
public void sendSystemMessage(Component message) {}
-@@ -4349,6 +4401,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -4360,6 +4412,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.yRotO = this.getYRot();
}
@@ -2566,7 +2567,7 @@ index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca11
public boolean updateFluidHeightAndDoFluidPushing(TagKey tag, double speed) {
if (false && this.touchingUnloadedChunk()) { // Gale - Airplane - reduce entity fluid lookups if no fluids - cost of a lookup here is the same cost as below, so skip
return false;
-@@ -4924,4 +4982,45 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -4935,4 +4993,45 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
}
// Paper end
@@ -2625,10 +2626,10 @@ index 3ff999734d14e2b6e7828e117f5ee32a60c26bc1..cfa9607241c3e69777ffc317206996c2
private EntitySelector() {}
// Paper start
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
-index 73871f456a85bda1e51f54986d0e61fb629822e8..a9f69e4f880711c21ef28bd079960ef8f12da25c 100644
+index 2561e74ffdf595a9b6ae13dcd738662c772db442..5930e45bae5aa86b3cedb811c4c9bb92099bc1b5 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
-@@ -307,13 +307,24 @@ public class EntityType implements FeatureElement, EntityTypeT
+@@ -309,13 +309,24 @@ public class EntityType implements FeatureElement, EntityTypeT
private Component description;
@Nullable
private ResourceLocation lootTable;
@@ -2654,7 +2655,7 @@ index 73871f456a85bda1e51f54986d0e61fb629822e8..a9f69e4f880711c21ef28bd079960ef8
public static ResourceLocation getKey(EntityType> type) {
return BuiltInRegistries.ENTITY_TYPE.getKey(type);
}
-@@ -529,6 +540,16 @@ public class EntityType implements FeatureElement, EntityTypeT
+@@ -531,6 +542,16 @@ public class EntityType implements FeatureElement, EntityTypeT
return this.category;
}
@@ -2671,7 +2672,7 @@ index 73871f456a85bda1e51f54986d0e61fb629822e8..a9f69e4f880711c21ef28bd079960ef8
public String getDescriptionId() {
if (this.descriptionId == null) {
this.descriptionId = Util.makeDescriptionId("entity", BuiltInRegistries.ENTITY_TYPE.getKey(this));
-@@ -590,6 +611,12 @@ public class EntityType implements FeatureElement, EntityTypeT
+@@ -592,6 +613,12 @@ public class EntityType implements FeatureElement, EntityTypeT
entity.load(nbt);
}, () -> {
EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
@@ -2769,7 +2770,7 @@ index 1bb8b6e91c44cd13411d96d749fa64835c75a267..b18cbe85330e26de6f6cbfcc3d51a741
protected ParticleOptions getInkParticle() {
return ParticleTypes.GLOW_SQUID_INK;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-index 37db21b3d2426dec69f378669b2ba8f0c8130bfc..704aa6ea5f6a7574706cb7aba6937a6ef89d8d8b 100644
+index f435e0e465a25724d7aa7a98d94da85dd4bc8f0d..0783ff43321b872bdd619713557969e2bf3a626d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -218,9 +218,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3050,7 +3051,7 @@ index 37db21b3d2426dec69f378669b2ba8f0c8130bfc..704aa6ea5f6a7574706cb7aba6937a6e
this.hurt(this.damageSources().flyIntoWall(), f3);
}
}
-@@ -3493,8 +3557,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
+@@ -3500,8 +3564,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.pushEntities();
// Paper start
@@ -3063,7 +3064,7 @@ index 37db21b3d2426dec69f378669b2ba8f0c8130bfc..704aa6ea5f6a7574706cb7aba6937a6e
Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
Location to = new Location (this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
-@@ -3504,12 +3570,48 @@ public abstract class LivingEntity extends Entity implements Attackable {
+@@ -3511,12 +3577,48 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
}
}
@@ -3112,7 +3113,7 @@ index 37db21b3d2426dec69f378669b2ba8f0c8130bfc..704aa6ea5f6a7574706cb7aba6937a6e
}
public boolean isSensitiveToWater() {
-@@ -3530,7 +3632,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
+@@ -3537,7 +3639,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
int j = i / 10;
if (j % 2 == 0) {
@@ -3131,7 +3132,7 @@ index 37db21b3d2426dec69f378669b2ba8f0c8130bfc..704aa6ea5f6a7574706cb7aba6937a6e
});
}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
-index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79b070b835 100644
+index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f137921ad 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -65,6 +65,7 @@ import net.minecraft.world.item.ProjectileWeaponItem;
@@ -3161,7 +3162,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
this.jumpControl = new JumpControl(this);
this.bodyRotationControl = this.createBodyControl();
this.navigation = this.createNavigation(world);
-@@ -323,6 +325,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -325,6 +327,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
entityliving = null;
}
}
@@ -3169,7 +3170,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
this.target = entityliving;
return true;
// CraftBukkit end
-@@ -367,8 +370,28 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -369,8 +372,28 @@ public abstract class Mob extends LivingEntity implements Targeting {
this.resetAmbientSoundTime();
this.playAmbientSound();
}
@@ -3198,7 +3199,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
@Override
protected void playHurtSound(DamageSource source) {
this.resetAmbientSoundTime();
-@@ -558,6 +581,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -560,6 +583,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
}
nbt.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit
@@ -3206,7 +3207,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
}
@Override
-@@ -628,6 +652,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -630,6 +654,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
this.aware = nbt.getBoolean("Bukkit.Aware");
}
// CraftBukkit end
@@ -3218,7 +3219,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
}
@Override
-@@ -671,7 +700,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -673,7 +702,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Override
public void aiStep() {
super.aiStep();
@@ -3227,7 +3228,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
Vec3i baseblockposition = this.getPickupReach();
List list = this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ()));
Iterator iterator = list.iterator();
-@@ -1146,6 +1175,12 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -1152,6 +1181,12 @@ public abstract class Mob extends LivingEntity implements Targeting {
}
@@ -3240,7 +3241,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
@Nullable
public static Item getEquipmentForSlot(EquipmentSlot equipmentSlot, int equipmentLevel) {
switch (equipmentSlot) {
-@@ -1240,7 +1275,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -1246,7 +1281,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
RandomSource randomsource = world.getRandom();
this.getAttribute(Attributes.FOLLOW_RANGE).addPermanentModifier(new AttributeModifier("Random spawn bonus", randomsource.triangle(0.0D, 0.11485000000000001D), AttributeModifier.Operation.MULTIPLY_BASE));
@@ -3249,7 +3250,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
this.setLeftHanded(true);
} else {
this.setLeftHanded(false);
-@@ -1288,6 +1323,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -1294,6 +1329,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (!this.isAlive()) {
return InteractionResult.PASS;
} else if (this.getLeashHolder() == player) {
@@ -3257,7 +3258,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
// CraftBukkit start - fire PlayerUnleashEntityEvent
// Paper start - drop leash variable
org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.getAbilities().instabuild);
-@@ -1361,7 +1397,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -1367,7 +1403,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
protected void onOffspringSpawnedFromEgg(Player player, Mob child) {}
protected InteractionResult mobInteract(Player player, InteractionHand hand) {
@@ -3266,7 +3267,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
}
public boolean isWithinRestriction() {
-@@ -1672,6 +1708,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -1678,6 +1714,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
this.setLastHurtMob(target);
}
@@ -3274,7 +3275,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
return flag;
}
-@@ -1693,28 +1730,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -1699,28 +1736,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
// Gale end - JettPack - optimize sun burn tick - cache eye blockpos
public boolean isSunBurnTick() {
@@ -3304,7 +3305,7 @@ index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79
}
@Override
-@@ -1761,4 +1777,56 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -1767,4 +1783,56 @@ public abstract class Mob extends LivingEntity implements Targeting {
return itemmonsteregg == null ? null : new ItemStack(itemmonsteregg);
}
@@ -3381,15 +3382,14 @@ index 5e8cc5cfac8888628c6d513148f41be09ca65a2c..a089fc61ec09be6b7490375489178dc6
boolean readyForShearing();
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
-index c5cdeb3a86453106c092c6f108da23ef54cb8123..ef5890a64355760b69217dedac079d1a98027930 100644
+index c5cdeb3a86453106c092c6f108da23ef54cb8123..635037fb2a44a422b42d7c3c27cc7638c7715635 100644
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
-@@ -26,15 +26,23 @@ public class AttributeMap {
- private final Set dirtyAttributes = new ReferenceOpenHashSet<>(0);
+@@ -27,14 +27,22 @@ public class AttributeMap {
// Gale end - Lithium - replace AI attributes with optimized collections
private final AttributeSupplier supplier;
-+ private final net.minecraft.world.entity.LivingEntity entity; // Purpur
private final java.util.function.Function createInstance; // Gale - Airplane - reduce entity allocations
++ private final net.minecraft.world.entity.LivingEntity entity; // Purpur
public AttributeMap(AttributeSupplier defaultAttributes) {
+ // Purpur start
@@ -6867,7 +6867,7 @@ index eecb7511582e5e316b71fa4a4734881424be5ca7..5d49ed7ddf44a3d549b178ae54866419
return super.mobInteract(player, hand);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
-index 26731a659fe3c40fc20135d473bacf105cc15300..7c7168cd16c6b55dc48ffa30e1ec86e94cf92226 100644
+index c521ff04be40bfa892021f67acc1b324551fcd5e..eb60d2d99155aae4a761051175fbbddf9ed5dad9 100644
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
@@ -100,10 +100,23 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@@ -6924,15 +6924,16 @@ index 26731a659fe3c40fc20135d473bacf105cc15300..7c7168cd16c6b55dc48ffa30e1ec86e9
@Override
protected Brain.Provider brainProvider() {
return Brain.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES);
-@@ -223,6 +258,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
-
+@@ -224,7 +259,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
+ private int behaviorTick = 0; // Pufferfish
@Override
protected void customServerAiStep() {
-+ if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider
+- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
this.getBrain().tick((ServerLevel) this.level(), this);
AllayAi.updateActivity(this);
super.customServerAiStep();
-@@ -365,9 +401,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
+@@ -367,9 +402,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@Override
public boolean wantsToPickUp(ItemStack stack) {
@@ -6968,7 +6969,7 @@ index 26731a659fe3c40fc20135d473bacf105cc15300..7c7168cd16c6b55dc48ffa30e1ec86e9
private boolean allayConsidersItemEqual(ItemStack stack, ItemStack stack2) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
-index 1125b7d7fdb700d692061f163ca742a1aaa560fc..6b7070eec9aa911a75e081983c6ef313a02bb04d 100644
+index 8624331c81be6fe857c90c8f61fa39d5446975cd..83ecc3c22f9c3aa5a9a88b53fe1196d1abad1350 100644
--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -98,6 +98,43 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder getModelRotationValues() {
return this.modelRotationValues;
-@@ -282,6 +319,7 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder {
@@ -7179,15 +7181,16 @@ index eee679f4c6d33d8dab9ad635c42a41a6dde122c5..ec508548ba24162913d7ec112b48a4ae
@Override
protected Brain.Provider brainProvider() {
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
-@@ -166,6 +219,7 @@ public class Frog extends Animal implements VariantHolder {
-
+@@ -167,7 +220,7 @@ public class Frog extends Animal implements VariantHolder {
+ private int behaviorTick = 0; // Pufferfish
@Override
protected void customServerAiStep() {
-+ if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider
+- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
this.getBrain().tick((ServerLevel)this.level(), this);
FrogAi.updateActivity(this);
super.customServerAiStep();
-@@ -348,7 +402,7 @@ public class Frog extends Animal implements VariantHolder {
+@@ -350,7 +403,7 @@ public class Frog extends Animal implements VariantHolder {
return world.getBlockState(pos.below()).is(BlockTags.FROGS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos);
}
@@ -7197,7 +7200,7 @@ index eee679f4c6d33d8dab9ad635c42a41a6dde122c5..ec508548ba24162913d7ec112b48a4ae
super(entity);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
-index 0f3a11203dd0353d74626a273e9003131356f5e1..f39710854ddf1cec2abc1efe39b9399f1528fc62 100644
+index c83dabddf93249a6477c10725622119c939db4d5..e91b4d63d42276f8a498cab7c439c785730f3f6f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -45,13 +45,50 @@ public class Tadpole extends AbstractFish {
@@ -7252,16 +7255,17 @@ index 0f3a11203dd0353d74626a273e9003131356f5e1..f39710854ddf1cec2abc1efe39b9399f
@Override
protected PathNavigation createNavigation(Level world) {
return new WaterBoundPathNavigation(this, world);
-@@ -79,6 +116,7 @@ public class Tadpole extends AbstractFish {
-
+@@ -80,7 +117,7 @@ public class Tadpole extends AbstractFish {
+ private int behaviorTick = 0; // Pufferfish
@Override
protected void customServerAiStep() {
-+ if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider
+- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
this.getBrain().tick((ServerLevel) this.level(), this);
TadpoleAi.updateActivity(this);
super.customServerAiStep();
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
-index 4df3f237e4b3bc27e1be66d1e593d4f619873c7e..0415a7b4b5e67b21ed3d92227b05c7c552e978a2 100644
+index 7b946ea210eebcab3d373b13e09ff839e49cfbe5..90e7c24eb50f333017e724ac56376fc54ee004f5 100644
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -92,6 +92,38 @@ public class Goat extends Animal {
@@ -7303,15 +7307,16 @@ index 4df3f237e4b3bc27e1be66d1e593d4f619873c7e..0415a7b4b5e67b21ed3d92227b05c7c5
@Override
protected Brain.Provider brainProvider() {
return Brain.provider(Goat.MEMORY_TYPES, Goat.SENSOR_TYPES);
-@@ -193,6 +225,7 @@ public class Goat extends Animal {
-
+@@ -194,7 +226,7 @@ public class Goat extends Animal {
+ private int behaviorTick = 0; // Pufferfish
@Override
protected void customServerAiStep() {
-+ if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider
+- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
this.getBrain().tick((ServerLevel) this.level(), this);
GoatAi.updateActivity(this);
super.customServerAiStep();
-@@ -391,6 +424,7 @@ public class Goat extends Animal {
+@@ -393,6 +425,7 @@ public class Goat extends Animal {
// Paper start - Goat ram API
public void ram(net.minecraft.world.entity.LivingEntity entity) {
@@ -12133,7 +12138,7 @@ index 1afe8a8694c1fd0bf43ce3c0c36a83fda9aec141..df8c7a45eb49a8c667030eb67d6d49dc
@Nullable
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
-index 024e2da8673a837a1185351bb211414e19a7f393..8f8040ca67fb8a1a7d9ae1f52bc07a6ab9dc2085 100644
+index 3ddcd9e7533724e9b3c7b89afd0bbe2009421fa5..e0514fd246771250bfdef46080c59d4f31acd33a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -69,6 +69,43 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
@@ -12180,16 +12185,17 @@ index 024e2da8673a837a1185351bb211414e19a7f393..8f8040ca67fb8a1a7d9ae1f52bc07a6a
@Override
public boolean canBeLeashed(Player player) {
return !this.isLeashed();
-@@ -130,6 +167,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
-
+@@ -131,7 +168,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
+ private int behaviorTick; // Pufferfish
@Override
protected void customServerAiStep() {
-+ if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider
+- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
this.getBrain().tick((ServerLevel)this.level(), this);
HoglinAi.updateActivity(this);
if (this.isConverting()) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
-index 57d7873290fc361d8c5c094e166416772fe11cbe..98ef5416d94cf5b3181a0f0abee32a835f0fa42f 100644
+index e25456327e510c0b4fac3b1974aa6f3e45b1a995..2b9e2eb912c2e7a04f154db517b293aed02e6c29 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -96,6 +96,38 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@@ -12231,15 +12237,16 @@ index 57d7873290fc361d8c5c094e166416772fe11cbe..98ef5416d94cf5b3181a0f0abee32a83
@Override
public void addAdditionalSaveData(CompoundTag nbt) {
super.addAdditionalSaveData(nbt);
-@@ -302,6 +334,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
-
+@@ -303,7 +335,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
+ private int behaviorTick; // Pufferfish
@Override
protected void customServerAiStep() {
-+ if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider
+- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
this.getBrain().tick((ServerLevel) this.level(), this);
PiglinAi.updateActivity(this);
super.customServerAiStep();
-@@ -398,7 +431,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
+@@ -400,7 +432,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
public boolean wantsToPickUp(ItemStack stack) {
@@ -12340,7 +12347,7 @@ index 5aab051998b67b7ba95cbf568de60e325b905eab..1805d4e15328fa99595641ea64fc2e3e
PiglinBruteAi.updateActivity(this);
PiglinBruteAi.maybePlayActivitySound(this);
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
-index db09d5c6b709f746e69111cedebd29f82c1f9e32..a82805a771fa4d1a9eceb8b5778fad30000e974e 100644
+index f172cf9f754b73e44c3688581c984baa4e2ad8b6..9e2498f8cb4a1a309aa037c01aa3039924f5b29e 100644
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
@@ -122,8 +122,32 @@ public class Warden extends Monster implements VibrationSystem {
@@ -12376,7 +12383,7 @@ index db09d5c6b709f746e69111cedebd29f82c1f9e32..a82805a771fa4d1a9eceb8b5778fad30
@Override
public Packet getAddEntityPacket() {
return new ClientboundAddEntityPacket(this, this.hasPose(Pose.EMERGING) ? 1 : 0);
-@@ -393,19 +417,16 @@ public class Warden extends Monster implements VibrationSystem {
+@@ -395,19 +419,16 @@ public class Warden extends Monster implements VibrationSystem {
@Contract("null->false")
public boolean canTargetEntity(@Nullable Entity entity) {
@@ -12458,20 +12465,19 @@ index 5f407535298a31a34cfe114dd863fd6a9b977707..29c7e33fe961020e5a0007287fe9b663
}
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
-index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be19dc56f5 100644
+index f4ba301189b8bb77c653725347d4bfdbf5144727..25c1a3f0e9b693b0fe8b6ea9dd4b5927290e372b 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
-@@ -144,6 +144,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
- return holder.is(PoiTypes.MEETING);
+@@ -145,6 +145,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
});
+ public long nextGolemPanic = -1; // Pufferfish
+ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur
+ private int notLobotomizedCount = 0; // Purpur
-+
+
public Villager(EntityType extends Villager> entityType, Level world) {
this(entityType, world, VillagerType.PLAINS);
- }
-@@ -155,6 +158,90 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -157,6 +159,90 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
this.getNavigation().setCanFloat(true);
this.setCanPickUpLoot(true);
this.setVillagerData(this.getVillagerData().setType(type).setProfession(VillagerProfession.NONE));
@@ -12562,7 +12568,7 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be
}
@Override
-@@ -191,7 +278,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -193,7 +279,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
brain.addActivity(Activity.PLAY, VillagerGoalPackages.getPlayPackage(0.5F));
} else {
brain.setSchedule(Schedule.VILLAGER_DEFAULT);
@@ -12571,14 +12577,13 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be
}
brain.addActivity(Activity.CORE, VillagerGoalPackages.getCorePackage(villagerprofession, 0.5F));
-@@ -253,9 +340,20 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -256,13 +342,22 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
// Paper start
this.customServerAiStep(false);
}
- protected void customServerAiStep(final boolean inactive) {
+ protected void customServerAiStep(boolean inactive) { // Purpur - not final
// Paper end
-- if (!inactive) this.getBrain().tick((ServerLevel) this.level(), this); // Paper
+ // Purpur start
+ if (this.level().purpurConfig.villagerLobotomizeEnabled) {
+ // treat as inactive if lobotomized
@@ -12587,14 +12592,18 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be
+ // clean up state for API
+ this.isLobotomized = false;
+ }
-+ if (!inactive && (getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider
-+ this.getBrain().tick((ServerLevel) this.level(), this); // Paper
+ // Pufferfish start
+- if (!inactive && this.behaviorTick++ % this.activatedPriority == 0) {
++ if (!inactive && (getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Purpur - only use brain if no rider
+ this.getBrain().tick((ServerLevel) this.level(), this); // Paper
+- }
+ // Pufferfish end
+ else if (this.isLobotomized && shouldRestock()) restock();
+ // Purpur end
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
}
-@@ -311,7 +409,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -318,7 +413,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
if (!itemstack.is(Items.VILLAGER_SPAWN_EGG) && this.isAlive() && !this.isTrading() && !this.isSleeping()) {
if (this.isBaby()) {
this.setUnhappy();
@@ -12603,7 +12612,7 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be
} else {
boolean flag = this.getOffers().isEmpty();
-@@ -324,9 +422,10 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -331,9 +426,10 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
if (flag) {
@@ -12616,7 +12625,7 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be
this.startTrading(player);
}
-@@ -495,7 +594,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -502,7 +598,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
while (iterator.hasNext()) {
MerchantOffer merchantrecipe = (MerchantOffer) iterator.next();
@@ -12625,7 +12634,7 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be
}
}
-@@ -745,7 +844,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -752,7 +848,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@Override
public boolean canBreed() {
@@ -12634,7 +12643,7 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be
}
private boolean hungry() {
-@@ -959,6 +1058,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -966,6 +1062,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
public boolean hasFarmSeeds() {
return this.getInventory().hasAnyMatching((itemstack) -> {
@@ -12646,7 +12655,7 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be
return itemstack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS);
});
}
-@@ -1016,6 +1120,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -1023,6 +1124,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
public void spawnGolemIfNeeded(ServerLevel world, long time, int requiredCount) {
@@ -12654,7 +12663,7 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be
if (this.wantsToSpawnGolem(time)) {
AABB axisalignedbb = this.getBoundingBox().inflate(10.0D, 10.0D, 10.0D);
List list = world.getEntitiesOfClass(Villager.class, axisalignedbb);
-@@ -1089,6 +1194,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
+@@ -1096,6 +1198,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@Override
public void startSleeping(BlockPos pos) {
@@ -12929,87 +12938,19 @@ index e1590e00f8150a5017d3816683f33cfba6642066..7de7fd5203b7fca1eacd727ae7f051e5
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) this, stack);
}
diff --git a/src/main/java/net/minecraft/world/entity/player/StackedContents.java b/src/main/java/net/minecraft/world/entity/player/StackedContents.java
-index 26b236a764177ac16d53f5cbaf83d3e21d015ebc..6bc60ea5249cca9f4c1d029a2b7460fe3476e05a 100644
+index 26b236a764177ac16d53f5cbaf83d3e21d015ebc..90b92aeeb893146a2036f4ad21bf3b084c2c50bd 100644
--- a/src/main/java/net/minecraft/world/entity/player/StackedContents.java
+++ b/src/main/java/net/minecraft/world/entity/player/StackedContents.java
-@@ -41,8 +41,62 @@ public class StackedContents {
- int j = Math.min(maxCount, stack.getCount());
+@@ -42,7 +42,6 @@ public class StackedContents {
if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, j)) return; // Paper - if an exact ingredient, don't include it
this.put(i, j);
-+ // PaperPR start
-+ if (stack.hasTag()) {
-+ this.put(getExactStackingIndex(stack), j);
-+ }
-+ }
-+
-+ }
-+ private static final net.minecraft.core.IdMap EXACT_MATCHES_ID_MAP = new net.minecraft.core.IdMap<>() {
-+ private final java.util.concurrent.atomic.AtomicInteger idCounter = new java.util.concurrent.atomic.AtomicInteger(BuiltInRegistries.ITEM.size());
-+ private final it.unimi.dsi.fastutil.objects.Object2IntMap itemstackToId = new it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap<>(new it.unimi.dsi.fastutil.Hash.Strategy<>() {
-+ @Override
-+ public int hashCode(ItemStack o) {
-+ return java.util.Objects.hash(o.getItem(), o.getTag());
-+ }
-+
-+ @Override
-+ public boolean equals(@Nullable ItemStack a, @Nullable ItemStack b) {
-+ if (a == null || b == null) {
-+ return false;
-+ }
-+ return ItemStack.matches(a, b);
-+ }
-+ });
-+ private final it.unimi.dsi.fastutil.ints.Int2ObjectMap idToItemstack = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>();
-+
-+ @Override
-+ public int getId(ItemStack value) {
-+ if (!this.itemstackToId.containsKey(value)) {
-+ final int id = this.idCounter.incrementAndGet();
-+ final ItemStack copy = value.copy();
-+ this.itemstackToId.put(copy, id);
-+ this.idToItemstack.put(id, copy);
-+ return id;
-+ }
-+ return this.itemstackToId.getInt(value);
-+ }
-+
-+ @Override
-+ public @Nullable ItemStack byId(int index) {
-+ return this.idToItemstack.get(index);
-+ }
-+
-+ @Override
-+ public int size() {
-+ return this.itemstackToId.size();
-+ }
-+
-+ @Override
-+ public java.util.Iterator iterator() {
-+ return this.idToItemstack.values().iterator();
}
-+ };
-
-+ public static int getExactStackingIndex(ItemStack stack) {
-+ return EXACT_MATCHES_ID_MAP.getId(stack);
-+ // PaperPR end
+-
}
public static int getStackingIndex(ItemStack stack) {
-@@ -84,6 +138,12 @@ public class StackedContents {
- }
-
- public static ItemStack fromStackingIndex(int itemId) {
-+ // PaperPR start
-+ if (itemId > BuiltInRegistries.ITEM.size()) {
-+ final ItemStack stack = EXACT_MATCHES_ID_MAP.byId(itemId);
-+ return stack == null ? ItemStack.EMPTY : stack.copy();
-+ }
-+ // PaperPR end
- return itemId == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(itemId));
- }
-
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
-index 02d45bf04f541ae85e68ea9f5b5825d4a2140061..9f37553ed0e2d3d43cc656c584be87a7214f8427 100644
+index a66de8353eae89790e4fb81eda2ef2e539d59b13..8576ebd969fba43b9dc92b4e7268b7e87cdbf75d 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -72,6 +72,7 @@ public abstract class AbstractArrow extends Projectile {
@@ -14366,18 +14307,10 @@ index 180aec596110309aade13d2080f8824d152b07cb..552c31c0f3746dd35388395036e70a92
return InteractionResult.PASS;
}
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
-index 1d292f4bae3eadfde0637cf0a8b49ff53eb21ac9..91ec3d395580ddd046a0d95a42eee6c0ab9cc5cd 100644
+index 1d292f4bae3eadfde0637cf0a8b49ff53eb21ac9..70ec2c6f73dd6aaf7623e47333277425a1d01139 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
-@@ -114,6 +114,7 @@ import org.bukkit.event.world.StructureGrowEvent;
-
- public final class ItemStack {
-
-+ public boolean isExactRecipeIngredient = false; // PaperPR
- public static final Codec CODEC = RecordCodecBuilder.create((instance) -> {
- return instance.group(BuiltInRegistries.ITEM.byNameCodec().fieldOf("id").forGetter(ItemStack::getItem), Codec.INT.fieldOf("Count").forGetter(ItemStack::getCount), CompoundTag.CODEC.optionalFieldOf("tag").forGetter((itemstack) -> {
- return Optional.ofNullable(itemstack.getTag());
-@@ -432,6 +433,7 @@ public final class ItemStack {
+@@ -432,6 +432,7 @@ public final class ItemStack {
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
for (BlockState blockstate : blocks) {
blockstate.update(true, false);
@@ -14385,7 +14318,7 @@ index 1d292f4bae3eadfde0637cf0a8b49ff53eb21ac9..91ec3d395580ddd046a0d95a42eee6c0
}
world.preventPoiUpdated = false;
-@@ -461,6 +463,7 @@ public final class ItemStack {
+@@ -461,6 +462,7 @@ public final class ItemStack {
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, context); // Paper - pass context
}
@@ -14393,7 +14326,7 @@ index 1d292f4bae3eadfde0637cf0a8b49ff53eb21ac9..91ec3d395580ddd046a0d95a42eee6c0
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
}
-@@ -589,6 +592,16 @@ public final class ItemStack {
+@@ -589,6 +591,16 @@ public final class ItemStack {
return this.isDamageableItem() && this.getDamageValue() > 0;
}
@@ -14410,7 +14343,7 @@ index 1d292f4bae3eadfde0637cf0a8b49ff53eb21ac9..91ec3d395580ddd046a0d95a42eee6c0
public int getDamageValue() {
return this.tag == null ? 0 : this.tag.getInt("Damage");
}
-@@ -608,7 +621,7 @@ public final class ItemStack {
+@@ -608,7 +620,7 @@ public final class ItemStack {
int j;
if (amount > 0) {
@@ -14419,7 +14352,7 @@ index 1d292f4bae3eadfde0637cf0a8b49ff53eb21ac9..91ec3d395580ddd046a0d95a42eee6c0
int k = 0;
for (int l = 0; j > 0 && l < amount; ++l) {
-@@ -663,6 +676,12 @@ public final class ItemStack {
+@@ -663,6 +675,12 @@ public final class ItemStack {
if (this.hurt(amount, entity.getRandom(), entity /*instanceof ServerPlayer ? (ServerPlayer) entity : null*/)) { // Paper - pass LivingEntity for EntityItemDamageEvent
breakCallback.accept(entity);
Item item = this.getItem();
@@ -14432,7 +14365,7 @@ index 1d292f4bae3eadfde0637cf0a8b49ff53eb21ac9..91ec3d395580ddd046a0d95a42eee6c0
// CraftBukkit start - Check for item breaking
if (this.count == 1 && entity instanceof net.minecraft.world.entity.player.Player) {
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((net.minecraft.world.entity.player.Player) entity, this);
-@@ -1189,7 +1208,7 @@ public final class ItemStack {
+@@ -1189,7 +1207,7 @@ public final class ItemStack {
ListTag nbttaglist = this.tag.getList("Enchantments", 10);
@@ -14441,7 +14374,7 @@ index 1d292f4bae3eadfde0637cf0a8b49ff53eb21ac9..91ec3d395580ddd046a0d95a42eee6c0
processEnchantOrder(this.tag); // Paper
}
-@@ -1197,6 +1216,12 @@ public final class ItemStack {
+@@ -1197,6 +1215,12 @@ public final class ItemStack {
return this.tag != null && this.tag.contains("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false;
}
@@ -14677,7 +14610,7 @@ index 8078f127ff4b6e0aafb5804b9c02e237f79445b5..c32cbe6065ecb6810f352b8a3598c21e
entityhuman.startAutoSpinAttack(20);
if (entityhuman.onGround()) {
diff --git a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
-index 06fe5b056d78d42cdf78437eeabe1786d596b7f8..ae98a5b49b5eb7b9b2846d1e41b5665c725198a2 100644
+index 06fe5b056d78d42cdf78437eeabe1786d596b7f8..3532db21cee82c18f95c540d24b2071585d71c4e 100644
--- a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
+++ b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
@@ -39,6 +39,7 @@ public final class Ingredient implements Predicate {
@@ -14688,20 +14621,7 @@ index 06fe5b056d78d42cdf78437eeabe1786d596b7f8..ae98a5b49b5eb7b9b2846d1e41b5665c
public static final Codec CODEC = Ingredient.codec(true);
public static final Codec CODEC_NONEMPTY = Ingredient.codec(false);
-@@ -56,7 +57,11 @@ public final class Ingredient implements Predicate {
- if (this.itemStacks == null) {
- this.itemStacks = (ItemStack[]) Arrays.stream(this.values).flatMap((recipeitemstack_provider) -> {
- return recipeitemstack_provider.getItems().stream();
-- }).distinct().toArray((i) -> {
-+ // PaperPR start
-+ }).distinct().peek(stack -> {
-+ stack.isExactRecipeIngredient = this.exact;
-+ }).toArray((i) -> {
-+ // PaperPR end
- return new ItemStack[i];
- });
- }
-@@ -70,6 +75,12 @@ public final class Ingredient implements Predicate {
+@@ -70,6 +71,12 @@ public final class Ingredient implements Predicate {
} else if (this.isEmpty()) {
return itemstack.isEmpty();
} else {
@@ -14714,20 +14634,6 @@ index 06fe5b056d78d42cdf78437eeabe1786d596b7f8..ae98a5b49b5eb7b9b2846d1e41b5665c
ItemStack[] aitemstack = this.getItems();
int i = aitemstack.length;
-@@ -105,7 +116,13 @@ public final class Ingredient implements Predicate {
- for (int j = 0; j < i; ++j) {
- ItemStack itemstack = aitemstack1[j];
-
-+ // PaperPR start
-+ if (itemstack.isExactRecipeIngredient) {
-+ this.stackingIds.add(StackedContents.getExactStackingIndex(itemstack));
-+ } else {
-+ // PaperPR end
- this.stackingIds.add(StackedContents.getStackingIndex(itemstack));
-+ } // PaperPR
- }
-
- this.stackingIds.sort(IntComparators.NATURAL_COMPARATOR);
diff --git a/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java b/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java
index 518d85a13c37a2f7d32ca0718323181048559986..27512787b37381a5236b1b473e9ce3f06df8e2d0 100644
--- a/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java
@@ -15487,6 +15393,19 @@ index ead7b37122c76d43af2cdd17af7f0da8014efb26..1acc2dcda68ec8e462d51927f2ea985e
+ }
+ // Purpur end
}
+diff --git a/src/main/java/net/minecraft/world/level/block/ChangeOverTimeBlock.java b/src/main/java/net/minecraft/world/level/block/ChangeOverTimeBlock.java
+index 8512b977b44a0a4d3a2521e27a60d65f7ac967be..dd270f67388c8663e0418875c88cb1e2a55d0635 100644
+--- a/src/main/java/net/minecraft/world/level/block/ChangeOverTimeBlock.java
++++ b/src/main/java/net/minecraft/world/level/block/ChangeOverTimeBlock.java
+@@ -65,7 +65,7 @@ public interface ChangeOverTimeBlock> {
+ }
+
+ float f = (float) (k + 1) / (float) (k + j + 1);
+- float f1 = f * f * this.getChanceModifier();
++ float f1 = world.purpurConfig.disableOxidationProximityPenalty ? this.getChanceModifier() : f * f * this.getChanceModifier(); // Purpur
+
+ if (random.nextFloat() < f1) {
+ this.getNext(state).ifPresent((iblockdata2) -> {
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
index 5e22d175b1048a58802cdf64ac70a8b56329e915..d81946b400f208c39941128ce823ff7709741c10 100644
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
@@ -17638,10 +17557,10 @@ index e195fd0a489985eebf432f350d7e84afece1529d..a50d36ab25d379239088f89b451f525b
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index b017cfd4671488cebdcf3e0fe9ae10b09f759889..44c524140ae39a6428d717dc89644c41e9f36f99 100644
+index 66715d62ba9cfab36d204536245e4fca979d11d3..a8d49858a29155c3bbcff487d8c6bbf8dd3ca66e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -2289,6 +2289,48 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -2298,6 +2298,48 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return (this.getHandle().getDragonFight() == null) ? null : new CraftDragonBattle(this.getHandle().getDragonFight());
}
@@ -17950,10 +17869,10 @@ index 75d10b5322eb0a62bce2855c04a5151eb857d7de..208018981a2a5666c455eb34614b03f6
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
-index 5e83fabb20bc2b0668cbf48530053ca1bb9092f3..8fcee0e426cd598ddfd7e12df4382d57d2016780 100644
+index 9c0f83ff8113696309265fb9e8f6006296de86a6..6eb0e250101d10064fe150f03d98086afeba67ca 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
-@@ -154,4 +154,46 @@ public class CraftItem extends CraftEntity implements Item {
+@@ -151,4 +151,46 @@ public class CraftItem extends CraftEntity implements Item {
public String toString() {
return "CraftItem";
}
@@ -18001,7 +17920,7 @@ index 5e83fabb20bc2b0668cbf48530053ca1bb9092f3..8fcee0e426cd598ddfd7e12df4382d57
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
-index fe2124694eb080cab685a1ce1f6a66e2fcdf6a17..9407845f1f8d17daae4a309961b94303994651f5 100644
+index daadfec2d86f7957072a639e1e36d4082448f35f..e2631dbd86d93203737da9aafd97e546877fcfea 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -453,7 +453,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -18452,10 +18371,10 @@ index 57f4cf40359fe9bb427eb0134660d00839a63c86..7e66cab93d13c296433493da86c93aeb
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
-index 5a71efd27180004ee91495d9255867dbdfa1783e..1dcc3405393d11836a21aa16e435be64c04f6e7d 100644
+index 677fdb8c312f79daade76f169292a2a989e11eec..e67c86bae2ab419dd4e6d989d12cef81d135cc2e 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
-@@ -43,6 +43,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
+@@ -45,6 +45,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
static final ItemMetaKey POTION_COLOR = new ItemMetaKey("CustomPotionColor", "custom-color");
static final ItemMetaKey ID = new ItemMetaKey("id", "potion-id");
static final ItemMetaKey DEFAULT_POTION = new ItemMetaKey("Potion", "potion-type");
@@ -18463,7 +18382,7 @@ index 5a71efd27180004ee91495d9255867dbdfa1783e..1dcc3405393d11836a21aa16e435be64
// Having an initial "state" in ItemMeta seems bit dirty but the UNCRAFTABLE potion type
// is treated as the empty form of the meta because it represents an empty potion with no effect
-@@ -92,7 +93,13 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
+@@ -97,7 +98,13 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
boolean ambient = effect.getBoolean(AMBIENT.NBT);
boolean particles = effect.contains(SHOW_PARTICLES.NBT, CraftMagicNumbers.NBT.TAG_BYTE) ? effect.getBoolean(SHOW_PARTICLES.NBT) : true;
boolean icon = effect.contains(SHOW_ICON.NBT, CraftMagicNumbers.NBT.TAG_BYTE) ? effect.getBoolean(SHOW_ICON.NBT) : particles;
@@ -18478,7 +18397,7 @@ index 5a71efd27180004ee91495d9255867dbdfa1783e..1dcc3405393d11836a21aa16e435be64
}
}
}
-@@ -139,6 +146,11 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
+@@ -150,6 +157,11 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
effectData.putBoolean(AMBIENT.NBT, effect.isAmbient());
effectData.putBoolean(SHOW_PARTICLES.NBT, effect.hasParticles());
effectData.putBoolean(SHOW_ICON.NBT, effect.hasIcon());
@@ -18490,7 +18409,7 @@ index 5a71efd27180004ee91495d9255867dbdfa1783e..1dcc3405393d11836a21aa16e435be64
effectList.add(effectData);
}
}
-@@ -200,7 +212,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
+@@ -225,7 +237,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
if (index != -1) {
if (overwrite) {
PotionEffect old = this.customEffects.get(index);
@@ -18527,10 +18446,10 @@ index 2d2bf5c37709b8e747fbfa2db5ce86f258e86224..f6413ab181208d729afb532dca5e96e4
+ // Purpur - end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
-index 354393cbf0f113f14e936b40da56125a3130cbd9..a1ef7ecdf272546bdd76bb4b2ecd86a69c51c777 100644
+index e29679a92da5ec05e122bb972a5ee469059a7a0a..70a3463eb6c93b662c5858016f934aa9ab267397 100644
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
-@@ -101,7 +101,7 @@ public class CraftPotionUtil {
+@@ -73,7 +73,7 @@ public class CraftPotionUtil {
public static MobEffectInstance fromBukkit(PotionEffect effect) {
MobEffect type = CraftPotionEffectType.bukkitToMinecraft(effect.getType());
@@ -18539,7 +18458,7 @@ index 354393cbf0f113f14e936b40da56125a3130cbd9..a1ef7ecdf272546bdd76bb4b2ecd86a6
}
public static PotionEffect toBukkit(MobEffectInstance effect) {
-@@ -110,7 +110,7 @@ public class CraftPotionUtil {
+@@ -82,7 +82,7 @@ public class CraftPotionUtil {
int duration = effect.getDuration();
boolean ambient = effect.isAmbient();
boolean particles = effect.isVisible();
@@ -19213,10 +19132,10 @@ index 0000000000000000000000000000000000000000..1be93b19b51b0772bebc9add05583a46
+}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
new file mode 100644
-index 0000000000000000000000000000000000000000..6c6b324e828d3c0628eae1b2201bbaa3d412d535
+index 0000000000000000000000000000000000000000..bdbf6efd723d93866b2d24f869b9e964c09fa9ab
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
-@@ -0,0 +1,3221 @@
+@@ -0,0 +1,3223 @@
+package org.purpurmc.purpur;
+
+import net.minecraft.core.registries.BuiltInRegistries;
@@ -19364,6 +19283,7 @@ index 0000000000000000000000000000000000000000..6c6b324e828d3c0628eae1b2201bbaa3
+ public boolean rainStopsAfterSleep = true;
+ public boolean thunderStopsAfterSleep = true;
+ public int mobLastHurtByPlayerTime = 100;
++ public boolean disableOxidationProximityPenalty = false;
+ private void miscGameplayMechanicsSettings() {
+ useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
+ mendingMultiplier = getDouble("gameplay-mechanics.mending-multiplier", mendingMultiplier);
@@ -19392,6 +19312,7 @@ index 0000000000000000000000000000000000000000..6c6b324e828d3c0628eae1b2201bbaa3
+ rainStopsAfterSleep = getBoolean("gameplay-mechanics.rain-stops-after-sleep", rainStopsAfterSleep);
+ thunderStopsAfterSleep = getBoolean("gameplay-mechanics.thunder-stops-after-sleep", thunderStopsAfterSleep);
+ mobLastHurtByPlayerTime = getInt("gameplay-mechanics.mob-last-hurt-by-player-time", mobLastHurtByPlayerTime);
++ disableOxidationProximityPenalty = getBoolean("gameplay-mechanics.disable-oxidation-proximity-penalty", disableOxidationProximityPenalty);
+ }
+
+ public int daytimeTicks = 12000;
@@ -24703,7 +24624,7 @@ index 0000000000000000000000000000000000000000..b7586f494528f30eb0da82420d3bcf5b
+ }
+}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
-index c5924bd66cc238a361cb56f623ea3e2c1579b02c..f1c24f2c2fa3bc6b0dabeb819fccb5fff61b736a 100644
+index 9893084bacba0087ea5241d6ea4eb5ef5fabe462..4490f1240304ac8c4600ca1182bfa363c2aae69c 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -15,6 +15,7 @@ import net.minecraft.world.entity.ambient.AmbientCreature;
@@ -24714,7 +24635,7 @@ index c5924bd66cc238a361cb56f623ea3e2c1579b02c..f1c24f2c2fa3bc6b0dabeb819fccb5ff
import net.minecraft.world.entity.animal.WaterAnimal;
import net.minecraft.world.entity.animal.horse.Llama;
import net.minecraft.world.entity.boss.EnderDragonPart;
-@@ -214,6 +215,7 @@ public class ActivationRange
+@@ -217,6 +218,7 @@ public class ActivationRange
continue;
}
@@ -24722,7 +24643,7 @@ index c5924bd66cc238a361cb56f623ea3e2c1579b02c..f1c24f2c2fa3bc6b0dabeb819fccb5ff
// Paper start
int worldHeight = world.getHeight();
ActivationRange.maxBB = player.getBoundingBox().inflate( maxRange, worldHeight, maxRange );
-@@ -393,6 +395,7 @@ public class ActivationRange
+@@ -415,6 +417,7 @@ public class ActivationRange
*/
public static boolean checkIfActive(Entity entity)
{
@@ -24804,7 +24725,7 @@ index afeb4271fffb7546209f1e651214065187c88302..81bc3af856b8af019fd13e1da1f7cccd
);
diff --git a/src/test/java/org/bukkit/potion/PotionTest.java b/src/test/java/org/bukkit/potion/PotionTest.java
-index 70a655df7195da8e037c22064c4ebfe5d771e884..cfdf155af7ec29dd221989edbd8623d27529f9e6 100644
+index 8963d93e99bdaf719fa160c11dd5af6a1d86f9a4..d852d8b14f5000415cbb4f06601059b3934b7efc 100644
--- a/src/test/java/org/bukkit/potion/PotionTest.java
+++ b/src/test/java/org/bukkit/potion/PotionTest.java
@@ -9,6 +9,7 @@ import net.minecraft.resources.ResourceLocation;
diff --git a/patches/server/0007-Purpur-Configurable-server-mod-name.patch b/patches/server/0010-Purpur-Configurable-server-mod-name.patch
similarity index 82%
rename from patches/server/0007-Purpur-Configurable-server-mod-name.patch
rename to patches/server/0010-Purpur-Configurable-server-mod-name.patch
index 5477c00a5..619dd4576 100644
--- a/patches/server/0007-Purpur-Configurable-server-mod-name.patch
+++ b/patches/server/0010-Purpur-Configurable-server-mod-name.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Purpur: Configurable server mod name
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
-index 6ff78398c0726714ae6cc0cc8da35503d18fcb78..dfe06a0f0d3c6ed0ce89c632a8b2cd050cc2e6a7 100644
+index 995dd071082e482785448678b9189f0715a75308..ee53c964c86e281120958aa0d2a7e1b7ca9d070f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
-@@ -1660,7 +1660,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, CommandSource, AutoCloseable {
public static final int SERVER_THREAD_PRIORITY = Integer.getInteger("gale.thread.priority.server", -1); // Gale - server thread priority environment variable
-@@ -915,7 +913,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop {
return !this.canSleepForTickNoOversleep(); // Paper - move oversleep into full server tick
-@@ -1375,15 +1372,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop {
entityplayer.connection.suspendFlushing();
});
@@ -1039,7 +1039,7 @@ index bc886017d72ca26655478c5f48f2b79689ab908c..6ff78398c0726714ae6cc0cc8da35503
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
getAllLevels().forEach(level -> {
-@@ -1492,20 +1480,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur
-@@ -1545,14 +1527,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop {
return ichunkaccess1;
-@@ -442,17 +440,13 @@ public class ServerChunkCache extends ChunkSource {
+@@ -445,17 +443,13 @@ public class ServerChunkCache extends ChunkSource {
public void save(boolean flush) {
this.runDistanceManagerUpdates();
@@ -1282,7 +1282,7 @@ index 18e521e77e58a9f786937192249c884aa317988c..8cf0d4e03726b4e4340850715b6ab1af
}
// Paper end
-@@ -478,20 +472,14 @@ public class ServerChunkCache extends ChunkSource {
+@@ -481,20 +475,14 @@ public class ServerChunkCache extends ChunkSource {
@Override
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
@@ -1303,7 +1303,7 @@ index 18e521e77e58a9f786937192249c884aa317988c..8cf0d4e03726b4e4340850715b6ab1af
this.clearCache();
}
-@@ -517,7 +505,6 @@ public class ServerChunkCache extends ChunkSource {
+@@ -520,7 +508,6 @@ public class ServerChunkCache extends ChunkSource {
boolean flag2AndHasNaturalSpawn = flag2 && this.anySpawnCategoryIsSpawnedThisTick();
if (flag2AndHasNaturalSpawn) {
// Gale end - MultiPaper - skip unnecessary mob spawning computations
@@ -1311,15 +1311,15 @@ index 18e521e77e58a9f786937192249c884aa317988c..8cf0d4e03726b4e4340850715b6ab1af
int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
-@@ -540,7 +527,6 @@ public class ServerChunkCache extends ChunkSource {
- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false);
+@@ -550,7 +537,6 @@ public class ServerChunkCache extends ChunkSource {
+ // Pufferfish end
}
// Paper end
- this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
- this.lastSpawnState = spawnercreature_d;
+ //this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously
// Paper - optimise chunk tick iteration
-@@ -550,9 +536,6 @@ public class ServerChunkCache extends ChunkSource {
+@@ -560,9 +546,6 @@ public class ServerChunkCache extends ChunkSource {
spawnercreature_d = null;
}
// Gale end - MultiPaper - skip unnecessary mob spawning computations
@@ -1329,7 +1329,7 @@ index 18e521e77e58a9f786937192249c884aa317988c..8cf0d4e03726b4e4340850715b6ab1af
// Paper start - optimise chunk tick iteration
ChunkMap playerChunkMap = this.chunkMap;
-@@ -653,15 +636,10 @@ public class ServerChunkCache extends ChunkSource {
+@@ -663,15 +646,10 @@ public class ServerChunkCache extends ChunkSource {
}
}
// Paper end - optimise chunk tick iteration
@@ -1345,7 +1345,7 @@ index 18e521e77e58a9f786937192249c884aa317988c..8cf0d4e03726b4e4340850715b6ab1af
// Paper start - optimise chunk tick iteration
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet copy = this.chunkMap.needsChangeBroadcasting.clone();
-@@ -675,7 +653,6 @@ public class ServerChunkCache extends ChunkSource {
+@@ -685,7 +663,6 @@ public class ServerChunkCache extends ChunkSource {
}
}
// Paper end - optimise chunk tick iteration
@@ -1354,7 +1354,7 @@ index 18e521e77e58a9f786937192249c884aa317988c..8cf0d4e03726b4e4340850715b6ab1af
this.chunkMap.tick();
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ffa9c76a0c 100644
+index f925951ec36a020d26c2012589d8d458df297a3c..7d607175686ceae222e45fd217dcd390551a4ff8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1,7 +1,6 @@
@@ -1401,9 +1401,9 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
- timings.entityTick.startTiming(); // Spigot
this.entityTickList.forEach((entity) -> {
+ entity.activatedPriorityReset = false; // Pufferfish - DAB
if (!entity.isRemoved()) {
- if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
-@@ -919,8 +908,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -920,8 +909,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
});
@@ -1412,7 +1412,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
this.tickBlockEntities();
}
-@@ -1053,7 +1040,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1054,7 +1041,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
} // Paper
// Paper start - optimise random block ticking
@@ -1420,7 +1420,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
if (randomTickSpeed > 0) {
LevelChunkSection[] sections = chunk.getSections();
final int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
-@@ -1085,8 +1071,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1086,8 +1072,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise random block ticking
@@ -1429,7 +1429,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
}
private void tickIceAndSnow(boolean raining, BlockPos.MutableBlockPos blockposition1, final LevelChunk chunk) { // Paper - optimise chunk ticking
-@@ -1411,31 +1395,21 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1412,31 +1396,21 @@ public class ServerLevel extends Level implements WorldGenLevel {
currentlyTickingEntity.lazySet(entity);
}
// Paper end - log detailed entity tick information
@@ -1461,7 +1461,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) {
-@@ -1443,7 +1417,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1444,7 +1418,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(entity, entity1);
}
@@ -1469,7 +1469,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
// Paper start - log detailed entity tick information
} finally {
if (currentlyTickingEntity.get() == entity) {
-@@ -1458,9 +1431,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1459,9 +1432,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
// Paper - EAR 2
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
@@ -1479,7 +1479,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
passenger.setOldPosAndRot();
++passenger.tickCount;
// Paper start - EAR 2
-@@ -1481,8 +1451,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1482,8 +1452,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2);
}
@@ -1488,7 +1488,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
}
} else {
passenger.stopRiding();
-@@ -1502,14 +1470,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1503,14 +1471,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld()));
}
@@ -1503,7 +1503,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
// Copied from save()
// CraftBukkit start - moved from MinecraftServer.saveChunks
-@@ -1521,7 +1486,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1522,7 +1487,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
}
// CraftBukkit end
@@ -1511,7 +1511,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
}
// Paper end
-@@ -1535,7 +1499,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1536,7 +1500,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!savingDisabled) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
@@ -1519,7 +1519,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
-@@ -1545,11 +1508,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1546,11 +1509,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
progressListener.progressStage(Component.translatable("menu.savingChunks"));
}
@@ -1532,7 +1532,7 @@ index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ff
} else if (close) { chunkproviderserver.close(false); } // Paper - rewrite chunk system
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 9d5f3bd830b547ff238dcef60aa00121038ba5f8..32c4e1c1157151e954ee7f99a9dedbb1741f7a6d 100644
+index 4e67556e1eb0a429a87fd07ae1c593e8bd4b6aab..adac48b53ba0e38f2df0150c02cb6f8dee637c07 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2480,7 +2480,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1588,10 +1588,10 @@ index b1a327b0208a30bc44e97dfd5c5e38014aafc197..20c061849cbb424fee66a47d9339cfd8
}
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
-index a9f69e4f880711c21ef28bd079960ef8f12da25c..4f031c68fa0788d782dd0124fe3b9669b8f1639d 100644
+index 5930e45bae5aa86b3cedb811c4c9bb92099bc1b5..540bafec1e973e7461c6c09228d801d4303b0e56 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
-@@ -334,15 +334,6 @@ public class EntityType implements FeatureElement, EntityTypeT
+@@ -336,15 +336,6 @@ public class EntityType implements FeatureElement, EntityTypeT
}
public EntityType(EntityType.EntityFactory factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) {
@@ -1607,7 +1607,7 @@ index a9f69e4f880711c21ef28bd079960ef8f12da25c..4f031c68fa0788d782dd0124fe3b9669
this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this);
this.factory = factory;
this.category = spawnGroup;
-@@ -712,12 +703,6 @@ public class EntityType implements FeatureElement, EntityTypeT
+@@ -714,12 +705,6 @@ public class EntityType implements FeatureElement, EntityTypeT
return this.updateInterval;
}
@@ -1620,7 +1620,7 @@ index a9f69e4f880711c21ef28bd079960ef8f12da25c..4f031c68fa0788d782dd0124fe3b9669
public boolean trackDeltas() {
return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS;
}
-@@ -827,7 +812,7 @@ public class EntityType implements FeatureElement, EntityTypeT
+@@ -829,7 +814,7 @@ public class EntityType implements FeatureElement, EntityTypeT
Util.fetchChoiceType(References.ENTITY_TREE, id);
}
@@ -1831,10 +1831,10 @@ index 3431f1a00ae2918b91a6b7a449e613e6e12ff6d4..cad0931ebd4b0ee8fab4fbbf111bb3cf
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
public CraftPersistentDataContainer persistentDataContainer;
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
-index 648481ad582e855e348dee28fa1cdd752ff6761b..f7958733a2321b34fbcb660e9c29fc14869e4a70 100644
+index 1c9659fc14d13934ce618dff0ec589dd65564966..7acf26bceff059de686274bb802160b99fc179be 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
-@@ -797,7 +797,6 @@ public class LevelChunk extends ChunkAccess {
+@@ -793,7 +793,6 @@ public class LevelChunk extends ChunkAccess {
this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system
if (this.needsDecoration) {
@@ -1842,7 +1842,7 @@ index 648481ad582e855e348dee28fa1cdd752ff6761b..f7958733a2321b34fbcb660e9c29fc14
this.needsDecoration = false;
java.util.Random random = new java.util.Random();
random.setSeed(this.level.getSeed());
-@@ -817,7 +816,6 @@ public class LevelChunk extends ChunkAccess {
+@@ -813,7 +812,6 @@ public class LevelChunk extends ChunkAccess {
}
}
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
@@ -1850,7 +1850,7 @@ index 648481ad582e855e348dee28fa1cdd752ff6761b..f7958733a2321b34fbcb660e9c29fc14
}
}
}
-@@ -1172,7 +1170,6 @@ public class LevelChunk extends ChunkAccess {
+@@ -1168,7 +1166,6 @@ public class LevelChunk extends ChunkAccess {
if (LevelChunk.this.isTicking(blockposition)) {
try {
@@ -1858,7 +1858,7 @@ index 648481ad582e855e348dee28fa1cdd752ff6761b..f7958733a2321b34fbcb660e9c29fc14
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
if (this.blockEntity.getType().isValid(iblockdata)) {
-@@ -1190,14 +1187,9 @@ public class LevelChunk extends ChunkAccess {
+@@ -1186,14 +1183,9 @@ public class LevelChunk extends ChunkAccess {
net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new ServerInternalException(msg, throwable)));
LevelChunk.this.removeBlockEntity(this.getPos());
// Paper end
@@ -2041,10 +2041,10 @@ index 7a2f46579352870cfbb32c343d7c68919758ffe3..16676b8be6ad1614ee261edd6bf4c0f9
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
-index b451ac809c769fbb943e30553f4c521140dc2edd..6016fb99b17a241f048b9e13253aed7924c80c09 100644
+index d28ccf22bba9bebae7fbdeaee94620de24365785..8f3d52c4a9cb38875334d0aeeb1ddfe76a93ba97 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
-@@ -206,12 +206,6 @@ public final class CraftMagicNumbers implements UnsafeValues {
+@@ -211,12 +211,6 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end
// ========================================================================
@@ -2057,7 +2057,7 @@ index b451ac809c769fbb943e30553f4c521140dc2edd..6016fb99b17a241f048b9e13253aed79
public static byte toLegacyData(BlockState data) {
return CraftLegacy.toLegacyData(data);
-@@ -455,10 +449,6 @@ public final class CraftMagicNumbers implements UnsafeValues {
+@@ -468,10 +462,6 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper start
@@ -2275,7 +2275,7 @@ index 139d946346594d2a59a8b2930c4eae794c880dbc..00000000000000000000000000000000
-
-}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
-index f1c24f2c2fa3bc6b0dabeb819fccb5fff61b736a..2ab536b4fb94f9c5f2e60b2b3e9f5ab13e03c73c 100644
+index 4490f1240304ac8c4600ca1182bfa363c2aae69c..1c5a23890b5f0daa96951b0f7d5c4e2d704f2869 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -35,7 +35,6 @@ import net.minecraft.world.entity.projectile.FireworkRocketEntity;
@@ -2286,7 +2286,7 @@ index f1c24f2c2fa3bc6b0dabeb819fccb5fff61b736a..2ab536b4fb94f9c5f2e60b2b3e9f5ab1
import net.minecraft.world.entity.schedule.Activity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
-@@ -181,7 +180,6 @@ public class ActivationRange
+@@ -184,7 +183,6 @@ public class ActivationRange
*/
public static void activateEntities(Level world)
{
@@ -2294,7 +2294,7 @@ index f1c24f2c2fa3bc6b0dabeb819fccb5fff61b736a..2ab536b4fb94f9c5f2e60b2b3e9f5ab1
final int miscActivationRange = world.spigotConfig.miscActivationRange;
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
-@@ -242,7 +240,6 @@ public class ActivationRange
+@@ -264,7 +262,6 @@ public class ActivationRange
}
// Paper end
}
diff --git a/patches/server/0008-Bump-Dependencies.patch b/patches/server/0012-Bump-Dependencies.patch
similarity index 82%
rename from patches/server/0008-Bump-Dependencies.patch
rename to patches/server/0012-Bump-Dependencies.patch
index 34dce0a61..8a4040ad0 100644
--- a/patches/server/0008-Bump-Dependencies.patch
+++ b/patches/server/0012-Bump-Dependencies.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Bump Dependencies
diff --git a/build.gradle.kts b/build.gradle.kts
-index d356988d21896ac06b5cc2e54785813b7d30233c..fa745abebf14fee0ca56cadc98822be62b647edf 100644
+index ab5aee09874e2258d05b22ca1be3c273cb1afb34..e3980e3e0eae7e6e6f2b4162a2ef5c318444b605 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -22,7 +22,7 @@ dependencies {
@@ -17,37 +17,35 @@ index d356988d21896ac06b5cc2e54785813b7d30233c..fa745abebf14fee0ca56cadc98822be6
implementation("net.minecrell:terminalconsoleappender:1.3.0")
implementation("net.kyori:adventure-text-serializer-ansi:4.14.0") // Keep in sync with adventureVersion from Paper-API build file
implementation("net.kyori:ansi:1.0.3") // Manually bump beyond above transitive dep
-@@ -32,31 +32,35 @@ dependencies {
+@@ -32,30 +32,34 @@ dependencies {
all its classes to check if they are plugins.
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/
- implementation("org.apache.logging.log4j:log4j-core:2.19.0") // Paper - implementation
- log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.19.0") // Paper - Needed to generate meta for our Log4j plugins
+ // Leaf start - Bump Dependencies
-+ implementation("org.apache.logging.log4j:log4j-core:2.20.0") // Paper - implementation
-+ log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.20.0") // Paper - Needed to generate meta for our Log4j plugins
++ implementation("org.apache.logging.log4j:log4j-core:2.21.0") // Paper - implementation
++ log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.21.0") // Paper - Needed to generate meta for our Log4j plugins
runtimeOnly(log4jPlugins.output)
alsoShade(log4jPlugins.output)
-- implementation("io.netty:netty-codec-haproxy:4.1.87.Final") // Paper - Add support for proxy protocol
-+ implementation("io.netty:netty-codec-haproxy:4.1.99.Final") // Paper - Add support for proxy protocol
+- implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol
++ implementation("io.netty:netty-codec-haproxy:4.1.100.Final") // Paper - Add support for proxy protocol
// Paper end
- implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
- implementation("org.ow2.asm:asm:9.5")
- implementation("org.ow2.asm:asm-commons:9.5") // Paper - ASM event executor generation
-- testImplementation("org.mockito:mockito-core:4.9.0") // Paper - switch to mockito
-+ implementation("org.apache.logging.log4j:log4j-iostreams:2.20.0") // Paper - remove exclusion
++ implementation("org.apache.logging.log4j:log4j-iostreams:2.21.0") // Paper - remove exclusion
+ implementation("org.ow2.asm:asm:9.6")
+ implementation("org.ow2.asm:asm-commons:9.6") // Paper - ASM event executor generation
-+ testImplementation("org.mockito:mockito-core:5.6.0") // Paper - switch to mockito
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
implementation("commons-lang:commons-lang:2.6")
- implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
- runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1")
+ implementation("net.fabricmc:mapping-io:0.5.0-beta.1") // Paper - needed to read mappings for stacktrace deobfuscation
-+ runtimeOnly("org.xerial:sqlite-jdbc:3.43.0.0")
++ runtimeOnly("org.xerial:sqlite-jdbc:3.43.2.1")
runtimeOnly("com.mysql:mysql-connector-j:8.1.0")
- runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
-+ runtimeOnly("com.lmax:disruptor:3.4.4") // Paper // Leaf - Bump Dependencies - Waiting Log4j support disruptor 4.0.0
++ runtimeOnly("com.lmax:disruptor:3.4.4") // Paper // Leaf - Bump Dependencies - Waiting Log4j 3.x that supported disruptor 4.0.0
+ // Leaf end
// Paper start - Use Velocity cipher
- implementation("com.velocitypowered:velocity-native:3.1.2-SNAPSHOT") {
@@ -67,23 +65,22 @@ index d356988d21896ac06b5cc2e54785813b7d30233c..fa745abebf14fee0ca56cadc98822be6
// Pufferfish start
implementation("org.yaml:snakeyaml:2.2")
-@@ -69,11 +73,13 @@ dependencies {
+@@ -68,10 +72,12 @@ dependencies {
implementation("org.mozilla:rhino-engine:1.7.14") // Purpur
implementation("dev.omega24:upnp4j:1.0") // Purpur
- testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
+ // Leaf start - Bump Dependencies
-+ testImplementation("io.github.classgraph:classgraph:4.8.162") // Paper - mob goal test
++ testImplementation("io.github.classgraph:classgraph:4.8.163") // Paper - mob goal test
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.hamcrest:hamcrest:2.2")
-
-- implementation("io.netty:netty-all:4.1.87.Final"); // Paper - Bump netty
-+ implementation("io.netty:netty-all:4.1.99.Final"); // Paper - Bump netty
+- testImplementation("org.mockito:mockito-core:5.5.0")
++ testImplementation("org.mockito:mockito-core:5.6.0")
+ // Leaf end
}
val craftbukkitPackageVersion = "1_20_R2" // Paper
-@@ -265,3 +271,7 @@ sourceSets {
+@@ -263,3 +269,7 @@ sourceSets {
}
}
// Gale end - package license into jar
diff --git a/patches/server/0009-Remove-Mojang-username-check.patch b/patches/server/0013-Remove-Mojang-username-check.patch
similarity index 93%
rename from patches/server/0009-Remove-Mojang-username-check.patch
rename to patches/server/0013-Remove-Mojang-username-check.patch
index e0989aa05..6abafc7c8 100644
--- a/patches/server/0009-Remove-Mojang-username-check.patch
+++ b/patches/server/0013-Remove-Mojang-username-check.patch
@@ -22,10 +22,10 @@ index 744f44e33578b56bbfd48fe27509e887716b3310..4cecb53d3792f02f8f76c26190583831
ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!");
return;
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index c9c926ec7129eaf235803a8b48a014e74385ac23..540b137c7f697001a325f57d06e2a0d69fae37ce 100644
+index 80a196442edbc6b4eb44bb6a405100871aea2f6a..1e9a440d790bdd521c58dfc9c1575e2759006d02 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -165,7 +165,11 @@ public class LeafConfig {
+@@ -169,7 +169,11 @@ public class LeafConfig {
serverModName = getString("server-mod-name", serverModName);
}
@@ -36,4 +36,4 @@ index c9c926ec7129eaf235803a8b48a014e74385ac23..540b137c7f697001a325f57d06e2a0d6
+ "enabling all characters as username");
}
- private static void performance() {
+ public static boolean enableAsyncMobSpawning = true;
diff --git a/patches/server/0010-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch b/patches/server/0014-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch
similarity index 92%
rename from patches/server/0010-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch
rename to patches/server/0014-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch
index 1f914eab0..825932b07 100644
--- a/patches/server/0010-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch
+++ b/patches/server/0014-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch
@@ -18,10 +18,10 @@ index b76f4b62d58087325d01983effe0a508d551d4ab..eb84043a3b39d899b83c8168e17fa19b
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
this.connection.disconnect(chatmessage);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index 540b137c7f697001a325f57d06e2a0d69fae37ce..1955a44a2cd178818bc53f4a56d7d0350cef80c8 100644
+index 1e9a440d790bdd521c58dfc9c1575e2759006d02..267f88d799fe98d1741a837c33d8c748362077ee 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -166,10 +166,14 @@ public class LeafConfig {
+@@ -170,10 +170,14 @@ public class LeafConfig {
}
public static boolean removeMojangUsernameCheck = true;
@@ -35,4 +35,4 @@ index 540b137c7f697001a325f57d06e2a0d69fae37ce..1955a44a2cd178818bc53f4a56d7d035
+ "without backend server enabling its bungee mode");
}
- private static void performance() {
+ public static boolean enableAsyncMobSpawning = true;
diff --git a/patches/server/0011-Remove-UseItemOnPacket-Too-Far-Check.patch b/patches/server/0015-Remove-UseItemOnPacket-Too-Far-Check.patch
similarity index 89%
rename from patches/server/0011-Remove-UseItemOnPacket-Too-Far-Check.patch
rename to patches/server/0015-Remove-UseItemOnPacket-Too-Far-Check.patch
index b113209c2..6f99d5dc5 100644
--- a/patches/server/0011-Remove-UseItemOnPacket-Too-Far-Check.patch
+++ b/patches/server/0015-Remove-UseItemOnPacket-Too-Far-Check.patch
@@ -7,7 +7,7 @@ This Check is added in 1.17.x -> 1.18.x update by Mojang.
By removing this check, it enable hackers to use some modules of hack clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 32c4e1c1157151e954ee7f99a9dedbb1741f7a6d..c005afe12d775036d11b04189167f2476e66a30f 100644
+index adac48b53ba0e38f2df0150c02cb6f8dee637c07..7c56e6bd76e8f8e5f9e925dc704be95e8a5532a1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1977,7 +1977,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -20,10 +20,10 @@ index 32c4e1c1157151e954ee7f99a9dedbb1741f7a6d..c005afe12d775036d11b04189167f247
this.player.resetLastActionTime();
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index 1955a44a2cd178818bc53f4a56d7d0350cef80c8..9a29a8c414b32376f7398e96a27eda1e477cb83e 100644
+index 267f88d799fe98d1741a837c33d8c748362077ee..83fee46886a21349d652b6bc871bd03ffbac2a7d 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -167,6 +167,8 @@ public class LeafConfig {
+@@ -171,6 +171,8 @@ public class LeafConfig {
public static boolean removeMojangUsernameCheck = true;
public static boolean removeSpigotCheckBungeeConfig = true;
@@ -32,7 +32,7 @@ index 1955a44a2cd178818bc53f4a56d7d0350cef80c8..9a29a8c414b32376f7398e96a27eda1e
private static void removal() {
removeMojangUsernameCheck = getBoolean("remove-Mojang-username-check", removeMojangUsernameCheck,
"Remove username check of Mojang",
-@@ -174,6 +176,9 @@ public class LeafConfig {
+@@ -178,6 +180,9 @@ public class LeafConfig {
removeSpigotCheckBungeeConfig = getBoolean("remove-Spigot-check-bungee-config", removeSpigotCheckBungeeConfig,
"Enable player enter backend server through proxy",
"without backend server enabling its bungee mode");
@@ -41,4 +41,4 @@ index 1955a44a2cd178818bc53f4a56d7d0350cef80c8..9a29a8c414b32376f7398e96a27eda1e
+ maxUseItemDistance = getDouble("max-UseItem-distance", maxUseItemDistance, "The max distance of UseItem for players");
}
- private static void performance() {
+ public static boolean enableAsyncMobSpawning = true;
diff --git a/patches/server/0012-KTP-Optimize-spigot-event-bus.patch b/patches/server/0016-KTP-Optimize-spigot-event-bus.patch
similarity index 100%
rename from patches/server/0012-KTP-Optimize-spigot-event-bus.patch
rename to patches/server/0016-KTP-Optimize-spigot-event-bus.patch
diff --git a/patches/server/0013-KeYi-Player-Skull-API.patch b/patches/server/0017-KeYi-Player-Skull-API.patch
similarity index 100%
rename from patches/server/0013-KeYi-Player-Skull-API.patch
rename to patches/server/0017-KeYi-Player-Skull-API.patch
diff --git a/patches/server/0014-KeYi-Disable-arrow-despawn-counter-by-default.patch b/patches/server/0018-KeYi-Disable-arrow-despawn-counter-by-default.patch
similarity index 100%
rename from patches/server/0014-KeYi-Disable-arrow-despawn-counter-by-default.patch
rename to patches/server/0018-KeYi-Disable-arrow-despawn-counter-by-default.patch
diff --git a/patches/server/0015-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch b/patches/server/0019-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch
similarity index 70%
rename from patches/server/0015-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch
rename to patches/server/0019-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch
index 0487f9c95..ba33a8712 100644
--- a/patches/server/0015-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch
+++ b/patches/server/0019-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch
@@ -20,15 +20,21 @@ index 07f1f6c9613150fd1cdd460a940629a67539d8db..0fe02df86483809cef22fca2e2ce0af7
} else {
ItemEntity.merge(other, itemstack1, this, itemstack);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index 9a29a8c414b32376f7398e96a27eda1e477cb83e..4b6ba35724d364da8397d991ba8453f22911ed07 100644
+index 83fee46886a21349d652b6bc871bd03ffbac2a7d..fc3938c16c43277e22b7a322177fa2a9150f1ff8 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -181,7 +181,9 @@ public class LeafConfig {
- maxUseItemDistance = getDouble("max-UseItem-distance", maxUseItemDistance, "The max distance of UseItem for players");
- }
-
+@@ -194,6 +194,7 @@ public class LeafConfig {
+ public static int activationDistanceMod = 8;
+ public static boolean throttleInactiveGoalSelectorTick = true;
+ public static Map projectileTimeouts;
+ public static boolean useSpigotItemMergingMechanism = true;
private static void performance() {
+ boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
+ "Whether or not asynchronous mob spawning should be enabled.",
+@@ -242,6 +243,7 @@ public class LeafConfig {
+ String type = EntityType.getKey(entityType).getPath().toUpperCase(Locale.ROOT);
+ entityType.ttl = config.getInt("entity_timeouts." + type, -1);
+ }
+ useSpigotItemMergingMechanism = getBoolean("performance.use-spigot-item-merging-mechanism", useSpigotItemMergingMechanism);
}
diff --git a/patches/server/0016-Carpet-Fixes-Optimized-getBiome-method.patch b/patches/server/0020-Carpet-Fixes-Optimized-getBiome-method.patch
similarity index 100%
rename from patches/server/0016-Carpet-Fixes-Optimized-getBiome-method.patch
rename to patches/server/0020-Carpet-Fixes-Optimized-getBiome-method.patch
diff --git a/patches/server/0017-Carpet-Fixes-Use-optimized-RecipeManager.patch b/patches/server/0021-Carpet-Fixes-Use-optimized-RecipeManager.patch
similarity index 100%
rename from patches/server/0017-Carpet-Fixes-Use-optimized-RecipeManager.patch
rename to patches/server/0021-Carpet-Fixes-Use-optimized-RecipeManager.patch
diff --git a/patches/server/0018-Akarin-Save-Json-list-asynchronously.patch b/patches/server/0022-Akarin-Save-Json-list-asynchronously.patch
similarity index 100%
rename from patches/server/0018-Akarin-Save-Json-list-asynchronously.patch
rename to patches/server/0022-Akarin-Save-Json-list-asynchronously.patch
diff --git a/patches/server/0019-Slice-Smooth-Teleports.patch b/patches/server/0023-Slice-Smooth-Teleports.patch
similarity index 97%
rename from patches/server/0019-Slice-Smooth-Teleports.patch
rename to patches/server/0023-Slice-Smooth-Teleports.patch
index 7551ace26..5c4abf725 100644
--- a/patches/server/0019-Slice-Smooth-Teleports.patch
+++ b/patches/server/0023-Slice-Smooth-Teleports.patch
@@ -7,7 +7,7 @@ Original license: MIT
Original project: https://github.com/Cryptite/Slice
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index e0fdc3156bec8c39a23c322f888826f710e36ddd..3c29dd986d8de2844087a479372ce4865bdf2bfe 100644
+index 28d58b0b09cc4a694d0a00b378cdc8148bab48d2..1e3cd5c91affc9b14d1b4f042907f0c5d29f775d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -279,6 +279,7 @@ public class ServerPlayer extends Player {
diff --git a/patches/server/0020-Parchment-Make-FixLight-use-action-bar.patch b/patches/server/0024-Parchment-Make-FixLight-use-action-bar.patch
similarity index 100%
rename from patches/server/0020-Parchment-Make-FixLight-use-action-bar.patch
rename to patches/server/0024-Parchment-Make-FixLight-use-action-bar.patch
diff --git a/patches/server/0021-Leaves-Server-Utils.patch b/patches/server/0025-Leaves-Server-Utils.patch
similarity index 97%
rename from patches/server/0021-Leaves-Server-Utils.patch
rename to patches/server/0025-Leaves-Server-Utils.patch
index 6805f6214..f346c612c 100644
--- a/patches/server/0021-Leaves-Server-Utils.patch
+++ b/patches/server/0025-Leaves-Server-Utils.patch
@@ -7,7 +7,7 @@ Original license: GPLv3
Original project: https://github.com/LeavesMC/Leaves
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
-index a025d009dc277b7e850cabd6fbbcca119f85a9b6..da016b3fceef0d2bac3ca9a0692f3deb04d82abf 100644
+index fad58fc3e46ee5ba333d07204c7389eef5dbd7c6..fb2d63fbe1b6c1144f878c417d1407c1fe5d4141 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -418,6 +418,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -18,7 +18,7 @@ index a025d009dc277b7e850cabd6fbbcca119f85a9b6..da016b3fceef0d2bac3ca9a0692f3deb
public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
-@@ -2463,6 +2464,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -2474,6 +2475,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
nbt.putBoolean("Paper.FreezeLock", true);
}
// Paper end
@@ -26,7 +26,7 @@ index a025d009dc277b7e850cabd6fbbcca119f85a9b6..da016b3fceef0d2bac3ca9a0692f3deb
return nbt;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
-@@ -2631,6 +2633,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -2642,6 +2644,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
}
// Paper end
@@ -38,7 +38,7 @@ index a025d009dc277b7e850cabd6fbbcca119f85a9b6..da016b3fceef0d2bac3ca9a0692f3deb
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
-@@ -5023,4 +5030,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -5034,4 +5041,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return false;
}
// Purpur end
diff --git a/patches/server/0022-Leaves-Protocol-Core.patch b/patches/server/0026-Leaves-Protocol-Core.patch
similarity index 93%
rename from patches/server/0022-Leaves-Protocol-Core.patch
rename to patches/server/0026-Leaves-Protocol-Core.patch
index 8b7e08043..bd4a96eff 100644
--- a/patches/server/0022-Leaves-Protocol-Core.patch
+++ b/patches/server/0026-Leaves-Protocol-Core.patch
@@ -25,10 +25,10 @@ index 975da2529d18391ed4ecc7359a2d7319129bd872..ae5590b015a2b018188bd7a45b44ec4d
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
-index dfe06a0f0d3c6ed0ce89c632a8b2cd050cc2e6a7..32cbb5a838152616e049f9a0e2623aab9a01c55a 100644
+index b54a764c2a24f8e09792ade7a9a4ebb17d9d4e7b..e060a6990173ede14ddb3b88df8d703244412755 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
-@@ -1558,6 +1558,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop PLAYER_JOIN = new ArrayList<>();
+ private static final List PLAYER_LEAVE = new ArrayList<>();
+ private static final List RELOAD_SERVER = new ArrayList<>();
-+ private static final Map MINECRAFT_REGISTER = new HashMap<>();
++ private static final Map> MINECRAFT_REGISTER = new HashMap<>();
+
+ public static void init() {
+ for (Class> clazz : getClasses("top.leavesmc.leaves.protocol")) {
@@ -240,7 +240,11 @@ index 0000000000000000000000000000000000000000..eb8bec80870bbe8a6b6aea3243764858
+
+ final ProtocolHandler.MinecraftRegister minecraftRegister = method.getAnnotation(ProtocolHandler.MinecraftRegister.class);
+ if (minecraftRegister != null) {
-+ MINECRAFT_REGISTER.put(minecraftRegister, method);
++ if (!MINECRAFT_REGISTER.containsKey(protocol)) {
++ MINECRAFT_REGISTER.put(protocol, new HashMap<>());
++ }
++
++ MINECRAFT_REGISTER.get(protocol).put(minecraftRegister, method);
+ }
+ }
+ KNOWN_TYPES.put(protocol, map);
@@ -280,7 +284,7 @@ index 0000000000000000000000000000000000000000..eb8bec80870bbe8a6b6aea3243764858
+ if (receiver.ignoreId() || receiver.payloadId().equals(payload.id().getPath()) ||
+ ArrayUtils.contains(receiver.payloadIds(), payload.id().getPath())) {
+ try {
-+ map.get(receiver).invoke(player, payload);
++ map.get(receiver).invoke(null, player, payload);
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
@@ -306,7 +310,7 @@ index 0000000000000000000000000000000000000000..eb8bec80870bbe8a6b6aea3243764858
+ if (!PLAYER_JOIN.isEmpty()) {
+ try {
+ for (Method method : PLAYER_JOIN) {
-+ method.invoke(player);
++ method.invoke(null, player);
+ }
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
@@ -318,7 +322,7 @@ index 0000000000000000000000000000000000000000..eb8bec80870bbe8a6b6aea3243764858
+ if (!PLAYER_LEAVE.isEmpty()) {
+ try {
+ for (Method method : PLAYER_LEAVE) {
-+ method.invoke(player);
++ method.invoke(null, player);
+ }
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
@@ -338,13 +342,19 @@ index 0000000000000000000000000000000000000000..eb8bec80870bbe8a6b6aea3243764858
+ }
+ }
+
-+ public static void handleMinecraftRegister(String channel, ServerPlayer player) {
-+ if (!MINECRAFT_REGISTER.isEmpty()) {
-+ for (ProtocolHandler.MinecraftRegister register : MINECRAFT_REGISTER.keySet()) {
-+ if (register.ignoreId() || register.channelId().equals(channel) ||
-+ ArrayUtils.contains(register.channelIds(), channel)) {
++ public static void handleMinecraftRegister(String channelId, ServerPlayer player) {
++ for (LeavesProtocol protocol : MINECRAFT_REGISTER.keySet()) {
++ String[] channel = channelId.split(":");
++ if (!protocol.namespace().equals(channel[0]) && !ArrayUtils.contains(protocol.namespaces(), channel[0])) {
++ continue;
++ }
++
++ Map map = MINECRAFT_REGISTER.get(protocol);
++ for (ProtocolHandler.MinecraftRegister register : map.keySet()) {
++ if (register.ignoreId() || register.channelId().equals(channel[1]) ||
++ ArrayUtils.contains(register.channelIds(), channel[1])) {
+ try {
-+ MINECRAFT_REGISTER.get(register).invoke(player);
++ map.get(register).invoke(null, player);
+ } catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
diff --git a/patches/server/0023-Leaves-Jade-Protocol.patch b/patches/server/0027-Leaves-Jade-Protocol.patch
similarity index 95%
rename from patches/server/0023-Leaves-Jade-Protocol.patch
rename to patches/server/0027-Leaves-Jade-Protocol.patch
index 6a1b34f98..b5c863e32 100644
--- a/patches/server/0023-Leaves-Jade-Protocol.patch
+++ b/patches/server/0027-Leaves-Jade-Protocol.patch
@@ -9,10 +9,10 @@ Original project: https://github.com/LeavesMC/Leaves
This patch is Powered by Jade(https://github.com/Snownee/Jade)
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
-index f39710854ddf1cec2abc1efe39b9399f1528fc62..c92ca5954fd929b0a51b0d39db665bede80f075a 100644
+index e91b4d63d42276f8a498cab7c439c785730f3f6f..a2d7c5008c6d6716d9530e00de0db0276cc0d9fc 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
-@@ -287,7 +287,7 @@ public class Tadpole extends AbstractFish {
+@@ -288,7 +288,7 @@ public class Tadpole extends AbstractFish {
}
@@ -22,10 +22,10 @@ index f39710854ddf1cec2abc1efe39b9399f1528fc62..c92ca5954fd929b0a51b0d39db665bed
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index 4b6ba35724d364da8397d991ba8453f22911ed07..fffa8e74d1ae895758fdbcb3e573004be3f7dfdb 100644
+index fc3938c16c43277e22b7a322177fa2a9150f1ff8..9445177d2cb64ae1cd0bd88d0c0b2ad89ef924f6 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -186,7 +186,9 @@ public class LeafConfig {
+@@ -246,7 +246,9 @@ public class LeafConfig {
useSpigotItemMergingMechanism = getBoolean("performance.use-spigot-item-merging-mechanism", useSpigotItemMergingMechanism);
}
@@ -37,10 +37,10 @@ index 4b6ba35724d364da8397d991ba8453f22911ed07..fffa8e74d1ae895758fdbcb3e573004b
public static String sentryDsn = "";
diff --git a/src/main/java/top/leavesmc/leaves/protocol/JadeProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/JadeProtocol.java
new file mode 100644
-index 0000000000000000000000000000000000000000..ebd34c2f0f8db4b43022cb436a047a0bf652acbb
+index 0000000000000000000000000000000000000000..e33c0cc960b3dffd98baea243d58ddd670627f5d
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/JadeProtocol.java
-@@ -0,0 +1,616 @@
+@@ -0,0 +1,621 @@
+package top.leavesmc.leaves.protocol;
+
+import com.google.common.cache.Cache;
@@ -342,14 +342,14 @@ index 0000000000000000000000000000000000000000..ebd34c2f0f8db4b43022cb436a047a0b
+ }
+
+ MinecraftServer server = MinecraftServer.getServer();
-+ Level world = player.level();
-+ boolean showDetails = payload.showDetails;
-+ Entity entity = world.getEntity(payload.entityId);
-+ if (entity == null || player.distanceToSqr(entity) > MAX_DISTANCE_SQR) {
-+ return;
-+ }
-+
+ server.execute(() -> {
++ Level world = player.level();
++ boolean showDetails = payload.showDetails;
++ Entity entity = world.getEntity(payload.entityId);
++ if (entity == null || player.distanceToSqr(entity) > MAX_DISTANCE_SQR) {
++ return;
++ }
++
+ var providers = entityDataProviders.get(entity);
+ if (providers.isEmpty()) {
+ return;
@@ -428,18 +428,21 @@ index 0000000000000000000000000000000000000000..ebd34c2f0f8db4b43022cb436a047a0b
+ void saveData(CompoundTag data, ServerPlayer player, Level world, T object, boolean showDetails);
+ }
+
-+ public record RequestEntityPayload(boolean showDetails, int entityId) implements CustomPacketPayload {
++ public record RequestEntityPayload(boolean showDetails, int entityId, float hitX, float hitY, float hitZ) implements CustomPacketPayload {
+
+ private static final ResourceLocation PACKET_REQUEST_ENTITY = JadeProtocol.id("request_entity");
+
+ public RequestEntityPayload(ResourceLocation id, FriendlyByteBuf buf) {
-+ this(buf.readBoolean(), buf.readInt());
++ this(buf.readBoolean(), buf.readVarInt(), buf.readFloat(), buf.readFloat(), buf.readFloat());
+ }
+
+ @Override
+ public void write(FriendlyByteBuf buf) {
+ buf.writeBoolean(showDetails);
+ buf.writeInt(entityId);
++ buf.writeFloat(hitX);
++ buf.writeFloat(hitY);
++ buf.writeFloat(hitZ);
+ }
+
+ @Override
@@ -449,18 +452,20 @@ index 0000000000000000000000000000000000000000..ebd34c2f0f8db4b43022cb436a047a0b
+ }
+ }
+
-+ public record RequestTilePayload(boolean showDetails, BlockHitResult hitResult) implements CustomPacketPayload {
++ public record RequestTilePayload(boolean showDetails, BlockHitResult hitResult, int blockState, ItemStack fakeBlock) implements CustomPacketPayload {
+
+ private static final ResourceLocation PACKET_REQUEST_TILE = JadeProtocol.id("request_tile");
+
+ public RequestTilePayload(ResourceLocation id, FriendlyByteBuf buf) {
-+ this(buf.readBoolean(), buf.readBlockHitResult());
++ this(buf.readBoolean(), buf.readBlockHitResult(), buf.readVarInt(), buf.readItem());
+ }
+
+ @Override
+ public void write(FriendlyByteBuf buf) {
+ buf.writeBoolean(showDetails);
+ buf.writeBlockHitResult(hitResult);
++ buf.writeVarInt(blockState);
++ buf.writeItem(fakeBlock);
+ }
+
+ @Override
diff --git a/patches/server/0024-Leaves-Appleskin-Protocol.patch b/patches/server/0028-Leaves-Appleskin-Protocol.patch
similarity index 88%
rename from patches/server/0024-Leaves-Appleskin-Protocol.patch
rename to patches/server/0028-Leaves-Appleskin-Protocol.patch
index 9d17a90c2..abcdba3c7 100644
--- a/patches/server/0024-Leaves-Appleskin-Protocol.patch
+++ b/patches/server/0028-Leaves-Appleskin-Protocol.patch
@@ -7,10 +7,10 @@ Original license: GPLv3
Original project: https://github.com/LeavesMC/Leaves
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index fffa8e74d1ae895758fdbcb3e573004be3f7dfdb..ae57267a0bc005519eb8bdb9313812fbecd30ac2 100644
+index 9445177d2cb64ae1cd0bd88d0c0b2ad89ef924f6..56dc6cb0b5659619ec5df42088fbecf758e652c6 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -187,8 +187,10 @@ public class LeafConfig {
+@@ -247,8 +247,10 @@ public class LeafConfig {
}
public static boolean jadeProtocol = false;
@@ -23,10 +23,10 @@ index fffa8e74d1ae895758fdbcb3e573004be3f7dfdb..ae57267a0bc005519eb8bdb9313812fb
public static String sentryDsn = "";
diff --git a/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java
new file mode 100644
-index 0000000000000000000000000000000000000000..ccc143344041b183912294f7e749f4b0506c063b
+index 0000000000000000000000000000000000000000..da1b2a0485ee99921ea61e5409ddbb4483b80951
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/AppleSkinProtocol.java
-@@ -0,0 +1,111 @@
+@@ -0,0 +1,106 @@
+package top.leavesmc.leaves.protocol;
+
+import net.minecraft.resources.ResourceLocation;
@@ -81,14 +81,17 @@ index 0000000000000000000000000000000000000000..ccc143344041b183912294f7e749f4b0
+ }
+ }
+
++ @ProtocolHandler.MinecraftRegister(ignoreId = true)
++ public static void onPlayerSubscribed(@NotNull ServerPlayer player) {
++ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
++ players.add(player);
++ }
++ }
++
+ @ProtocolHandler.Ticker
+ public static void tick() {
+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
+ for (ServerPlayer player : players) {
-+ if (!player.getBukkitEntity().getListeningPluginChannels().contains(SATURATION_KEY.toString())) {
-+ continue;
-+ }
-+
+ FoodData data = player.getFoodData();
+
+ float saturation = data.getSaturationLevel();
@@ -114,19 +117,11 @@ index 0000000000000000000000000000000000000000..ccc143344041b183912294f7e749f4b0
+
+ @ProtocolHandler.ReloadServer
+ public static void onServerReload() {
-+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) {
-+ enableAllPlayer();
-+ } else {
++ if (!org.dreeam.leaf.LeafConfig.appleskinProtocol) {
+ disableAllPlayer();
+ }
+ }
+
-+ public static void enableAllPlayer() {
-+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) {
-+ onPlayerLoggedIn(player);
-+ }
-+ }
-+
+ public static void disableAllPlayer() {
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) {
+ onPlayerLoggedOut(player);
diff --git a/patches/server/0025-Leaves-Xaero-Map-Protocol.patch b/patches/server/0029-Leaves-Xaero-Map-Protocol.patch
similarity index 93%
rename from patches/server/0025-Leaves-Xaero-Map-Protocol.patch
rename to patches/server/0029-Leaves-Xaero-Map-Protocol.patch
index 32a36d501..7ea49250d 100644
--- a/patches/server/0025-Leaves-Xaero-Map-Protocol.patch
+++ b/patches/server/0029-Leaves-Xaero-Map-Protocol.patch
@@ -19,18 +19,18 @@ index 963d5b4d2bc44c32d23da0f45480e0b0bd293ec2..8042254407f7aabfa41483ef6b5661ca
// CraftBukkit start - handle player weather
// entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.START_RAINING, 0.0F));
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index ae57267a0bc005519eb8bdb9313812fbecd30ac2..080cf996ee41503c6adc1d66e19be219102cbbcd 100644
+index 56dc6cb0b5659619ec5df42088fbecf758e652c6..5bd068203f787cba7e024bbb301065fd75d25f9e 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -1,6 +1,7 @@
- package org.dreeam.leaf;
+@@ -2,6 +2,7 @@ package org.dreeam.leaf;
import com.google.common.collect.ImmutableMap;
+ import net.minecraft.core.registries.BuiltInRegistries;
+import java.util.Random;
import net.minecraft.server.MinecraftServer;
+ import net.minecraft.world.entity.EntityType;
import org.bukkit.configuration.ConfigurationSection;
- import org.bukkit.configuration.MemoryConfiguration;
-@@ -188,9 +189,13 @@ public class LeafConfig {
+@@ -248,9 +249,13 @@ public class LeafConfig {
public static boolean jadeProtocol = false;
public static boolean appleskinProtocol = false;
diff --git a/patches/server/0026-Leaves-Syncmatica-Protocol.patch b/patches/server/0030-Leaves-Syncmatica-Protocol.patch
similarity index 95%
rename from patches/server/0026-Leaves-Syncmatica-Protocol.patch
rename to patches/server/0030-Leaves-Syncmatica-Protocol.patch
index e26bf384e..54b7756ac 100644
--- a/patches/server/0026-Leaves-Syncmatica-Protocol.patch
+++ b/patches/server/0030-Leaves-Syncmatica-Protocol.patch
@@ -9,7 +9,7 @@ Original project: https://github.com/LeavesMC/Leaves
This patch is Powered by Syncmatica(https://github.com/End-Tech/syncmatica)
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index c005afe12d775036d11b04189167f2476e66a30f..62c13bd9fe36ed748ee9eae7fec6019f1ec8c1d4 100644
+index 7c56e6bd76e8f8e5f9e925dc704be95e8a5532a1..bb3701298013bbdf3c6c43e23e2e422170c3efee 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -308,6 +308,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -30,10 +30,10 @@ index c005afe12d775036d11b04189167f2476e66a30f..62c13bd9fe36ed748ee9eae7fec6019f
public void tick() {
if (this.ackBlockChangesUpTo > -1) {
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index 080cf996ee41503c6adc1d66e19be219102cbbcd..0daa9a6ecefe67c6df2f9f36fac6dbbad2d74288 100644
+index 5bd068203f787cba7e024bbb301065fd75d25f9e..318d41b0e1849a729fd32fe9c5842174d2b1d532 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -191,11 +191,20 @@ public class LeafConfig {
+@@ -251,11 +251,20 @@ public class LeafConfig {
public static boolean appleskinProtocol = false;
public static boolean xaeroMapProtocol = false;
public static int xaeroMapServerID = new Random().nextInt();
@@ -56,7 +56,7 @@ index 080cf996ee41503c6adc1d66e19be219102cbbcd..0daa9a6ecefe67c6df2f9f36fac6dbba
public static String sentryDsn = "";
diff --git a/src/main/java/top/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java b/src/main/java/top/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java
new file mode 100644
-index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab1b5fc352
+index 0000000000000000000000000000000000000000..fc229f23076147304754a267bcc345cc836b648b
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java
@@ -0,0 +1,391 @@
@@ -98,13 +98,13 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+@LeavesProtocol(namespace = "syncmatica")
+public class CommunicationManager {
+
-+ private final Map> downloadingFile = new HashMap<>();
-+ private final Map playerMap = new HashMap<>();
++ private static final Map> downloadingFile = new HashMap<>();
++ private static final Map playerMap = new HashMap<>();
+
-+ protected final Collection broadcastTargets = new ArrayList<>();
++ protected static final Collection broadcastTargets = new ArrayList<>();
+
-+ protected final Map downloadState = new HashMap<>();
-+ protected final Map modifyState = new HashMap<>();
++ protected static final Map downloadState = new HashMap<>();
++ protected static final Map modifyState = new HashMap<>();
+
+ protected static final Rotation[] rotOrdinals = Rotation.values();
+ protected static final Mirror[] mirOrdinals = Mirror.values();
@@ -112,7 +112,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ public CommunicationManager() {
+ }
+
-+ public GameProfile getGameProfile(final ExchangeTarget exchangeTarget) {
++ public static GameProfile getGameProfile(final ExchangeTarget exchangeTarget) {
+ return playerMap.get(exchangeTarget).getGameProfile();
+ }
+
@@ -129,7 +129,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ }
+
+ @ProtocolHandler.PlayerJoin
-+ public void onPlayerJoin(ServerPlayer player) {
++ public static void onPlayerJoin(ServerPlayer player) {
+ final ExchangeTarget newPlayer = player.connection.exchangeTarget;
+ final VersionHandshakeServer hi = new VersionHandshakeServer(newPlayer);
+ playerMap.put(newPlayer, player);
@@ -139,7 +139,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ }
+
+ @ProtocolHandler.PlayerLeave
-+ public void onPlayerLeave(ServerPlayer player) {
++ public static void onPlayerLeave(ServerPlayer player) {
+ final ExchangeTarget oldPlayer = player.connection.exchangeTarget;
+ final Collection potentialMessageTarget = oldPlayer.getExchanges();
+ if (potentialMessageTarget != null) {
@@ -153,11 +153,11 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ }
+
+ @ProtocolHandler.PayloadReceiver(payload = LeavesProtocolManager.LeavesPayload.class, ignoreId = true)
-+ public void onPacketGet(ServerPlayer player, LeavesProtocolManager.LeavesPayload payload) {
++ public static void onPacketGet(ServerPlayer player, LeavesProtocolManager.LeavesPayload payload) {
+ onPacket(player.connection.exchangeTarget, payload.id(), payload.data());
+ }
+
-+ public void onPacket(final @NotNull ExchangeTarget source, final ResourceLocation id, final FriendlyByteBuf packetBuf) {
++ public static void onPacket(final @NotNull ExchangeTarget source, final ResourceLocation id, final FriendlyByteBuf packetBuf) {
+ Exchange handler = null;
+ final Collection potentialMessageTarget = source.getExchanges();
+ if (potentialMessageTarget != null) {
@@ -176,7 +176,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ }
+ }
+
-+ protected void handle(ExchangeTarget source, @NotNull ResourceLocation id, FriendlyByteBuf packetBuf) {
++ protected static void handle(ExchangeTarget source, @NotNull ResourceLocation id, FriendlyByteBuf packetBuf) {
+ if (id.equals(PacketType.REQUEST_LITEMATIC.identifier)) {
+ final UUID syncmaticaId = packetBuf.readUUID();
+ final ServerPlacement placement = SyncmaticaProtocol.getSyncmaticManager().getPlacement(syncmaticaId);
@@ -228,7 +228,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ final UUID placementId = packetBuf.readUUID();
+ final ServerPlacement placement = SyncmaticaProtocol.getSyncmaticManager().getPlacement(placementId);
+ if (placement != null) {
-+ if (!this.getGameProfile(source).getId().equals(placement.getOwner().uuid)) {
++ if (!getGameProfile(source).getId().equals(placement.getOwner().uuid)) {
+ return;
+ }
+
@@ -252,7 +252,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ }
+ }
+
-+ protected void handleExchange(Exchange exchange) {
++ protected static void handleExchange(Exchange exchange) {
+ if (exchange instanceof DownloadExchange) {
+ final ServerPlacement p = ((DownloadExchange) exchange).getPlacement();
+
@@ -302,7 +302,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ }
+ }
+
-+ private void addPlacement(final ExchangeTarget t, final @NotNull ServerPlacement placement) {
++ private static void addPlacement(final ExchangeTarget t, final @NotNull ServerPlacement placement) {
+ if (SyncmaticaProtocol.getSyncmaticManager().getPlacement(placement.getId()) != null) {
+ cancelShare(t, placement);
+ return;
@@ -313,19 +313,19 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ }
+ }
+
-+ private void cancelShare(final @NotNull ExchangeTarget source, final @NotNull ServerPlacement placement) {
++ private static void cancelShare(final @NotNull ExchangeTarget source, final @NotNull ServerPlacement placement) {
+ final FriendlyByteBuf FriendlyByteBuf = new FriendlyByteBuf(Unpooled.buffer());
+ FriendlyByteBuf.writeUUID(placement.getId());
+ source.sendPacket(PacketType.CANCEL_SHARE.identifier, FriendlyByteBuf);
+ }
+
-+ public void sendMetaData(final ServerPlacement metaData, final ExchangeTarget target) {
++ public static void sendMetaData(final ServerPlacement metaData, final ExchangeTarget target) {
+ final FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
+ putMetaData(metaData, buf, target);
+ target.sendPacket(PacketType.REGISTER_METADATA.identifier, buf);
+ }
+
-+ public void putMetaData(final @NotNull ServerPlacement metaData, final @NotNull FriendlyByteBuf buf, final @NotNull ExchangeTarget exchangeTarget) {
++ public static void putMetaData(final @NotNull ServerPlacement metaData, final @NotNull FriendlyByteBuf buf, final @NotNull ExchangeTarget exchangeTarget) {
+ buf.writeUUID(metaData.getId());
+
+ buf.writeUtf(SyncmaticaProtocol.sanitizeFileName(metaData.getName()));
@@ -341,7 +341,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ putPositionData(metaData, buf, exchangeTarget);
+ }
+
-+ public void putPositionData(final @NotNull ServerPlacement metaData, final @NotNull FriendlyByteBuf buf, final @NotNull ExchangeTarget exchangeTarget) {
++ public static void putPositionData(final @NotNull ServerPlacement metaData, final @NotNull FriendlyByteBuf buf, final @NotNull ExchangeTarget exchangeTarget) {
+ buf.writeBlockPos(metaData.getPosition());
+ buf.writeUtf(metaData.getDimension());
+ buf.writeInt(metaData.getRotation().ordinal());
@@ -365,7 +365,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ }
+ }
+
-+ public ServerPlacement receiveMetaData(final @NotNull FriendlyByteBuf buf, final @NotNull ExchangeTarget exchangeTarget) {
++ public static ServerPlacement receiveMetaData(final @NotNull FriendlyByteBuf buf, final @NotNull ExchangeTarget exchangeTarget) {
+ final UUID id = buf.readUUID();
+
+ final String fileName = SyncmaticaProtocol.sanitizeFileName(buf.readUtf(32767));
@@ -388,7 +388,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ return placement;
+ }
+
-+ public void receivePositionData(final @NotNull ServerPlacement placement, final @NotNull FriendlyByteBuf buf, final @NotNull ExchangeTarget exchangeTarget) {
++ public static void receivePositionData(final @NotNull ServerPlacement placement, final @NotNull FriendlyByteBuf buf, final @NotNull ExchangeTarget exchangeTarget) {
+ final BlockPos pos = buf.readBlockPos();
+ final String dimensionId = buf.readUtf(32767);
+ final Rotation rot = rotOrdinals[buf.readInt()];
@@ -405,7 +405,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ }
+ }
+
-+ public void download(final ServerPlacement syncmatic, final ExchangeTarget source) throws NoSuchAlgorithmException, IOException {
++ public static void download(final ServerPlacement syncmatic, final ExchangeTarget source) throws NoSuchAlgorithmException, IOException {
+ if (!SyncmaticaProtocol.getFileStorage().getLocalState(syncmatic).isReadyForDownload()) {
+ throw new IllegalArgumentException(syncmatic.toString() + " is not ready for download local state is: " + SyncmaticaProtocol.getFileStorage().getLocalState(syncmatic).toString());
+ }
@@ -415,30 +415,30 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ startExchange(downloadExchange);
+ }
+
-+ public void setDownloadState(final @NotNull ServerPlacement syncmatic, final boolean b) {
++ public static void setDownloadState(final @NotNull ServerPlacement syncmatic, final boolean b) {
+ downloadState.put(syncmatic.getHash(), b);
+ }
+
-+ public boolean getDownloadState(final @NotNull ServerPlacement syncmatic) {
++ public static boolean getDownloadState(final @NotNull ServerPlacement syncmatic) {
+ return downloadState.getOrDefault(syncmatic.getHash(), false);
+ }
+
-+ public void setModifier(final @NotNull ServerPlacement syncmatic, final Exchange exchange) {
++ public static void setModifier(final @NotNull ServerPlacement syncmatic, final Exchange exchange) {
+ modifyState.put(syncmatic.getHash(), exchange);
+ }
+
-+ public Exchange getModifier(final @NotNull ServerPlacement syncmatic) {
++ public static Exchange getModifier(final @NotNull ServerPlacement syncmatic) {
+ return modifyState.get(syncmatic.getHash());
+ }
+
-+ public void startExchange(final @NotNull Exchange newExchange) {
++ public static void startExchange(final @NotNull Exchange newExchange) {
+ if (!broadcastTargets.contains(newExchange.getPartner())) {
+ throw new IllegalArgumentException(newExchange.getPartner().toString() + " is not a valid ExchangeTarget");
+ }
+ startExchangeUnchecked(newExchange);
+ }
+
-+ protected void startExchangeUnchecked(final @NotNull Exchange newExchange) {
++ protected static void startExchangeUnchecked(final @NotNull Exchange newExchange) {
+ newExchange.getPartner().getExchanges().add(newExchange);
+ newExchange.init();
+ if (newExchange.isFinished()) {
@@ -446,7 +446,7 @@ index 0000000000000000000000000000000000000000..747da005acc37d8c1f8adec0d707afab
+ }
+ }
+
-+ public void notifyClose(final @NotNull Exchange e) {
++ public static void notifyClose(final @NotNull Exchange e) {
+ e.getPartner().getExchanges().remove(e);
+ handleExchange(e);
+ }
@@ -1326,7 +1326,7 @@ index 0000000000000000000000000000000000000000..9fbeef1ef528504276895faed4dba41e
+}
diff --git a/src/main/java/top/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java
new file mode 100644
-index 0000000000000000000000000000000000000000..fdb099a694dda5465b7aa0a14df28bc12f315725
+index 0000000000000000000000000000000000000000..b36dee2714750f79489cea9fce4855d1cfe3e770
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java
@@ -0,0 +1,122 @@
@@ -1347,7 +1347,7 @@ index 0000000000000000000000000000000000000000..fdb099a694dda5465b7aa0a14df28bc1
+public class SyncmaticaProtocol {
+
+ public static final String PROTOCOL_ID = "syncmatica";
-+ public static final String PROTOCOL_VERSION = "0.3.8";
++ public static final String PROTOCOL_VERSION = "leaves-syncmatica-1.0.0";
+
+ private static final File litematicFolder = new File("." + File.separator + "syncmatics");
+ private static final PlayerIdentifierProvider playerIdentifierProvider = new PlayerIdentifierProvider();
diff --git a/patches/server/0027-Fix-Make-log4j-compatible-with-future-release.patch b/patches/server/0031-Fix-Make-log4j-compatible-with-future-release.patch
similarity index 100%
rename from patches/server/0027-Fix-Make-log4j-compatible-with-future-release.patch
rename to patches/server/0031-Fix-Make-log4j-compatible-with-future-release.patch
diff --git a/patches/server/0028-sync-with-Gale-s-Optimize-villager-data-storage.patc.patch b/patches/server/0032-sync-with-Gale-s-Optimize-villager-data-storage.patc.patch
similarity index 100%
rename from patches/server/0028-sync-with-Gale-s-Optimize-villager-data-storage.patc.patch
rename to patches/server/0032-sync-with-Gale-s-Optimize-villager-data-storage.patc.patch
diff --git a/patches/server/0033-sync-with-Gale-s-Skip-unnecessary-mob-spawning-compu.patch b/patches/server/0033-sync-with-Gale-s-Skip-unnecessary-mob-spawning-compu.patch
new file mode 100644
index 000000000..3272c50a9
--- /dev/null
+++ b/patches/server/0033-sync-with-Gale-s-Skip-unnecessary-mob-spawning-compu.patch
@@ -0,0 +1,20 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
+Date: Tue, 24 Oct 2023 17:50:49 -0400
+Subject: [PATCH] sync with Gale's
+ Skip-unnecessary-mob-spawning-computations.patch
+
+
+diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+index 25bbb4afdb616d827db4a511ebc503445bec27fa..448f3a5197901c9d861bfca92ab3105056726624 100644
+--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+@@ -629,7 +629,7 @@ public class ServerChunkCache extends ChunkSource {
+ // Paper end - optimise chunk tick iteration
+ if (tick && chunk1.chunkStatus.isOrAfter(net.minecraft.server.level.FullChunkStatus.ENTITY_TICKING)) { // Paper - optimise chunk tick iteration
+ chunk1.incrementInhabitedTime(j);
+- if (spawn && flag2 && (!org.dreeam.leaf.LeafConfig.enableAsyncMobSpawning || _pufferfish_spawnCountsReady.get()) && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration // Pufferfish
++ if (spawn && flag2AndHasNaturalSpawn && (!org.dreeam.leaf.LeafConfig.enableAsyncMobSpawning || _pufferfish_spawnCountsReady.get()) && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration // Gale - MultiPaper - skip unnecessary mob spawning computations // Pufferfish
+ NaturalSpawner.spawnForChunk(this.level, chunk1, lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag1); // Pufferfish
+ }
+
diff --git a/patches/server/0029-Petal-Async-Pathfinding.patch b/patches/server/0034-Petal-Async-Pathfinding.patch
similarity index 98%
rename from patches/server/0029-Petal-Async-Pathfinding.patch
rename to patches/server/0034-Petal-Async-Pathfinding.patch
index 59908802c..f2a2da1fe 100644
--- a/patches/server/0029-Petal-Async-Pathfinding.patch
+++ b/patches/server/0034-Petal-Async-Pathfinding.patch
@@ -14,10 +14,10 @@ This patch was ported downstream from the Petal fork.
Makes most pathfinding-related work happen asynchronously
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
-index fd3b14649d4ba0212ec3e3d2cd36cf79b070b835..b333e08e4988438609e4c327dd101a546734c1b3 100644
+index d6009cf7ea6857e98f86b6bd71e34d0f137921ad..4a029f394e9df35a5bcbc42f8e2731fc2d789326 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
-@@ -291,6 +291,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
+@@ -293,6 +293,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Nullable
@Override
public LivingEntity getTarget() {
@@ -613,7 +613,7 @@ index 38a3dcec138d9233a46e5d523bcc6d64bc7fffd0..4f53747d6b90db92ae12f656c3525c45
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
-index ec508548ba24162913d7ec112b48a4ae18f5a43e..d08721d1ab8538decffad3717962442e281bb49c 100644
+index afd2b1922f23148d25e0f2732d60f4da8ea3b063..56badde70e0833d1e4f0bc521fc67f3e90aa3e58 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -66,6 +66,8 @@ import net.minecraft.world.level.pathfinder.Node;
@@ -625,7 +625,7 @@ index ec508548ba24162913d7ec112b48a4ae18f5a43e..d08721d1ab8538decffad3717962442e
public class Frog extends Animal implements VariantHolder {
public static final Ingredient TEMPTATION_ITEM = Ingredient.of(Items.SLIME_BALL);
-@@ -438,6 +440,17 @@ public class Frog extends Animal implements VariantHolder {
+@@ -439,6 +441,17 @@ public class Frog extends Animal implements VariantHolder {
super(frog, world);
}
@@ -643,7 +643,7 @@ index ec508548ba24162913d7ec112b48a4ae18f5a43e..d08721d1ab8538decffad3717962442e
@Override
public boolean canCutCorner(BlockPathTypes nodeType) {
return nodeType != BlockPathTypes.WATER_BORDER && super.canCutCorner(nodeType);
-@@ -447,6 +460,11 @@ public class Frog extends Animal implements VariantHolder {
+@@ -448,6 +461,11 @@ public class Frog extends Animal implements VariantHolder {
protected PathFinder createPathFinder(int range) {
this.nodeEvaluator = new Frog.FrogNodeEvaluator(true);
this.nodeEvaluator.setCanPassDoors(true);
@@ -717,10 +717,10 @@ index 2f49b528601a1feb7246fe7a9b83ce828c2d78fc..a29f212f3b38f1d80d7d5023f86a7acf
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
-index a82805a771fa4d1a9eceb8b5778fad30000e974e..3e1d2908cbfc5dd467443729fe9f3cc888af0016 100644
+index 9e2498f8cb4a1a309aa037c01aa3039924f5b29e..2df6e3772ffb79f17c1e4097cbf3ea1ebc2a82ae 100644
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
-@@ -620,6 +620,16 @@ public class Warden extends Monster implements VibrationSystem {
+@@ -622,6 +622,16 @@ public class Warden extends Monster implements VibrationSystem {
protected PathFinder createPathFinder(int range) {
this.nodeEvaluator = new WalkNodeEvaluator();
this.nodeEvaluator.setCanPassDoors(true);
@@ -935,33 +935,38 @@ index 0e2b14e7dfedf209d63279c81723fd7955122d78..079b278e2e262af433bb5bd0c12b3d8d
public SwimNodeEvaluator(boolean canJumpOutOfWater) {
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index 0daa9a6ecefe67c6df2f9f36fac6dbbad2d74288..839b4dba682b67f4ea291717d45d973c84cd3612 100644
+index 318d41b0e1849a729fd32fe9c5842174d2b1d532..d23cab4c405fb91c77a7d41af630656809a303de 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -3,6 +3,7 @@ package org.dreeam.leaf;
- import com.google.common.collect.ImmutableMap;
+@@ -5,6 +5,7 @@ import net.minecraft.core.registries.BuiltInRegistries;
import java.util.Random;
import net.minecraft.server.MinecraftServer;
+ import net.minecraft.world.entity.EntityType;
+import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
import org.jetbrains.annotations.Nullable;
-@@ -16,6 +17,7 @@ import java.lang.reflect.Method;
- import java.lang.reflect.Modifier;
+@@ -20,6 +21,7 @@ import java.util.Collections;
import java.util.List;
+ import java.util.Locale;
import java.util.Map;
+import java.util.logging.Level;
public class LeafConfig {
-@@ -183,8 +185,22 @@ public class LeafConfig {
- }
-
+@@ -196,6 +198,9 @@ public class LeafConfig {
+ public static boolean throttleInactiveGoalSelectorTick = true;
+ public static Map projectileTimeouts;
public static boolean useSpigotItemMergingMechanism = true;
+ public static boolean asyncPathfinding = false;
+ public static int asyncPathfindingMaxThreads = 0;
+ public static int asyncPathfindingKeepalive = 60;
private static void performance() {
+ boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
+ "Whether or not asynchronous mob spawning should be enabled.",
+@@ -245,6 +250,17 @@ public class LeafConfig {
+ entityType.ttl = config.getInt("entity_timeouts." + type, -1);
+ }
useSpigotItemMergingMechanism = getBoolean("performance.use-spigot-item-merging-mechanism", useSpigotItemMergingMechanism);
+ asyncPathfinding = getBoolean("performance.async-pathfinding.enable", asyncPathfinding);
+ asyncPathfindingMaxThreads = getInt("performance.async-pathfinding.max-threads", asyncPathfindingMaxThreads);
diff --git a/patches/server/0030-Fix-tracker-NPE.patch b/patches/server/0035-Fix-tracker-NPE.patch
similarity index 84%
rename from patches/server/0030-Fix-tracker-NPE.patch
rename to patches/server/0035-Fix-tracker-NPE.patch
index f053dec50..261329173 100644
--- a/patches/server/0030-Fix-tracker-NPE.patch
+++ b/patches/server/0035-Fix-tracker-NPE.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Fix tracker NPE
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
-index 727a5120f16c30a0393b25a762f031eb40dd69b4..0380672e1ba184720acb35a630722bc6b02994df 100644
+index 3fe61c302e4bb355edf2e8d6f608bcc31cc0197b..870ad0318cd6799b66ac2b0c73b498b95ac49821 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -204,7 +204,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -13,8 +13,8 @@ index 727a5120f16c30a0393b25a762f031eb40dd69b4..0380672e1ba184720acb35a630722bc6
// Paper end
// Paper start - optimise chunk tick iteration
- public final it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet needsChangeBroadcasting = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>();
-+ public final Set needsChangeBroadcasting = Sets.newConcurrentHashSet(); // Leaf
- public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
++ public final Set needsChangeBroadcasting = Sets.newConcurrentHashSet(); // Leaf - Fix tracker NPE
+ public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap = new gg.pufferfish.pufferfish.util.AsyncPlayerAreaMap(this.pooledLinkedPlayerHashSets); // Pufferfish
// Paper end - optimise chunk tick iteration
@@ -1212,7 +1212,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -27,7 +27,7 @@ index 727a5120f16c30a0393b25a762f031eb40dd69b4..0380672e1ba184720acb35a630722bc6
public TrackedEntity(Entity entity, int i, int j, boolean flag) {
this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
-index 8cf0d4e03726b4e4340850715b6ab1af8c183fbd..0f17b1f50d369c46526d14eefdd9e0a498c11528 100644
+index 448f3a5197901c9d861bfca92ab3105056726624..363901a4084ca275a6fef752290bc11a0053ab38 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -10,6 +10,7 @@ import java.util.Arrays;
@@ -38,17 +38,17 @@ index 8cf0d4e03726b4e4340850715b6ab1af8c183fbd..0f17b1f50d369c46526d14eefdd9e0a4
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
-@@ -642,7 +643,7 @@ public class ServerChunkCache extends ChunkSource {
+@@ -652,7 +653,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - optimise chunk tick iteration
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
- it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet copy = this.chunkMap.needsChangeBroadcasting.clone();
-+ List copy = new ArrayList<>(this.chunkMap.needsChangeBroadcasting); // Leaf
++ List copy = new ArrayList<>(this.chunkMap.needsChangeBroadcasting); // Leaf - Fix tracker NPE
this.chunkMap.needsChangeBroadcasting.clear();
for (ChunkHolder holder : copy) {
holder.broadcastChanges(holder.getFullChunkNowUnchecked()); // LevelChunks are NEVER unloaded
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
-index ef5890a64355760b69217dedac079d1a98027930..f0def3b3f5b2e0d16ffe26a15d43fb110ccdfb21 100644
+index 635037fb2a44a422b42d7c3c27cc7638c7715635..4fa17d2ba40bfd0159c182b909f9ab936e3ddf39 100644
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
@@ -1,6 +1,7 @@
@@ -72,7 +72,7 @@ index ef5890a64355760b69217dedac079d1a98027930..f0def3b3f5b2e0d16ffe26a15d43fb11
// Gale start - Lithium - replace AI attributes with optimized collections
private final Map attributes = new Reference2ReferenceOpenHashMap<>(0);
- private final Set dirtyAttributes = new ReferenceOpenHashSet<>(0);
-+ private final Set dirtyAttributes = Sets.newConcurrentHashSet(); // Leaf
++ private final Set dirtyAttributes = Sets.newConcurrentHashSet(); // Leaf - Fix tracker NPE
// Gale end - Lithium - replace AI attributes with optimized collections
private final AttributeSupplier supplier;
- private final net.minecraft.world.entity.LivingEntity entity; // Purpur
+ private final java.util.function.Function createInstance; // Gale - Airplane - reduce entity allocations
diff --git a/patches/server/0031-Cache-minecart-vehicle-collision-results.patch b/patches/server/0036-Cache-minecart-vehicle-collision-results.patch
similarity index 88%
rename from patches/server/0031-Cache-minecart-vehicle-collision-results.patch
rename to patches/server/0036-Cache-minecart-vehicle-collision-results.patch
index d8b90c61a..9064fc029 100644
--- a/patches/server/0031-Cache-minecart-vehicle-collision-results.patch
+++ b/patches/server/0036-Cache-minecart-vehicle-collision-results.patch
@@ -6,9 +6,10 @@ Subject: [PATCH] Cache minecart vehicle collision results
Co-authored-by: MrHua269
Cache minecart vehicle collision results to prevent lag causing by massive stacked minecart
+The known issue: entity can't enter the minecart after enabling this!
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
-index faf449dfb4f95a300796db46833f3b6a51cb961b..847bf9edd3f3dbd5c9fd4de4973ac066bbcc1f45 100644
+index faf449dfb4f95a300796db46833f3b6a51cb961b..3a5a13e1d921703a9f32ec5169ed8805a09fa84f 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -5,6 +5,8 @@ import com.google.common.collect.ImmutableMap;
@@ -49,7 +50,7 @@ index faf449dfb4f95a300796db46833f3b6a51cb961b..847bf9edd3f3dbd5c9fd4de4973ac066
+ if (org.dreeam.leaf.LeafConfig.cacheMinecartCollision) this.checkAndUpdateCache(); // Leaf - Cache minecart vehicle collision results
if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
- List list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this));
-+ List list = org.dreeam.leaf.LeafConfig.cacheMinecartCollision ? this.lastCollideCache : this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this));; // Leaf - Cache minecart vehicle collcollisionide results
++ List list = org.dreeam.leaf.LeafConfig.cacheMinecartCollision ? this.lastCollideCache : this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this));; // Leaf - Cache minecart vehicle collision results
if (!list.isEmpty()) {
Iterator iterator = list.iterator();
@@ -63,18 +64,18 @@ index faf449dfb4f95a300796db46833f3b6a51cb961b..847bf9edd3f3dbd5c9fd4de4973ac066
while (iterator1.hasNext()) {
Entity entity1 = (Entity) iterator1.next();
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index 839b4dba682b67f4ea291717d45d973c84cd3612..c994424d11747484f45c0bc76d947b080ce83394 100644
+index d23cab4c405fb91c77a7d41af630656809a303de..5c61144904bac178d40d8cb43253730c7d1e150f 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -188,6 +188,7 @@ public class LeafConfig {
+@@ -201,6 +201,7 @@ public class LeafConfig {
public static boolean asyncPathfinding = false;
public static int asyncPathfindingMaxThreads = 0;
public static int asyncPathfindingKeepalive = 60;
+ public static boolean cacheMinecartCollision = false;
private static void performance() {
- useSpigotItemMergingMechanism = getBoolean("performance.use-spigot-item-merging-mechanism", useSpigotItemMergingMechanism);
- asyncPathfinding = getBoolean("performance.async-pathfinding.enable", asyncPathfinding);
-@@ -201,6 +202,9 @@ public class LeafConfig {
+ boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning,
+ "Whether or not asynchronous mob spawning should be enabled.",
+@@ -261,6 +262,9 @@ public class LeafConfig {
asyncPathfindingMaxThreads = 0;
else
Bukkit.getLogger().log(Level.INFO, "Using " + asyncPathfindingMaxThreads + " threads for Async Pathfinding");
diff --git a/patches/server/0032-Reduce-canSee-work.patch b/patches/server/0037-Reduce-canSee-work.patch
similarity index 100%
rename from patches/server/0032-Reduce-canSee-work.patch
rename to patches/server/0037-Reduce-canSee-work.patch
diff --git a/patches/server/0033-Faster-Natural-Spawning.patch b/patches/server/0038-Faster-Natural-Spawning.patch
similarity index 100%
rename from patches/server/0033-Faster-Natural-Spawning.patch
rename to patches/server/0038-Faster-Natural-Spawning.patch
diff --git a/patches/server/0034-Faster-Random-for-xaeroMapServerID-generation.patch b/patches/server/0039-Faster-Random-for-xaeroMapServerID-generation.patch
similarity index 79%
rename from patches/server/0034-Faster-Random-for-xaeroMapServerID-generation.patch
rename to patches/server/0039-Faster-Random-for-xaeroMapServerID-generation.patch
index 65ceccd7a..8b725be40 100644
--- a/patches/server/0034-Faster-Random-for-xaeroMapServerID-generation.patch
+++ b/patches/server/0039-Faster-Random-for-xaeroMapServerID-generation.patch
@@ -5,19 +5,19 @@ Subject: [PATCH] Faster Random for xaeroMapServerID generation
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
-index c994424d11747484f45c0bc76d947b080ce83394..7a9f95d0ab3a3e57e8df8c2587d35691fbe90b54 100644
+index 5c61144904bac178d40d8cb43253730c7d1e150f..ec64cbc95cbdff883c92bf3f2785780dc5e3e269 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
-@@ -1,7 +1,7 @@
- package org.dreeam.leaf;
+@@ -2,7 +2,7 @@ package org.dreeam.leaf;
import com.google.common.collect.ImmutableMap;
+ import net.minecraft.core.registries.BuiltInRegistries;
-import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
import net.minecraft.server.MinecraftServer;
+ import net.minecraft.world.entity.EntityType;
import org.bukkit.Bukkit;
- import org.bukkit.configuration.ConfigurationSection;
-@@ -210,7 +210,7 @@ public class LeafConfig {
+@@ -270,7 +270,7 @@ public class LeafConfig {
public static boolean jadeProtocol = false;
public static boolean appleskinProtocol = false;
public static boolean xaeroMapProtocol = false;
diff --git a/patches/server/0040-Update-method-use.patch b/patches/server/0040-Update-method-use.patch
new file mode 100644
index 000000000..35c0044bf
--- /dev/null
+++ b/patches/server/0040-Update-method-use.patch
@@ -0,0 +1,61 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
+Date: Tue, 24 Oct 2023 19:50:01 -0400
+Subject: [PATCH] Update method use
+
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+index 6eb0e250101d10064fe150f03d98086afeba67ca..adff3b47b283998ae5137b1336b818a332bfd09d 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+@@ -155,42 +155,42 @@ public class CraftItem extends CraftEntity implements Item {
+ // Purpur start
+ @Override
+ public void setImmuneToCactus(boolean immuneToCactus) {
+- item.immuneToCactus = immuneToCactus;
++ this.getHandle().immuneToCactus = immuneToCactus;
+ }
+
+ @Override
+ public boolean isImmuneToCactus() {
+- return item.immuneToCactus;
++ return this.getHandle().immuneToCactus;
+ }
+
+ @Override
+ public void setImmuneToExplosion(boolean immuneToExplosion) {
+- item.immuneToExplosion = immuneToExplosion;
++ this.getHandle().immuneToExplosion = immuneToExplosion;
+ }
+
+ @Override
+ public boolean isImmuneToExplosion() {
+- return item.immuneToExplosion;
++ return this.getHandle().immuneToExplosion;
+ }
+
+ @Override
+ public void setImmuneToFire(boolean immuneToFire) {
+- item.immuneToFire = immuneToFire;
++ this.getHandle().immuneToFire = immuneToFire;
+ }
+
+ @Override
+ public boolean isImmuneToFire() {
+- return item.immuneToFire;
++ return this.getHandle().immuneToFire;
+ }
+
+ @Override
+ public void setImmuneToLightning(boolean immuneToLightning) {
+- item.immuneToLightning = immuneToLightning;
++ this.getHandle().immuneToLightning = immuneToLightning;
+ }
+
+ @Override
+ public boolean isImmuneToLightning() {
+- return item.immuneToLightning;
++ return this.getHandle().immuneToLightning;
+ }
+ // Purpur end
+ }
diff --git a/patches/server/0041-Fix-casting-in-Purpur-world-config.patch b/patches/server/0041-Fix-casting-in-Purpur-world-config.patch
new file mode 100644
index 000000000..2d6b1891f
--- /dev/null
+++ b/patches/server/0041-Fix-casting-in-Purpur-world-config.patch
@@ -0,0 +1,55 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
+Date: Tue, 24 Oct 2023 20:02:48 -0400
+Subject: [PATCH] Fix casting in Purpur world config
+
+
+diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+index bdbf6efd723d93866b2d24f869b9e964c09fa9ab..c434bf2bab763013d4377773a98b0dfae28be205 100644
+--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
++++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+@@ -643,7 +643,7 @@ public class PurpurWorldConfig {
+ dropsMap.forEach((itemId, chance) -> {
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.strippables." + blockId + ".drops`: " + itemId); return; }
+- drops.put(item, (double) chance);
++ drops.put(item, (Double) chance); // Leaf - Fix casting
+ });
+ axeStrippables.put(block, new Strippable(into, drops));
+ });
+@@ -677,7 +677,7 @@ public class PurpurWorldConfig {
+ dropsMap.forEach((itemId, chance) -> {
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.waxables." + blockId + ".drops`: " + itemId); return; }
+- drops.put(item, (double) chance);
++ drops.put(item, (Double) chance); // Leaf - Fix casting
+ });
+ axeWaxables.put(block, new Waxable(into, drops));
+ });
+@@ -707,7 +707,7 @@ public class PurpurWorldConfig {
+ dropsMap.forEach((itemId, chance) -> {
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.weatherables." + blockId + ".drops`: " + itemId); return; }
+- drops.put(item, (double) chance);
++ drops.put(item, (Double) chance); // Leaf - Fix casting
+ });
+ axeWeatherables.put(block, new Weatherable(into, drops));
+ });
+@@ -733,7 +733,7 @@ public class PurpurWorldConfig {
+ dropsMap.forEach((itemId, chance) -> {
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.hoe.tillables." + blockId + ".drops`: " + itemId); return; }
+- drops.put(item, (double) chance);
++ drops.put(item, (Double) chance); // Leaf - Fix casting
+ });
+ hoeTillables.put(block, new Tillable(condition, into, drops));
+ });
+@@ -757,7 +757,7 @@ public class PurpurWorldConfig {
+ dropsMap.forEach((itemId, chance) -> {
+ Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(itemId.toString()));
+ if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.shovel.flattenables." + blockId + ".drops`: " + itemId); return; }
+- drops.put(item, (double) chance);
++ drops.put(item, (Double) chance); // Leaf - Fix casting
+ });
+ shovelFlattenables.put(block, new Flattenable(into, drops));
+ });