diff --git a/.github/workflows/build-1202.yml b/.github/workflows/build-1202.yml index 6347cad4..3ac404fe 100644 --- a/.github/workflows/build-1202.yml +++ b/.github/workflows/build-1202.yml @@ -4,7 +4,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@main - uses: gradle/wrapper-validation-action@main - name: Set up JDK uses: graalvm/setup-graalvm@main @@ -23,13 +23,13 @@ jobs: - name: Rename Paperclip Jar run: mv build/libs/Leaf-paperclip-1.20.2-R0.1-SNAPSHOT-reobf.jar ./leaf-1.20.2.jar - name: Upload Leaf - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@main with: name: Leaf path: ./leaf-1.20.2.jar - name: Release Leaf if: github.ref_name == 'ver/1.20.2' - uses: marvinpinto/action-automatic-releases@latest + uses: marvinpinto/action-automatic-releases@master with: title: "Leaf 1.20.2" automatic_release_tag: "ver-1.20.2" diff --git a/build.gradle.kts b/build.gradle.kts index e86f4113..9cd55709 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,8 @@ -import io.papermc.paperweight.util.constants.* - plugins { java `maven-publish` id("com.github.johnrengelman.shadow") version "8.1.1" apply false - id("io.papermc.paperweight.patcher") version "1.5.7-SNAPSHOT" + id("io.papermc.paperweight.patcher") version "1.5.8-SNAPSHOT" } val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" @@ -17,7 +15,7 @@ repositories { } dependencies { - remapper("net.fabricmc:tiny-remapper:0.8.9:fat") + remapper("net.fabricmc:tiny-remapper:0.8.10:fat") decompiler("org.vineflower:vineflower:1.9.3") paperclip("io.papermc:paperclip:3.0.4-SNAPSHOT") } @@ -63,7 +61,7 @@ paperweight { decompileRepo.set("https://maven.quiltmc.org/") useStandardUpstream("Gale") { - url.set(github("GaleMC", "Gale")) + url.set(github("Dreeam-qwq", "Gale")) ref.set(providers.gradleProperty("galeCommit")) withStandardPatcher { diff --git a/gradle.properties b/gradle.properties index c376fb98..db043509 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ group = org.dreeam.leaf version = 1.20.2-R0.1-SNAPSHOT -galeCommit = 276e903b2688f23b19bdc8d493c0bf87656d2400 +galeCommit = 059cbce88f62a7685d1ca31788e1b903cc63e905 org.gradle.caching = true org.gradle.parallel = true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b745ffcc..3fa8f862 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-rc-1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/patches/api/0002-Pufferfish-Sentry.patch b/patches/api/0002-Pufferfish-Sentry.patch index 6948697b..2d0e5a95 100644 --- a/patches/api/0002-Pufferfish-Sentry.patch +++ b/patches/api/0002-Pufferfish-Sentry.patch @@ -7,14 +7,14 @@ Original license: GPL v3 Original project: https://github.com/pufferfish-gg/Pufferfish diff --git a/build.gradle.kts b/build.gradle.kts -index a2f7dbcd9ab971e5c4b809e7c9dd39e9b1077af6..2f8d0f4a592536ab8d3b5a95093d118137ba65de 100644 +index d5d99ee9dca23783f5b70b96790143e689a49ae4..d0cfdfc846d0d644349ee59c3a9b0ad8d32e4352 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -46,6 +46,7 @@ dependencies { apiAndDocs("net.kyori:adventure-text-logger-slf4j") api("org.apache.logging.log4j:log4j-api:$log4jVersion") api("org.slf4j:slf4j-api:$slf4jVersion") -+ api("io.sentry:sentry:6.29.0") // Pufferfish ++ api("io.sentry:sentry:7.0.0-beta.1") // Pufferfish implementation("org.ow2.asm:asm:9.4") implementation("org.ow2.asm:asm-commons:9.4") diff --git a/patches/api/0003-Purpur-API-Changes.patch b/patches/api/0003-Purpur-API-Changes.patch index f374e023..cb53a04e 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: e068628a9f2c66ba9dca5875ce8604db01e82bdb +Commit: 69d6fae0647074feeb4eb7a2b98fcc2979cc9f92 Patches below are removed in this patch: Pufferfish-API-Changes.patch @@ -279,7 +279,7 @@ index 918a045165cdcde264bc24082b7afebb407271de..687d11619379aead7f665d4a5f8f8bcc + // Purpur end } diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 8a948a61d0bdb06b0b9a6eac8a27baeb35a7d36c..f6e0b39ba9ea34613ecb22c55d5c38d5dcad9a82 100644 +index da6e36a16e609272b60fc41ff69a6fa3c34926c0..eba4e7ebe3530fd8cb3ecbe72f703932df8721c9 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -11050,4 +11050,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla @@ -817,10 +817,10 @@ index 138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2..10a8d64ad2da0be2c14f34c3e7d1957c // Paper start /** diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 762cb07861ca8ff058ce8d57ea6c15df1e588bf3..52867495d0f746ff40e802c4f1018511e58fd03e 100644 +index d340ddcf6924cc834455de3acbbac91ab9c66e39..ee3ca27a5406024ed71cce14b0891266b64e6fdf 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1049,4 +1049,42 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -1065,4 +1065,42 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent */ @NotNull String getScoreboardEntryName(); // Paper end - entity scoreboard name @@ -1027,7 +1027,7 @@ index bc84b892cae5fe7019a3ad481e9da79956efa1fe..48eb5b00c460cccde29d327cef1d63fc + // Purpur end } diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 4c33eac096619af16d571dca28411c4fff6f00f4..2156418958fb25eb9de08e39e42b90a5337bf92e 100644 +index a8bd76124340cbee9e68b5924c8cee44b16a3fe4..e63dc87f0c4d110b71dfd589f4a299772171c304 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -3290,4 +3290,122 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1294,10 +1294,30 @@ index c60be4fd24c7fdf65251dd6169e5e1ac3b588d95..569deccd2f1cf21da9b5906433ac493c + boolean canDoUnsafeEnchants(); + + void setDoUnsafeEnchants(boolean canDoUnsafeEnchants); ++ // Purpur end + } +diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java +index ab73893656932f54009340df59293df2a732be51..2ac5b6b3fe9d8c3c68504cff485a516f38da9956 100644 +--- a/src/main/java/org/bukkit/inventory/ItemFactory.java ++++ b/src/main/java/org/bukkit/inventory/ItemFactory.java +@@ -298,4 +298,15 @@ public interface ItemFactory { + @Deprecated + net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName); + // Paper end - bungee hover events ++ ++ // Purpur start ++ /** ++ * Returns the lines of text shown when hovering over an item ++ * ++ * @param itemStack The ItemStack ++ * @param advanced Whether advanced tooltips are shown ++ * @return the list of Components ++ */ ++ @NotNull java.util.List getHoverLines(@NotNull ItemStack itemStack, boolean advanced); + // Purpur end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 0af73cc04edb93b9772136d4d808f657ea40e733..c733206b769d7a55076d863757fcac1a129033b7 100644 +index 0af73cc04edb93b9772136d4d808f657ea40e733..085d98b30afa51e7665cb01bdd80b21f82771b95 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -17,6 +17,18 @@ import org.bukkit.inventory.meta.ItemMeta; @@ -1319,7 +1339,7 @@ index 0af73cc04edb93b9772136d4d808f657ea40e733..c733206b769d7a55076d863757fcac1a /** * Represents a stack of items. -@@ -1005,4 +1017,626 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -1005,4 +1017,636 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return type.isAir() || amount <= 0; } // Paper end @@ -1944,6 +1964,16 @@ index 0af73cc04edb93b9772136d4d808f657ea40e733..c733206b769d7a55076d863757fcac1a + } + return random.nextInt(unbreaking + 1) > 0; + } ++ ++ /** ++ * Returns the lines of text shown when hovering over the item ++ * ++ * @param advanced Whether advanced tooltips are shown ++ * @return the list of Components ++ */ ++ public @NotNull List getHoverLines(boolean advanced) { ++ return Bukkit.getItemFactory().getHoverLines(this, advanced); ++ } + // Purpur end } diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java diff --git a/patches/api/0004-Remove-Timings.patch b/patches/api/0004-Remove-Timings.patch index 556711d6..805727b6 100644 --- a/patches/api/0004-Remove-Timings.patch +++ b/patches/api/0004-Remove-Timings.patch @@ -2830,7 +2830,7 @@ index 3e61a926620a67daec3af54b72a1b911eaef2ed4..00000000000000000000000000000000 - } -} diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index de36dab37d3af249cf51573d163731c12346066a..aa3f38adb930bb06f4131a5a9b9b1c0d8a97b999 100644 +index 9237e2fca0557890b718de9029207a552396e45a..359c72a5fc0a98a71429907a437a1c7be03ed64c 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -35,7 +35,6 @@ public interface UnsafeValues { @@ -2841,7 +2841,7 @@ index de36dab37d3af249cf51573d163731c12346066a..aa3f38adb930bb06f4131a5a9b9b1c0d Material toLegacy(Material material); Material fromLegacy(Material material); -@@ -114,11 +113,6 @@ public interface UnsafeValues { +@@ -113,11 +112,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 573a1c88..032f22e1 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 33de936fff3c77e5d90dfbc59e84c0ff16a59b55..ddb297af7226d3c4763a6136013b45f0680ee517 100644 +index d0cfdfc846d0d644349ee59c3a9b0ad8d32e4352..f6f8fc879d938d31b184216eaccb477637be5a13 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,8 +11,8 @@ java { @@ -30,22 +30,22 @@ index 33de936fff3c77e5d90dfbc59e84c0ff16a59b55..ddb297af7226d3c4763a6136013b45f0 apiAndDocs("net.kyori:adventure-text-minimessage") @@ -48,30 +48,32 @@ dependencies { api("org.slf4j:slf4j-api:$slf4jVersion") - api("io.sentry:sentry:6.29.0") // Pufferfish + api("io.sentry:sentry:7.0.0-beta.1") // Pufferfish - implementation("org.ow2.asm:asm:9.4") - implementation("org.ow2.asm:asm-commons:9.4") + // Leaf start - Bump Dependencies -+ implementation("org.ow2.asm:asm:9.5") -+ implementation("org.ow2.asm:asm-commons:9.5") ++ implementation("org.ow2.asm:asm:9.6") ++ implementation("org.ow2.asm:asm-commons:9.6") // Paper end - api("org.apache.maven:maven-resolver-provider:3.8.5") - compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3") - compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") - compileOnly("com.google.code.findbugs:jsr305:1.3.9") // Paper -+ api("org.apache.maven:maven-resolver-provider:3.9.4") -+ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.15") -+ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.15") ++ api("org.apache.maven:maven-resolver-provider:3.9.5") ++ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.16") ++ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.16") + compileOnly("com.google.code.findbugs:jsr305:3.0.2") // Paper val annotations = "org.jetbrains:annotations:$annotationsVersion" // Paper - we don't want Java 5 annotations... @@ -54,7 +54,7 @@ index 33de936fff3c77e5d90dfbc59e84c0ff16a59b55..ddb297af7226d3c4763a6136013b45f0 // Paper start - add checker - val checkerQual = "org.checkerframework:checker-qual:3.21.0" -+ val checkerQual = "org.checkerframework:checker-qual:3.38.0" // Leaf - Bump Dependencies ++ val checkerQual = "org.checkerframework:checker-qual:3.39.0" // Leaf - Bump Dependencies compileOnlyApi(checkerQual) testCompileOnly(checkerQual) // Paper end @@ -63,8 +63,10 @@ index 33de936fff3c77e5d90dfbc59e84c0ff16a59b55..ddb297af7226d3c4763a6136013b45f0 + testImplementation("org.apache.commons:commons-lang3:3.13.0") testImplementation("org.junit.jupiter:junit-jupiter:5.10.0") testImplementation("org.hamcrest:hamcrest:2.2") - testImplementation("org.mockito:mockito-core:5.5.0") - testImplementation("org.ow2.asm:asm-tree:9.5") +- testImplementation("org.mockito:mockito-core:5.5.0") +- testImplementation("org.ow2.asm:asm-tree:9.5") ++ testImplementation("org.mockito:mockito-core:5.6.0") ++ testImplementation("org.ow2.asm:asm-tree:9.6") + // Leaf end } @@ -74,11 +76,11 @@ index 33de936fff3c77e5d90dfbc59e84c0ff16a59b55..ddb297af7226d3c4763a6136013b45f0 "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/$log4jVersion/", // Paper end - "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3", // Paper -+ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.9.15", // Paper // Leaf - Bump Dependencies ++ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.9.16", // Paper // Leaf - Bump Dependencies ) options.tags("apiNote:a:API Note:") -@@ -174,6 +176,9 @@ val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks. +@@ -184,6 +186,9 @@ val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks. jarToScan.set(tasks.jar.flatMap { it.archiveFile }) classpath.from(configurations.compileClasspath) } diff --git a/patches/server/0009-Purpur-Server-Changes.patch b/patches/server/0005-Purpur-Server-Changes.patch similarity index 98% rename from patches/server/0009-Purpur-Server-Changes.patch rename to patches/server/0005-Purpur-Server-Changes.patch index cf78f971..31ae0592 100644 --- a/patches/server/0009-Purpur-Server-Changes.patch +++ b/patches/server/0005-Purpur-Server-Changes.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Purpur Server Changes Original license: MIT Original project: https://github.com/PurpurMC/Purpur -Commit: e068628a9f2c66ba9dca5875ce8604db01e82bdb +Commit: 69d6fae0647074feeb4eb7a2b98fcc2979cc9f92 Patches below are removed in this patch: Metrics change in 0002-Purpur-config-files.patch @@ -26,7 +26,7 @@ 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 ab6525f6fb91c7f6d287c5c50a822ed69ecc63f5..1b402ea22d93f46a5ce4b9722e74b3d911eb2e52 100644 +index 2bb82cf44a7db2931f9ecfd0076d16276da38ccf..d356988d21896ac06b5cc2e54785813b7d30233c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -65,6 +65,10 @@ dependencies { @@ -40,10 +40,10 @@ index ab6525f6fb91c7f6d287c5c50a822ed69ecc63f5..1b402ea22d93f46a5ce4b9722e74b3d9 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") -@@ -182,7 +186,7 @@ fun TaskContainer.registerRunTask( - } - } - // Gale end - use default Java installation for development runs +@@ -180,7 +184,7 @@ fun TaskContainer.registerRunTask( + name: String, + block: JavaExec.() -> Unit + ): TaskProvider = register(name) { - group = "paper" + group = "paperweight" // Purpur mainClass.set("org.bukkit.craftbukkit.Main") @@ -631,7 +631,7 @@ index e17090003988ad2c890d48666c2234b14d511345..433f1f11b8b92c7d48352416f79ab5a3 return true; } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index b0a4fee32ac348ea26fa18c122e888a348e2ca07..5a0eba369702fcac4d6715c4ff29d151cecf3c7e 100644 +index e344fe0f2192f20f5d6d1594f7844b539fadcc7a..b82f4bdd45be544ae6e19ff97dea86bd03a83d7d 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -570,11 +570,20 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -700,7 +700,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 a8535f791188b2d8ba8d663372e688a1bfebe3c0..995dd071082e482785448678b9189f0715a75308 100644 +index 889886a949df9eb49a26c6fec9a32ddfbf938847..bc886017d72ca26655478c5f48f2b79689ab908c 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 +809,7 @@ index a8535f791188b2d8ba8d663372e688a1bfebe3c0..995dd071082e482785448678b9189f07 /* Drop global time updates if (this.tickCount % 20 == 0) { -@@ -2542,6 +2568,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 35515563d498a6e9817d9bd92ff5eda959de212a..a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b 100644 +index fbfef5678423f1224bfcfe62073e0603bb0bd58d..a01bce7c699658f8043e6b3eb6983af70c2bbc0f 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 +1188,7 @@ index 35515563d498a6e9817d9bd92ff5eda959de212a..a3ab2f88c0fdfab8e03911df6d6f4b2c // CraftBukkit start j = this.levelData.getDayTime() + 24000L; TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (j - j % 24000L) - this.getDayTime()); -@@ -922,6 +943,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -921,6 +942,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 +1202,7 @@ index 35515563d498a6e9817d9bd92ff5eda959de212a..a3ab2f88c0fdfab8e03911df6d6f4b2c this.setDayTime(this.levelData.getDayTime() + 1L); } -@@ -930,8 +958,22 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -929,8 +957,22 @@ public class ServerLevel extends Level implements WorldGenLevel { public void setDayTime(long timeOfDay) { this.serverLevelData.setDayTime(timeOfDay); @@ -1225,7 +1225,7 @@ index 35515563d498a6e9817d9bd92ff5eda959de212a..a3ab2f88c0fdfab8e03911df6d6f4b2c public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) { Iterator iterator = this.customSpawners.iterator(); -@@ -974,10 +1016,18 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -973,10 +1015,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) { @@ -1300,7 +1300,7 @@ index 35515563d498a6e9817d9bd92ff5eda959de212a..a3ab2f88c0fdfab8e03911df6d6f4b2c 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. -@@ -2761,7 +2829,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2777,7 +2845,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,12 +1310,12 @@ index 35515563d498a6e9817d9bd92ff5eda959de212a..a3ab2f88c0fdfab8e03911df6d6f4b2c } // 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 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10515b3bff 100644 +index 032ae1af757f0241467fddd0c7c735d53a1eb473..e0fdc3156bec8c39a23c322f888826f710e36ddd 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -274,6 +274,10 @@ public class ServerPlayer extends Player { - public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper +@@ -275,6 +275,10 @@ public class ServerPlayer extends Player { public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper + public @Nullable String clientBrandName = null; // Paper - Brand name public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event + public boolean purpurClient = false; // Purpur + private boolean tpsBar = false; // Purpur @@ -1324,7 +1324,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 // Paper start - replace player chunk loader private final java.util.concurrent.atomic.AtomicReference viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1)); -@@ -561,6 +565,9 @@ public class ServerPlayer extends Player { +@@ -562,6 +566,9 @@ public class ServerPlayer extends Player { } } @@ -1334,7 +1334,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 } @Override -@@ -627,6 +634,9 @@ public class ServerPlayer extends Player { +@@ -628,6 +635,9 @@ public class ServerPlayer extends Player { } this.getBukkitEntity().setExtraData(nbt); // CraftBukkit @@ -1344,7 +1344,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 } // CraftBukkit start - World fallback code, either respawn location or global spawn -@@ -755,6 +765,15 @@ public class ServerPlayer extends Player { +@@ -756,6 +766,15 @@ public class ServerPlayer extends Player { this.trackStartFallingPosition(); this.trackEnteredOrExitedLavaOnVehicle(); this.advancements.flushDirty(this); @@ -1360,7 +1360,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 } public void doTick() { -@@ -993,6 +1012,7 @@ public class ServerPlayer extends Player { +@@ -994,6 +1013,7 @@ public class ServerPlayer extends Player { })); Team scoreboardteambase = this.getTeam(); @@ -1368,7 +1368,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != Team.Visibility.ALWAYS) { if (scoreboardteambase.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) { this.server.getPlayerList().broadcastSystemToTeam(this, ichatbasecomponent); -@@ -1099,6 +1119,16 @@ public class ServerPlayer extends Player { +@@ -1100,6 +1120,16 @@ public class ServerPlayer extends Player { if (this.isInvulnerableTo(source)) { return false; } else { @@ -1385,7 +1385,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 boolean flag = this.server.isDedicatedServer() && this.isPvpAllowed() && source.is(DamageTypeTags.IS_FALL); if (!flag && this.spawnInvulnerableTime > 0 && !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { -@@ -1242,6 +1272,7 @@ public class ServerPlayer extends Player { +@@ -1243,6 +1273,7 @@ public class ServerPlayer extends Player { playerlist.sendPlayerPermissionLevel(this); worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); this.unsetRemoved(); @@ -1393,7 +1393,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 // CraftBukkit end this.setServerLevel(worldserver); -@@ -1397,7 +1428,7 @@ public class ServerPlayer extends Player { +@@ -1398,7 +1429,7 @@ public class ServerPlayer extends Player { return entitymonster.isPreventingPlayerRest(this); }); @@ -1402,7 +1402,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 return Either.left(Player.BedSleepingProblem.NOT_SAFE); } } -@@ -1437,7 +1468,19 @@ public class ServerPlayer extends Player { +@@ -1438,7 +1469,19 @@ public class ServerPlayer extends Player { }); if (!this.serverLevel().canSleepThroughNights()) { @@ -1423,7 +1423,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 } ((ServerLevel) this.level()).updateSleepingPlayerList(); -@@ -1534,6 +1577,7 @@ public class ServerPlayer extends Player { +@@ -1535,6 +1578,7 @@ public class ServerPlayer extends Player { @Override public void openTextEdit(SignBlockEntity sign, boolean front) { @@ -1431,7 +1431,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 this.connection.send(new ClientboundBlockUpdatePacket(this.level(), sign.getBlockPos())); this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), front)); } -@@ -1779,6 +1823,26 @@ public class ServerPlayer extends Player { +@@ -1780,6 +1824,26 @@ public class ServerPlayer extends Player { this.lastSentExp = -1; // CraftBukkit - Added to reset } @@ -1458,7 +1458,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 @Override public void displayClientMessage(Component message, boolean overlay) { this.sendSystemMessage(message, overlay); -@@ -2101,8 +2165,68 @@ public class ServerPlayer extends Player { +@@ -2102,8 +2166,68 @@ public class ServerPlayer extends Player { public void resetLastActionTime() { this.lastActionTime = Util.getMillis(); @@ -1527,7 +1527,7 @@ index 3998a67ea984b6b7eeedcbc0446ef9fd057c0faa..849a740430abc4ed762adcfefa6b5b10 public ServerStatsCounter getStats() { return this.stats; } -@@ -2650,4 +2774,50 @@ public class ServerPlayer extends Player { +@@ -2651,4 +2775,50 @@ public class ServerPlayer extends Player { return (CraftPlayer) super.getBukkitEntity(); } // CraftBukkit end @@ -1636,18 +1636,18 @@ index 921af5bba8f1f67bcdfe2b7fb7489f7f5ef80e7b..609652d92a3084dedb17f60db52aa38b + // Purpur end } diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 9045be8b757fe4ed9b1acf7f749a7eb51d89080d..004c6fde273599d9a7449c95480951d894ceae76 100644 +index 963cbdff10dd3c2ed8a0737853fa584cfafae29b..1eef67ca260434e8627dba35792a7c5d97df891f 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -64,6 +64,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -63,6 +63,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + private static final long KEEPALIVE_LIMIT = KEEPALIVE_LIMIT_IN_SECONDS * 1000; // Gale end - Purpur - send multiple keep-alive packets - private @Nullable String clientBrandName = null; // Paper - Brand name protected static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support + protected static final ResourceLocation PURPUR_CLIENT = new ResourceLocation("purpur", "client"); // Purpur public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit this.server = minecraftserver; -@@ -152,6 +153,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -156,6 +157,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); this.disconnect("Invalid payload REGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause } @@ -1662,7 +1662,7 @@ index 9045be8b757fe4ed9b1acf7f749a7eb51d89080d..004c6fde273599d9a7449c95480951d8 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 4c13544652f8fe21a69e843b338ac04e7234f065..c82a310bd69abf30b39e4b96d1ef2b43283ecdbe 100644 +index 210ee08c071c1504c21f745214dd5484f305664d..9d5f3bd830b547ff238dcef60aa00121038ba5f8 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 @@ -2372,7 +2372,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 c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389eef5dbd7c6 100644 +index 0f993e020a733a518641f8a2125d8e970d2974d0..a025d009dc277b7e850cabd6fbbcca119f85a9b6 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 +2402,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee private float eyeHeight; public boolean isInPowderSnow; public boolean wasInPowderSnow; -@@ -493,6 +493,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -488,6 +488,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return false; } @@ -2428,7 +2428,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee public final boolean hardCollides() { return this.hardCollides; } -@@ -543,7 +562,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -538,7 +557,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.bb = Entity.INITIAL_AABB; this.stuckSpeedMultiplier = Vec3.ZERO; this.nextStep = 1.0F; @@ -2437,7 +2437,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee this.remainingFireTicks = -this.getFireImmuneTicks(); this.fluidHeight = new Object2DoubleArrayMap(2); this.fluidOnEyes = new HashSet(); -@@ -865,10 +884,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -854,10 +873,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { public void checkBelowWorld() { // Paper start - Configurable nether ceiling damage @@ -2450,7 +2450,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee this.onBelowWorld(); } -@@ -1845,7 +1865,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1834,7 +1854,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return this.isInWater() || flag; } @@ -2459,7 +2459,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee Entity entity = this.getVehicle(); if (entity instanceof Boat) { -@@ -2966,6 +2986,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2955,6 +2975,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.passengers = ImmutableList.copyOf(list); } @@ -2473,7 +2473,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee this.gameEvent(GameEvent.ENTITY_MOUNT, passenger); } } -@@ -3006,6 +3033,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2995,6 +3022,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return false; } // Spigot end @@ -2488,7 +2488,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee if (this.passengers.size() == 1 && this.passengers.get(0) == entity) { this.passengers = ImmutableList.of(); } else { -@@ -3085,12 +3120,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3074,12 +3109,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return Vec3.directionFromRotation(this.getRotationVector()); } @@ -2505,7 +2505,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee } this.isInsidePortal = true; -@@ -3139,7 +3177,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3128,7 +3166,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } this.processPortalCooldown(); @@ -2514,7 +2514,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee } } -@@ -3329,7 +3367,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3318,7 +3356,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public int getMaxAirSupply() { @@ -2523,7 +2523,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee } public int getAirSupply() { -@@ -3793,7 +3831,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3782,7 +3820,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public boolean canChangeDimensions() { @@ -2532,7 +2532,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee } public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { -@@ -4091,6 +4129,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4080,6 +4118,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return SlotAccess.NULL; } @@ -2553,7 +2553,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee @Override public void sendSystemMessage(Component message) {} -@@ -4360,6 +4412,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4349,6 +4401,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.yRotO = this.getYRot(); } @@ -2566,7 +2566,7 @@ index c59ce8a083eb0ca616f9d17932457b899dc946a5..fad58fc3e46ee5ba333d07204c7389ee 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; -@@ -4935,4 +4993,45 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4924,4 +4982,45 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this); } // Paper end @@ -2625,10 +2625,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 2561e74ffdf595a9b6ae13dcd738662c772db442..5930e45bae5aa86b3cedb811c4c9bb92099bc1b5 100644 +index 73871f456a85bda1e51f54986d0e61fb629822e8..a9f69e4f880711c21ef28bd079960ef8f12da25c 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -309,13 +309,24 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -307,13 +307,24 @@ public class EntityType implements FeatureElement, EntityTypeT private Component description; @Nullable private ResourceLocation lootTable; @@ -2654,7 +2654,7 @@ index 2561e74ffdf595a9b6ae13dcd738662c772db442..5930e45bae5aa86b3cedb811c4c9bb92 public static ResourceLocation getKey(EntityType type) { return BuiltInRegistries.ENTITY_TYPE.getKey(type); } -@@ -531,6 +542,16 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -529,6 +540,16 @@ public class EntityType implements FeatureElement, EntityTypeT return this.category; } @@ -2671,7 +2671,7 @@ index 2561e74ffdf595a9b6ae13dcd738662c772db442..5930e45bae5aa86b3cedb811c4c9bb92 public String getDescriptionId() { if (this.descriptionId == null) { this.descriptionId = Util.makeDescriptionId("entity", BuiltInRegistries.ENTITY_TYPE.getKey(this)); -@@ -592,6 +613,12 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -590,6 +611,12 @@ public class EntityType implements FeatureElement, EntityTypeT entity.load(nbt); }, () -> { EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); @@ -2769,7 +2769,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 16d036443087bec4f36052290aef11ece746a3fb..776d57177ecee9050aaffc2fc664d18b5c7c2625 100644 +index 37db21b3d2426dec69f378669b2ba8f0c8130bfc..704aa6ea5f6a7574706cb7aba6937a6ef89d8d8b 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 { @@ -3131,7 +3131,7 @@ index 16d036443087bec4f36052290aef11ece746a3fb..776d57177ecee9050aaffc2fc664d18b }); } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f137921ad 100644 +index 23900bc67d20aaf773d593fef6eb7308a96bbe51..fd3b14649d4ba0212ec3e3d2cd36cf79b070b835 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 +3161,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f this.jumpControl = new JumpControl(this); this.bodyRotationControl = this.createBodyControl(); this.navigation = this.createNavigation(world); -@@ -325,6 +327,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -323,6 +325,7 @@ public abstract class Mob extends LivingEntity implements Targeting { entityliving = null; } } @@ -3169,7 +3169,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f this.target = entityliving; return true; // CraftBukkit end -@@ -369,8 +372,28 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -367,8 +370,28 @@ public abstract class Mob extends LivingEntity implements Targeting { this.resetAmbientSoundTime(); this.playAmbientSound(); } @@ -3198,7 +3198,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f @Override protected void playHurtSound(DamageSource source) { this.resetAmbientSoundTime(); -@@ -560,6 +583,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -558,6 +581,7 @@ public abstract class Mob extends LivingEntity implements Targeting { } nbt.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit @@ -3206,7 +3206,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f } @Override -@@ -630,6 +654,11 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -628,6 +652,11 @@ public abstract class Mob extends LivingEntity implements Targeting { this.aware = nbt.getBoolean("Bukkit.Aware"); } // CraftBukkit end @@ -3218,7 +3218,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f } @Override -@@ -673,7 +702,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -671,7 +700,7 @@ public abstract class Mob extends LivingEntity implements Targeting { @Override public void aiStep() { super.aiStep(); @@ -3227,7 +3227,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f 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(); -@@ -1152,6 +1181,12 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1146,6 +1175,12 @@ public abstract class Mob extends LivingEntity implements Targeting { } @@ -3240,7 +3240,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f @Nullable public static Item getEquipmentForSlot(EquipmentSlot equipmentSlot, int equipmentLevel) { switch (equipmentSlot) { -@@ -1246,7 +1281,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1240,7 +1275,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 +3249,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f this.setLeftHanded(true); } else { this.setLeftHanded(false); -@@ -1294,6 +1329,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1288,6 +1323,7 @@ public abstract class Mob extends LivingEntity implements Targeting { if (!this.isAlive()) { return InteractionResult.PASS; } else if (this.getLeashHolder() == player) { @@ -3257,7 +3257,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f // CraftBukkit start - fire PlayerUnleashEntityEvent // Paper start - drop leash variable org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.getAbilities().instabuild); -@@ -1367,7 +1403,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1361,7 +1397,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 +3266,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f } public boolean isWithinRestriction() { -@@ -1678,6 +1714,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1672,6 +1708,7 @@ public abstract class Mob extends LivingEntity implements Targeting { this.setLastHurtMob(target); } @@ -3274,7 +3274,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f return flag; } -@@ -1699,28 +1736,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1693,28 +1730,7 @@ public abstract class Mob extends LivingEntity implements Targeting { // Gale end - JettPack - optimize sun burn tick - cache eye blockpos public boolean isSunBurnTick() { @@ -3304,7 +3304,7 @@ index db0fb4cd2041b456269479bd97751bd78d9593e9..d6009cf7ea6857e98f86b6bd71e34d0f } @Override -@@ -1767,4 +1783,56 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1761,4 +1777,56 @@ public abstract class Mob extends LivingEntity implements Targeting { return itemmonsteregg == null ? null : new ItemStack(itemmonsteregg); } @@ -4129,7 +4129,7 @@ index be105a4460e9bf2ef4b72a307fa31291c37d5e0e..2e268aa614522b40fbffabce4017b228 entityanimal.resetLove(); worldserver.broadcastEntityEvent(this, (byte) 18); diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index 55026e1731e41b4e3e4c6a8fef5d96a32051a556..6c04c8e7776b2830ac368229da834532e8ce163e 100644 +index 9a7956befc346e1b58f064213800fd099a052fc6..38a3dcec138d9233a46e5d523bcc6d64bc7fffd0 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java @@ -43,6 +43,7 @@ import net.minecraft.world.entity.EntityType; @@ -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 c521ff04be40bfa892021f67acc1b324551fcd5e..eb60d2d99155aae4a761051175fbbddf9ed5dad9 100644 +index 26731a659fe3c40fc20135d473bacf105cc15300..7c7168cd16c6b55dc48ffa30e1ec86e94cf92226 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,16 +6924,15 @@ index c521ff04be40bfa892021f67acc1b324551fcd5e..eb60d2d99155aae4a761051175fbbddf @Override protected Brain.Provider brainProvider() { return Brain.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES); -@@ -224,7 +259,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS - private int behaviorTick = 0; // Pufferfish +@@ -223,6 +258,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS + @Override protected void customServerAiStep() { -- 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 ++ if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider this.getBrain().tick((ServerLevel) this.level(), this); AllayAi.updateActivity(this); super.customServerAiStep(); -@@ -367,9 +402,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS +@@ -365,9 +401,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @Override public boolean wantsToPickUp(ItemStack stack) { @@ -6969,7 +6968,7 @@ index c521ff04be40bfa892021f67acc1b324551fcd5e..eb60d2d99155aae4a761051175fbbddf 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 8624331c81be6fe857c90c8f61fa39d5446975cd..83ecc3c22f9c3aa5a9a88b53fe1196d1abad1350 100644 +index 1125b7d7fdb700d692061f163ca742a1aaa560fc..6b7070eec9aa911a75e081983c6ef313a02bb04d 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; -@@ -283,7 +320,7 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder { @@ -7181,16 +7179,15 @@ index 4e78834c03baef977ebc691103f4ec7a8d88a5fb..afd2b1922f23148d25e0f2732d60f4da @Override protected Brain.Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); -@@ -167,7 +220,7 @@ public class Frog extends Animal implements VariantHolder { - private int behaviorTick = 0; // Pufferfish +@@ -166,6 +219,7 @@ public class Frog extends Animal implements VariantHolder { + @Override protected void customServerAiStep() { -- 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 ++ if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider this.getBrain().tick((ServerLevel)this.level(), this); FrogAi.updateActivity(this); super.customServerAiStep(); -@@ -350,7 +403,7 @@ public class Frog extends Animal implements VariantHolder { +@@ -348,7 +402,7 @@ public class Frog extends Animal implements VariantHolder { return world.getBlockState(pos.below()).is(BlockTags.FROGS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos); } @@ -7200,7 +7197,7 @@ index 4e78834c03baef977ebc691103f4ec7a8d88a5fb..afd2b1922f23148d25e0f2732d60f4da 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 c83dabddf93249a6477c10725622119c939db4d5..e91b4d63d42276f8a498cab7c439c785730f3f6f 100644 +index 0f3a11203dd0353d74626a273e9003131356f5e1..f39710854ddf1cec2abc1efe39b9399f1528fc62 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 { @@ -7255,17 +7252,16 @@ index c83dabddf93249a6477c10725622119c939db4d5..e91b4d63d42276f8a498cab7c439c785 @Override protected PathNavigation createNavigation(Level world) { return new WaterBoundPathNavigation(this, world); -@@ -80,7 +117,7 @@ public class Tadpole extends AbstractFish { - private int behaviorTick = 0; // Pufferfish +@@ -79,6 +116,7 @@ public class Tadpole extends AbstractFish { + @Override protected void customServerAiStep() { -- 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 ++ if ((getRider() == null || !this.isControllable())) // 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 7b946ea210eebcab3d373b13e09ff839e49cfbe5..90e7c24eb50f333017e724ac56376fc54ee004f5 100644 +index 4df3f237e4b3bc27e1be66d1e593d4f619873c7e..0415a7b4b5e67b21ed3d92227b05c7c552e978a2 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 { @@ -7307,16 +7303,15 @@ index 7b946ea210eebcab3d373b13e09ff839e49cfbe5..90e7c24eb50f333017e724ac56376fc5 @Override protected Brain.Provider brainProvider() { return Brain.provider(Goat.MEMORY_TYPES, Goat.SENSOR_TYPES); -@@ -194,7 +226,7 @@ public class Goat extends Animal { - private int behaviorTick = 0; // Pufferfish +@@ -193,6 +225,7 @@ public class Goat extends Animal { + @Override protected void customServerAiStep() { -- 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 ++ if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider this.getBrain().tick((ServerLevel) this.level(), this); GoatAi.updateActivity(this); super.customServerAiStep(); -@@ -393,6 +425,7 @@ public class Goat extends Animal { +@@ -391,6 +424,7 @@ public class Goat extends Animal { // Paper start - Goat ram API public void ram(net.minecraft.world.entity.LivingEntity entity) { @@ -8527,7 +8522,7 @@ index 1e07febcf7a3dfb281728cc5e3e4f15dd776d7e0..71f8cea4a33b30fdafa41714a424b309 } diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index 9b19cca3b8231b8fbda674f080922673503b1260..b735c8029685bc4cca5998b36b52249dc51df1a2 100644 +index 1c7702a5c888846f93f8f80d3b854a26c11499be..2f64267d780fdbba1248398094bed39ed619740c 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java @@ -99,10 +99,12 @@ public class ArmorStand extends LivingEntity { @@ -10156,7 +10151,7 @@ index 2858ea5562d06c11e5c7337a2b123f9be7a3f62e..1ad97267394d3717b1871336193cdc91 @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java -index 55c245d0dfa369dc6de2197ae37335fba4fae4ae..c9b40515f4c2ff1eedfc9510930c3baebc078ebd 100644 +index e4218acaaf7d3aef0fb31f5597fb1af32aa2c8b5..01977550309451cda795583ba4122143b140b9b7 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Monster.java +++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java @@ -89,6 +89,14 @@ public abstract class Monster extends PathfinderMob implements Enemy { @@ -11776,7 +11771,7 @@ index 3e79562f51efbac51785fa0998d6a1a6e3036939..4f242ba9131f341606af13ac543af8a0 this.updateActivity(); } diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 1ddbba72a5fd3d225b651815a38d178941fba289..929cbdb6cc7b40329fe65705aecf4f36b1c40a48 100644 +index 3d44f8e9f8056d7d899e90e61240b2d1d109354b..93c16ae029aec4d62e4110567d09f491ada87937 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -96,22 +96,69 @@ public class Zombie extends Monster { @@ -11929,7 +11924,7 @@ index 1ddbba72a5fd3d225b651815a38d178941fba289..929cbdb6cc7b40329fe65705aecf4f36 } // Paper end -@@ -528,19 +565,20 @@ public class Zombie extends Monster { +@@ -520,19 +557,20 @@ public class Zombie extends Monster { if (object instanceof Zombie.ZombieGroupData) { Zombie.ZombieGroupData entityzombie_groupdatazombie = (Zombie.ZombieGroupData) object; @@ -11956,7 +11951,7 @@ index 1ddbba72a5fd3d225b651815a38d178941fba289..929cbdb6cc7b40329fe65705aecf4f36 Chicken entitychicken1 = (Chicken) EntityType.CHICKEN.create(this.level()); if (entitychicken1 != null) { -@@ -550,6 +588,7 @@ public class Zombie extends Monster { +@@ -542,6 +580,7 @@ public class Zombie extends Monster { this.startRiding(entitychicken1); world.addFreshEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit } @@ -11964,7 +11959,7 @@ index 1ddbba72a5fd3d225b651815a38d178941fba289..929cbdb6cc7b40329fe65705aecf4f36 } } } -@@ -596,7 +635,7 @@ public class Zombie extends Monster { +@@ -588,7 +627,7 @@ public class Zombie extends Monster { } protected void randomizeReinforcementsChance() { @@ -12138,7 +12133,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 3ddcd9e7533724e9b3c7b89afd0bbe2009421fa5..e0514fd246771250bfdef46080c59d4f31acd33a 100644 +index 024e2da8673a837a1185351bb211414e19a7f393..8f8040ca67fb8a1a7d9ae1f52bc07a6ab9dc2085 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 { @@ -12185,17 +12180,16 @@ index 3ddcd9e7533724e9b3c7b89afd0bbe2009421fa5..e0514fd246771250bfdef46080c59d4f @Override public boolean canBeLeashed(Player player) { return !this.isLeashed(); -@@ -131,7 +168,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { - private int behaviorTick; // Pufferfish +@@ -130,6 +167,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { + @Override protected void customServerAiStep() { -- 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 ++ if ((getRider() == null || !this.isControllable())) // 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 e25456327e510c0b4fac3b1974aa6f3e45b1a995..2b9e2eb912c2e7a04f154db517b293aed02e6c29 100644 +index 57d7873290fc361d8c5c094e166416772fe11cbe..98ef5416d94cf5b3181a0f0abee32a835f0fa42f 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 @@ -12237,16 +12231,15 @@ index e25456327e510c0b4fac3b1974aa6f3e45b1a995..2b9e2eb912c2e7a04f154db517b293ae @Override public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); -@@ -303,7 +335,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento - private int behaviorTick; // Pufferfish +@@ -302,6 +334,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento + @Override protected void customServerAiStep() { -- 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 ++ if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider this.getBrain().tick((ServerLevel) this.level(), this); PiglinAi.updateActivity(this); super.customServerAiStep(); -@@ -400,7 +432,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -398,7 +431,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override public boolean wantsToPickUp(ItemStack stack) { @@ -12347,7 +12340,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 f172cf9f754b73e44c3688581c984baa4e2ad8b6..9e2498f8cb4a1a309aa037c01aa3039924f5b29e 100644 +index db09d5c6b709f746e69111cedebd29f82c1f9e32..a82805a771fa4d1a9eceb8b5778fad30000e974e 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 { @@ -12383,7 +12376,7 @@ index f172cf9f754b73e44c3688581c984baa4e2ad8b6..9e2498f8cb4a1a309aa037c01aa30399 @Override public Packet getAddEntityPacket() { return new ClientboundAddEntityPacket(this, this.hasPose(Pose.EMERGING) ? 1 : 0); -@@ -395,19 +419,16 @@ public class Warden extends Monster implements VibrationSystem { +@@ -393,19 +417,16 @@ public class Warden extends Monster implements VibrationSystem { @Contract("null->false") public boolean canTargetEntity(@Nullable Entity entity) { @@ -12465,12 +12458,12 @@ 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 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd77c8fe224 100644 +index e157e11933710e0ceb73c6d41f673332fbeee303..e4a60e7222e49fc173caed4658e0f7be19dc56f5 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -146,6 +146,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - - public long nextGolemPanic = -1; // Pufferfish +@@ -144,6 +144,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + return holder.is(PoiTypes.MEETING); + }); + private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur + private int notLobotomizedCount = 0; // Purpur @@ -12478,7 +12471,7 @@ index 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd7 public Villager(EntityType entityType, Level world) { this(entityType, world, VillagerType.PLAINS); } -@@ -157,6 +160,90 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -155,6 +158,90 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.getNavigation().setCanFloat(true); this.setCanPickUpLoot(true); this.setVillagerData(this.getVillagerData().setType(type).setProfession(VillagerProfession.NONE)); @@ -12569,7 +12562,7 @@ index 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd7 } @Override -@@ -193,7 +280,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -191,7 +278,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler brain.addActivity(Activity.PLAY, VillagerGoalPackages.getPlayPackage(0.5F)); } else { brain.setSchedule(Schedule.VILLAGER_DEFAULT); @@ -12578,17 +12571,14 @@ index 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd7 } brain.addActivity(Activity.CORE, VillagerGoalPackages.getCorePackage(villagerprofession, 0.5F)); -@@ -256,14 +343,20 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -253,9 +340,20 @@ 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 -- // Pufferfish start -- if (!inactive) { -- if (this.behaviorTick++ % this.activatedPriority == 0) -- this.getBrain().tick((ServerLevel) this.level(), this); // Paper +- if (!inactive) this.getBrain().tick((ServerLevel) this.level(), this); // Paper + // Purpur start + if (this.level().purpurConfig.villagerLobotomizeEnabled) { + // treat as inactive if lobotomized @@ -12596,16 +12586,15 @@ index 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd7 + } else { + // clean up state for API + this.isLobotomized = false; - } -- // Pufferfish end -+ if (!inactive && (getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Purpur - only use brain if no rider ++ } ++ if (!inactive && (getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + this.getBrain().tick((ServerLevel) this.level(), this); // Paper + else if (this.isLobotomized && shouldRestock()) restock(); + // Purpur end if (this.assignProfessionWhenSpawned) { this.assignProfessionWhenSpawned = false; } -@@ -319,7 +412,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -311,7 +409,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(); @@ -12614,7 +12603,7 @@ index 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd7 } else { boolean flag = this.getOffers().isEmpty(); -@@ -332,9 +425,10 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -324,9 +422,10 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } if (flag) { @@ -12627,7 +12616,7 @@ index 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd7 this.startTrading(player); } -@@ -503,7 +597,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -495,7 +594,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler while (iterator.hasNext()) { MerchantOffer merchantrecipe = (MerchantOffer) iterator.next(); @@ -12636,7 +12625,7 @@ index 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd7 } } -@@ -753,7 +847,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -745,7 +844,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public boolean canBreed() { @@ -12645,7 +12634,7 @@ index 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd7 } private boolean hungry() { -@@ -967,6 +1061,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -959,6 +1058,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler public boolean hasFarmSeeds() { return this.getInventory().hasAnyMatching((itemstack) -> { @@ -12657,7 +12646,7 @@ index 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd7 return itemstack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS); }); } -@@ -1024,6 +1123,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -1016,6 +1120,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } public void spawnGolemIfNeeded(ServerLevel world, long time, int requiredCount) { @@ -12665,7 +12654,7 @@ index 812313bb3aade49c4afa2eec9be1f9cc7b3e3cb2..be8a491cfb75d0a835a983e65ee0edd7 if (this.wantsToSpawnGolem(time)) { AABB axisalignedbb = this.getBoundingBox().inflate(10.0D, 10.0D, 10.0D); List list = world.getEntitiesOfClass(Villager.class, axisalignedbb); -@@ -1097,6 +1197,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -1089,6 +1194,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public void startSleeping(BlockPos pos) { @@ -14377,7 +14366,7 @@ 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 0ce0286ceb0518edee1be9466a9116dd28bb2d76..5a93838f6c9528224d88331dcec4feae3303de90 100644 +index 1d292f4bae3eadfde0637cf0a8b49ff53eb21ac9..91ec3d395580ddd046a0d95a42eee6c0ab9cc5cd 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; @@ -16660,7 +16649,7 @@ index f13943db6f2fb923c52dcf9e8bf7000041d0a362..99ef8d7e3ee0ee9777d12ad825e728c3 BeaconBlockEntity.playSound(world, pos, SoundEvents.BEACON_AMBIENT); } diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -index 41c9f074203915c31c1ae7a160ce509c13383f84..5344393f62af19c3591f54a6ebc40b2e4c3b6226 100644 +index 41c9f074203915c31c1ae7a160ce509c13383f84..d6316aec8860ed3e579c1adb0b4578517ce0b885 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java @@ -43,7 +43,7 @@ public class BeehiveBlockEntity extends BlockEntity { @@ -16672,29 +16661,15 @@ index 41c9f074203915c31c1ae7a160ce509c13383f84..5344393f62af19c3591f54a6ebc40b2e public BeehiveBlockEntity(BlockPos pos, BlockState state) { super(BlockEntityType.BEEHIVE, pos, state); -@@ -130,6 +130,36 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -130,6 +130,22 @@ public class BeehiveBlockEntity extends BlockEntity { return list; } + // Purpur start -+ public List releaseBees(BlockState iblockdata, Level level, BeehiveBlockEntity.BeeReleaseStatus tileentitybeehive_releasestatus, boolean force) { ++ public List releaseBee(BlockState iblockdata, BeeData data, BeehiveBlockEntity.BeeReleaseStatus tileentitybeehive_releasestatus, boolean force) { + List list = Lists.newArrayList(); + -+ this.stored.removeIf((tileentitybeehive_hivebee) -> { -+ return BeehiveBlockEntity.releaseBee(level, this.worldPosition, iblockdata, tileentitybeehive_hivebee, list, tileentitybeehive_releasestatus, this.savedFlowerPos, force); -+ }); -+ -+ if (!list.isEmpty()) { -+ super.setChanged(); -+ } -+ -+ return list; -+ } -+ -+ public List releaseBee(BlockState iblockdata, Level level, BeeData data, BeehiveBlockEntity.BeeReleaseStatus tileentitybeehive_releasestatus, boolean force) { -+ List list = Lists.newArrayList(); -+ -+ BeehiveBlockEntity.releaseBee(level, this.worldPosition, iblockdata, data, list, tileentitybeehive_releasestatus, this.savedFlowerPos, force); ++ BeehiveBlockEntity.releaseBee(this.level, this.worldPosition, iblockdata, data, list, tileentitybeehive_releasestatus, this.savedFlowerPos, force); + + if (!list.isEmpty()) { + stored.remove(data); @@ -16709,7 +16684,7 @@ index 41c9f074203915c31c1ae7a160ce509c13383f84..5344393f62af19c3591f54a6ebc40b2e public void addOccupant(Entity entity, boolean hasNectar) { this.addOccupantWithPresetTicks(entity, hasNectar, 0); } -@@ -139,6 +169,12 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -139,6 +155,12 @@ public class BeehiveBlockEntity extends BlockEntity { return this.stored.size(); } @@ -16722,7 +16697,7 @@ index 41c9f074203915c31c1ae7a160ce509c13383f84..5344393f62af19c3591f54a6ebc40b2e // Paper start - Add EntityBlockStorage clearEntities public void clearBees() { this.stored.clear(); -@@ -203,7 +239,7 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -203,7 +225,7 @@ public class BeehiveBlockEntity extends BlockEntity { } private static boolean releaseBee(Level world, BlockPos blockposition, BlockState iblockdata, BeehiveBlockEntity.BeeData tileentitybeehive_hivebee, @Nullable List list, BeehiveBlockEntity.BeeReleaseStatus tileentitybeehive_releasestatus, @Nullable BlockPos blockposition1, boolean force) { @@ -16731,7 +16706,7 @@ index 41c9f074203915c31c1ae7a160ce509c13383f84..5344393f62af19c3591f54a6ebc40b2e // CraftBukkit end return false; } else { -@@ -425,9 +461,9 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -425,9 +447,9 @@ public class BeehiveBlockEntity extends BlockEntity { private BeeReleaseStatus() {} } @@ -17515,7 +17490,7 @@ index 03fc90a470c0f63d44161843cac88bea09166858..88640ac32d70ced6e8b1984663e1c492 + // Purpur end - OfflinePlayer API } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 4632619ea57ce3ac36061a727e023b11cb0ca7e4..47794e6f0fed60b361bb330dff411af0e93becdf 100644 +index e195fd0a489985eebf432f350d7e84afece1529d..a50d36ab25d379239088f89b451f525bc57a3306 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -403,6 +403,20 @@ public final class CraftServer implements Server { @@ -17646,7 +17621,7 @@ index 4632619ea57ce3ac36061a727e023b11cb0ca7e4..47794e6f0fed60b361bb330dff411af0 @Override public void restart() { org.spigotmc.RestartCommand.restart(); -@@ -3200,4 +3279,15 @@ public final class CraftServer implements Server { +@@ -3205,4 +3284,15 @@ public final class CraftServer implements Server { } // Gale end - YAPFA - last tick time - API @@ -17716,7 +17691,7 @@ index b017cfd4671488cebdcf3e0fe9ae10b09f759889..44c524140ae39a6428d717dc89644c41 public PersistentDataContainer getPersistentDataContainer() { return this.persistentDataContainer; diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 548abace550afee0f6ffb15ea83b940585c59f8c..05f6d24ff60809e270e3c2300e2f2aa38176ae41 100644 +index 4be1f93d518329c1c5cff9ed2c77999cb6e44e8d..9213110d0084ff06657e08437ae079f1c5a9cb66 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -194,6 +194,14 @@ public class Main { @@ -17744,7 +17719,7 @@ index 548abace550afee0f6ffb15ea83b940585c59f8c..05f6d24ff60809e270e3c2300e2f2aa3 Calendar deadline = Calendar.getInstance(); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java -index 380897c010521f368848a3e6986d307cf47ff319..3c5eae31dc229b8c5f15215be9462410bcb41f07 100644 +index 2b906fccdb0a5ecddaf487ee931d05b511f84351..7011f0c22b4ede8423ed702d5adb9674aa8a315c 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java @@ -16,8 +16,15 @@ import org.bukkit.entity.Bee; @@ -17756,23 +17731,14 @@ index 380897c010521f368848a3e6986d307cf47ff319..3c5eae31dc229b8c5f15215be9462410 public CraftBeehive(World world, BeehiveBlockEntity tileEntity) { super(world, tileEntity); + // Purpur start - load bees to be able to modify them individually -+ for(BeehiveBlockEntity.BeeData data : getSnapshot().getStored()) { ++ for(BeehiveBlockEntity.BeeData data : tileEntity.getStored()) { + storage.add(new org.purpurmc.purpur.entity.PurpurStoredBee(data, this)); + } + // Purpur end } - @Override -@@ -66,25 +73,67 @@ public class CraftBeehive extends CraftBlockEntityState impl - List bees = new ArrayList<>(); - - if (isPlaced()) { -- BeehiveBlockEntity beehive = ((BeehiveBlockEntity) this.getTileEntityFromWorld()); -- for (Entity bee : beehive.releaseBees(this.getHandle(), BeeReleaseStatus.BEE_RELEASED, true)) { -+ // Purpur start - change which releaseBees method is called, and use beehive snapshot -+ BeehiveBlockEntity beehive = ((BeehiveBlockEntity) this.getSnapshot()); -+ for (Entity bee : beehive.releaseBees(this.getHandle(), getWorldHandle().getMinecraftWorld(), BeeReleaseStatus.BEE_RELEASED, true)) { -+ // Purpur end + protected CraftBeehive(CraftBeehive state) { +@@ -75,15 +82,54 @@ public class CraftBeehive extends CraftBlockEntityState impl bees.add((Bee) bee.getBukkitEntity()); } } @@ -17791,10 +17757,10 @@ index 380897c010521f368848a3e6986d307cf47ff319..3c5eae31dc229b8c5f15215be9462410 + } + + if(isPlaced()) { -+ BeehiveBlockEntity beehive = this.getSnapshot(); ++ BeehiveBlockEntity beehive = ((BeehiveBlockEntity) this.getTileEntityFromWorld()); + BeehiveBlockEntity.BeeData data = ((org.purpurmc.purpur.entity.PurpurStoredBee) entity).getHandle(); + -+ List list = beehive.releaseBee(getHandle(), getWorldHandle().getMinecraftWorld(), data, BeeReleaseStatus.BEE_RELEASED, true); ++ List list = beehive.releaseBee(getHandle(), data, BeeReleaseStatus.BEE_RELEASED, true); + + if (list.size() == 1) { + storage.remove(entity); @@ -17826,7 +17792,9 @@ index 380897c010521f368848a3e6986d307cf47ff319..3c5eae31dc229b8c5f15215be9462410 + } + // Purpur end } - // Paper start - Add EntityBlockStorage clearEntities + + @Override +@@ -95,6 +141,7 @@ public class CraftBeehive extends CraftBlockEntityState impl @Override public void clearEntities() { getSnapshot().clearBees(); @@ -17893,7 +17861,7 @@ index d657fd2c507a5b215aeab0a5f3e9c2ee892a27c8..985e9ec21c60a1f47973bd5fc53b96a6 // Paper start @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index e932cfac619c30b8c7444a9fa41e0403a6eadf6a..431e3cedde33b33202be1d44bf066323997f21f8 100644 +index 315d8260e196709ed9084272aa640f11e327c0a8..ee419545d9ddd1def10781f57b6f3dcbb802b9f2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -223,6 +223,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -17919,7 +17887,7 @@ index e932cfac619c30b8c7444a9fa41e0403a6eadf6a..431e3cedde33b33202be1d44bf066323 return false; } -@@ -1506,4 +1515,27 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1523,4 +1532,27 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return this.getHandle().getScoreboardName(); } // Paper end - entity scoreboard name @@ -18127,7 +18095,7 @@ index 0ad16ee7b33582d214dab41eeee378d52c8e38ed..16bd1294c219f15ada653ef810bc2d74 + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e188bb3ba5d2ec28421947c0b66b25eecb569bfe..28910943e5efcdf24865b961fba161b7d1e4a8f5 100644 +index 604ed1f6742a6b028b9db2809f7bd4b9a3b38f4d..b6515c469ae3ff06daf631f0d5e5f792b41f8e48 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -519,10 +519,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -18340,7 +18308,7 @@ index e16459c9cfcac790edd6d912750d32c68387cbbc..890938ad866e2c588f3f819230ba121b + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 50fed722bbba5c663e4be33a179ea75dfa2dd9e9..c3eaef001e6d7be7f16977c3f539d5d4a478c734 100644 +index 193ad79f57255b1ea4cf7930071b4f4988dc2b04..05039f5d90c9c039a776d56befe2dfe201d95475 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -592,6 +592,15 @@ public class CraftEventFactory { @@ -18459,6 +18427,28 @@ index 88d3ca586ff6905f18a8ab9f0e229f440ed44088..27dd4eb4781a3c75772860c11db886e1 + public void setDoUnsafeEnchants(boolean canDoUnsafeEnchants) { + container.canDoUnsafeEnchants = canDoUnsafeEnchants; + } ++ // Purpur end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +index 57f4cf40359fe9bb427eb0134660d00839a63c86..7e66cab93d13c296433493da86c93aebca3622de 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +@@ -559,4 +559,17 @@ public final class CraftItemFactory implements ItemFactory { + return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror(); + } + // Paper end ++ ++ // Purpur start ++ @Override ++ public @org.jetbrains.annotations.NotNull java.util.List getHoverLines(@org.jetbrains.annotations.NotNull ItemStack itemStack, boolean advanced) { ++ return io.papermc.paper.adventure.PaperAdventure.asAdventure( ++ CraftItemStack.asNMSCopy(itemStack).getTooltipLines( ++ null, ++ advanced ? net.minecraft.world.item.TooltipFlag.ADVANCED ++ : net.minecraft.world.item.TooltipFlag.NORMAL ++ ) ++ ); ++ } + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java @@ -24713,7 +24703,7 @@ index 0000000000000000000000000000000000000000..b7586f494528f30eb0da82420d3bcf5b + } +} diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 9893084bacba0087ea5241d6ea4eb5ef5fabe462..4490f1240304ac8c4600ca1182bfa363c2aae69c 100644 +index c5924bd66cc238a361cb56f623ea3e2c1579b02c..f1c24f2c2fa3bc6b0dabeb819fccb5fff61b736a 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; @@ -24724,7 +24714,7 @@ index 9893084bacba0087ea5241d6ea4eb5ef5fabe462..4490f1240304ac8c4600ca1182bfa363 import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.animal.horse.Llama; import net.minecraft.world.entity.boss.EnderDragonPart; -@@ -217,6 +218,7 @@ public class ActivationRange +@@ -214,6 +215,7 @@ public class ActivationRange continue; } @@ -24732,7 +24722,7 @@ index 9893084bacba0087ea5241d6ea4eb5ef5fabe462..4490f1240304ac8c4600ca1182bfa363 // Paper start int worldHeight = world.getHeight(); ActivationRange.maxBB = player.getBoundingBox().inflate( maxRange, worldHeight, maxRange ); -@@ -415,6 +417,7 @@ public class ActivationRange +@@ -393,6 +395,7 @@ public class ActivationRange */ public static boolean checkIfActive(Entity entity) { diff --git a/patches/server/0010-Remove-Timings.patch b/patches/server/0006-Remove-Timings.patch similarity index 96% rename from patches/server/0010-Remove-Timings.patch rename to patches/server/0006-Remove-Timings.patch index 1402d1e0..2de13ea5 100644 --- a/patches/server/0010-Remove-Timings.patch +++ b/patches/server/0006-Remove-Timings.patch @@ -833,23 +833,27 @@ index b66a7d4aab887309579154815a0d4abf9de506b0..78cb9d7da9bb025ea362028fdc9d0317 return executedUnloadTask | canSaveChunk | canSaveEntities | canSavePOI ? new SaveStat(executedUnloadTask || canSaveChunk, canSaveEntities, canSavePOI): null; } diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 5013dd1d875f7ca56ac36ef5f5505227018cb1f2..d375d0bc4aab326ad26f7a18c040f5a6c7dbf705 100644 +index d840237674c67c739e0f990a89f77a31cb706558..942c2a826f9a4f8c66f2dcd0e7f25432edc4e836 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -1,6 +1,5 @@ +@@ -1,7 +1,7 @@ package io.papermc.paper.configuration; -import co.aikar.timings.MinecraftTimings; - import io.papermc.paper.configuration.constraint.Constraint; + import com.mojang.logging.LogUtils; ++import io.papermc.paper.configuration.constraint.Constraint; import io.papermc.paper.configuration.constraint.Constraints; - import io.papermc.paper.configuration.type.IntOr; -@@ -87,37 +86,6 @@ public class GlobalConfiguration extends ConfigurationPart { + import io.papermc.paper.configuration.type.number.IntOr; + import net.kyori.adventure.text.Component; +@@ -90,39 +90,6 @@ public class GlobalConfiguration extends ConfigurationPart { public boolean useDisplayNameInQuitMessage = false; } +- @Deprecated(forRemoval = true) - public Timings timings; - -- public class Timings extends ConfigurationPart.Post { +- @Deprecated(forRemoval = true) +- public class Timings extends ConfigurationPart { - // Gale start - recommend disabling timings on startup - public boolean enabled = false; // Gale - set default value to false - public boolean warnIfEnabled = true; @@ -865,8 +869,8 @@ index 5013dd1d875f7ca56ac36ef5f5505227018cb1f2..d375d0bc4aab326ad26f7a18c040f5a6 - public int historyLength = 3600; - public String serverName = "Unknown Server"; - -- @Override -- public void postProcess() { +- @PostProcess +- private void postProcess() { - // Gale start - recommend disabling timings on startup - if (enabled && warnIfEnabled) { - net.minecraft.server.MinecraftServer.LOGGER.warn("To improve performance, we recommend setting timings.enabled to false in paper-global.yml"); @@ -958,7 +962,7 @@ index 9a49f5271ec1d9de17632bfffe8309cb1ba0d8b1..1bf374d482acba25614ae303d1fa72ed } catch (Exception exception) { if (exception instanceof ReportedException) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af84d29f25d 100644 +index bc886017d72ca26655478c5f48f2b79689ab908c..6ff78398c0726714ae6cc0cc8da35503d18fcb78 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -179,8 +179,6 @@ import org.bukkit.craftbukkit.Main; @@ -970,7 +974,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8 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 -@@ -917,7 +915,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return !this.canSleepForTickNoOversleep(); // Paper - move oversleep into full server tick -@@ -1377,15 +1374,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { entityplayer.connection.suspendFlushing(); }); @@ -1035,7 +1039,7 @@ index 995dd071082e482785448678b9189f0715a75308..233325eab66a856eaa56abc3f0cc8af8 // Paper start - Folia scheduler API ((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick(); getAllLevels().forEach(level -> { -@@ -1494,20 +1482,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur -@@ -1547,14 +1529,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return ichunkaccess1; -@@ -445,17 +443,13 @@ public class ServerChunkCache extends ChunkSource { +@@ -442,17 +440,13 @@ public class ServerChunkCache extends ChunkSource { public void save(boolean flush) { this.runDistanceManagerUpdates(); @@ -1278,7 +1282,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7 } // Paper end -@@ -481,20 +475,14 @@ public class ServerChunkCache extends ChunkSource { +@@ -478,20 +472,14 @@ public class ServerChunkCache extends ChunkSource { @Override public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { @@ -1299,7 +1303,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7 this.clearCache(); } -@@ -520,7 +508,6 @@ public class ServerChunkCache extends ChunkSource { +@@ -517,7 +505,6 @@ public class ServerChunkCache extends ChunkSource { boolean flag2AndHasNaturalSpawn = flag2 && this.anySpawnCategoryIsSpawnedThisTick(); if (flag2AndHasNaturalSpawn) { // Gale end - MultiPaper - skip unnecessary mob spawning computations @@ -1307,15 +1311,15 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7 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 -@@ -550,7 +537,6 @@ public class ServerChunkCache extends ChunkSource { - // Pufferfish end +@@ -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); } // Paper end - this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings - //this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously + this.lastSpawnState = spawnercreature_d; // Paper - optimise chunk tick iteration -@@ -560,9 +546,6 @@ public class ServerChunkCache extends ChunkSource { +@@ -550,9 +536,6 @@ public class ServerChunkCache extends ChunkSource { spawnercreature_d = null; } // Gale end - MultiPaper - skip unnecessary mob spawning computations @@ -1325,7 +1329,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7 // Paper start - optimise chunk tick iteration ChunkMap playerChunkMap = this.chunkMap; -@@ -663,15 +646,10 @@ public class ServerChunkCache extends ChunkSource { +@@ -653,15 +636,10 @@ public class ServerChunkCache extends ChunkSource { } } // Paper end - optimise chunk tick iteration @@ -1341,7 +1345,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7 // Paper start - optimise chunk tick iteration if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) { it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet copy = this.chunkMap.needsChangeBroadcasting.clone(); -@@ -685,7 +663,6 @@ public class ServerChunkCache extends ChunkSource { +@@ -675,7 +653,6 @@ public class ServerChunkCache extends ChunkSource { } } // Paper end - optimise chunk tick iteration @@ -1350,7 +1354,7 @@ index f5584de85ca4b95be9b107df562ebf3963ad1b5a..acaa1575a2d7164174d9514d750696d7 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 a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b..260a69194c92257a917b17fcb13045c8541270a3 100644 +index a01bce7c699658f8043e6b3eb6983af70c2bbc0f..b487eb9538681db2d0bcd9710a9d73ffa9c76a0c 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 @@ @@ -1397,9 +1401,9 @@ index a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b..260a69194c92257a917b17fcb13045c8 org.spigotmc.ActivationRange.activateEntities(this); // Spigot - timings.entityTick.startTiming(); // Spigot this.entityTickList.forEach((entity) -> { - entity.activatedPriorityReset = false; // Pufferfish - DAB if (!entity.isRemoved()) { -@@ -920,8 +909,6 @@ public class ServerLevel extends Level implements WorldGenLevel { + 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 { } } }); @@ -1408,7 +1412,7 @@ index a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b..260a69194c92257a917b17fcb13045c8 this.tickBlockEntities(); } -@@ -1054,7 +1041,6 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1053,7 +1040,6 @@ public class ServerLevel extends Level implements WorldGenLevel { } // Paper // Paper start - optimise random block ticking @@ -1416,7 +1420,7 @@ index a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b..260a69194c92257a917b17fcb13045c8 if (randomTickSpeed > 0) { LevelChunkSection[] sections = chunk.getSections(); final int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this); -@@ -1086,8 +1072,6 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1085,8 +1071,6 @@ public class ServerLevel extends Level implements WorldGenLevel { } } // Paper end - optimise random block ticking @@ -1528,7 +1532,7 @@ index a3ab2f88c0fdfab8e03911df6d6f4b2cdd30542b..260a69194c92257a917b17fcb13045c8 } 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 c82a310bd69abf30b39e4b96d1ef2b43283ecdbe..ef84bdb881160bbe7b2ceb97f0ea9f35d50f96f1 100644 +index 9d5f3bd830b547ff238dcef60aa00121038ba5f8..32c4e1c1157151e954ee7f99a9dedbb1741f7a6d 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 @@ -1584,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 5930e45bae5aa86b3cedb811c4c9bb92099bc1b5..540bafec1e973e7461c6c09228d801d4303b0e56 100644 +index a9f69e4f880711c21ef28bd079960ef8f12da25c..4f031c68fa0788d782dd0124fe3b9669b8f1639d 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -336,15 +336,6 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -334,15 +334,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) { @@ -1603,7 +1607,7 @@ index 5930e45bae5aa86b3cedb811c4c9bb92099bc1b5..540bafec1e973e7461c6c09228d801d4 this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this); this.factory = factory; this.category = spawnGroup; -@@ -714,12 +705,6 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -712,12 +703,6 @@ public class EntityType implements FeatureElement, EntityTypeT return this.updateInterval; } @@ -1616,7 +1620,7 @@ index 5930e45bae5aa86b3cedb811c4c9bb92099bc1b5..540bafec1e973e7461c6c09228d801d4 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; } -@@ -829,7 +814,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -827,7 +812,7 @@ public class EntityType implements FeatureElement, EntityTypeT Util.fetchChoiceType(References.ENTITY_TREE, id); } @@ -1870,7 +1874,7 @@ index 648481ad582e855e348dee28fa1cdd752ff6761b..f7958733a2321b34fbcb660e9c29fc14 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 47794e6f0fed60b361bb330dff411af0e93becdf..0a27a839d33c95d89aa352f374aa1877fb99acca 100644 +index a50d36ab25d379239088f89b451f525bc57a3306..76621b258b2d63099959e77d113f279aa71d7d4f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -475,7 +475,6 @@ public final class CraftServer implements Server { @@ -1882,7 +1886,7 @@ index 47794e6f0fed60b361bb330dff411af0e93becdf..0a27a839d33c95d89aa352f374aa1877 console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 05f6d24ff60809e270e3c2300e2f2aa38176ae41..6d6e5ff97cb6a0cd1897c7c32341f67364f5693d 100644 +index 9213110d0084ff06657e08437ae079f1c5a9cb66..bb42788a84cd161d22f29e271da7373df50cac21 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -371,8 +371,6 @@ public class Main { @@ -2065,10 +2069,10 @@ index 7f4e0a4bff74bcb56f455f3ea76bb1d96d71e1ad..e0d631c2e692fa61e252a418a5eebf78 @Override public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java -index 5b7e2afd8ecc5b8bbe524d4ba6e1d0ac0282878b..3f12cf7608f8966b8a4279c17f86c5d7e1002714 100644 +index 104316a79771cfd9fce6883499fca268eed223c4..357dafd28c77b3fdd16f51381d59c6c40dcfd1d1 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java -@@ -79,41 +79,6 @@ public class GaleGlobalConfiguration extends ConfigurationPart { +@@ -80,41 +80,6 @@ public class GaleGlobalConfiguration extends ConfigurationPart { public int premiumAccountSlowLoginTimeout = -1; // Gale - make slow login timeout configurable public boolean ignoreNullLegacyStructureData = false; // Gale - MultiPaper - ignore null legacy structure data @@ -2271,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 4490f1240304ac8c4600ca1182bfa363c2aae69c..1c5a23890b5f0daa96951b0f7d5c4e2d704f2869 100644 +index f1c24f2c2fa3bc6b0dabeb819fccb5fff61b736a..2ab536b4fb94f9c5f2e60b2b3e9f5ab13e03c73c 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; @@ -2282,7 +2286,7 @@ index 4490f1240304ac8c4600ca1182bfa363c2aae69c..1c5a23890b5f0daa96951b0f7d5c4e2d import net.minecraft.world.entity.schedule.Activity; import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; -@@ -184,7 +183,6 @@ public class ActivationRange +@@ -181,7 +180,6 @@ public class ActivationRange */ public static void activateEntities(Level world) { @@ -2290,7 +2294,7 @@ index 4490f1240304ac8c4600ca1182bfa363c2aae69c..1c5a23890b5f0daa96951b0f7d5c4e2d final int miscActivationRange = world.spigotConfig.miscActivationRange; final int raiderActivationRange = world.spigotConfig.raiderActivationRange; final int animalActivationRange = world.spigotConfig.animalActivationRange; -@@ -264,7 +262,6 @@ public class ActivationRange +@@ -242,7 +240,6 @@ public class ActivationRange } // Paper end } diff --git a/patches/server/0011-Purpur-Configurable-server-mod-name.patch b/patches/server/0007-Purpur-Configurable-server-mod-name.patch similarity index 82% rename from patches/server/0011-Purpur-Configurable-server-mod-name.patch rename to patches/server/0007-Purpur-Configurable-server-mod-name.patch index 7db0283a..5477c00a 100644 --- a/patches/server/0011-Purpur-Configurable-server-mod-name.patch +++ b/patches/server/0007-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 233325eab66a856eaa56abc3f0cc8af84d29f25d..b54a764c2a24f8e09792ade7a9a4ebb17d9d4e7b 100644 +index 6ff78398c0726714ae6cc0cc8da35503d18fcb78..dfe06a0f0d3c6ed0ce89c632a8b2cd050cc2e6a7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1662,7 +1662,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop classes = new HashSet<>(); + + final StringPool pool = new StringPool(); diff --git a/patches/server/0013-Remove-Mojang-username-check.patch b/patches/server/0009-Remove-Mojang-username-check.patch similarity index 93% rename from patches/server/0013-Remove-Mojang-username-check.patch rename to patches/server/0009-Remove-Mojang-username-check.patch index 6abafc7c..e0989aa0 100644 --- a/patches/server/0013-Remove-Mojang-username-check.patch +++ b/patches/server/0009-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 80a196442edbc6b4eb44bb6a405100871aea2f6a..1e9a440d790bdd521c58dfc9c1575e2759006d02 100644 +index c9c926ec7129eaf235803a8b48a014e74385ac23..540b137c7f697001a325f57d06e2a0d69fae37ce 100644 --- a/src/main/java/org/dreeam/leaf/LeafConfig.java +++ b/src/main/java/org/dreeam/leaf/LeafConfig.java -@@ -169,7 +169,11 @@ public class LeafConfig { +@@ -165,7 +165,11 @@ public class LeafConfig { serverModName = getString("server-mod-name", serverModName); } @@ -36,4 +36,4 @@ index 80a196442edbc6b4eb44bb6a405100871aea2f6a..1e9a440d790bdd521c58dfc9c1575e27 + "enabling all characters as username"); } - public static boolean enableAsyncMobSpawning = true; + private static void performance() { diff --git a/patches/server/0014-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch b/patches/server/0010-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch similarity index 92% rename from patches/server/0014-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch rename to patches/server/0010-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch index 825932b0..1f914eab 100644 --- a/patches/server/0014-Remove-Spigot-Check-for-Broken-BungeeCord-Configurat.patch +++ b/patches/server/0010-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 1e9a440d790bdd521c58dfc9c1575e2759006d02..267f88d799fe98d1741a837c33d8c748362077ee 100644 +index 540b137c7f697001a325f57d06e2a0d69fae37ce..1955a44a2cd178818bc53f4a56d7d0350cef80c8 100644 --- a/src/main/java/org/dreeam/leaf/LeafConfig.java +++ b/src/main/java/org/dreeam/leaf/LeafConfig.java -@@ -170,10 +170,14 @@ public class LeafConfig { +@@ -166,10 +166,14 @@ public class LeafConfig { } public static boolean removeMojangUsernameCheck = true; @@ -35,4 +35,4 @@ index 1e9a440d790bdd521c58dfc9c1575e2759006d02..267f88d799fe98d1741a837c33d8c748 + "without backend server enabling its bungee mode"); } - public static boolean enableAsyncMobSpawning = true; + private static void performance() { diff --git a/patches/server/0015-Remove-UseItemOnPacket-Too-Far-Check.patch b/patches/server/0011-Remove-UseItemOnPacket-Too-Far-Check.patch similarity index 89% rename from patches/server/0015-Remove-UseItemOnPacket-Too-Far-Check.patch rename to patches/server/0011-Remove-UseItemOnPacket-Too-Far-Check.patch index 2184d209..b113209c 100644 --- a/patches/server/0015-Remove-UseItemOnPacket-Too-Far-Check.patch +++ b/patches/server/0011-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 ef84bdb881160bbe7b2ceb97f0ea9f35d50f96f1..aa8f5320d027518dfe28548424c4a6477deeb45e 100644 +index 32c4e1c1157151e954ee7f99a9dedbb1741f7a6d..c005afe12d775036d11b04189167f2476e66a30f 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 ef84bdb881160bbe7b2ceb97f0ea9f35d50f96f1..aa8f5320d027518dfe28548424c4a647 this.player.resetLastActionTime(); diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java -index 267f88d799fe98d1741a837c33d8c748362077ee..83fee46886a21349d652b6bc871bd03ffbac2a7d 100644 +index 1955a44a2cd178818bc53f4a56d7d0350cef80c8..9a29a8c414b32376f7398e96a27eda1e477cb83e 100644 --- a/src/main/java/org/dreeam/leaf/LeafConfig.java +++ b/src/main/java/org/dreeam/leaf/LeafConfig.java -@@ -171,6 +171,8 @@ public class LeafConfig { +@@ -167,6 +167,8 @@ public class LeafConfig { public static boolean removeMojangUsernameCheck = true; public static boolean removeSpigotCheckBungeeConfig = true; @@ -32,7 +32,7 @@ index 267f88d799fe98d1741a837c33d8c748362077ee..83fee46886a21349d652b6bc871bd03f private static void removal() { removeMojangUsernameCheck = getBoolean("remove-Mojang-username-check", removeMojangUsernameCheck, "Remove username check of Mojang", -@@ -178,6 +180,9 @@ public class LeafConfig { +@@ -174,6 +176,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 267f88d799fe98d1741a837c33d8c748362077ee..83fee46886a21349d652b6bc871bd03f + maxUseItemDistance = getDouble("max-UseItem-distance", maxUseItemDistance, "The max distance of UseItem for players"); } - public static boolean enableAsyncMobSpawning = true; + private static void performance() { diff --git a/patches/server/0016-KTP-Optimize-spigot-event-bus.patch b/patches/server/0012-KTP-Optimize-spigot-event-bus.patch similarity index 100% rename from patches/server/0016-KTP-Optimize-spigot-event-bus.patch rename to patches/server/0012-KTP-Optimize-spigot-event-bus.patch diff --git a/patches/server/0017-KeYi-Player-Skull-API.patch b/patches/server/0013-KeYi-Player-Skull-API.patch similarity index 95% rename from patches/server/0017-KeYi-Player-Skull-API.patch rename to patches/server/0013-KeYi-Player-Skull-API.patch index 0fc71c72..d40243ab 100644 --- a/patches/server/0017-KeYi-Player-Skull-API.patch +++ b/patches/server/0013-KeYi-Player-Skull-API.patch @@ -7,7 +7,7 @@ Original license: MIT Original project: https://github.com/KeYiMC/KeYi diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 28910943e5efcdf24865b961fba161b7d1e4a8f5..f8cbec0c5dee624280f3c28f4b1b7de4f2ee8c8f 100644 +index b6515c469ae3ff06daf631f0d5e5f792b41f8e48..1c06a414abe91085216c07b12cd4310b586fecb3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -29,6 +29,11 @@ import java.util.Optional; diff --git a/patches/server/0018-KeYi-Disable-arrow-despawn-counter-by-default.patch b/patches/server/0014-KeYi-Disable-arrow-despawn-counter-by-default.patch similarity index 90% rename from patches/server/0018-KeYi-Disable-arrow-despawn-counter-by-default.patch rename to patches/server/0014-KeYi-Disable-arrow-despawn-counter-by-default.patch index e15bad5d..65bffcbb 100644 --- a/patches/server/0018-KeYi-Disable-arrow-despawn-counter-by-default.patch +++ b/patches/server/0014-KeYi-Disable-arrow-despawn-counter-by-default.patch @@ -7,10 +7,10 @@ Original license: MIT Original project: https://github.com/KeYiMC/KeYi diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java -index 4a4a8360c4286e06d88049512bf44237d2622f01..582640872ead7b9b4107fa5cc8f4e204b9d8bcc7 100644 +index 5fe6f626b63274e33f7c8b46441d17cf4ff9d533..1b1bf657993c2a96d7168e3b1161872839a6e67a 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java -@@ -139,7 +139,7 @@ public class GaleWorldConfiguration extends ConfigurationPart { +@@ -140,7 +140,7 @@ public class GaleWorldConfiguration extends ConfigurationPart { public boolean loadPortalDestinationChunkBeforeEntityTeleport = false; // Gale - MultiPaper - load portal destination chunk before entity teleport } diff --git a/patches/server/0019-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch b/patches/server/0015-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch similarity index 67% rename from patches/server/0019-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch rename to patches/server/0015-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch index ef13595c..0487f9c9 100644 --- a/patches/server/0019-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch +++ b/patches/server/0015-KeYi-Add-an-option-for-spigot-item-merging-mechanism.patch @@ -7,7 +7,7 @@ Original license: MIT Original project: https://github.com/KeYiMC/KeYi diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 3ff5c2a4a2cca5c9a89ceafd9fddeb1012344433..90ab4610026b23ac84e6c941c6581d13fe3565a2 100644 +index 07f1f6c9613150fd1cdd460a940629a67539d8db..0fe02df86483809cef22fca2e2ce0af7b4a5c6d5 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -331,7 +331,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -20,21 +20,15 @@ index 3ff5c2a4a2cca5c9a89ceafd9fddeb1012344433..90ab4610026b23ac84e6c941c6581d13 } 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 83fee46886a21349d652b6bc871bd03ffbac2a7d..fc3938c16c43277e22b7a322177fa2a9150f1ff8 100644 +index 9a29a8c414b32376f7398e96a27eda1e477cb83e..4b6ba35724d364da8397d991ba8453f22911ed07 100644 --- a/src/main/java/org/dreeam/leaf/LeafConfig.java +++ b/src/main/java/org/dreeam/leaf/LeafConfig.java -@@ -194,6 +194,7 @@ public class LeafConfig { - public static int activationDistanceMod = 8; - public static boolean throttleInactiveGoalSelectorTick = true; - public static Map projectileTimeouts; +@@ -181,7 +181,9 @@ public class LeafConfig { + maxUseItemDistance = getDouble("max-UseItem-distance", maxUseItemDistance, "The max distance of UseItem for players"); + } + + 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/0020-Carpet-Fixes-Optimized-getBiome-method.patch b/patches/server/0016-Carpet-Fixes-Optimized-getBiome-method.patch similarity index 100% rename from patches/server/0020-Carpet-Fixes-Optimized-getBiome-method.patch rename to patches/server/0016-Carpet-Fixes-Optimized-getBiome-method.patch diff --git a/patches/server/0021-Carpet-Fixes-Use-optimized-RecipeManager.patch b/patches/server/0017-Carpet-Fixes-Use-optimized-RecipeManager.patch similarity index 100% rename from patches/server/0021-Carpet-Fixes-Use-optimized-RecipeManager.patch rename to patches/server/0017-Carpet-Fixes-Use-optimized-RecipeManager.patch diff --git a/patches/server/0022-Akarin-Save-Json-list-asynchronously.patch b/patches/server/0018-Akarin-Save-Json-list-asynchronously.patch similarity index 100% rename from patches/server/0022-Akarin-Save-Json-list-asynchronously.patch rename to patches/server/0018-Akarin-Save-Json-list-asynchronously.patch diff --git a/patches/server/0023-Slice-Smooth-Teleports.patch b/patches/server/0019-Slice-Smooth-Teleports.patch similarity index 94% rename from patches/server/0023-Slice-Smooth-Teleports.patch rename to patches/server/0019-Slice-Smooth-Teleports.patch index 10f9099f..7551ace2 100644 --- a/patches/server/0023-Slice-Smooth-Teleports.patch +++ b/patches/server/0019-Slice-Smooth-Teleports.patch @@ -7,10 +7,10 @@ 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 849a740430abc4ed762adcfefa6b5b10515b3bff..ab2a7440afd2ef6fa0c78888c5072012e73fddc7 100644 +index e0fdc3156bec8c39a23c322f888826f710e36ddd..3c29dd986d8de2844087a479372ce4865bdf2bfe 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -278,6 +278,7 @@ public class ServerPlayer extends Player { +@@ -279,6 +279,7 @@ public class ServerPlayer extends Player { private boolean tpsBar = false; // Purpur private boolean compassBar = false; // Purpur private boolean ramBar = false; // Purpur @@ -36,7 +36,7 @@ index 20c061849cbb424fee66a47d9339cfd8a1920660..d20eed35c85cf5118206dbf9ca2c706b entityplayer1.connection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); entityplayer1.connection.send(new ClientboundSetExperiencePacket(entityplayer1.experienceProgress, entityplayer1.totalExperience, entityplayer1.experienceLevel)); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f8cbec0c5dee624280f3c28f4b1b7de4f2ee8c8f..762edca984d02b8a2a4224adba1f240fa9ea0661 100644 +index 1c06a414abe91085216c07b12cd4310b586fecb3..57d3b887b606800d0d1e12b46ae793c50f09bee3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1267,6 +1267,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0024-Parchment-Make-FixLight-use-action-bar.patch b/patches/server/0020-Parchment-Make-FixLight-use-action-bar.patch similarity index 100% rename from patches/server/0024-Parchment-Make-FixLight-use-action-bar.patch rename to patches/server/0020-Parchment-Make-FixLight-use-action-bar.patch diff --git a/patches/server/0025-Leaves-Server-Utils.patch b/patches/server/0021-Leaves-Server-Utils.patch similarity index 86% rename from patches/server/0025-Leaves-Server-Utils.patch rename to patches/server/0021-Leaves-Server-Utils.patch index 3a108af9..6805f621 100644 --- a/patches/server/0025-Leaves-Server-Utils.patch +++ b/patches/server/0021-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 fad58fc3e46ee5ba333d07204c7389eef5dbd7c6..fb2d63fbe1b6c1144f878c417d1407c1fe5d4141 100644 +index a025d009dc277b7e850cabd6fbbcca119f85a9b6..da016b3fceef0d2bac3ca9a0692f3deb04d82abf 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 fad58fc3e46ee5ba333d07204c7389eef5dbd7c6..fb2d63fbe1b6c1144f878c417d1407c1 public void setOrigin(@javax.annotation.Nonnull Location location) { this.origin = location.toVector(); -@@ -2474,6 +2475,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2463,6 +2464,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { nbt.putBoolean("Paper.FreezeLock", true); } // Paper end @@ -26,7 +26,7 @@ index fad58fc3e46ee5ba333d07204c7389eef5dbd7c6..fb2d63fbe1b6c1144f878c417d1407c1 return nbt; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); -@@ -2642,6 +2644,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2631,6 +2633,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { freezeLocked = nbt.getBoolean("Paper.FreezeLock"); } // Paper end @@ -38,7 +38,7 @@ index fad58fc3e46ee5ba333d07204c7389eef5dbd7c6..fb2d63fbe1b6c1144f878c417d1407c1 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); -@@ -5034,4 +5041,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -5023,4 +5030,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return false; } // Purpur end @@ -265,28 +265,3 @@ index 0000000000000000000000000000000000000000..b684d8f576acbc5de8d06b0ff779c257 + return backingMap.size(); + } +} -diff --git a/src/main/java/top/leavesmc/leaves/util/ProtocolUtils.java b/src/main/java/top/leavesmc/leaves/util/ProtocolUtils.java -new file mode 100644 -index 0000000000000000000000000000000000000000..5ce52537e5a05a72ef29a66857920ebd86ff930c ---- /dev/null -+++ b/src/main/java/top/leavesmc/leaves/util/ProtocolUtils.java -@@ -0,0 +1,19 @@ -+package top.leavesmc.leaves.util; -+ -+import net.minecraft.network.FriendlyByteBuf; -+import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; -+import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; -+import net.minecraft.resources.ResourceLocation; -+import net.minecraft.server.level.ServerPlayer; -+import org.jetbrains.annotations.NotNull; -+ -+public class ProtocolUtils { -+ -+ public static void sendPayloadPacket(@NotNull ServerPlayer player, ResourceLocation channel, FriendlyByteBuf data) { -+ player.connection.send(new ClientboundCustomPayloadPacket(data.writeResourceLocation(channel))); -+ } -+ -+ public static boolean isNamespacePacket(@NotNull ServerboundCustomPayloadPacket packet, String namespace) { -+ return packet.payload().id().getNamespace().equals(namespace); -+ } -+} diff --git a/patches/server/0022-Leaves-Protocol-Core.patch b/patches/server/0022-Leaves-Protocol-Core.patch new file mode 100644 index 00000000..7f50e609 --- /dev/null +++ b/patches/server/0022-Leaves-Protocol-Core.patch @@ -0,0 +1,532 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: violetc <58360096+s-yh-china@users.noreply.github.com> +Date: Tue, 26 Sep 2023 19:00:41 +0800 +Subject: [PATCH] Leaves Protocol Core + +Original license: GPLv3 +Original project: https://github.com/LeavesMC/Leaves + +diff --git a/src/main/java/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java b/src/main/java/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java +index 975da2529d18391ed4ecc7359a2d7319129bd872..ae5590b015a2b018188bd7a45b44ec4d4af048a5 100644 +--- a/src/main/java/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java +@@ -20,7 +20,12 @@ public record ServerboundCustomPayloadPacket(CustomPacketPayload payload) implem + + private static CustomPacketPayload readPayload(ResourceLocation id, FriendlyByteBuf buf) { + FriendlyByteBuf.Reader packetdataserializer_a = (FriendlyByteBuf.Reader) ServerboundCustomPayloadPacket.KNOWN_TYPES.get(id); +- ++ // Leaves start - protocol ++ CustomPacketPayload leavesPayload = top.leavesmc.leaves.protocol.core.LeavesProtocolManager.getPayload(id, buf); ++ if (leavesPayload != null) { ++ return leavesPayload; ++ } ++ // Leaves end - protocol + return (CustomPacketPayload) (packetdataserializer_a != null ? (CustomPacketPayload) packetdataserializer_a.apply(buf) : readUnknownPayload(id, buf)); + } + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index dfe06a0f0d3c6ed0ce89c632a8b2cd050cc2e6a7..32cbb5a838152616e049f9a0e2623aab9a01c55a 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>> KNOWN_TYPES = new HashMap<>(); ++ private static final Map> KNOW_RECEIVERS = new HashMap<>(); ++ ++ private static final List TICKERS = new ArrayList<>(); ++ private static final List 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<>(); ++ ++ public static void init() { ++ for (Class clazz : getClasses("top.leavesmc.leaves.protocol")) { ++ final LeavesProtocol protocol = clazz.getAnnotation(LeavesProtocol.class); ++ if (protocol != null) { ++ Set methods; ++ try { ++ Method[] publicMethods = clazz.getMethods(); ++ Method[] privateMethods = clazz.getDeclaredMethods(); ++ methods = new HashSet<>(publicMethods.length + privateMethods.length, 1.0f); ++ Collections.addAll(methods, publicMethods); ++ Collections.addAll(methods, privateMethods); ++ } catch (NoClassDefFoundError e) { ++ e.printStackTrace(); ++ return; ++ } ++ ++ Map> map = new HashMap<>(); ++ for (final Method method : methods) { ++ if (method.isBridge() || method.isSynthetic() || !Modifier.isStatic(method.getModifiers())) { ++ continue; ++ } ++ ++ method.setAccessible(true); ++ ++ final ProtocolHandler.Init init = method.getAnnotation(ProtocolHandler.Init.class); ++ if (init != null) { ++ try { ++ method.invoke(null); ++ } catch (InvocationTargetException | IllegalAccessException e) { ++ e.printStackTrace(); ++ } ++ continue; ++ } ++ ++ final ProtocolHandler.PayloadReceiver receiver = method.getAnnotation(ProtocolHandler.PayloadReceiver.class); ++ if (receiver != null) { ++ try { ++ map.put(receiver, receiver.payload().getConstructor(ResourceLocation.class, FriendlyByteBuf.class)); ++ } catch (NoSuchMethodException e) { ++ e.printStackTrace(); ++ continue; ++ } ++ ++ if (!KNOW_RECEIVERS.containsKey(protocol)) { ++ KNOW_RECEIVERS.put(protocol, new HashMap<>()); ++ } ++ ++ KNOW_RECEIVERS.get(protocol).put(receiver, method); ++ continue; ++ } ++ ++ final ProtocolHandler.Ticker ticker = method.getAnnotation(ProtocolHandler.Ticker.class); ++ if (ticker != null) { ++ TICKERS.add(method); ++ continue; ++ } ++ ++ final ProtocolHandler.PlayerJoin playerJoin = method.getAnnotation(ProtocolHandler.PlayerJoin.class); ++ if (playerJoin != null) { ++ PLAYER_JOIN.add(method); ++ continue; ++ } ++ ++ final ProtocolHandler.PlayerLeave playerLeave = method.getAnnotation(ProtocolHandler.PlayerLeave.class); ++ if (playerLeave != null) { ++ PLAYER_LEAVE.add(method); ++ continue; ++ } ++ ++ final ProtocolHandler.ReloadServer reloadServer = method.getAnnotation(ProtocolHandler.ReloadServer.class); ++ if (reloadServer != null) { ++ RELOAD_SERVER.add(method); ++ continue; ++ } ++ ++ final ProtocolHandler.MinecraftRegister minecraftRegister = method.getAnnotation(ProtocolHandler.MinecraftRegister.class); ++ if (minecraftRegister != null) { ++ MINECRAFT_REGISTER.put(minecraftRegister, method); ++ } ++ } ++ KNOWN_TYPES.put(protocol, map); ++ } ++ } ++ } ++ ++ public static CustomPacketPayload getPayload(ResourceLocation id, FriendlyByteBuf buf) { ++ for (LeavesProtocol protocol : KNOWN_TYPES.keySet()) { ++ if (!protocol.namespace().equals(id.getNamespace()) && !ArrayUtils.contains(protocol.namespaces(), id.getNamespace())) { ++ continue; ++ } ++ ++ Map> map = KNOWN_TYPES.get(protocol); ++ for (ProtocolHandler.PayloadReceiver receiver : map.keySet()) { ++ if (receiver.ignoreId() || receiver.payloadId().equals(id.getPath()) || ArrayUtils.contains(receiver.payloadIds(), id.getPath())) { ++ try { ++ return map.get(receiver).newInstance(id, buf); ++ } catch (InvocationTargetException | InstantiationException | IllegalAccessException e) { ++ e.printStackTrace(); ++ } ++ } ++ } ++ } ++ return null; ++ } ++ ++ public static void handlePayload(ServerPlayer player, CustomPacketPayload payload) { ++ for (LeavesProtocol protocol : KNOW_RECEIVERS.keySet()) { ++ if (!protocol.namespace().equals(payload.id().getNamespace()) && !ArrayUtils.contains(protocol.namespaces(), payload.id().getNamespace())) { ++ continue; ++ } ++ ++ Map map = KNOW_RECEIVERS.get(protocol); ++ for (ProtocolHandler.PayloadReceiver receiver : map.keySet()) { ++ if (payload.getClass() == receiver.payload()) { ++ if (receiver.ignoreId() || receiver.payloadId().equals(payload.id().getPath()) || ++ ArrayUtils.contains(receiver.payloadIds(), payload.id().getPath())) { ++ try { ++ map.get(receiver).invoke(player, payload); ++ } catch (InvocationTargetException | IllegalAccessException e) { ++ e.printStackTrace(); ++ } ++ } ++ } ++ } ++ } ++ } ++ ++ public static void handleTick() { ++ if (!TICKERS.isEmpty()) { ++ try { ++ for (Method method : TICKERS) { ++ method.invoke(null); ++ } ++ } catch (InvocationTargetException | IllegalAccessException e) { ++ e.printStackTrace(); ++ } ++ } ++ } ++ ++ public static void handlePlayerJoin(ServerPlayer player) { ++ if (!PLAYER_JOIN.isEmpty()) { ++ try { ++ for (Method method : PLAYER_JOIN) { ++ method.invoke(player); ++ } ++ } catch (InvocationTargetException | IllegalAccessException e) { ++ e.printStackTrace(); ++ } ++ } ++ } ++ ++ public static void handlePlayerLeave(ServerPlayer player) { ++ if (!PLAYER_LEAVE.isEmpty()) { ++ try { ++ for (Method method : PLAYER_LEAVE) { ++ method.invoke(player); ++ } ++ } catch (InvocationTargetException | IllegalAccessException e) { ++ e.printStackTrace(); ++ } ++ } ++ } ++ ++ public static void handleServerReload() { ++ if (!RELOAD_SERVER.isEmpty()) { ++ try { ++ for (Method method : RELOAD_SERVER) { ++ method.invoke(null); ++ } ++ } catch (InvocationTargetException | IllegalAccessException e) { ++ e.printStackTrace(); ++ } ++ } ++ } ++ ++ 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)) { ++ try { ++ MINECRAFT_REGISTER.get(register).invoke(player); ++ } catch (InvocationTargetException | IllegalAccessException e) { ++ e.printStackTrace(); ++ } ++ } ++ } ++ } ++ } ++ ++ private static List> getClasses(String packageName) { ++ List> classes = new ArrayList<>(); ++ String packageDirName = packageName.replace('.', '/'); ++ Enumeration dirs; ++ try { ++ dirs = Thread.currentThread().getContextClassLoader().getResources(packageDirName); ++ while (dirs.hasMoreElements()) { ++ URL url = dirs.nextElement(); ++ findClassInPackageByFile(packageName, URLDecoder.decode(url.getFile(), StandardCharsets.UTF_8), classes); ++ } ++ } catch (IOException e) { ++ throw new RuntimeException(e); ++ } ++ return classes; ++ } ++ ++ private static void findClassInPackageByFile(String packageName, String filePath, List> classes) { ++ File dir = new File(filePath); ++ if (!dir.exists() || !dir.isDirectory()) { ++ return; ++ } ++ ++ File[] dirFiles = dir.listFiles(file -> file.getName().endsWith("class") || file.isDirectory()); ++ if (dirFiles != null) { ++ for (File file : dirFiles) { ++ if (file.isDirectory()) { ++ if (!file.getName().equals("core")) { ++ findClassInPackageByFile(packageName + "." + file.getName(), file.getPath(), classes); ++ } ++ continue; ++ } ++ String className = file.getName().substring(0, file.getName().length() - 6); ++ try { ++ classes.add(Thread.currentThread().getContextClassLoader().loadClass(packageName + "." + className)); ++ } catch (ClassNotFoundException e) { ++ throw new RuntimeException(e); ++ } ++ } ++ } ++ } ++ ++ public record EmptyPayload(ResourceLocation id) implements CustomPacketPayload { ++ ++ public EmptyPayload(ResourceLocation location, FriendlyByteBuf buf) { ++ this(location); ++ } ++ ++ @Override ++ public void write(@NotNull FriendlyByteBuf buf) { ++ } ++ } ++ ++ public record LeavesPayload(FriendlyByteBuf data, ResourceLocation id) implements CustomPacketPayload { ++ ++ public LeavesPayload(ResourceLocation location, FriendlyByteBuf buf) { ++ this(new FriendlyByteBuf(buf.readBytes(buf.readableBytes())), location); ++ } ++ ++ @Override ++ public void write(FriendlyByteBuf buf) { ++ buf.writeBytes(data); ++ } ++ } ++} +diff --git a/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolHandler.java b/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolHandler.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d696f001d2576d1b61cc732c81f22eb52205072b +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolHandler.java +@@ -0,0 +1,65 @@ ++package top.leavesmc.leaves.protocol.core; ++ ++import net.minecraft.network.protocol.common.custom.CustomPacketPayload; ++ ++import java.lang.annotation.ElementType; ++import java.lang.annotation.Retention; ++import java.lang.annotation.RetentionPolicy; ++import java.lang.annotation.Target; ++ ++public class ProtocolHandler { ++ ++ @Target(ElementType.METHOD) ++ @Retention(RetentionPolicy.RUNTIME) ++ public @interface Init { ++ ++ } ++ ++ @Target(ElementType.METHOD) ++ @Retention(RetentionPolicy.RUNTIME) ++ public @interface PayloadReceiver { ++ ++ Class payload(); ++ ++ String[] payloadIds() default {}; ++ ++ String payloadId() default ""; ++ ++ boolean ignoreId() default false; ++ } ++ ++ @Target(ElementType.METHOD) ++ @Retention(RetentionPolicy.RUNTIME) ++ public @interface Ticker { ++ int delay() default 0; ++ } ++ ++ @Target(ElementType.METHOD) ++ @Retention(RetentionPolicy.RUNTIME) ++ public @interface PlayerJoin { ++ ++ } ++ ++ @Target(ElementType.METHOD) ++ @Retention(RetentionPolicy.RUNTIME) ++ public @interface PlayerLeave { ++ ++ } ++ ++ @Target(ElementType.METHOD) ++ @Retention(RetentionPolicy.RUNTIME) ++ public @interface ReloadServer { ++ ++ } ++ ++ @Target(ElementType.METHOD) ++ @Retention(RetentionPolicy.RUNTIME) ++ public @interface MinecraftRegister { ++ ++ String channelId() default ""; ++ ++ String[] channelIds() default {}; ++ ++ boolean ignoreId() default false; ++ } ++} +diff --git a/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolUtils.java b/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolUtils.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5282c5ad3d26d06ab685ddaaf6fd9a4d49559717 +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/protocol/core/ProtocolUtils.java +@@ -0,0 +1,36 @@ ++package top.leavesmc.leaves.protocol.core; ++ ++import net.minecraft.network.FriendlyByteBuf; ++import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; ++import net.minecraft.network.protocol.common.custom.CustomPacketPayload; ++import net.minecraft.resources.ResourceLocation; ++import net.minecraft.server.level.ServerPlayer; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.function.Consumer; ++ ++public class ProtocolUtils { ++ ++ public static void sendEmptyPayloadPacket(ServerPlayer player, ResourceLocation id) { ++ player.connection.send(new ClientboundCustomPayloadPacket(new LeavesProtocolManager.EmptyPayload(id))); ++ } ++ ++ public static void sendPayloadPacket(ServerPlayer player, ResourceLocation id, Consumer consumer) { ++ player.connection.send(new ClientboundCustomPayloadPacket(new CustomPacketPayload() { ++ @Override ++ public void write(@NotNull FriendlyByteBuf buf) { ++ consumer.accept(buf); ++ } ++ ++ @Override ++ @NotNull ++ public ResourceLocation id() { ++ return id; ++ } ++ })); ++ } ++ ++ public static void sendPayloadPacket(ServerPlayer player, CustomPacketPayload payload) { ++ player.connection.send(new ClientboundCustomPayloadPacket(payload)); ++ } ++} diff --git a/patches/server/0026-Leaves-Jade-Protocol.patch b/patches/server/0023-Leaves-Jade-Protocol.patch similarity index 75% rename from patches/server/0026-Leaves-Jade-Protocol.patch rename to patches/server/0023-Leaves-Jade-Protocol.patch index 84a65094..6a1b34f9 100644 --- a/patches/server/0026-Leaves-Jade-Protocol.patch +++ b/patches/server/0023-Leaves-Jade-Protocol.patch @@ -8,58 +8,11 @@ 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/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 004c6fde273599d9a7449c95480951d894ceae76..ec99c3d5808c36d3a1c9107ae34dc3875f828027 100644 ---- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -43,6 +43,7 @@ import org.bukkit.craftbukkit.util.CraftLocation; - import org.bukkit.craftbukkit.util.Waitable; - import org.bukkit.event.player.PlayerKickEvent; - import org.bukkit.event.player.PlayerResourcePackStatusEvent; -+import top.leavesmc.leaves.util.ProtocolUtils; - // CraftBukkit end - - public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener { -@@ -184,6 +185,9 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - } - // Paper end - this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data); -+ if (org.dreeam.leaf.LeafConfig.jadeProtocol && ProtocolUtils.isNamespacePacket(packet, top.leavesmc.leaves.protocol.JadeProtocol.PROTOCOL_ID)) { -+ top.leavesmc.leaves.protocol.JadeProtocol.handlePacket(server, player, packet); -+ } - } catch (Exception ex) { - ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); - this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index aa8f5320d027518dfe28548424c4a6477deeb45e..3d651ad8b6d2feb3327ec29fb5e622e4d93ef63b 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -242,6 +242,7 @@ import org.bukkit.inventory.CraftingInventory; - import org.bukkit.inventory.EquipmentSlot; - import org.bukkit.inventory.InventoryView; - import org.bukkit.inventory.SmithingInventory; -+import top.leavesmc.leaves.util.ProtocolUtils; - // CraftBukkit end - - public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl implements ServerGamePacketListener, ServerPlayerConnection, TickablePacketListener { -diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index d20eed35c85cf5118206dbf9ca2c706b51d4460e..2504f80358fd561f4c195569dc6fb32215bf8f6b 100644 ---- a/src/main/java/net/minecraft/server/players/PlayerList.java -+++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -343,6 +343,8 @@ public abstract class PlayerList { - - player.didPlayerJoinEvent = true; // Gale - EMC - do not process chat/commands before player has joined - -+ top.leavesmc.leaves.protocol.JadeProtocol.onPlayerJoin(player); // Leaves - Jade -+ - final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage(); - - if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure 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 e91b4d63d42276f8a498cab7c439c785730f3f6f..a2d7c5008c6d6716d9530e00de0db0276cc0d9fc 100644 +index f39710854ddf1cec2abc1efe39b9399f1528fc62..c92ca5954fd929b0a51b0d39db665bede80f075a 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 -@@ -288,7 +288,7 @@ public class Tadpole extends AbstractFish { +@@ -287,7 +287,7 @@ public class Tadpole extends AbstractFish { } @@ -68,35 +21,11 @@ index e91b4d63d42276f8a498cab7c439c785730f3f6f..a2d7c5008c6d6716d9530e00de0db027 return Math.max(0, Tadpole.ticksToBeFrog - this.age); } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0a27a839d33c95d89aa352f374aa1877fb99acca..fcb500e993820477706ed66943f864be2d637a39 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -487,6 +487,7 @@ public final class CraftServer implements Server { - MapPalette.setMapColorCache(new CraftMapColorCache(this.logger)); - } - datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper -+ top.leavesmc.leaves.protocol.JadeProtocol.init(); // Leaves - Jade - } - - public boolean getCommandBlockOverride(String command) { -@@ -1058,6 +1059,11 @@ public final class CraftServer implements Server { - this.console.paperConfigurations.reloadConfigs(this.console); - this.console.galeConfigurations.reloadConfigs(this.console); // Gale - Gale configuration - org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur -+ // Leaves start - Jade -+ if (org.dreeam.leaf.LeafConfig.jadeProtocol) { -+ top.leavesmc.leaves.protocol.JadeProtocol.enableAllPlayer(); -+ } -+ // Leaves end - Jade - for (ServerLevel world : this.console.getAllLevels()) { - // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty - world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java -index fc3938c16c43277e22b7a322177fa2a9150f1ff8..9445177d2cb64ae1cd0bd88d0c0b2ad89ef924f6 100644 +index 4b6ba35724d364da8397d991ba8453f22911ed07..fffa8e74d1ae895758fdbcb3e573004be3f7dfdb 100644 --- a/src/main/java/org/dreeam/leaf/LeafConfig.java +++ b/src/main/java/org/dreeam/leaf/LeafConfig.java -@@ -246,7 +246,9 @@ public class LeafConfig { +@@ -186,7 +186,9 @@ public class LeafConfig { useSpigotItemMergingMechanism = getBoolean("performance.use-spigot-item-merging-mechanism", useSpigotItemMergingMechanism); } @@ -108,10 +37,10 @@ index fc3938c16c43277e22b7a322177fa2a9150f1ff8..9445177d2cb64ae1cd0bd88d0c0b2ad8 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..f838e0786026ee2ff92a33fb5be370232079095f +index 0000000000000000000000000000000000000000..ebd34c2f0f8db4b43022cb436a047a0bf652acbb --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/protocol/JadeProtocol.java -@@ -0,0 +1,577 @@ +@@ -0,0 +1,616 @@ +package top.leavesmc.leaves.protocol; + +import com.google.common.cache.Cache; @@ -121,14 +50,15 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023 +import com.google.common.collect.ListMultimap; +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; -+import io.netty.buffer.Unpooled; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.network.FriendlyByteBuf; ++import net.minecraft.network.chat.CommonComponents; +import net.minecraft.network.chat.Component; -+import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; ++import net.minecraft.network.chat.MutableComponent; ++import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; @@ -173,18 +103,16 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023 +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.phys.BlockHitResult; +import org.apache.commons.lang3.mutable.MutableInt; -+import org.apache.logging.log4j.util.TriConsumer; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -+import top.leavesmc.leaves.LeavesLogger; -+import top.leavesmc.leaves.util.ProtocolUtils; ++import top.leavesmc.leaves.protocol.core.LeavesProtocol; ++import top.leavesmc.leaves.protocol.core.ProtocolHandler; ++import top.leavesmc.leaves.protocol.core.ProtocolUtils; + +import java.util.Collection; -+import java.util.HashMap; +import java.util.List; +import java.util.Locale; -+import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import java.util.concurrent.ExecutionException; @@ -192,6 +120,7 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023 +import java.util.stream.IntStream; +import java.util.stream.Stream; + ++@LeavesProtocol(namespace = "jade") +public class JadeProtocol { + + public static final String PROTOCOL_ID = "jade"; @@ -199,9 +128,6 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023 + // send + public static final ResourceLocation PACKET_SERVER_PING = id("server_ping"); + public static final ResourceLocation PACKET_RECEIVE_DATA = id("receive_data"); -+ // call -+ public static final ResourceLocation PACKET_REQUEST_ENTITY = id("request_entity"); -+ public static final ResourceLocation PACKET_REQUEST_TILE = id("request_tile"); + + private static final HierarchyLookup> entityDataProviders = new HierarchyLookup<>(Entity.class); + private static final HierarchyLookup> tileDataProviders = new HierarchyLookup<>(BlockEntity.class); @@ -213,37 +139,12 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023 + return new ResourceLocation(PROTOCOL_ID, path); + } + -+ public static void onPlayerJoin(ServerPlayer player) { -+ if (org.dreeam.leaf.LeafConfig.jadeProtocol) { -+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); -+ buf.writeUtf("{}"); -+ ProtocolUtils.sendPayloadPacket(player, PACKET_SERVER_PING, buf); -+ } -+ } -+ -+ public static void enableAllPlayer() { -+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().players) { -+ onPlayerJoin(player); -+ } -+ } -+ -+ private static final Map> globalReceivers = new HashMap<>(); -+ -+ private static void registerGlobalReceiver(ResourceLocation identifier, TriConsumer consumer) { -+ globalReceivers.put(identifier, consumer); -+ } -+ -+ public static void handlePacket(MinecraftServer server, ServerPlayer player, ServerboundCustomPayloadPacket packet) { -+ globalReceivers.getOrDefault(packet.payload().id(), ((server1, player1, buf) -> LeavesLogger.LOGGER.severe("NullPotion"))).accept(server, player, (FriendlyByteBuf) packet.payload()); -+ } -+ ++ @ProtocolHandler.Init + public static void init() { + entityDataProviders.register(Entity.class, ((data, player, world, entity, showDetails) -> { + UUID ownerUUID = null; + if (entity instanceof OwnableEntity) { + ownerUUID = ((OwnableEntity) entity).getOwnerUUID(); -+ } else if (entity instanceof AbstractHorse) { -+ ownerUUID = ((AbstractHorse) entity).getOwnerUUID(); + } + if (ownerUUID != null) { + MinecraftServer.getServer().getProfileCache().get(ownerUUID).map(GameProfile::getName).ifPresent(name -> data.putString("OwnerName", name)); @@ -258,14 +159,16 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023 + ListTag list = new ListTag(); + for (MobEffectInstance effect : effects) { + CompoundTag compound = new CompoundTag(); -+ compound.putString("Name", effect.getDescriptionId()); -+ compound.putInt("Amplifier", effect.getAmplifier()); -+ int duration = Math.min(32767, effect.getDuration()); -+ compound.putInt("Duration", duration); ++ compound.putString("Name", Component.Serializer.toJson(getEffectName(effect))); ++ if (effect.isInfiniteDuration()) { ++ compound.putBoolean("Infinite", true); ++ } else { ++ compound.putInt("Duration", effect.getDuration()); ++ } + compound.putBoolean("Bad", effect.getEffect().getCategory() == MobEffectCategory.HARMFUL); + list.add(compound); + } -+ data.put("Potions", list); ++ data.put("StatusEffects", list); + })); + entityDataProviders.register(AgeableMob.class, ((data, player, world, entity, showDetails) -> { + int time = -((AgeableMob) entity).getAge(); @@ -423,19 +326,25 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023 + } + } + })); -+ -+ registerGlobalReceiver(PACKET_REQUEST_TILE, JadeProtocol::requestTileData); -+ registerGlobalReceiver(PACKET_REQUEST_ENTITY, JadeProtocol::requestEntityData); + } + -+ public static void requestEntityData(MinecraftServer server, ServerPlayer player, FriendlyByteBuf buf) { ++ @ProtocolHandler.PlayerJoin ++ public static void onPlayerJoin(ServerPlayer player) { ++ if (org.dreeam.leaf.LeafConfig.jadeProtocol) { ++ ProtocolUtils.sendPayloadPacket(player, PACKET_SERVER_PING, buf -> buf.writeUtf("{}")); ++ } ++ } ++ ++ @ProtocolHandler.PayloadReceiver(payload = RequestEntityPayload.class, payloadId = "request_entity") ++ public static void requestEntityData(ServerPlayer player, RequestEntityPayload payload) { + if (!org.dreeam.leaf.LeafConfig.jadeProtocol) { + return; + } + ++ MinecraftServer server = MinecraftServer.getServer(); + Level world = player.level(); -+ boolean showDetails = buf.readBoolean(); -+ Entity entity = world.getEntity(buf.readVarInt()); ++ boolean showDetails = payload.showDetails; ++ Entity entity = world.getEntity(payload.entityId); + if (entity == null || player.distanceToSqr(entity) > MAX_DISTANCE_SQR) { + return; + } @@ -456,19 +365,19 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023 + } + tag.putInt("WailaEntityID", entity.getId()); + -+ FriendlyByteBuf buf1 = new FriendlyByteBuf(Unpooled.buffer()); -+ buf1.writeNbt(tag); -+ ProtocolUtils.sendPayloadPacket(player, PACKET_RECEIVE_DATA, buf1); ++ ProtocolUtils.sendPayloadPacket(player, PACKET_RECEIVE_DATA, buf -> buf.writeNbt(tag)); + }); + } + -+ public static void requestTileData(MinecraftServer server, ServerPlayer player, FriendlyByteBuf buf) { ++ @ProtocolHandler.PayloadReceiver(payload = RequestTilePayload.class, payloadId = "request_tile") ++ public static void requestTileData(ServerPlayer player, RequestTilePayload payload) { + if (!org.dreeam.leaf.LeafConfig.jadeProtocol) { + return; + } + -+ boolean showDetails = buf.readBoolean(); -+ BlockHitResult result = buf.readBlockHitResult(); ++ MinecraftServer server = MinecraftServer.getServer(); ++ boolean showDetails = payload.showDetails; ++ BlockHitResult result = payload.hitResult; + BlockPos pos = result.getBlockPos(); + Level world = player.level(); + if (pos.distSqr(player.blockPosition()) > MAX_DISTANCE_SQR || !world.isLoaded(pos)) { @@ -498,19 +407,79 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023 + tag.putInt("z", pos.getZ()); + tag.putString("id", BuiltInRegistries.BLOCK_ENTITY_TYPE.getKey(tile.getType()).toString()); + -+ FriendlyByteBuf buf1 = new FriendlyByteBuf(Unpooled.buffer()); -+ buf1.writeNbt(tag); -+ ProtocolUtils.sendPayloadPacket(player, PACKET_RECEIVE_DATA, buf1); ++ ProtocolUtils.sendPayloadPacket(player, PACKET_RECEIVE_DATA, buf -> buf.writeNbt(tag)); + }); ++ } + ++ @ProtocolHandler.ReloadServer ++ public static void onServerReload() { ++ if (org.dreeam.leaf.LeafConfig.jadeProtocol) { ++ enableAllPlayer(); ++ } ++ } ++ ++ public static void enableAllPlayer() { ++ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().players) { ++ onPlayerJoin(player); ++ } + } + + public interface IJadeProvider { -+ public void saveData(CompoundTag data, ServerPlayer player, Level world, T object, boolean showDetails); ++ void saveData(CompoundTag data, ServerPlayer player, Level world, T object, boolean showDetails); ++ } ++ ++ public record RequestEntityPayload(boolean showDetails, int entityId) implements CustomPacketPayload { ++ ++ private static final ResourceLocation PACKET_REQUEST_ENTITY = JadeProtocol.id("request_entity"); ++ ++ public RequestEntityPayload(ResourceLocation id, FriendlyByteBuf buf) { ++ this(buf.readBoolean(), buf.readInt()); ++ } ++ ++ @Override ++ public void write(FriendlyByteBuf buf) { ++ buf.writeBoolean(showDetails); ++ buf.writeInt(entityId); ++ } ++ ++ @Override ++ @NotNull ++ public ResourceLocation id() { ++ return PACKET_REQUEST_ENTITY; ++ } ++ } ++ ++ public record RequestTilePayload(boolean showDetails, BlockHitResult hitResult) implements CustomPacketPayload { ++ ++ private static final ResourceLocation PACKET_REQUEST_TILE = JadeProtocol.id("request_tile"); ++ ++ public RequestTilePayload(ResourceLocation id, FriendlyByteBuf buf) { ++ this(buf.readBoolean(), buf.readBlockHitResult()); ++ } ++ ++ @Override ++ public void write(FriendlyByteBuf buf) { ++ buf.writeBoolean(showDetails); ++ buf.writeBlockHitResult(hitResult); ++ } ++ ++ @Override ++ @NotNull ++ public ResourceLocation id() { ++ return PACKET_REQUEST_TILE; ++ } + } + + // Power by Jade + ++ public static Component getEffectName(MobEffectInstance mobEffectInstance) { ++ MutableComponent mutableComponent = mobEffectInstance.getEffect().getDisplayName().copy(); ++ if (mobEffectInstance.getAmplifier() >= 1 && mobEffectInstance.getAmplifier() <= 9) { ++ mutableComponent.append(CommonComponents.SPACE).append(Component.translatable("enchantment.level." + (mobEffectInstance.getAmplifier() + 1))); ++ } ++ return mutableComponent; ++ } ++ + public static List> getGroups(ServerPlayer player, ServerLevel world, Object target, boolean showDetails) { + if (target instanceof RandomizableContainerBlockEntity te && te.lootTable != null) { + return List.of(); @@ -687,5 +656,4 @@ index 0000000000000000000000000000000000000000..f838e0786026ee2ff92a33fb5be37023 + list.addAll(objects.get(clazz)); + } + } -+ +} diff --git a/patches/server/0027-Leaves-Appleskin-Protocol.patch b/patches/server/0024-Leaves-Appleskin-Protocol.patch similarity index 51% rename from patches/server/0027-Leaves-Appleskin-Protocol.patch rename to patches/server/0024-Leaves-Appleskin-Protocol.patch index 81a91c64..9d17a90c 100644 --- a/patches/server/0027-Leaves-Appleskin-Protocol.patch +++ b/patches/server/0024-Leaves-Appleskin-Protocol.patch @@ -6,61 +6,11 @@ Subject: [PATCH] Leaves: Appleskin Protocol Original license: GPLv3 Original project: https://github.com/LeavesMC/Leaves -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b54a764c2a24f8e09792ade7a9a4ebb17d9d4e7b..e4455fcee23ea7511fdacd3ef9c6dd2353fc6191 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1560,6 +1560,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { ++ buf.writeFloat(saturation); ++ }); ++ previousSaturationLevels.put(player.getUUID(), saturation); ++ } ++ ++ float exhaustion = data.getExhaustionLevel(); ++ Float previousExhaustion = previousExhaustionLevels.get(player.getUUID()); ++ if (previousExhaustion == null || Math.abs(exhaustion - previousExhaustion) >= MINIMUM_EXHAUSTION_CHANGE_THRESHOLD) { ++ ProtocolUtils.sendPayloadPacket(player, EXHAUSTION_KEY, buf -> { ++ buf.writeFloat(exhaustion); ++ }); ++ previousExhaustionLevels.put(player.getUUID(), exhaustion); ++ } ++ } ++ } ++ } ++ ++ @ProtocolHandler.ReloadServer ++ public static void onServerReload() { ++ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) { ++ enableAllPlayer(); ++ } else { ++ disableAllPlayer(); ++ } ++ } ++ + public static void enableAllPlayer() { + for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) { + onPlayerLoggedIn(player); @@ -126,48 +133,8 @@ index 0000000000000000000000000000000000000000..e471fb844c34294886b6668b04ec5098 + } + } + -+ public static void onPlayerLoggedIn(@NotNull ServerPlayer player) { -+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) { -+ players.add(player); -+ resetPlayerData(player); -+ } -+ } -+ -+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) { -+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) { -+ players.remove(player); -+ resetPlayerData(player); -+ } -+ } -+ + private static void resetPlayerData(@NotNull ServerPlayer player) { + previousExhaustionLevels.remove(player.getUUID()); + previousSaturationLevels.remove(player.getUUID()); + } -+ -+ public static void tick() { -+ if (org.dreeam.leaf.LeafConfig.appleskinProtocol) { -+ for (ServerPlayer player : players) { -+ FoodData data = player.getFoodData(); -+ -+ float saturation = data.getSaturationLevel(); -+ Float previousSaturation = previousSaturationLevels.get(player.getUUID()); -+ if (previousSaturation == null || saturation != previousSaturation) { -+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); -+ buf.writeFloat(saturation); -+ ProtocolUtils.sendPayloadPacket(player, SATURATION_KEY, buf); -+ previousSaturationLevels.put(player.getUUID(), saturation); -+ } -+ -+ float exhaustion = data.getExhaustionLevel(); -+ Float previousExhaustion = previousExhaustionLevels.get(player.getUUID()); -+ if (previousExhaustion == null || Math.abs(exhaustion - previousExhaustion) >= MINIMUM_EXHAUSTION_CHANGE_THRESHOLD) { -+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); -+ buf.writeFloat(exhaustion); -+ ProtocolUtils.sendPayloadPacket(player, EXHAUSTION_KEY, buf); -+ previousExhaustionLevels.put(player.getUUID(), exhaustion); -+ } -+ } -+ } -+ } +} diff --git a/patches/server/0028-Leaves-Xaero-Map-Protocol.patch b/patches/server/0025-Leaves-Xaero-Map-Protocol.patch similarity index 76% rename from patches/server/0028-Leaves-Xaero-Map-Protocol.patch rename to patches/server/0025-Leaves-Xaero-Map-Protocol.patch index 752fd2f6..32a36d50 100644 --- a/patches/server/0028-Leaves-Xaero-Map-Protocol.patch +++ b/patches/server/0025-Leaves-Xaero-Map-Protocol.patch @@ -7,10 +7,10 @@ Original license: GPLv3 Original project: https://github.com/LeavesMC/Leaves diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f5f9fa9dff79a7ad4c92e58f8e4f5a821145933a..cb2388ae2868a49aa0236844c104f12cfa61f190 100644 +index 963d5b4d2bc44c32d23da0f45480e0b0bd293ec2..8042254407f7aabfa41483ef6b5661ca7cb11a75 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1353,6 +1353,7 @@ public abstract class PlayerList { +@@ -1351,6 +1351,7 @@ public abstract class PlayerList { player.connection.send(new ClientboundInitializeBorderPacket(worldborder)); player.connection.send(new ClientboundSetTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(world.getSharedSpawnPos(), world.getSharedSpawnAngle())); @@ -19,18 +19,18 @@ index f5f9fa9dff79a7ad4c92e58f8e4f5a821145933a..cb2388ae2868a49aa0236844c104f12c // 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 56dc6cb0b5659619ec5df42088fbecf758e652c6..4cf74bc39f61e024b7d453759cdc9397f0e3d4f5 100644 +index ae57267a0bc005519eb8bdb9313812fbecd30ac2..080cf996ee41503c6adc1d66e19be219102cbbcd 100644 --- a/src/main/java/org/dreeam/leaf/LeafConfig.java +++ b/src/main/java/org/dreeam/leaf/LeafConfig.java -@@ -19,6 +19,7 @@ import java.util.Collections; - import java.util.List; - import java.util.Locale; - import java.util.Map; +@@ -1,6 +1,7 @@ + package org.dreeam.leaf; + + import com.google.common.collect.ImmutableMap; +import java.util.Random; - - public class LeafConfig { - -@@ -248,9 +249,13 @@ public class LeafConfig { + import net.minecraft.server.MinecraftServer; + import org.bukkit.configuration.ConfigurationSection; + import org.bukkit.configuration.MemoryConfiguration; +@@ -188,9 +189,13 @@ public class LeafConfig { public static boolean jadeProtocol = false; public static boolean appleskinProtocol = false; @@ -46,20 +46,20 @@ index 56dc6cb0b5659619ec5df42088fbecf758e652c6..4cf74bc39f61e024b7d453759cdc9397 public static String sentryDsn = ""; diff --git a/src/main/java/top/leavesmc/leaves/protocol/XaeroMapProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/XaeroMapProtocol.java new file mode 100644 -index 0000000000000000000000000000000000000000..461f9f947f14c4eb86f80b644628cebbe6fb3619 +index 0000000000000000000000000000000000000000..68dce7130b97270840405eadf0677ab5ffd6b3b8 --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/protocol/XaeroMapProtocol.java -@@ -0,0 +1,38 @@ +@@ -0,0 +1,41 @@ +package top.leavesmc.leaves.protocol; + -+import io.netty.buffer.Unpooled; -+import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; -+import top.leavesmc.leaves.util.ProtocolUtils; ++import top.leavesmc.leaves.protocol.core.LeavesProtocol; ++import top.leavesmc.leaves.protocol.core.ProtocolUtils; + ++@LeavesProtocol(namespaces = {"xaerominimap", "xaeroworldmap"}) +public class XaeroMapProtocol { + + public static final String PROTOCOL_ID_MINI = "xaerominimap"; @@ -80,11 +80,14 @@ index 0000000000000000000000000000000000000000..461f9f947f14c4eb86f80b644628cebb + + public static void onSendWorldInfo(@NotNull ServerPlayer player) { + if (org.dreeam.leaf.LeafConfig.xaeroMapProtocol) { -+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); -+ buf.writeByte(0); -+ buf.writeInt(org.dreeam.leaf.LeafConfig.xaeroMapServerID); -+ ProtocolUtils.sendPayloadPacket(player, MINIMAP_KEY, buf); -+ ProtocolUtils.sendPayloadPacket(player, WORLDMAP_KEY, buf); ++ ProtocolUtils.sendPayloadPacket(player, MINIMAP_KEY, buf -> { ++ buf.writeByte(0); ++ buf.writeInt(org.dreeam.leaf.LeafConfig.xaeroMapServerID); ++ }); ++ ProtocolUtils.sendPayloadPacket(player, WORLDMAP_KEY, buf -> { ++ buf.writeByte(0); ++ buf.writeInt(org.dreeam.leaf.LeafConfig.xaeroMapServerID); ++ }); + } + } +} diff --git a/patches/server/0029-Fix-Make-log4j-compatible-with-future-release.patch b/patches/server/0026-Fix-Make-log4j-compatible-with-future-release.patch similarity index 100% rename from patches/server/0029-Fix-Make-log4j-compatible-with-future-release.patch rename to patches/server/0026-Fix-Make-log4j-compatible-with-future-release.patch diff --git a/patches/server/0031-sync-with-Gale-s-Optimize-villager-data-storage.patc.patch b/patches/server/0027-sync-with-Gale-s-Optimize-villager-data-storage.patc.patch similarity index 100% rename from patches/server/0031-sync-with-Gale-s-Optimize-villager-data-storage.patc.patch rename to patches/server/0027-sync-with-Gale-s-Optimize-villager-data-storage.patc.patch diff --git a/patches/server/0032-Petal-Async-Pathfinding.patch b/patches/server/0028-Petal-Async-Pathfinding.patch similarity index 97% rename from patches/server/0032-Petal-Async-Pathfinding.patch rename to patches/server/0028-Petal-Async-Pathfinding.patch index eeeacb89..7981d6dd 100644 --- a/patches/server/0032-Petal-Async-Pathfinding.patch +++ b/patches/server/0028-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 d6009cf7ea6857e98f86b6bd71e34d0f137921ad..4a029f394e9df35a5bcbc42f8e2731fc2d789326 100644 +index fd3b14649d4ba0212ec3e3d2cd36cf79b070b835..b333e08e4988438609e4c327dd101a546734c1b3 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -293,6 +293,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -291,6 +291,7 @@ public abstract class Mob extends LivingEntity implements Targeting { @Nullable @Override public LivingEntity getTarget() { @@ -591,7 +591,7 @@ index 8db20db72cd51046213625fac46c35854c59ec5d..fc99483dfe248d26885c904b72c93b0d } } diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index 6c04c8e7776b2830ac368229da834532e8ce163e..abf25dfbf33be9be1875470448ebef8547b5aa2c 100644 +index 38a3dcec138d9233a46e5d523bcc6d64bc7fffd0..4f53747d6b90db92ae12f656c3525c45fb051d3f 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java @@ -1147,7 +1147,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -613,7 +613,7 @@ index 6c04c8e7776b2830ac368229da834532e8ce163e..abf25dfbf33be9be1875470448ebef85 } } 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 afd2b1922f23148d25e0f2732d60f4da8ea3b063..56badde70e0833d1e4f0bc521fc67f3e90aa3e58 100644 +index ec508548ba24162913d7ec112b48a4ae18f5a43e..d08721d1ab8538decffad3717962442e281bb49c 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 afd2b1922f23148d25e0f2732d60f4da8ea3b063..56badde70e0833d1e4f0bc521fc67f3e public class Frog extends Animal implements VariantHolder { public static final Ingredient TEMPTATION_ITEM = Ingredient.of(Items.SLIME_BALL); -@@ -439,6 +441,17 @@ public class Frog extends Animal implements VariantHolder { +@@ -438,6 +440,17 @@ public class Frog extends Animal implements VariantHolder { super(frog, world); } @@ -643,7 +643,7 @@ index afd2b1922f23148d25e0f2732d60f4da8ea3b063..56badde70e0833d1e4f0bc521fc67f3e @Override public boolean canCutCorner(BlockPathTypes nodeType) { return nodeType != BlockPathTypes.WATER_BORDER && super.canCutCorner(nodeType); -@@ -448,6 +461,11 @@ public class Frog extends Animal implements VariantHolder { +@@ -447,6 +460,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 9e2498f8cb4a1a309aa037c01aa3039924f5b29e..2df6e3772ffb79f17c1e4097cbf3ea1ebc2a82ae 100644 +index a82805a771fa4d1a9eceb8b5778fad30000e974e..3e1d2908cbfc5dd467443729fe9f3cc888af0016 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 -@@ -622,6 +622,16 @@ public class Warden extends Monster implements VibrationSystem { +@@ -620,6 +620,16 @@ public class Warden extends Monster implements VibrationSystem { protected PathFinder createPathFinder(int range) { this.nodeEvaluator = new WalkNodeEvaluator(); this.nodeEvaluator.setCanPassDoors(true); @@ -935,38 +935,33 @@ 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 4cf74bc39f61e024b7d453759cdc9397f0e3d4f5..4ec2954384a7c99b4f489b1b2a666f93ee69e98f 100644 +index 080cf996ee41503c6adc1d66e19be219102cbbcd..245bf3d0c17e91c24ff28e53f0ee73b66b4d5e50 100644 --- a/src/main/java/org/dreeam/leaf/LeafConfig.java +++ b/src/main/java/org/dreeam/leaf/LeafConfig.java -@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap; - import net.minecraft.core.registries.BuiltInRegistries; +@@ -3,6 +3,7 @@ package org.dreeam.leaf; + import com.google.common.collect.ImmutableMap; + 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; -@@ -20,6 +21,7 @@ import java.util.List; - import java.util.Locale; +@@ -16,6 +17,7 @@ import java.lang.reflect.Method; + import java.lang.reflect.Modifier; + import java.util.List; import java.util.Map; - import java.util.Random; +import java.util.logging.Level; public class LeafConfig { -@@ -196,6 +198,9 @@ public class LeafConfig { - public static boolean throttleInactiveGoalSelectorTick = true; - public static Map projectileTimeouts; +@@ -183,8 +185,22 @@ public class LeafConfig { + } + 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/0033-Fix-tracker-NPE.patch b/patches/server/0029-Fix-tracker-NPE.patch similarity index 96% rename from patches/server/0033-Fix-tracker-NPE.patch rename to patches/server/0029-Fix-tracker-NPE.patch index db19b401..f053dec5 100644 --- a/patches/server/0033-Fix-tracker-NPE.patch +++ b/patches/server/0029-Fix-tracker-NPE.patch @@ -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 acaa1575a2d7164174d9514d750696d7f844f065..bb55302e3f846961c026e0607f04366756921dc1 100644 +index 8cf0d4e03726b4e4340850715b6ab1af8c183fbd..0f17b1f50d369c46526d14eefdd9e0a498c11528 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,7 +38,7 @@ index acaa1575a2d7164174d9514d750696d7f844f065..bb55302e3f846961c026e0607f043667 import java.util.Objects; import java.util.Optional; import java.util.concurrent.CompletableFuture; -@@ -652,7 +653,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -642,7 +643,7 @@ public class ServerChunkCache extends ChunkSource { // Paper start - optimise chunk tick iteration if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) { diff --git a/patches/server/0034-Cache-minecart-vehicle-collide-results.patch b/patches/server/0030-Cache-minecart-vehicle-collide-results.patch similarity index 100% rename from patches/server/0034-Cache-minecart-vehicle-collide-results.patch rename to patches/server/0030-Cache-minecart-vehicle-collide-results.patch diff --git a/patches/server/0030-Fix-compile-error.patch b/patches/server/0030-Fix-compile-error.patch deleted file mode 100644 index ed7ca8fc..00000000 --- a/patches/server/0030-Fix-compile-error.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> -Date: Sat, 10 Jun 2023 11:28:24 +0800 -Subject: [PATCH] Fix compile error - - -diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java -index d1088e4b7fa5f8e689f23b150b83645ce1ae5a0e..f951f4024745503e9cdfa7ff17b9313ac6d7b4c4 100644 ---- a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java -+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/PermissionConfigurationSerializer.java -@@ -39,7 +39,7 @@ public class PermissionConfigurationSerializer { - try { - result.add(Permission.loadPermission(entry.getKey().toString(), (Map) entry.getValue(), permissionDefault, result)); - } catch (Throwable ex) { -- throw new SerializationException(null, "Error loading permission %s".formatted(entry.getKey()), ex); -+ throw new SerializationException((Type) null, "Error loading permission %s".formatted(entry.getKey()), ex); - } - } - } diff --git a/patches/server/0035-Reduce-canSee-work.patch b/patches/server/0031-Reduce-canSee-work.patch similarity index 97% rename from patches/server/0035-Reduce-canSee-work.patch rename to patches/server/0031-Reduce-canSee-work.patch index a743cd37..011bcf71 100644 --- a/patches/server/0035-Reduce-canSee-work.patch +++ b/patches/server/0031-Reduce-canSee-work.patch @@ -35,7 +35,7 @@ index ed2bfe717406741583b9c261c6ba18cd4a47f67b..1916e5f1d6bc4c2b14a138a46477adea return false; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 762edca984d02b8a2a4224adba1f240fa9ea0661..f9abae6d2f1e28e36919e32e298d85494cae62ab 100644 +index 57d3b887b606800d0d1e12b46ae793c50f09bee3..af472e1532000a764eb7464a1661fbcce561a8e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -580,12 +580,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0036-Faster-Natural-Spawning.patch b/patches/server/0032-Faster-Natural-Spawning.patch similarity index 100% rename from patches/server/0036-Faster-Natural-Spawning.patch rename to patches/server/0032-Faster-Natural-Spawning.patch diff --git a/patches/server/0006-Pufferfish-Dynamic-Activation-of-Brain.patch b/patches/unapplied/server/0005-Pufferfish-Dynamic-Activation-of-Brain.patch similarity index 96% rename from patches/server/0006-Pufferfish-Dynamic-Activation-of-Brain.patch rename to patches/unapplied/server/0005-Pufferfish-Dynamic-Activation-of-Brain.patch index e2e674d8..bd2e2f33 100644 --- a/patches/server/0006-Pufferfish-Dynamic-Activation-of-Brain.patch +++ b/patches/unapplied/server/0005-Pufferfish-Dynamic-Activation-of-Brain.patch @@ -30,7 +30,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 064281266350872693029069ee732bd4ff66448a..35515563d498a6e9817d9bd92ff5eda959de212a 100644 +index fbfef5678423f1224bfcfe62073e0603bb0bd58d..ccbc0c3d4f151194fb937aed75837ca1afa1306b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -864,6 +864,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -295,7 +295,7 @@ index e157e11933710e0ceb73c6d41f673332fbeee303..812313bb3aade49c4afa2eec9be1f9cc this.assignProfessionWhenSpawned = false; } diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java -index 5d161351e7517acf57e98203bab8c9f9ab9d4005..47c7b75b721bb2210eded56a7590612fbc3a395c 100644 +index b1fcd3588c22143f9852805a6cea3b6cf6c33a1f..7aa266b6cecb7e8d2bed41ec2e68f057deb99d05 100644 --- a/src/main/java/org/dreeam/leaf/LeafConfig.java +++ b/src/main/java/org/dreeam/leaf/LeafConfig.java @@ -1,7 +1,9 @@ @@ -316,22 +316,16 @@ index 5d161351e7517acf57e98203bab8c9f9ab9d4005..47c7b75b721bb2210eded56a7590612f import java.util.List; import java.util.Map; -@@ -165,6 +168,11 @@ public class LeafConfig { +@@ -163,7 +166,33 @@ public class LeafConfig { + private static void removal() { + } - 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 +185,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/server/0005-Pufferfish-Optimize-mob-spawning.patch b/patches/unapplied/server/0005-Pufferfish-Optimize-mob-spawning.patch similarity index 100% rename from patches/server/0005-Pufferfish-Optimize-mob-spawning.patch rename to patches/unapplied/server/0005-Pufferfish-Optimize-mob-spawning.patch diff --git a/patches/server/0007-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch b/patches/unapplied/server/0006-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch similarity index 87% rename from patches/server/0007-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch rename to patches/unapplied/server/0006-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch index 62874588..2c30b7a8 100644 --- a/patches/server/0007-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch +++ b/patches/unapplied/server/0006-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch @@ -26,18 +26,18 @@ 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 47c7b75b721bb2210eded56a7590612fbc3a395c..9a11228726c9a489181fc8a0c511ea83cdcf0f6e 100644 +index 7aa266b6cecb7e8d2bed41ec2e68f057deb99d05..9cfa1d626c83a5c2fb1ae7db4746a4cb07262778 100644 --- a/src/main/java/org/dreeam/leaf/LeafConfig.java +++ b/src/main/java/org/dreeam/leaf/LeafConfig.java -@@ -173,6 +173,7 @@ public class LeafConfig { +@@ -171,6 +171,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() { - boolean asyncMobSpawning = getBoolean("performance.enable-async-mob-spawning", enableAsyncMobSpawning, - "Whether or not asynchronous mob spawning should be enabled.", -@@ -206,6 +207,9 @@ public class LeafConfig { + 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 { 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/server/0008-Pufferfish-Entity-TTL.patch b/patches/unapplied/server/0007-Pufferfish-Entity-TTL.patch similarity index 90% rename from patches/server/0008-Pufferfish-Entity-TTL.patch rename to patches/unapplied/server/0007-Pufferfish-Entity-TTL.patch index effc09d0..4dedbefe 100644 --- a/patches/server/0008-Pufferfish-Entity-TTL.patch +++ b/patches/unapplied/server/0007-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 9a11228726c9a489181fc8a0c511ea83cdcf0f6e..9299d2fe1cda71b6881fd8bd65d3d74b1189a196 100644 +index 9cfa1d626c83a5c2fb1ae7db4746a4cb07262778..c135a861217d0ae43cf1b84e5bf259b41a0bf92e 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 9a11228726c9a489181fc8a0c511ea83cdcf0f6e..9299d2fe1cda71b6881fd8bd65d3d74b import java.util.Map; public class LeafConfig { -@@ -174,6 +175,7 @@ public class LeafConfig { +@@ -172,6 +173,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() { - 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 { + 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 { 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.");