diff --git a/.gitignore b/.gitignore index 65d08f7..e27ab2f 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,8 @@ nbactions.xml .gradle/ build/ */build/ +run/ +javadoc/ # we use maven! build.xml @@ -47,13 +49,12 @@ manifest.mf # Linux temp files *~ -# other stuff -run/ -javadoc/ - +# Paperweight build-data/ *-API *-MojangAPI *-Server paper-api-generator compare.txt +*.patch +!patches/**/* diff --git a/build-data/dev-imports.txt b/build-data/dev-imports.txt index 302359e..1d9862a 100644 --- a/build-data/dev-imports.txt +++ b/build-data/dev-imports.txt @@ -12,4 +12,3 @@ # mc_data chat_type/chat.json # mc_data dimension_type/overworld.json # - diff --git a/fxapi b/fxapi index 90bb0d7..d515699 100755 --- a/fxapi +++ b/fxapi @@ -9,5 +9,6 @@ cd Plazma-API git add . git commit -m "fixup" git format-patch -1 +mv 0001-fixup.patch ../ -cd ../ \ No newline at end of file +cd ../ diff --git a/fxsrv b/fxsrv index 28e7acd..bba81b5 100755 --- a/fxsrv +++ b/fxsrv @@ -9,5 +9,6 @@ cd Plazma-Server git add . git commit -m "fixup" git format-patch -1 +mv 0001-fixup.patch ../ -cd ../ \ No newline at end of file +cd ../ diff --git a/gradle.properties b/gradle.properties index cd033c6..dee6afe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,12 @@ -version = 1.20.4-R0.1-SNAPSHOT -mcVersion = 1.20.4 - -paperCommit = 850b736e1442587230bbba241f99eb0cee193cd9 -purpurCommit = d80fbedf5d8a8830aa895595114ec1979fc0a3f7 - group = org.plazmamc.plazma +org.gradle.deamon = true org.gradle.caching = true org.gradle.parallel = true org.gradle.vfs.watch = false org.gradle.jvmargs = -Xmx4G -Dfile.encoding=UTF-8 -Dgraal.CompilerConfiguration=community -Dgraal.UsePriorityInlining=true -Dgraal.Vectorization=true -Dgraal.OptDuplication=true -Dgraal.SpeculativeGuardMovement=true -Dgraal.WriteableCodeCache=true + +version = 1.20.4-R0.1-SNAPSHOT +mcVersion = 1.20.4 + +paperCommit = f4c7d373e4a1aff23539fe099745bf29a28559b9 +purpurCommit = 6b1ee98f813ee19f8046b3c528feeee61840a35b diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2db0b90..52b8239 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,13 +1,13 @@ [versions] shadow = "8.1.1" -paperweight = "1.5.11" +paperweight = "1.5.15" paperclip = "3.0.3" -decompiler = "2.0.627.2" -remapper = "0.10.0" +decompiler = "1.10.1" +remapper = "0.10.1" [libraries] remapper = { group = "net.fabricmc", name = "tiny-remapper", version.ref="remapper" } -decompiler = { group = "net.minecraftforge", name = "forgeflower", version.ref = "decompiler" } +decompiler = { group = "org.vineflower", name = "vineflower", version.ref = "decompiler" } paperclip = { group = "io.papermc", name = "paperclip", version.ref = "paperclip" } [plugins] diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135..d64cd49 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e09..b82aa23 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.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/libs/common.versions.toml b/libs/common.versions.toml index 2d917a1..fcea90c 100644 --- a/libs/common.versions.toml +++ b/libs/common.versions.toml @@ -5,7 +5,7 @@ mockito = "5.5.0" jupiter = "5.10.0" hamcrest = "2.2" snakeyaml = "2.2" -adventure = "4.15.0" +adventure = "4.16.0" commons-lang2 = "2.6" commons-lang3 = "3.12.0" maven-provider = "3.9.6" diff --git a/libs/server.versions.toml b/libs/server.versions.toml index d8aed57..7218785 100644 --- a/libs/server.versions.toml +++ b/libs/server.versions.toml @@ -1,4 +1,5 @@ [versions] +upnp = "1.0" ansi = "1.0.3" jansi = "3.21.0" rhino = "1.7.14" @@ -16,6 +17,7 @@ terminal-appender = "1.3.0" [libraries] ansi = { group = "net.kyori", name = "ansi", version.ref = "ansi" } +upnp = { group = "dev.omega24", name = "upnp4j", version.ref = "upnp" } mysql = { group = "com.mysql", name = "mysql-connector-j", version.ref = "mysql" } jansi = { group = "org.jline", name = "jline-terminal-jansi", version.ref = "jansi" } sqlite = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqlite" } @@ -34,5 +36,5 @@ terminal-appender = { group = "net.minecrell", name = "terminalconsoleappender", [bundles] runtime = [ "sqlite", "mysql", "disruptor" ] -implementation = [ "jansi", "terminal-appender", "ansi", "haproxy", "configurate", "mappingio", "rhino-engine", "rhino-runtime" ] +implementation = [ "jansi", "terminal-appender", "ansi", "upnp", "haproxy", "configurate", "mappingio", "rhino-engine", "rhino-runtime" ] test = [ "classgraph", "pioneer" ] diff --git a/patches/api/0001-Pufferfish-API-Changes.patch b/patches/api/0001-Pufferfish-API-Changes.patch index 39c9227..b12f8e0 100644 --- a/patches/api/0001-Pufferfish-API-Changes.patch +++ b/patches/api/0001-Pufferfish-API-Changes.patch @@ -4,7 +4,7 @@ Date: Tue, 9 Nov 2021 14:01:56 -0500 Subject: [PATCH] Pufferfish API Changes Pufferfish -Copyright (C) 2022 Pufferfish Studios LLC +Copyright (C) 2024 Pufferfish Studios LLC This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/build.gradle.kts b/build.gradle.kts -index bf01892c248b988531d21d9fb0f74d0adf2205ac..80833c13a2d19e31d6f648e7ef5b3456025e767e 100644 +index 04853c43b99951bf0d4c96ef73724625bdaf018f..9164120d299d062c62529a7ef74eac0ded367993 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,6 +51,7 @@ dependencies { @@ -29,8 +29,8 @@ index bf01892c248b988531d21d9fb0f74d0adf2205ac..80833c13a2d19e31d6f648e7ef5b3456 api("org.slf4j:slf4j-api:$slf4jVersion") + api("io.sentry:sentry:5.4.0") // Pufferfish - implementation("org.ow2.asm:asm:9.5") - implementation("org.ow2.asm:asm-commons:9.5") + implementation("org.ow2.asm:asm:9.7") + implementation("org.ow2.asm:asm-commons:9.7") @@ -109,6 +110,13 @@ val generateApiVersioningFile by tasks.registering { } } diff --git a/patches/api/0002-Purpur-API-Changes.patch b/patches/api/0002-Purpur-API-Changes.patch index 0305314..db4566c 100644 --- a/patches/api/0002-Purpur-API-Changes.patch +++ b/patches/api/0002-Purpur-API-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: granny -Date: Sun, 3 Mar 2024 00:58:34 +0000 +Date: Fri, 26 Apr 2024 18:07:21 +0900 Subject: [PATCH] Purpur API Changes PurpurMC @@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/build.gradle.kts b/build.gradle.kts -index 28a3ee2f2df6f93a894793abc03d357a9010a399..0588b113b02a05e946dd92fce489662bc01a41eb 100644 +index 9164120d299d062c62529a7ef74eac0ded367993..09e541dcbbb43699b4402036b8a3cc86a0ac9aad 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -129,6 +129,8 @@ tasks.jar { @@ -185,11 +185,24 @@ index a736d7bcdc5861a01b66ba36158db1c716339346..22fc165fd9c95f0f3ae1be7a0857e48c class DummyVersionFetcher implements VersionFetcher { @Override +diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java +index ab5fea0b03224bf249352ce340e94704ff713345..3441cdad70da1bd523c5933b1a914688718c2657 100644 +--- a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java ++++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java +@@ -15,7 +15,7 @@ public class SIMDChecker { + @Deprecated + public static boolean canEnable(Logger logger) { + try { +- if (SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19) { ++ if (SIMDDetection.getJavaVersion() < 17 || SIMDDetection.getJavaVersion() > 21) { + return false; + } else { + SIMDDetection.testRun = true; diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index ca27559cf4aa1c2e44fdca2022e213b1b1c80f4e..d218cd30fc0733a83e3e0ba3279eb21561b0b08e 100644 +index 9a428153f34291bdc026a71f7e60e285b7794b0c..53ce0fb2dac9c22680ab934f535b5a2037139445 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2862,4 +2862,127 @@ public final class Bukkit { +@@ -2884,4 +2884,127 @@ public final class Bukkit { public static Server.Spigot spigot() { return server.spigot(); } @@ -408,10 +421,10 @@ index 918a045165cdcde264bc24082b7afebb407271de..687d11619379aead7f665d4a5f8f8bcc + // Purpur end } diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index f9af60356da4668cec8b24e73f5747ab82e35a91..b304ad1307cdd6785653b1eab9781e070fb14c5a 100644 +index ec117c47401ea1a04beb0e5ee9d4d394db7c5c4e..5b058d709751a5b720e209931774e09fcc9c960c 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -11557,4 +11557,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla +@@ -11559,4 +11559,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla public boolean isEnabledByFeature(@NotNull World world) { return Bukkit.getDataPackManager().isEnabledByFeature(this, world); } @@ -453,10 +466,10 @@ index f9af60356da4668cec8b24e73f5747ab82e35a91..b304ad1307cdd6785653b1eab9781e07 + // Purpur end } diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index abb5109ed08a3a651c2c27d4d17a3d49eb06da1e..98308b759907e03b168f7e06704a91925ffcd3fd 100644 +index 30298a629b39bd43ce14b414fc697b2dfcbea89c..ce00af9121de7a910aaea4e0685a06d4cf31b4e3 100644 --- a/src/main/java/org/bukkit/OfflinePlayer.java +++ b/src/main/java/org/bukkit/OfflinePlayer.java -@@ -545,4 +545,106 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio +@@ -557,4 +557,106 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio */ @Nullable public Location getLocation(); @@ -564,10 +577,10 @@ index abb5109ed08a3a651c2c27d4d17a3d49eb06da1e..98308b759907e03b168f7e06704a9192 + // Purpur end - OfflinePlayer API } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index b4f8281d3797ec825a7671f38077cd65d5a1d76e..be0e4c789a02d67160287c39cf6bdf8ef2229afc 100644 +index 4ff1b38eb65f97344257204cf018f176f247ed36..c15b0b05870a469ea5d314c9fac6a57a045f463c 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -2214,6 +2214,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2235,6 +2235,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi } // Paper end @@ -586,7 +599,7 @@ index b4f8281d3797ec825a7671f38077cd65d5a1d76e..be0e4c789a02d67160287c39cf6bdf8e /** * Sends the component to the player * -@@ -2497,4 +2509,105 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2518,4 +2530,105 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ boolean isOwnedByCurrentRegion(@NotNull Entity entity); // Paper end - Folia region threading API @@ -693,10 +706,10 @@ index b4f8281d3797ec825a7671f38077cd65d5a1d76e..be0e4c789a02d67160287c39cf6bdf8e + // Purpur end } diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index c5fe36050eeaff80cfb989fe2f38370215af6fe5..565ce4b0c5eb300953aaefa786b9f8938c771f2a 100644 +index e6f66d70d024cf4f0536a5bf8e51bf7b306335df..07e75978b4fc0e446e8aa46a40be5e371dc1c11b 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -4213,6 +4213,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -4233,6 +4233,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @Nullable public DragonBattle getEnderDragonBattle(); @@ -946,10 +959,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 d9929d9311e4b2b0ae13a8f6f13563257263f298..a36fc32dd83339b6939cb4046538ec6285042397 100644 +index 23def071492ccd715693d534cc506936e18f0f46..706096924ffd3b578866693e2937de4182fad554 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1104,4 +1104,55 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -1144,4 +1144,55 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent */ @NotNull String getScoreboardEntryName(); // Paper end - entity scoreboard name @@ -1098,13 +1111,13 @@ index bcc6ba95bd21c7972865838c636a03f50b6c1f1a..c3fcd8dd7dbb1e1a18e17c014c1e6411 + // Purpur end } diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index e67455efc84f1e06d3396291d104ce65fee4591b..744b869c028324d5de30d2d64ab080b050fa3c47 100644 +index 65112eae8b92344796850b1e4c89e75443eab2fe..5369d802d37863a1efc0c031520147ceedcadc78 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1310,4 +1310,41 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -1445,4 +1445,41 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource */ void setBodyYaw(float bodyYaw); - // Paper end + // Paper end - body yaw API + + // Purpur start + /** @@ -1169,10 +1182,10 @@ 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 254a02ddb5dc867c9dd6c2086791f7ab94247fd3..6dc63bfe85d83a7cff369f06c57ebe0aa04c63a3 100644 +index d048ae07cc33fd77d128cc1ebf88b0804969fa3c..8bbbdad40bc6a1932d8f79ec95c0a92037b3dac5 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3687,4 +3687,123 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -3752,4 +3752,123 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @Override Spigot spigot(); // Spigot end @@ -1473,7 +1486,7 @@ index f680545b6b59bf8d2ad154b0472dda4cba42a162..58a62ba0635f9158bf18043da89aba75 + // Purpur end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 245a730a54c4b241a9a67eccceefafd2763bd238..54dd0bd043a37f6519fc8a318856a4825d389669 100644 +index 7414b4fa690d393a8e9557cc1fd1ce12fa426940..591759aef6c7c3333cbdab596c6619af9185c3c2 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; @@ -1495,7 +1508,7 @@ index 245a730a54c4b241a9a67eccceefafd2763bd238..54dd0bd043a37f6519fc8a318856a482 /** * Represents a stack of items. -@@ -1033,4 +1045,635 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -1061,4 +1073,635 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return Bukkit.getUnsafe().computeTooltipLines(this, tooltipContext, player); } // Paper end - expose itemstack tooltip lines diff --git a/patches/api/0003-Use-Gradle-Version-Catalogs.patch b/patches/api/0003-Use-Gradle-Version-Catalogs.patch index 1726c9d..bda575b 100644 --- a/patches/api/0003-Use-Gradle-Version-Catalogs.patch +++ b/patches/api/0003-Use-Gradle-Version-Catalogs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use Gradle Version Catalogs diff --git a/build.gradle.kts b/build.gradle.kts -index 0588b113b02a05e946dd92fce489662bc01a41eb..83f574f2314f11425eb9c4b11e8873c048f404ca 100644 +index 09e541dcbbb43699b4402036b8a3cc86a0ac9aad..085cdd8ccdc27f94b22baab7ea4ac0d02769378f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,11 +9,13 @@ java { @@ -15,7 +15,7 @@ index 0588b113b02a05e946dd92fce489662bc01a41eb..83f574f2314f11425eb9c4b11e8873c0 +/* // Plazma - Use Gradle Version Catalogs val annotationsVersion = "24.0.1" val bungeeCordChatVersion = "1.20-R0.2" - val adventureVersion = "4.15.0" + val adventureVersion = "4.16.0" val slf4jVersion = "2.0.9" val log4jVersion = "2.17.1" + */ // Plazma - Use Gradle Version Catalogs @@ -30,7 +30,7 @@ index 0588b113b02a05e946dd92fce489662bc01a41eb..83f574f2314f11425eb9c4b11e8873c0 // api dependencies are listed transitively to API consumers api("com.google.guava:guava:32.1.2-jre") api("com.google.code.gson:gson:2.10.1") -@@ -39,8 +42,34 @@ dependencies { +@@ -39,6 +42,34 @@ dependencies { api("org.joml:joml:1.10.5") // Paper start api("com.googlecode.json-simple:json-simple:1.1.1") { @@ -43,8 +43,8 @@ index 0588b113b02a05e946dd92fce489662bc01a41eb..83f574f2314f11425eb9c4b11e8873c0 + api(common.log4j.api) + api(common.maven.provider) + api(api.jsonsimple) { - isTransitive = false // includes junit - } ++ isTransitive = false // includes junit ++ } + + apiAndDocs(common.bundles.adventure) + apiAndDocs(platform(common.adventure.bom)) @@ -62,25 +62,24 @@ index 0588b113b02a05e946dd92fce489662bc01a41eb..83f574f2314f11425eb9c4b11e8873c0 + testCompileOnly(api.bundles.annotations) + /* + // Plazma end - Use Gradle Version Catalogs + isTransitive = false // includes junit + } api("it.unimi.dsi:fastutil:8.5.6") - apiAndDocs(platform("net.kyori:adventure-bom:$adventureVersion")) - apiAndDocs("net.kyori:adventure-api") -@@ -76,6 +105,7 @@ dependencies { +@@ -76,6 +107,7 @@ dependencies { 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.11.0") + testImplementation("org.ow2.asm:asm-tree:9.7") + */ // Plazma - Use Gradle Version Catalogs } // Paper start -@@ -136,25 +166,27 @@ tasks.withType { +@@ -136,25 +168,25 @@ tasks.withType { options.use() options.isDocFilesSubDirs = true options.links( - "https://guava.dev/releases/32.1.2-jre/api/docs/", - "https://javadoc.io/doc/org.yaml/snakeyaml/2.2/", - "https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations -+ // Plazma start - Use Gradle Version Catalogs + "https://guava.dev/releases/${api.guava.orNull?.version}/api/docs/", + "https://javadoc.io/doc/org.yaml/snakeyaml/${common.snakeyaml.orNull?.version}/", + "https://javadoc.io/doc/org.jetbrains/annotations/${api.annotations.orNull?.version}/", // Paper - we don't want Java 5 annotations @@ -111,7 +110,6 @@ index 0588b113b02a05e946dd92fce489662bc01a41eb..83f574f2314f11425eb9c4b11e8873c0 // 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/${common.maven.connector.orNull?.version}", // Paper -+ // Plazma end - Use Gradle Version Catalogs ) options.tags("apiNote:a:API Note:") diff --git a/patches/api/0004-Plazma-Configurations.patch b/patches/api/0004-Plazma-Configurations.patch index 46bba27..b974d6c 100644 --- a/patches/api/0004-Plazma-Configurations.patch +++ b/patches/api/0004-Plazma-Configurations.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Plazma Configurations diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index be0e4c789a02d67160287c39cf6bdf8ef2229afc..2b3786560d8fb93b9899ebc1e0a7c96a808268d0 100644 +index c15b0b05870a469ea5d314c9fac6a57a045f463c..b55834f2477d18290b2985685eeeb249114dca67 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -2226,6 +2226,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2247,6 +2247,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi } // Purpur end diff --git a/patches/api/0005-Optimize-spigot-event-bus.patch b/patches/api/0005-Optimize-Spigot-event-bus.patch similarity index 98% rename from patches/api/0005-Optimize-spigot-event-bus.patch rename to patches/api/0005-Optimize-Spigot-event-bus.patch index 9b37788..f3f6ed0 100644 --- a/patches/api/0005-Optimize-spigot-event-bus.patch +++ b/patches/api/0005-Optimize-Spigot-event-bus.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: IPECTER Date: Wed, 6 Sep 2023 15:04:25 +0900 -Subject: [PATCH] Optimize-spigot-event-bus +Subject: [PATCH] Optimize Spigot event bus diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java diff --git a/patches/api/0007-Always-allow-Java-17-on-SIMD.patch b/patches/api/0007-Always-allow-Java-17-on-SIMD.patch deleted file mode 100644 index 7df01f6..0000000 --- a/patches/api/0007-Always-allow-Java-17-on-SIMD.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alpha -Date: Sun, 25 Feb 2024 14:14:18 +0900 -Subject: [PATCH] Always allow Java 17+ on SIMD - - -diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java -index ab5fea0b03224bf249352ce340e94704ff713345..8dd1bad95e488f52ebbe23c15fd5db3d32aaebd1 100644 ---- a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java -+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java -@@ -15,7 +15,7 @@ public class SIMDChecker { - @Deprecated - public static boolean canEnable(Logger logger) { - try { -- if (SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19) { -+ if (SIMDDetection.getJavaVersion() < 17) { // Plazma - Always allow Java 17+ - return false; - } else { - SIMDDetection.testRun = true; diff --git a/patches/server/0001-Pufferfish-Server-Changes.patch b/patches/server/0001-Pufferfish-Server-Changes.patch index 94acd1a..48f3aa4 100644 --- a/patches/server/0001-Pufferfish-Server-Changes.patch +++ b/patches/server/0001-Pufferfish-Server-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Kevin Raneri -Date: Sun, 3 Mar 2024 00:58:33 +0000 +Date: Fri, 26 Apr 2024 18:07:20 +0900 Subject: [PATCH] Pufferfish Server Changes Pufferfish @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/build.gradle.kts b/build.gradle.kts -index 241808d8619e17c0681f79acbbc98af5bf52dd89..12b774464e8de3a07993be23e233d31e11ede7b1 100644 +index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..4517548e2c892c2e94f91e7449660f9e36b8f14e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { @@ -76,15 +76,6 @@ index 241808d8619e17c0681f79acbbc98af5bf52dd89..12b774464e8de3a07993be23e233d31e "Implementation-Vendor" to date, // Paper "Specification-Title" to "Bukkit", "Specification-Version" to project.version, -@@ -211,7 +230,5 @@ val runtimeClasspathForRunDev = sourceSets.main.flatMap { src -> - } - tasks.registerRunTask("runDev") { - description = "Spin up a non-relocated Mojang-mapped test server" -- classpath(tasks.filterProjectDir.flatMap { it.outputJar }) -- classpath(runtimeClasspathForRunDev) -- jvmArgs("-DPaper.isRunDev=true") -+ classpath(sourceSets.main.map { it.runtimeClasspath }) - } diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java index 7620c72a4c243cbeea245203ce03a97cbfa7d922..b35a9f4c5f8960864c402ede8a51fb5ab9c4fcc0 100644 --- a/src/main/java/co/aikar/timings/TimingsExport.java @@ -625,10 +616,10 @@ index 0000000000000000000000000000000000000000..020368da69b9a492155f6de6297f7473 +} diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..f6a3364175476c57a7763a087ff55e1689474800 +index 0000000000000000000000000000000000000000..6464682e2f93659e73aca491031c8051ab000033 --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java -@@ -0,0 +1,301 @@ +@@ -0,0 +1,302 @@ +package gg.pufferfish.pufferfish; + +import gg.pufferfish.pufferfish.simd.SIMDDetection; @@ -921,6 +912,7 @@ index 0000000000000000000000000000000000000000..f6a3364175476c57a7763a087ff55e16 + "the ender dragon whenever a player places an end crystal."); + } + ++ + public static boolean disableMethodProfiler; + public static boolean disableOutOfOrderChat; + private static void miscSettings() { @@ -1471,10 +1463,10 @@ index 0000000000000000000000000000000000000000..facd55463d44cb7e3d2ca6892982f549 + } +} diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index 850f75172e9efa72cabb8e5bd124b96a0b1a945f..3db1de70c76e1427e257d988d1a7f26e986b5617 100644 +index e028353e0261310afc42ca0454b723d9f1ffc131..2222625a515d9ae6c3e9c92fc4d4a5bf974af5f8 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -212,7 +212,7 @@ public final class MCUtil { +@@ -215,7 +215,7 @@ public final class MCUtil { } public static long getCoordinateKey(final Entity entity) { @@ -1484,10 +1476,10 @@ index 850f75172e9efa72cabb8e5bd124b96a0b1a945f..3db1de70c76e1427e257d988d1a7f26e public static long getCoordinateKey(final ChunkPos pair) { diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java -index ba12919c3f9aec34a9e64993b143ae92be5eb172..9efeab9078e2d08903e482718b840797e22ab1c2 100644 +index 0af9ed92824ccf30814eceb6a2c2e5c12661c991..67eeb39aede6908d2756e49821ca350ebe916902 100644 --- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java +++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java -@@ -38,7 +38,7 @@ public class SignedMessageChain { +@@ -37,7 +37,7 @@ public class SignedMessageChain { throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.chain_broken"), false); // Paper - diff on change (if disconnects, need a new kick event cause) } else if (playerPublicKey.data().hasExpired()) { throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.expiredProfileKey"), false, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes @@ -1497,7 +1489,7 @@ index ba12919c3f9aec34a9e64993b143ae92be5eb172..9efeab9078e2d08903e482718b840797 } else { this.lastTimeStamp = body.timeStamp(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d06185566b447c432d4dc2e3ba04d121bcdbc71b..d1c21d36de331905aedb08b0a8d4fbf97e100a13 100644 +index 2dc07e5ef249636e85ad9c78e3729e9e066a8fe8..b9e0a32f5829ca15f949effcafcbe2a975f6f690 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -312,6 +312,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { AtomicReference atomicreference = new AtomicReference(); -@@ -1219,6 +1220,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop this.supplier.createInstance(this::onAttributeModified, attribute); // Pufferfish ++ this.createInstance = attributex -> this.supplier.createInstance(this::onAttributeModified, attributex); // Pufferfish } private void onAttributeModified(AttributeInstance instance) { -@@ -45,11 +47,10 @@ public class AttributeMap { - }).collect(Collectors.toList()); +@@ -42,9 +44,10 @@ public class AttributeMap { + return this.attributes.values().stream().filter(attribute -> attribute.getAttribute().isClientSyncable()).collect(Collectors.toList()); } + @Nullable public AttributeInstance getInstance(Attribute attribute) { -- return this.attributes.computeIfAbsent(attribute, (attributex) -> { -- return this.supplier.createInstance(this::onAttributeModified, attributex); -- }); +- return this.attributes.computeIfAbsent(attribute, attributex -> this.supplier.createInstance(this::onAttributeModified, attributex)); + return this.attributes.computeIfAbsent(attribute, this.createInstance); // Pufferfish - cache lambda, as for some reason java allocates it anyways } @Nullable diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java -index 646d9a121d908a2fc3e4e302484dd5cd1bfc6804..e546ecdccde352502e26a8668eaaafe048d6e282 100644 +index 758f62416ca9c02351348ac0d41deeb4624abc0e..69130969c9a434ec2361e573c9a1ec9f462dfda2 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java -@@ -37,7 +37,11 @@ public class VillagerPanicTrigger extends Behavior { +@@ -36,7 +36,11 @@ public class VillagerPanicTrigger extends Behavior { @Override protected void tick(ServerLevel world, Villager entity, long time) { @@ -2225,12 +2215,12 @@ index 646d9a121d908a2fc3e4e302484dd5cd1bfc6804..e546ecdccde352502e26a8668eaaafe0 + // Pufferfish end entity.spawnGolemIfNeeded(world, time, 3); } - + } diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -index 676f5485a4ca9252e911213dcda8d51776b637b6..2d63ee8fef87264d4b61290effa6ba86a787aa61 100644 +index 38af5c7280366fd6ec077f3d914ea5f3ee77451a..d78e1f6191738d426968efc24e734f04b0fc7edb 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -@@ -53,9 +53,12 @@ public class GoalSelector { +@@ -52,9 +52,12 @@ public class GoalSelector { } // Paper start @@ -2246,27 +2236,27 @@ index 676f5485a4ca9252e911213dcda8d51776b637b6..2d63ee8fef87264d4b61290effa6ba86 public boolean hasTasks() { for (WrappedGoal task : this.availableGoals) { diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java -index 07519c817cc6de04a98198c43a0c2b02ba3141eb..ee66be6e5aa45ec8448b6d30785a6e71200b09e3 100644 +index aee0147649d458b87d92496eda0c1723ebe570d2..89e9ea999d2fbd81a1d74382ef3fcd675fc8b94e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java -@@ -120,6 +120,7 @@ public abstract class MoveToBlockGoal extends Goal { - for(int m = 0; m <= l; m = m > 0 ? -m : 1 - m) { - for(int n = m < l && m > -l ? l : 0; n <= l; n = n > 0 ? -n : 1 - n) { +@@ -121,6 +121,7 @@ public abstract class MoveToBlockGoal extends Goal { + for (int m = 0; m <= l; m = m > 0 ? -m : 1 - m) { + for (int n = m < l && m > -l ? l : 0; n <= l; n = n > 0 ? -n : 1 - n) { mutableBlockPos.setWithOffset(blockPos, m, k - 1, n); + if (!this.mob.level().hasChunkAt(mutableBlockPos)) continue; // Pufferfish - if this block isn't loaded, continue if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) { this.blockPos = mutableBlockPos; this.mob.movingTarget = mutableBlockPos == BlockPos.ZERO ? null : mutableBlockPos.immutable(); // Paper diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -index c8a80c1b2fedff22e8a877d466062375ffb2f0d7..931cbbe41905d7ed3fd46c53d3ddd06a6b9a7c8a 100644 +index d2f0c3b26d4beedb49d86e0242d843590d469d02..28cff997a1b263784e245f692adbff2a888a2d53 100644 --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -@@ -75,9 +75,18 @@ public class TargetingConditions { +@@ -76,9 +76,18 @@ public class TargetingConditions { } - if (this.range > 0.0D) { -- double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D; -- double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0D); // Paper - Fix MC-145656 + if (this.range > 0.0) { +- double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0; +- double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0); // Paper - Fix MC-145656 + // Pufferfish start - check range before getting visibility + // d = invisibility percent, e = follow range adjusted for invisibility, f = distance double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ()); @@ -2276,8 +2266,8 @@ index c8a80c1b2fedff22e8a877d466062375ffb2f0d7..931cbbe41905d7ed3fd46c53d3ddd06a + return false; + } + -+ double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D; -+ double e = Math.max((followRangeRaw) * d, 2.0D); // Paper - Fix MC-145656 ++ double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0; ++ double e = Math.max((followRangeRaw) * d, 2.0); // Paper - Fix MC-145656 + // Pufferfish end if (f > e * e) { return false; @@ -2343,11 +2333,11 @@ index b21e180641d17438997a80e5bcb0ec7998d24a2e..33c160994f70f71446d665e748791343 this.level().getProfiler().pop(); this.level().getProfiler().push("axolotlActivityUpdate"); 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 295769d039f2a1e4f48912a60f9dbe267d8992c1..e88b058c0734e436ef24bab6364b206c13e5a9c2 100644 +index a03fb7aa9f4528f4885db88eaf480202d5f54750..1767fd2df8cb37e9c36fa3008b5131ff4bdad12c 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 -@@ -159,9 +159,11 @@ public class Frog extends Animal implements VariantHolder { - +@@ -183,9 +183,11 @@ public class Frog extends Animal implements VariantHolder { + } } + private int behaviorTick = 0; // Pufferfish @@ -2433,11 +2423,11 @@ index f33c03e81b7ff643741f56eea055e6af260de618..6563e625ebae47fc68e5010d36bd4b4d boolean flag1 = iblockdata.getFluidState().is(FluidTags.WATER); 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 01a2016ac82807d28ffe407b7dbb74bdbcde503e..9921b160fb21f72fbd28fe81ea66fbc3dc05f83f 100644 +index 050ffa4a23feba29fdf4c6a175cdff4e5009027d..1299f93d4f983e6715e447add65df91ef9e9090a 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 -@@ -128,9 +128,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { - return (Brain) super.getBrain(); // Paper - decompile fix +@@ -155,9 +155,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { + return (Brain)super.getBrain(); } + private int behaviorTick; // Pufferfish @@ -2517,7 +2507,7 @@ index 24044795d8e0f1fb15a4f2f5401f44897092f2a3..96ca567af2d8fb2ba39f995be80b9353 if (this.assignProfessionWhenSpawned) { this.assignProfessionWhenSpawned = false; diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java -index 309acf7bd07e38043aa81e0e686edba1136bd04c..deabb3400ee2406a8ec179a96d8cfd86f8edbbd6 100644 +index 96c898086f35fd83f9b1ce7e3fe53d31b2fa4c31..c6a925cbd35eb33b27b90bfa8344ac7515d28b76 100644 --- a/src/main/java/net/minecraft/world/entity/player/Inventory.java +++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java @@ -687,6 +687,8 @@ public class Inventory implements Container, Nameable { @@ -2697,19 +2687,19 @@ index 27b0a79f7a7c47047216aae42944bac2a2151181..a097cfc528f709c80575f35483b68783 autorecipestackmanager.initialize(this); // Paper - better exact choice recipes int i = 0; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index f476ba6c97944bdffae5aacae2e285d17541f46e..506100b02e7e9a3eabfde6b1f93858c4cc048524 100644 +index ca89d1593bf1b46c79a882db528cbca1359dc9d4..a82de7111915b19cdc3f065910465a5e7e843aff 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -207,6 +207,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -215,6 +215,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + // Paper end public abstract ResourceKey getTypeKey(); - ++ + protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter -+ + protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, RegistryAccess iregistrycustom, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot - this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config -@@ -1308,14 +1310,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1317,13 +1319,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { try { tickConsumer.accept(entity); MinecraftServer.getServer().executeMidTickTasks(); // Paper - execute chunk tasks mid tick @@ -2721,13 +2711,11 @@ index f476ba6c97944bdffae5aacae2e285d17541f46e..506100b02e7e9a3eabfde6b1f93858c4 MinecraftServer.LOGGER.error(msg, throwable); getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent - entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); -- // Paper end - Prevent block entity and entity crashes + entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Pufferfish - diff on change ServerLevel.tick -+ // Paper end + // Paper end - Prevent block entity and entity crashes } } - // Paper start - Option to prevent armor stands from doing entity lookups -@@ -1788,6 +1790,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1797,6 +1799,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } public ProfilerFiller getProfiler() { @@ -2757,17 +2745,16 @@ index da7489986848316fed029b71d1bc4e1248c9c9a8..661acdf4b1f33d150b0caf179e925d31 return new BlockPos(i, l, j); } diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java -index 4f9187d9d640618c40a2fa528f36b845017b4777..efca73d4de33028cf9df944f36e51b7b50f7a4c5 100644 +index 64076a452a315090d299a7a58a43fd3b5c1b4e0a..0c317b0147a73a8075e0883f0c132f4db0bdfea7 100644 --- a/src/main/java/net/minecraft/world/level/biome/Biome.java +++ b/src/main/java/net/minecraft/world/level/biome/Biome.java -@@ -66,14 +66,20 @@ public final class Biome { +@@ -63,13 +63,18 @@ public final class Biome { private final BiomeGenerationSettings generationSettings; private final MobSpawnSettings mobSettings; private final BiomeSpecialEffects specialEffects; -- private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> { +- private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> Util.make(() -> { + // Pufferfish start - use our cache -+ private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> { - return Util.make(() -> { ++ private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> Util.make(() -> { + /* Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) { protected void rehash(int i) { @@ -2775,14 +2762,13 @@ index 4f9187d9d640618c40a2fa528f36b845017b4777..efca73d4de33028cf9df944f36e51b7b }; long2FloatLinkedOpenHashMap.defaultReturnValue(Float.NaN); return long2FloatLinkedOpenHashMap; -+ + */ + return new gg.airplane.structs.Long2FloatAgingCache(TEMPERATURE_CACHE_SIZE); + // Pufferfish end - }); - }); + })); -@@ -118,17 +124,15 @@ public final class Biome { + Biome(Biome.ClimateSettings weather, BiomeSpecialEffects effects, BiomeGenerationSettings generationSettings, MobSpawnSettings spawnSettings) { +@@ -112,17 +117,15 @@ public final class Biome { @Deprecated public float getTemperature(BlockPos blockPos) { long l = blockPos.asLong(); @@ -2884,7 +2870,7 @@ index 9b1243d96e0694c62fc9e82e9be540bce0d2b3ad..3514022d898a24052c917ebf55dcef3e @Override diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 757edf74751dc7183454656fda9cecc4eb601e4c..9e577408d8e794c40bf34bc800cd0920856a5d2b 100644 +index cdb739df2a285032d25d84f4464f202a7a3fa578..6b9cd8543a5bfc2b936ba18f66ffd60f2f792e43 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -48,7 +48,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen @@ -2895,7 +2881,7 @@ index 757edf74751dc7183454656fda9cecc4eb601e4c..9e577408d8e794c40bf34bc800cd0920 private NonNullList items; + private gg.airplane.structs.ItemListWithBitset optimizedItems; // Pufferfish + // Pufferfish end - private int cooldownTime; + public int cooldownTime; private long tickedGameTime; @@ -84,14 +87,37 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen @@ -2980,12 +2966,12 @@ index 757edf74751dc7183454656fda9cecc4eb601e4c..9e577408d8e794c40bf34bc800cd0920 public static void entityInside(Level world, BlockPos pos, BlockState state, Entity entity, HopperBlockEntity blockEntity) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java -index f52ccd4f3e062af3c7cc6eaea5b074a3bbd21690..a5cd70b6ada2b44f64db0985483ee5eadc67003f 100644 +index dfd1246b735fe64c5beae83567a013861eb00822..fa64bf5ad13c278438039b663ea3134e72108411 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java @@ -94,12 +94,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc public boolean isEmpty() { - this.unpackLootTable((Player)null); + this.unpackLootTable(null); // Paper start - Perf: Optimize Hoppers - for (final ItemStack itemStack : this.getItems()) { - if (!itemStack.isEmpty()) { @@ -2998,7 +2984,7 @@ index f52ccd4f3e062af3c7cc6eaea5b074a3bbd21690..a5cd70b6ada2b44f64db0985483ee5ea } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 6ec3fc801453fd54c25b642e6fa71c19b463311d..922191159fadf8e89646d7299aadee4aa851f71a 100644 +index 465458e8a7dbaf9afb32709a71c7b2620d1e1fd2..270a892373ecbb3982990d6201d79c8a66de4f60 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -86,6 +86,18 @@ public class LevelChunk extends ChunkAccess { @@ -3066,10 +3052,10 @@ index 796bbef3544e06b8e7aac7e8ac5f740a2613f4bd..2422ca3ffc6ab7178cacf933b8013f85 // Paper start - optimise collisions diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java -index 4cdfc433df67afcd455422e9baf56f167dd712ae..57fcf3910f45ce371ac2e237b277b1034caaac4e 100644 +index 83a39f900551e39d5af6f17a339a386ddee4feef..0c8c534fc69172387f188af5282accfed7597ac7 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java +++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java -@@ -8,7 +8,7 @@ import javax.annotation.Nullable; +@@ -9,7 +9,7 @@ import javax.annotation.Nullable; import net.minecraft.world.entity.Entity; public class EntityTickList { @@ -3168,7 +3154,7 @@ index 6d8ff6c06af5545634f255ed17dc1e489ece2548..6411aa4ff6bd4cabb25c426fa8f4a7ee return flag; } diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootParams.java b/src/main/java/net/minecraft/world/level/storage/loot/LootParams.java -index e43d07ccdd36f0c9f5b8e9c74cf0d87e17eec66a..8e441f7c2b2d911a0c0111aaa231fc6adae08730 100644 +index 37a0002bbe6539648db5219bb373e0404ae48dc0..ca0571d232e102c4b177a1ea44b96f5f0f440211 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/LootParams.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/LootParams.java @@ -21,8 +21,10 @@ public class LootParams { @@ -3185,10 +3171,10 @@ index e43d07ccdd36f0c9f5b8e9c74cf0d87e17eec66a..8e441f7c2b2d911a0c0111aaa231fc6a } diff --git a/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java b/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java -index ebe65474a4a05ff1637d7f37ebcfe690af59def5..42142c512b12e5b269c19f1e821c50e7496a5f25 100644 +index 88a4a72bb390947dc17e5da09a99b2d1b3ac4621..284c76ddb9724b44bb2e93f590685c728e843e6d 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java +++ b/src/main/java/net/minecraft/world/phys/shapes/EntityCollisionContext.java -@@ -19,47 +19,66 @@ public class EntityCollisionContext implements CollisionContext { +@@ -17,50 +17,69 @@ public class EntityCollisionContext implements CollisionContext { return defaultValue; } }; @@ -3219,16 +3205,23 @@ index ebe65474a4a05ff1637d7f37ebcfe690af59def5..42142c512b12e5b269c19f1e821c50e7 this.entity = entity; } - /** @deprecated */ @Deprecated protected EntityCollisionContext(Entity entity) { -- this(entity.isDescending(), entity.getY(), entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY, entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : (fluidState) -> { -- return false; -- }, entity); +- this( +- entity.isDescending(), +- entity.getY(), +- entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY, +- entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : fluidState -> false, +- entity +- ); + // Pufferfish start - remove this -+ // this(entity.isDescending(), entity.getY(), entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY, entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : (fluidState) -> { -+ // return false; -+ // }, entity); ++ // this( ++ // entity.isDescending(), ++ // entity.getY(), ++ // entity instanceof LivingEntity ? ((LivingEntity)entity).getMainHandItem() : ItemStack.EMPTY, ++ // entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : fluidState -> false, ++ // entity ++ // ); + // Pufferfish end + this.entity = entity; } @@ -3265,13 +3258,13 @@ index ebe65474a4a05ff1637d7f37ebcfe690af59def5..42142c512b12e5b269c19f1e821c50e7 @Override public boolean isAbove(VoxelShape shape, BlockPos pos, boolean defaultValue) { -- return this.entityBottom > (double)pos.getY() + shape.max(Direction.Axis.Y) - (double)1.0E-5F; -+ return (this.entity == null ? -Double.MAX_VALUE : entity.getY()) > (double)pos.getY() + shape.max(Direction.Axis.Y) - (double)1.0E-5F; // Pufferfish +- return this.entityBottom > (double)pos.getY() + shape.max(Direction.Axis.Y) - 1.0E-5F; ++ return (this.entity == null ? -Double.MAX_VALUE : entity.getY()) > (double)pos.getY() + shape.max(Direction.Axis.Y) - 1.0E-5F; // Pufferfish } @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9f7ed337463cc9bb370a5541d9de5cd8f9c1a78a..9f5a6398a7dca841570a895054cee969dc96bca4 100644 +index c490a29bcf7410bc54959ee71375605964379ed5..18bfe2fb7efad66f5fae07a30593d640c597bf77 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper @@ -3308,10 +3301,10 @@ index 96d772eb02f79f8c478f5e6f065e387aa7665b18..c5ce412f321b8b4f31cc042893659e21 } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 1324f05de8106032ce290e928cf106fb4f450517..0493e0cf3fac2d4e065118f60f1d7b19751b467f 100644 +index 3c7a771c48cc2732cc038ca11bb93ec5f8c2d667..94681c5d807019be5caf0b5d5156c0d670f45f8f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -497,7 +497,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -502,7 +502,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @Override public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { @@ -3334,7 +3327,7 @@ index 774556a62eb240da42e84db4502e2ed43495be17..80553face9c70c2a3d897681e7761df8 if (stream != null) { diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index c39894e824334f1dc52e0466cf9d84f7e219be70..41cddf7e42f0e8f80973e482a95e55d3bd19f659 100644 +index 3283ed99c35ffed6805567705e0518d9f84feedc..d7c7e12c0b8f77e59d94de130972f762ed227726 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -38,6 +38,10 @@ import co.aikar.timings.MinecraftTimings; @@ -3348,7 +3341,7 @@ index c39894e824334f1dc52e0466cf9d84f7e219be70..41cddf7e42f0e8f80973e482a95e55d3 public class ActivationRange { -@@ -221,6 +225,25 @@ public class ActivationRange +@@ -223,6 +227,25 @@ public class ActivationRange } // Paper end - Configurable marker ticking ActivationRange.activateEntity(entity); @@ -3374,7 +3367,7 @@ index c39894e824334f1dc52e0466cf9d84f7e219be70..41cddf7e42f0e8f80973e482a95e55d3 } // Paper end } -@@ -237,12 +260,12 @@ public class ActivationRange +@@ -239,12 +262,12 @@ public class ActivationRange if ( MinecraftServer.currentTick > entity.activatedTick ) { if ( entity.defaultActivationState ) @@ -3389,7 +3382,7 @@ index c39894e824334f1dc52e0466cf9d84f7e219be70..41cddf7e42f0e8f80973e482a95e55d3 entity.activatedTick = MinecraftServer.currentTick; } } -@@ -296,7 +319,7 @@ public class ActivationRange +@@ -298,7 +321,7 @@ public class ActivationRange if ( entity instanceof LivingEntity ) { LivingEntity living = (LivingEntity) entity; diff --git a/patches/server/0002-Purpur-Server-Changes.patch b/patches/server/0002-Purpur-Server-Changes.patch index 6bbd742..2b85133 100644 --- a/patches/server/0002-Purpur-Server-Changes.patch +++ b/patches/server/0002-Purpur-Server-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: granny -Date: Sun, 3 Mar 2024 00:58:34 +0000 +Date: Fri, 26 Apr 2024 18:07:21 +0900 Subject: [PATCH] Purpur Server Changes PurpurMC @@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/build.gradle.kts b/build.gradle.kts -index 12b774464e8de3a07993be23e233d31e11ede7b1..32366253c04c493135f2b22d1940f83669104723 100644 +index 4517548e2c892c2e94f91e7449660f9e36b8f14e..1cad0728d005df9475a978b272adef9703f2ba46 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,12 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { @@ -65,7 +65,7 @@ index 12b774464e8de3a07993be23e233d31e11ede7b1..32366253c04c493135f2b22d1940f836 "Implementation-Vendor" to date, // Paper "Specification-Title" to "Bukkit", "Specification-Version" to project.version, -@@ -174,7 +178,7 @@ fun TaskContainer.registerRunTask( +@@ -169,7 +173,7 @@ fun TaskContainer.registerRunTask( name: String, block: JavaExec.() -> Unit ): TaskProvider = register(name) { @@ -74,15 +74,6 @@ index 12b774464e8de3a07993be23e233d31e11ede7b1..32366253c04c493135f2b22d1940f836 mainClass.set("org.bukkit.craftbukkit.Main") standardInput = System.`in` workingDir = rootProject.layout.projectDirectory -@@ -230,5 +234,7 @@ val runtimeClasspathForRunDev = sourceSets.main.flatMap { src -> - } - tasks.registerRunTask("runDev") { - description = "Spin up a non-relocated Mojang-mapped test server" -- classpath(sourceSets.main.map { it.runtimeClasspath }) -+ classpath(tasks.filterProjectDir.flatMap { it.outputJar }) -+ classpath(runtimeClasspathForRunDev) -+ jvmArgs("-DPaper.isRunDev=true") - } diff --git a/src/log4jPlugins/java/org/purpurmc/purpur/gui/HighlightErrorConverter.java b/src/log4jPlugins/java/org/purpurmc/purpur/gui/HighlightErrorConverter.java new file mode 100644 index 0000000000000000000000000000000000000000..15a226e3854d731f7724025ea3459c8ace07630c @@ -342,7 +333,7 @@ index 039a86034928a5eb7aaa2d7ca76a7bddcca346bd..308f67d0616e2d6bb135258f1fda53cc } diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java -index f6a3364175476c57a7763a087ff55e1689474800..3fea9b69f4cfc94e7f01d4e3ca4ce7506a8e5d5c 100644 +index 6464682e2f93659e73aca491031c8051ab000033..8afc58f35deb49084a20b803e91ce4692ce6e4d6 100644 --- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java @@ -28,6 +28,7 @@ public class PufferfishConfig { @@ -362,6 +353,24 @@ index f6a3364175476c57a7763a087ff55e1689474800..3fea9b69f4cfc94e7f01d4e3ca4ce750 if (configFile.exists()) { try { +@@ -86,7 +87,7 @@ public class PufferfishConfig { + // Attempt to detect vectorization + try { + SIMDDetection.isEnabled = SIMDDetection.canEnable(PufferfishLogger.LOGGER); +- SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19; ++ SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() < 17 || SIMDDetection.getJavaVersion() > 21; + } catch (NoClassDefFoundError | Exception ignored) { + ignored.printStackTrace(); + } +@@ -94,7 +95,7 @@ public class PufferfishConfig { + if (SIMDDetection.isEnabled) { + PufferfishLogger.LOGGER.info("SIMD operations detected as functional. Will replace some operations with faster versions."); + } else if (SIMDDetection.versionLimited) { +- PufferfishLogger.LOGGER.warning("Will not enable SIMD! These optimizations are only safely supported on Java 17, Java 18, and Java 19."); ++ PufferfishLogger.LOGGER.warning("Will not enable SIMD! These optimizations are only safely supported on Java 17 through Java 21."); + } else { + PufferfishLogger.LOGGER.warning("SIMD operations are available for your server, but are not configured!"); + PufferfishLogger.LOGGER.warning("To enable additional optimizations, add \"--add-modules=jdk.incubator.vector\" to your startup flags, BEFORE the \"-jar\"."); @@ -232,7 +233,7 @@ public class PufferfishConfig { public static int activationDistanceMod; @@ -891,27 +900,33 @@ index 676a1499747b071515479130875157263d3a8352..fc1bba350030c076405711716e9830f8 + // Purpur end } diff --git a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java -index 89f0f68b3e2be64bcbf8b173a51d56ea3a3fb4ea..d1c7effca3592a234925657136f750717d696873 100644 +index b0d26b0eadb2a43924629424a6c13198aace8f69..e7cc8105fff9cb952eabfd006e0a4e4638091019 100644 --- a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java +++ b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java -@@ -43,9 +43,9 @@ public class BuildContexts> { +@@ -42,7 +42,7 @@ public class BuildContexts> { ChainModifiers chainModifiers = flags; List list = sources; if (contextChain.getStage() != Stage.EXECUTE) { -- context.profiler().push(() -> { -+ /*context.profiler().push(() -> { // Purpur - return "prepare " + this.commandInput; -- }); -+ });*/ // Purpur +- context.profiler().push(() -> "prepare " + this.commandInput); ++ //context.profiler().push(() -> "prepare " + this.commandInput); // Purpur try { - for(int i = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) { -@@ -88,13 +88,13 @@ public class BuildContexts> { + for (int i = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) { +@@ -52,7 +52,7 @@ public class BuildContexts> { + } + + RedirectModifier redirectModifier = commandContext.getRedirectModifier(); +- if (redirectModifier instanceof CustomModifierExecutor customModifierExecutor) { ++ if (redirectModifier instanceof CustomModifierExecutor customModifierExecutor) { // Purpur - decompile error + customModifierExecutor.apply(baseSource, list, contextChain, chainModifiers, ExecutionControl.create(context, frame)); + return; + } +@@ -86,17 +86,17 @@ public class BuildContexts> { } } } finally { - context.profiler().pop(); -+ // context.profiler().pop(); // Purpur ++ //context.profiler().pop(); // Purpur } } @@ -920,21 +935,23 @@ index 89f0f68b3e2be64bcbf8b173a51d56ea3a3fb4ea..d1c7effca3592a234925657136f75071 - context.queueNext(new CommandQueueEntry<>(frame, FallthroughTask.instance())); + context.queueNext(new CommandQueueEntry<>(frame, (EntryAction) FallthroughTask.instance())); // Purpur - decompile error } - } else { + CommandContext commandContext2 = contextChain.getTopContext(); +- if (commandContext2.getCommand() instanceof CustomCommandExecutor customCommandExecutor) { ++ if (commandContext2.getCommand() instanceof CustomCommandExecutor customCommandExecutor) { // Purpur - decompile error + ExecutionControl executionControl = ExecutionControl.create(context, frame); + + for (T executionCommandSource2 : list) { diff --git a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java -index 821dc4aeaf48460000682604fba51b340b9738e7..3aa2ce6a2a3d3cdfc372a60419a09f49002339da 100644 +index e9775b4506909bee65a74964f0d5391a0513de1d..684f7f202305c09b1037c5d38a52a5ea7f00751b 100644 --- a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java +++ b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java -@@ -23,9 +23,9 @@ public class ExecuteCommand> implements Unbo +@@ -23,7 +23,7 @@ public class ExecuteCommand> implements Unbo @Override public void execute(T executionCommandSource, ExecutionContext executionContext, Frame frame) { -- executionContext.profiler().push(() -> { -+ /*executionContext.profiler().push(() -> { // Purpur - return "execute " + this.commandInput; -- }); -+ });*/ // Purpur +- executionContext.profiler().push(() -> "execute " + this.commandInput); ++ //executionContext.profiler().push(() -> "execute " + this.commandInput); // Purpur try { executionContext.incrementCost(); @@ -943,15 +960,34 @@ index 821dc4aeaf48460000682604fba51b340b9738e7..3aa2ce6a2a3d3cdfc372a60419a09f49 executionCommandSource.handleError(var9, this.modifiers.isForked(), executionContext.tracer()); } finally { - executionContext.profiler().pop(); -+ // executionContext.profiler().pop(); // Purpur ++ //executionContext.profiler().pop(); // Purpur } - } + } +diff --git a/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java b/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java +index b8fa8d5bb62a51281a8ec676066fb02ddeacbebf..682d6d8bd679106a6f07df31adb8dbc568c10d62 100644 +--- a/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java ++++ b/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java +@@ -116,10 +116,10 @@ public class ArgumentTypeInfos { + register(registry, "dimension", DimensionArgument.class, SingletonArgumentInfo.contextFree(DimensionArgument::dimension)); + register(registry, "gamemode", GameModeArgument.class, SingletonArgumentInfo.contextFree(GameModeArgument::gameMode)); + register(registry, "time", TimeArgument.class, new TimeArgument.Info()); +- register(registry, "resource_or_tag", fixClassType(ResourceOrTagArgument.class), new ResourceOrTagArgument.Info()); +- register(registry, "resource_or_tag_key", fixClassType(ResourceOrTagKeyArgument.class), new ResourceOrTagKeyArgument.Info()); +- register(registry, "resource", fixClassType(ResourceArgument.class), new ResourceArgument.Info()); +- register(registry, "resource_key", fixClassType(ResourceKeyArgument.class), new ResourceKeyArgument.Info()); ++ register(registry, "resource_or_tag", fixClassType(ResourceOrTagArgument.class), new ResourceOrTagArgument.Info<>()); // Purpur - decompile error ++ register(registry, "resource_or_tag_key", fixClassType(ResourceOrTagKeyArgument.class), new ResourceOrTagKeyArgument.Info<>()); // Purpur - decompile error ++ register(registry, "resource", fixClassType(ResourceArgument.class), new ResourceArgument.Info<>()); // Purpur - decompile error ++ register(registry, "resource_key", fixClassType(ResourceKeyArgument.class), new ResourceKeyArgument.Info<>()); // Purpur - decompile error + register(registry, "template_mirror", TemplateMirrorArgument.class, SingletonArgumentInfo.contextFree(TemplateMirrorArgument::templateMirror)); + register(registry, "template_rotation", TemplateRotationArgument.class, SingletonArgumentInfo.contextFree(TemplateRotationArgument::templateRotation)); + register(registry, "heightmap", HeightmapTypeArgument.class, SingletonArgumentInfo.contextFree(HeightmapTypeArgument::heightmap)); diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index e17fa30966dea2836fb791becd032fc7d5cc2611..dd06323731533fb9b1b25a56844a4e39e8a1c4ea 100644 +index 70f9e737b3b9f80395afc3542aafe4a0c774c722..70fa9893c7af6387df9e5c33be21653e73222b36 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -48,6 +48,12 @@ public class BlockPos extends Vec3i { +@@ -47,6 +47,12 @@ public class BlockPos extends Vec3i { private static final int X_OFFSET = 38; // Paper end - Optimize Bit Operations by inlining @@ -964,36 +1000,6 @@ index e17fa30966dea2836fb791becd032fc7d5cc2611..dd06323731533fb9b1b25a56844a4e39 public BlockPos(int x, int y, int z) { super(x, y, z); } -diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java -index 2a9fc1f1dfc0c5894c1e74dad5a79ae9b02ac74f..f27fe4370cb027df4fce239eccde28bd8dcd301c 100644 ---- a/src/main/java/net/minecraft/core/Direction.java -+++ b/src/main/java/net/minecraft/core/Direction.java -@@ -253,6 +253,12 @@ public enum Direction implements StringRepresentable { - case EAST: - var10000 = SOUTH; - break; -+ // Purpur start -+ case UP: -+ return UP; -+ case DOWN: -+ return DOWN; -+ // Purpur end - default: - throw new IllegalStateException("Unable to get Y-rotated facing of " + this); - } -@@ -365,6 +371,12 @@ public enum Direction implements StringRepresentable { - case EAST: - var10000 = NORTH; - break; -+ // Purpur start -+ case UP: -+ return UP; -+ case DOWN: -+ return DOWN; -+ // Purpur end - default: - throw new IllegalStateException("Unable to get CCW facing of " + this); - } diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java index e2e1273d787536d2fe1bdbbf8af36eb5ac220599..a3fe92e1db6755a9111ab58e84d61f429d72010f 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java @@ -1036,10 +1042,10 @@ index 8d65cdb013706a932c2c73231108b2810b99e1c7..5b1938fc849db743e65cd7eed0f83ba0 // Paper end - Add drops to shear events continue; diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 4716f8bd8a64d4f20f0d5957c1e7fabf63020f43..b41cab778f446434b788946ea9d3e02c152e570e 100644 +index a536ebcf29d8ef0ed32863bd8d5e70f7a0636e8d..9e31954212b1d6162dca2fbc91d373e908560335 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -569,11 +569,20 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -570,11 +570,20 @@ public class Connection extends SimpleChannelInboundHandler> { private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world private static int joinAttemptsThisTick; // Paper - Buffer joins to world private static int currTick; // Paper - Buffer joins to world @@ -1092,11 +1098,11 @@ index b863249ff7e13cf4939c8961601f0564c62fd661..bdcfd80f937c34956911373905d66424 this.writeId(BuiltInRegistries.ITEM, item); diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -index 3e2d5dcd62775b6ed7c0ce0ba51a71b635b1d644..166cd0f8e72189d10e56cd7bc095409aa919840e 100644 +index 83302c252f54481f239522e5c6861ccfe233070a..620edb63cacd15e38f7fc859efd4095bfb5e5f72 100644 --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java @@ -50,7 +50,7 @@ public class PacketUtils { - if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 + if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players if (listener.shouldHandleMessage(packet)) { co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings - try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings @@ -1118,10 +1124,10 @@ index 9ec6145fe04ec64bbee8ec6a837719caebdbc6f5..358d610ad020cada1bb83e393deeeaae public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) { this.gameTime = time; diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 61840cfd64caba6595dfc99c91c76a195638d4ee..b4a009a1108758110181af3321a91b3ec9cf74dc 100644 +index bc391d27399d8c22e78735ca39aa8ab45efb6413..4ef8eaad4485a2ee920f80556f9dda04e59d2b2a 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -141,6 +141,10 @@ public class Main { +@@ -130,6 +130,10 @@ public class Main { // Paper start - load config files early for access below if needed org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings")); org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings")); @@ -1133,7 +1139,7 @@ index 61840cfd64caba6595dfc99c91c76a195638d4ee..b4a009a1108758110181af3321a91b3e if (optionset.has("initSettings")) { // CraftBukkit diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d1c21d36de331905aedb08b0a8d4fbf97e100a13..b1dd8d66a524254a270a725f5f7a46f28e13b749 100644 +index b9e0a32f5829ca15f949effcafcbe2a975f6f690..60b5e0643d933393b5473681ac9261db29fe2416 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -293,6 +293,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; try { this.isSaving = true; -@@ -1546,20 +1572,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { entityplayer.connection.suspendFlushing(); }); @@ -1407,7 +1413,7 @@ index d1c21d36de331905aedb08b0a8d4fbf97e100a13..b1dd8d66a524254a270a725f5f7a46f2 // Paper start - Folia scheduler API ((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick(); getAllLevels().forEach(level -> { -@@ -1657,22 +1683,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper - Add EntityMoveEvent net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers worldserver.updateLagCompensationTick(); // Paper - lag compensation @@ -1496,7 +1502,7 @@ index d1c21d36de331905aedb08b0a8d4fbf97e100a13..b1dd8d66a524254a270a725f5f7a46f2 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world"); -@@ -1732,33 +1760,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { this.executeBlocking(() -> { this.saveDebugReport(path.resolve("server")); -@@ -2699,40 +2727,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { - final io.papermc.paper.adventure.ChatDecorationProcessor processor = new io.papermc.paper.adventure.ChatDecorationProcessor(this, sender, commandSourceStack, message); diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java index 24e5993b281448734eb67c7a8439a349bbf9fd72..ba8a8575af92541cef2e116743d51cd68d1e794a 100644 --- a/src/main/java/net/minecraft/server/PlayerAdvancements.java @@ -1705,7 +1695,7 @@ index 24e5993b281448734eb67c7a8439a349bbf9fd72..ba8a8575af92541cef2e116743d51cd6 // Paper end } diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java -index df0c15f6b5b2224d53e4f8fad42b9a1e5f33dc25..5dd0dcb47211cec69189115bf4eab1dffc3ca8cf 100644 +index df0c15f6b5b2224d53e4f8fad42b9a1e5f33dc25..92aa26881818fec92d0663e2ccf507165c34c733 100644 --- a/src/main/java/net/minecraft/server/ServerFunctionManager.java +++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java @@ -53,10 +53,10 @@ public class ServerFunctionManager { @@ -1731,7 +1721,7 @@ index df0c15f6b5b2224d53e4f8fad42b9a1e5f33dc25..5dd0dcb47211cec69189115bf4eab1df public void execute(CommandFunction function, CommandSourceStack source) { - ProfilerFiller gameprofilerfiller = this.server.getProfiler(); -+ // ProfilerFiller gameprofilerfiller = this.server.getProfiler(); // Purpur ++ //ProfilerFiller gameprofilerfiller = this.server.getProfiler(); // Purpur - gameprofilerfiller.push(() -> { + /*gameprofilerfiller.push(() -> { // Purpur @@ -1746,15 +1736,15 @@ index df0c15f6b5b2224d53e4f8fad42b9a1e5f33dc25..5dd0dcb47211cec69189115bf4eab1df ServerFunctionManager.LOGGER.warn("Failed to execute function {}", function.id(), exception); } finally { - gameprofilerfiller.pop(); -+ // gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.pop(); // Purpur } } diff --git a/src/main/java/net/minecraft/server/commands/EnchantCommand.java b/src/main/java/net/minecraft/server/commands/EnchantCommand.java -index 37d9c354af887c474094b1a364782007a5f2035d..ec86231077f6a1e03068507555539c5b550ddf31 100644 +index 15bfe2e58d16864af29b04c17181ebf45fa21eba..8b0c61bcdb8e00dda6fb8f43e6d74711361eba9c 100644 --- a/src/main/java/net/minecraft/server/commands/EnchantCommand.java +++ b/src/main/java/net/minecraft/server/commands/EnchantCommand.java -@@ -48,7 +48,7 @@ public class EnchantCommand { +@@ -70,7 +70,7 @@ public class EnchantCommand { private static int enchant(CommandSourceStack source, Collection targets, Holder enchantment, int level) throws CommandSyntaxException { Enchantment enchantment2 = enchantment.value(); @@ -1763,20 +1753,20 @@ index 37d9c354af887c474094b1a364782007a5f2035d..ec86231077f6a1e03068507555539c5b throw ERROR_LEVEL_TOO_HIGH.create(level, enchantment2.getMaxLevel()); } else { int i = 0; -@@ -58,7 +58,7 @@ public class EnchantCommand { - LivingEntity livingEntity = (LivingEntity)entity; +@@ -81,7 +81,7 @@ public class EnchantCommand { ItemStack itemStack = livingEntity.getMainHandItem(); if (!itemStack.isEmpty()) { -- if (enchantment2.canEnchant(itemStack) && EnchantmentHelper.isEnchantmentCompatible(EnchantmentHelper.getEnchantments(itemStack).keySet(), enchantment2)) { -+ if ((enchantment2.canEnchant(itemStack) && EnchantmentHelper.isEnchantmentCompatible(EnchantmentHelper.getEnchantments(itemStack).keySet(), enchantment2)) || (org.purpurmc.purpur.PurpurConfig.allowUnsafeEnchantCommand && !itemStack.hasEnchantment(enchantment2))) { // Purpur + if (enchantment2.canEnchant(itemStack) +- && EnchantmentHelper.isEnchantmentCompatible(EnchantmentHelper.getEnchantments(itemStack).keySet(), enchantment2)) { ++ && EnchantmentHelper.isEnchantmentCompatible(EnchantmentHelper.getEnchantments(itemStack).keySet(), enchantment2) || (org.purpurmc.purpur.PurpurConfig.allowUnsafeEnchantCommand && !itemStack.hasEnchantment(enchantment2))) { // Purpur itemStack.enchant(enchantment2, level); - ++i; + i++; } else if (targets.size() == 1) { diff --git a/src/main/java/net/minecraft/server/commands/GameModeCommand.java b/src/main/java/net/minecraft/server/commands/GameModeCommand.java -index f7c9127346261d83413ca03a1cdaa84975ae17d6..0cb50229df7df79ad3185a5695707392301653d9 100644 +index d1da3600dc07107309b20ebe6e7c0c4da0e8de76..244b4719c689f153fa36381a60acc280bb0bd9b3 100644 --- a/src/main/java/net/minecraft/server/commands/GameModeCommand.java +++ b/src/main/java/net/minecraft/server/commands/GameModeCommand.java -@@ -45,6 +45,18 @@ public class GameModeCommand { +@@ -57,6 +57,18 @@ public class GameModeCommand { } private static int setMode(CommandContext context, Collection targets, GameType gameMode) { @@ -1794,7 +1784,7 @@ index f7c9127346261d83413ca03a1cdaa84975ae17d6..0cb50229df7df79ad3185a5695707392 + // Purpur end int i = 0; - for(ServerPlayer serverPlayer : targets) { + for (ServerPlayer serverPlayer : targets) { diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java index 1b459a8ee8a6bc039e742d65796bc76660a1c765..599172b994d75484f7c7e0ce6d3d3d771c1c44d0 100644 --- a/src/main/java/net/minecraft/server/commands/GiveCommand.java @@ -1909,7 +1899,7 @@ index bab2471616404821671264ccefd729cab8d0bf58..ae75edfaa9e4c72f11fbb7ffc66294be public final boolean spawnNpcs = this.get("spawn-npcs", true); public final boolean pvp = this.get("pvp", true); diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java -index c42a9949c4d37d45883867a54222a7ab33944b39..7f07ffab0835d45d4d170fe171d7fa996d5913d9 100644 +index 7704a5951ac3d02020ed0f40d76500dd6ba005af..0dec2f3762aa55cfaa7af5b357f0fe243a3b2cc6 100644 --- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java +++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java @@ -43,6 +43,11 @@ public class MinecraftServerGui extends JComponent { @@ -1951,7 +1941,7 @@ index c42a9949c4d37d45883867a54222a7ab33944b39..7f07ffab0835d45d4d170fe171d7fa99 server.halt(true); servergui.runFinalizers(); } -@@ -125,7 +130,7 @@ public class MinecraftServerGui extends JComponent { +@@ -159,7 +164,7 @@ public class MinecraftServerGui extends JComponent { private JComponent buildChatPanel() { JPanel jpanel = new JPanel(new BorderLayout()); @@ -1960,7 +1950,7 @@ index c42a9949c4d37d45883867a54222a7ab33944b39..7f07ffab0835d45d4d170fe171d7fa99 JScrollPane jscrollpane = new JScrollPane(jtextarea, 22, 30); jtextarea.setEditable(false); -@@ -137,10 +142,43 @@ public class MinecraftServerGui extends JComponent { +@@ -171,10 +176,43 @@ public class MinecraftServerGui extends JComponent { if (!s.isEmpty()) { this.server.handleConsoleInput(s, this.server.createCommandSourceStack()); @@ -2004,7 +1994,7 @@ index c42a9949c4d37d45883867a54222a7ab33944b39..7f07ffab0835d45d4d170fe171d7fa99 jtextarea.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent focusevent) {} }); -@@ -176,7 +214,7 @@ public class MinecraftServerGui extends JComponent { +@@ -210,7 +248,7 @@ public class MinecraftServerGui extends JComponent { } private static final java.util.regex.Pattern ANSI = java.util.regex.Pattern.compile("\\e\\[[\\d;]*[^\\d;]"); // CraftBukkit // Paper @@ -2013,7 +2003,7 @@ index c42a9949c4d37d45883867a54222a7ab33944b39..7f07ffab0835d45d4d170fe171d7fa99 if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(() -> { this.print(textArea, scrollPane, message); -@@ -190,11 +228,14 @@ public class MinecraftServerGui extends JComponent { +@@ -224,11 +262,14 @@ public class MinecraftServerGui extends JComponent { flag = (double) jscrollbar.getValue() + jscrollbar.getSize().getHeight() + (double) (MinecraftServerGui.MONOSPACED.getSize() * 4) > (double) jscrollbar.getMaximum(); } @@ -2028,7 +2018,7 @@ index c42a9949c4d37d45883867a54222a7ab33944b39..7f07ffab0835d45d4d170fe171d7fa99 if (flag) { jscrollbar.setValue(Integer.MAX_VALUE); -@@ -202,4 +243,16 @@ public class MinecraftServerGui extends JComponent { +@@ -236,4 +277,16 @@ public class MinecraftServerGui extends JComponent { } } @@ -2046,17 +2036,17 @@ index c42a9949c4d37d45883867a54222a7ab33944b39..7f07ffab0835d45d4d170fe171d7fa99 + // Purpur end } diff --git a/src/main/java/net/minecraft/server/gui/StatsComponent.java b/src/main/java/net/minecraft/server/gui/StatsComponent.java -index 38fe7e5014332f45e41a3d5d91c28dd0acfdc3b0..479657ddef21f0279b361117b82549f7105be416 100644 +index 096c89bd01cec2abd151bf6fffc4847d1bcd548f..cd0a8a6a1be75cab8bbb8ee3ac17bb732b9e7108 100644 --- a/src/main/java/net/minecraft/server/gui/StatsComponent.java +++ b/src/main/java/net/minecraft/server/gui/StatsComponent.java @@ -45,7 +45,7 @@ public class StatsComponent extends JComponent { - } - this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; - this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms"; + this.msgs[1] = "Avg tick: " + + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND) + + " ms"; - this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg); + this.msgs[2] = "TPS from last 5s, 1m, 5m, 15m: " + String.join(", ", tpsAvg); // Purpur // Paper end - Improve ServerGUI - this.values[this.vp++ & 255] = (int)(l * 100L / Runtime.getRuntime().maxMemory()); + this.values[this.vp++ & 0xFF] = (int)(l * 100L / Runtime.getRuntime().maxMemory()); this.repaint(); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java index 1081e9df44bb24b2c51ebd9364c21c7b2a3a205a..bb412ca874b85d777c0e3565fcefcee15b23182b 100644 @@ -2151,7 +2141,7 @@ index 1081e9df44bb24b2c51ebd9364c21c7b2a3a205a..bb412ca874b85d777c0e3565fcefcee1 } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 1cf8c819c0d7776c3b33d6594ca81abe3c2a719d..6167ffb1263a1a65b582b7d295d1d77ef38c3ee3 100644 +index 1cf8c819c0d7776c3b33d6594ca81abe3c2a719d..7b3ba500f465b999ce11964b0e4e30f36005536e 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -264,16 +264,16 @@ public class ServerChunkCache extends ChunkSource { @@ -2281,7 +2271,7 @@ index 1cf8c819c0d7776c3b33d6594ca81abe3c2a719d..6167ffb1263a1a65b582b7d295d1d77e if (this.level.getServer().tickRateManager().runsNormally()) { - gameprofilerfiller.popPush("naturalSpawnCount"); - this.level.timings.countNaturalMobs.startTiming(); // Paper - timings -+ // gameprofilerfiller.popPush("naturalSpawnCount"); // Purpur ++ //gameprofilerfiller.popPush("naturalSpawnCount"); // Purpur + //this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur int k = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - Optional per player mob spawns @@ -2362,7 +2352,7 @@ index db55ad9aaabfa1ea998754f3ac352d1698936696..04b98e23eed926d8473cc2464e04a5b9 public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer> 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 531c9ef0d6504fc1632b83bd93b9cf76e91377e8..fb6b762bac4d36b2e307b5343988884fa339d001 100644 +index fbffe3dab1b7812b50df5d6bddf4fbdb2e583339..00ac2902be93327c7dd1bf78ee5922d7954f1b26 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -215,6 +215,8 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2429,10 +2419,10 @@ index 531c9ef0d6504fc1632b83bd93b9cf76e91377e8..fb6b762bac4d36b2e307b5343988884f if (flag) { - gameprofilerfiller.push("world border"); -+ // gameprofilerfiller.push("world border"); // Purpur ++ //gameprofilerfiller.push("world border"); // Purpur this.getWorldBorder().tick(); - gameprofilerfiller.popPush("weather"); -+ // gameprofilerfiller.popPush("weather"); // Purpur ++ //gameprofilerfiller.popPush("weather"); // Purpur this.advanceWeatherCycle(); } @@ -2456,10 +2446,10 @@ index 531c9ef0d6504fc1632b83bd93b9cf76e91377e8..fb6b762bac4d36b2e307b5343988884f j = this.getGameTime(); - gameprofilerfiller.push("blockTicks"); + //gameprofilerfiller.push("blockTicks"); // Purpur - this.blockTicks.tick(j, 65536, this::tickBlock); + this.blockTicks.tick(j, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks - gameprofilerfiller.popPush("fluidTicks"); + //gameprofilerfiller.popPush("fluidTicks"); // Purpur - this.fluidTicks.tick(j, 65536, this::tickFluid); + this.fluidTicks.tick(j, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks - gameprofilerfiller.pop(); + //gameprofilerfiller.pop(); // Purpur } @@ -2496,7 +2486,7 @@ index 531c9ef0d6504fc1632b83bd93b9cf76e91377e8..fb6b762bac4d36b2e307b5343988884f this.handlingTick = false; - gameprofilerfiller.pop(); + //gameprofilerfiller.pop(); // Purpur - boolean flag1 = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players + boolean flag1 = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this if (flag1) { @@ -883,25 +904,25 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2541,12 +2531,7 @@ index 531c9ef0d6504fc1632b83bd93b9cf76e91377e8..fb6b762bac4d36b2e307b5343988884f // Pufferfish start - copied from this.guardEntityTick try { this.tickNonPassenger(entity); // Pufferfish - changed -@@ -924,24 +945,23 @@ public class ServerLevel extends Level implements WorldGenLevel { - final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); - MinecraftServer.LOGGER.error(msg, throwable); - getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); -- entity.discard(); -+ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Purpur +@@ -928,20 +949,19 @@ public class ServerLevel extends Level implements WorldGenLevel { // Paper end } // Pufferfish end @@ -2861,7 +2846,7 @@ index 531c9ef0d6504fc1632b83bd93b9cf76e91377e8..fb6b762bac4d36b2e307b5343988884f // Paper - rewrite chunk system - entity saving moved into ChunkHolder } else if (close) { chunkproviderserver.close(false); } // Paper - rewrite chunk system -@@ -2841,7 +2908,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2852,7 +2919,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 - Fix merchant inventory not closing on entity removal @@ -2871,7 +2856,7 @@ index 531c9ef0d6504fc1632b83bd93b9cf76e91377e8..fb6b762bac4d36b2e307b5343988884f } // Paper end - Fix merchant inventory not closing on entity removal diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 58591bf2f63b9c5e97d9ce4188dff3366968a178..36b7686fdfeaab13cb1be9610ddc76fc70f6f6e5 100644 +index b3781efbd3edcf102fe1bda5d6149915dc1127c6..305b90d10a499e9731f5178433fb10207e428091 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -281,6 +281,10 @@ public class ServerPlayer extends Player { @@ -3216,7 +3201,7 @@ index a7b217ddbcbf92513bd38101fdfca2075505e267..f8edb6b0d119582cf404b9931adc0948 + // Purpur end } diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index 5ece375eaf6bcc61864997a389bb5e24625e4505..aee4ab6c7ea09006bec4a1c6df0005718c6d86bd 100644 +index 9c3f8f79c2b3389a118dce9a1558edda52446833..01097e09c020fbe08d4fb467c02abc356657f768 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java @@ -318,6 +318,7 @@ public class WorldGenRegion implements WorldGenLevel { @@ -3315,7 +3300,7 @@ index 0306771b8f90dcdd77f151c19c6c2d75c41f8feb..02e65b0bd212d46855baee48fab35dc9 public void suspendFlushing() { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 601ac8738a775eafde2c9e237feb596a9a47ba89..ae5a2152cde8922deeb8d1d8a85bf39518ccd759 100644 +index e725c1c0496383007ffb94c46fc18340666b5e29..f7ac60e1aa188ec25a4c5d326cdd4a109a54101c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -324,6 +324,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3585,7 +3570,7 @@ index 601ac8738a775eafde2c9e237feb596a9a47ba89..ae5a2152cde8922deeb8d1d8a85bf395 // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { entity.getEntityData().resendPossiblyDesyncedEntity(player); // Paper - The entire mob gets deleted, so resend it. -@@ -3296,6 +3369,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3309,6 +3382,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } } @@ -3624,12 +3609,12 @@ index e5006e7672ba79ed4bcf2c4173c5a9ed4c68395b..6338c52e0082d36d3b80038fdb44abf2 // Paper end } diff --git a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -index 9ddbfcf80d9a381dace78a62880f85a4d767e0eb..7383c7d3820dce06108eaafd236a7c6c06a10a42 100644 +index f14113eef226e906c0d21641e74a27471254909d..0c25f3ed0a8a538edc7cadd3476100c9b3631f7a 100644 --- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -@@ -9,11 +9,11 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener - @Override - default CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) { +@@ -16,11 +16,11 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener + Executor applyExecutor + ) { return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> { - applyProfiler.startTick(); - applyProfiler.push("listener"); @@ -3782,7 +3767,7 @@ index 4103ddf16164e3992fef0765d368282572537e29..a0cb49233b1dbf53ce9d1bcc52b89678 } else { handler.accept((RecipeHolder) optional.get()); diff --git a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java -index 196c7331138fee2822c76aacd136f9da040e0049..c6c30d99399c5cde2b0ec2f320d81d952b422d78 100644 +index bce2dac613d29083dd5fbb68739304cc5a6d4d27..600a7036b503f60cc9c95f189f73c2dbf020e2e1 100644 --- a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java +++ b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java @@ -55,7 +55,7 @@ public class ActiveProfiler implements ProfileCollector { @@ -3802,7 +3787,7 @@ index 196c7331138fee2822c76aacd136f9da040e0049..c6c30d99399c5cde2b0ec2f320d81d95 + //this.pop(); // Purpur this.started = false; if (!this.path.isEmpty()) { - LOGGER.error("Profiler tick ended before path was fully popped (remainder: '{}'). Mismatched push/pop?", LogUtils.defer(() -> { + LOGGER.error( @@ -93,7 +93,7 @@ public class ActiveProfiler implements ProfileCollector { @Override @@ -3832,7 +3817,7 @@ index 196c7331138fee2822c76aacd136f9da040e0049..c6c30d99399c5cde2b0ec2f320d81d95 private ActiveProfiler.PathEntry getCurrentEntry() { diff --git a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java -index 2e6e8eac987c4ef6b2dcd3de592d8a51d2b29792..863343a87fe34d72f04af89d75268b477b2adc7a 100644 +index a715ecf4a8ac91d3e5e5c6269d89e54b2c1cd279..223c3665126c576eddb1a8f7c9f5bc60c6ff9818 100644 --- a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java +++ b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java @@ -6,32 +6,44 @@ import net.minecraft.util.profiling.metrics.MetricCategory; @@ -3881,7 +3866,7 @@ index 2e6e8eac987c4ef6b2dcd3de592d8a51d2b29792..863343a87fe34d72f04af89d75268b47 + @io.papermc.paper.annotation.DoNotUse // Purpur void incrementCounter(Supplier markerGetter, int num); - static ProfilerFiller tee(final ProfilerFiller a, final ProfilerFiller b) { + static ProfilerFiller tee(ProfilerFiller a, ProfilerFiller b) { @@ -41,62 +53,62 @@ public interface ProfilerFiller { return b == InactiveProfiler.INSTANCE ? a : new ProfilerFiller() { @Override @@ -3985,19 +3970,19 @@ index ccbfcef3e83b1bef364447657bfd08a92d615cf6..aa2331c6df4e79d4bb0add071a0b11d2 } } diff --git a/src/main/java/net/minecraft/world/damagesource/CombatTracker.java b/src/main/java/net/minecraft/world/damagesource/CombatTracker.java -index 9c99b2e365aacb8309f29acb9025faccd2c676b3..1653d154edb38a6450ee51cb5e5b8e3d37a1784e 100644 +index 7056c8ca7a87748f14142c6af274aae492f29f1c..bf06bb78d060bb54d9aaade3605d42ce837d598b 100644 --- a/src/main/java/net/minecraft/world/damagesource/CombatTracker.java +++ b/src/main/java/net/minecraft/world/damagesource/CombatTracker.java -@@ -59,7 +59,7 @@ public class CombatTracker { - } +@@ -53,7 +53,7 @@ public class CombatTracker { - ItemStack itemStack = var10000; -- return !itemStack.isEmpty() && itemStack.hasCustomHoverName() ? Component.translatable(itemDeathTranslationKey, this.mob.getDisplayName(), attackerDisplayName, itemStack.getDisplayName()) : Component.translatable(deathTranslationKey, this.mob.getDisplayName(), attackerDisplayName); -+ return !itemStack.isEmpty() && (org.purpurmc.purpur.PurpurConfig.playerDeathsAlwaysShowItem || itemStack.hasCustomHoverName()) ? Component.translatable(itemDeathTranslationKey, this.mob.getDisplayName(), attackerDisplayName, itemStack.getDisplayName()) : Component.translatable(deathTranslationKey, this.mob.getDisplayName(), attackerDisplayName); + private Component getMessageForAssistedFall(Entity attacker, Component attackerDisplayName, String itemDeathTranslationKey, String deathTranslationKey) { + ItemStack itemStack = attacker instanceof LivingEntity livingEntity ? livingEntity.getMainHandItem() : ItemStack.EMPTY; +- return !itemStack.isEmpty() && itemStack.hasCustomHoverName() ++ return !itemStack.isEmpty() && (org.purpurmc.purpur.PurpurConfig.playerDeathsAlwaysShowItem || itemStack.hasCustomHoverName()) // Purpur + ? Component.translatable(itemDeathTranslationKey, this.mob.getDisplayName(), attackerDisplayName, itemStack.getDisplayName()) + : Component.translatable(deathTranslationKey, this.mob.getDisplayName(), attackerDisplayName); } - - private Component getFallMessage(CombatEntry damageRecord, @Nullable Entity attacker) { -@@ -99,6 +99,13 @@ public class CombatTracker { +@@ -97,6 +97,13 @@ public class CombatTracker { Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable(string + ".link")).withStyle(INTENTIONAL_GAME_DESIGN_STYLE); return Component.translatable(string + ".message", this.mob.getDisplayName(), component); } else { @@ -4012,7 +3997,7 @@ index 9c99b2e365aacb8309f29acb9025faccd2c676b3..1653d154edb38a6450ee51cb5e5b8e3d } } diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java -index 1561b85a45f52a8162f43553f8485bfe084b8f1f..ba4466c49a7c1713007140efdc2eb805e2516b4c 100644 +index b26e4d58ea1898a5e4b31c3d6ab33f38835ab2c6..a1724d2d545aa808ea380f910c0190658fc7881b 100644 --- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java +++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java @@ -27,6 +27,8 @@ public class DamageSource { @@ -4021,10 +4006,10 @@ index 1561b85a45f52a8162f43553f8485bfe084b8f1f..ba4466c49a7c1713007140efdc2eb805 private boolean poison = false; + private boolean scissors = false; // Purpur + private boolean stonecutter = false; // Purpur - private Entity customCausingEntity = null; // This field is a helper for when causing entity damage is not set by vanilla + @Nullable + private Entity customEventDamager = null; // This field is a helper for when causing entity damage is not set by vanilla // Paper - fix DamageSource API - public DamageSource sweep() { -@@ -56,6 +58,26 @@ public class DamageSource { +@@ -57,6 +59,26 @@ public class DamageSource { return this.poison; } @@ -4048,10 +4033,10 @@ index 1561b85a45f52a8162f43553f8485bfe084b8f1f..ba4466c49a7c1713007140efdc2eb805 + } + // Purpur end + - public Entity getCausingEntity() { - return (this.customCausingEntity != null) ? this.customCausingEntity : this.causingEntity; - } -@@ -94,6 +116,8 @@ public class DamageSource { + // Paper start - fix DamageSource API + public @Nullable Entity getCustomEventDamager() { + return (this.customEventDamager != null) ? this.customEventDamager : this.directEntity; +@@ -100,6 +122,8 @@ public class DamageSource { damageSource.withSweep = this.isSweep(); damageSource.poison = this.isPoison(); damageSource.melting = this.isMelting(); @@ -4060,7 +4045,7 @@ index 1561b85a45f52a8162f43553f8485bfe084b8f1f..ba4466c49a7c1713007140efdc2eb805 return damageSource; } // CraftBukkit end -@@ -166,10 +190,19 @@ public class DamageSource { +@@ -172,10 +196,19 @@ public class DamageSource { ItemStack itemstack1 = itemstack; @@ -4131,7 +4116,7 @@ index 3aad6bd0a1fb7bb3f9b7dab2c10c875864900750..31bd845130e363dd11c225dfd1e9dd89 } diff --git a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java -index bf304db1f9506d3e83d16cd632b9155c39346634..d94497083f3da89dbef6479ef8f70591e630e3e7 100644 +index 5c9a0c91ae53b575d325a294c702668d30252fcf..0758ddbd37a519d03ae134731368f4a69c2f8aab 100644 --- a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java +++ b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java @@ -36,6 +36,7 @@ public class MobEffectInstance implements Comparable { @@ -4142,37 +4127,31 @@ index bf304db1f9506d3e83d16cd632b9155c39346634..d94497083f3da89dbef6479ef8f70591 private final Optional factorData; public MobEffectInstance(MobEffect type) { -@@ -54,17 +55,36 @@ public class MobEffectInstance implements Comparable { +@@ -54,8 +55,14 @@ public class MobEffectInstance implements Comparable { this(type, duration, amplifier, ambient, visible, visible); } + // Purpur start -+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean visible, @Nullable org.bukkit.NamespacedKey key) { -+ this(type, duration, amplifier, ambient, visible, visible, key); ++ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable org.bukkit.NamespacedKey key) { ++ this(type, duration, amplifier, ambient, showParticles, showIcon, null, key, type.createFactorData()); + } + // Purpur end + public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon) { -- this(type, duration, amplifier, ambient, showParticles, showIcon, (MobEffectInstance)null, type.createFactorData()); -+ // Purpur start -+ this(type, duration, amplifier, ambient, showParticles, showIcon, (MobEffectInstance)null, type.createFactorData(), (org.bukkit.NamespacedKey)null); -+ } -+ -+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable org.bukkit.NamespacedKey key) { -+ this(type, duration, amplifier, ambient, showParticles, showIcon, (MobEffectInstance)null, type.createFactorData(), key); -+ // Purpur end +- this(type, duration, amplifier, ambient, showParticles, showIcon, null, type.createFactorData()); ++ this(type, duration, amplifier, ambient, showParticles, showIcon, null, null, type.createFactorData()); // Purpur } - public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable MobEffectInstance hiddenEffect, Optional factorCalculationData) { -+ // Purpur start -+ this(type, duration, amplifier, ambient, showParticles, showIcon, hiddenEffect, factorCalculationData, (org.bukkit.NamespacedKey) null); -+ } -+ -+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable MobEffectInstance hiddenEffect, Optional factorCalculationData, @Nullable org.bukkit.NamespacedKey key) { -+ // Purpur end + public MobEffectInstance( +@@ -66,6 +73,7 @@ public class MobEffectInstance implements Comparable { + boolean showParticles, + boolean showIcon, + @Nullable MobEffectInstance hiddenEffect, ++ @Nullable org.bukkit.NamespacedKey key, // Purpur + Optional factorCalculationData + ) { this.effect = type; - this.duration = duration; - this.amplifier = amplifier; +@@ -74,6 +82,7 @@ public class MobEffectInstance implements Comparable { this.ambient = ambient; this.visible = showParticles; this.showIcon = showIcon; @@ -4180,7 +4159,7 @@ index bf304db1f9506d3e83d16cd632b9155c39346634..d94497083f3da89dbef6479ef8f70591 this.hiddenEffect = hiddenEffect; this.factorData = factorCalculationData; } -@@ -85,6 +105,7 @@ public class MobEffectInstance implements Comparable { +@@ -94,6 +103,7 @@ public class MobEffectInstance implements Comparable { this.ambient = that.ambient; this.visible = that.visible; this.showIcon = that.showIcon; @@ -4188,7 +4167,7 @@ index bf304db1f9506d3e83d16cd632b9155c39346634..d94497083f3da89dbef6479ef8f70591 } public boolean update(MobEffectInstance that) { -@@ -129,6 +150,13 @@ public class MobEffectInstance implements Comparable { +@@ -138,6 +148,13 @@ public class MobEffectInstance implements Comparable { bl = true; } @@ -4202,7 +4181,7 @@ index bf304db1f9506d3e83d16cd632b9155c39346634..d94497083f3da89dbef6479ef8f70591 return bl; } -@@ -172,6 +200,17 @@ public class MobEffectInstance implements Comparable { +@@ -181,6 +198,17 @@ public class MobEffectInstance implements Comparable { return this.showIcon; } @@ -4220,7 +4199,7 @@ index bf304db1f9506d3e83d16cd632b9155c39346634..d94497083f3da89dbef6479ef8f70591 public boolean tick(LivingEntity entity, Runnable overwriteCallback) { if (this.hasRemainingDuration()) { int i = this.isInfiniteDuration() ? entity.tickCount : this.duration; -@@ -232,6 +271,12 @@ public class MobEffectInstance implements Comparable { +@@ -237,6 +265,12 @@ public class MobEffectInstance implements Comparable { string = string + ", Show Icon: false"; } @@ -4233,16 +4212,15 @@ index bf304db1f9506d3e83d16cd632b9155c39346634..d94497083f3da89dbef6479ef8f70591 return string; } -@@ -247,7 +292,7 @@ public class MobEffectInstance implements Comparable { - return false; - } else { - MobEffectInstance mobEffectInstance = (MobEffectInstance)object; -- return this.duration == mobEffectInstance.duration && this.amplifier == mobEffectInstance.amplifier && this.ambient == mobEffectInstance.ambient && this.effect.equals(mobEffectInstance.effect); -+ return this.duration == mobEffectInstance.duration && this.amplifier == mobEffectInstance.amplifier && this.ambient == mobEffectInstance.ambient && this.effect.equals(mobEffectInstance.effect) && this.key == mobEffectInstance.key; // Purpur - add key - } +@@ -251,6 +285,7 @@ public class MobEffectInstance implements Comparable { + && this.duration == mobEffectInstance.duration + && this.amplifier == mobEffectInstance.amplifier + && this.ambient == mobEffectInstance.ambient ++ && this.key == mobEffectInstance.key // Purpur - add key + && this.effect.equals(mobEffectInstance.effect); } -@@ -272,6 +317,11 @@ public class MobEffectInstance implements Comparable { +@@ -275,6 +310,11 @@ public class MobEffectInstance implements Comparable { nbt.putBoolean("ambient", this.isAmbient()); nbt.putBoolean("show_particles", this.isVisible()); nbt.putBoolean("show_icon", this.showIcon()); @@ -4254,7 +4232,7 @@ index bf304db1f9506d3e83d16cd632b9155c39346634..d94497083f3da89dbef6479ef8f70591 if (this.hiddenEffect != null) { CompoundTag compoundTag = new CompoundTag(); this.hiddenEffect.save(compoundTag); -@@ -306,6 +356,13 @@ public class MobEffectInstance implements Comparable { +@@ -311,6 +351,13 @@ public class MobEffectInstance implements Comparable { bl3 = nbt.getBoolean("show_icon"); } @@ -4268,12 +4246,12 @@ index bf304db1f9506d3e83d16cd632b9155c39346634..d94497083f3da89dbef6479ef8f70591 MobEffectInstance mobEffectInstance = null; if (nbt.contains("hidden_effect", 10)) { mobEffectInstance = loadSpecifiedEffect(type, nbt.getCompound("hidden_effect")); -@@ -318,7 +375,7 @@ public class MobEffectInstance implements Comparable { +@@ -325,7 +372,7 @@ public class MobEffectInstance implements Comparable { optional = Optional.empty(); } - return new MobEffectInstance(type, j, Math.max(i, 0), bl, bl2, bl3, mobEffectInstance, optional); -+ return new MobEffectInstance(type, j, Math.max(i, 0), bl, bl2, bl3, mobEffectInstance, optional, key); // Purpur - add key ++ return new MobEffectInstance(type, j, Math.max(i, 0), bl, bl2, bl3, mobEffectInstance, key, optional); // Purpur - add key } @Override @@ -4319,7 +4297,7 @@ index b994ae09621934df2cdd6a83a7d8ecb44649fb16..c2b812c992db1ac9cd391da902c8d819 ((CraftPlayer) entityhuman.getBukkitEntity()).sendHealthUpdate(); diff --git a/src/main/java/net/minecraft/world/effect/WitherMobEffect.java b/src/main/java/net/minecraft/world/effect/WitherMobEffect.java -index 1f9e0c139988c4c44a26552881647d36965aa4fa..b8d612d22aca74a08b53393c0723a2ae3a0b9ddf 100644 +index cc45fd864185a7842c465e26304b36f7c744bb93..434390a6b88eac7bd41ad6b05d223c78571885fb 100644 --- a/src/main/java/net/minecraft/world/effect/WitherMobEffect.java +++ b/src/main/java/net/minecraft/world/effect/WitherMobEffect.java @@ -10,7 +10,7 @@ class WitherMobEffect extends MobEffect { @@ -4332,7 +4310,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 098c410f0285948d7ac48835c352f9c97742c5c7..2092ede561d14ace1c003ced051cd4967bb41beb 100644 +index 1aa45e64e49ea011c2ba5e943b4e72c4f3a47176..f2c6b52fe7fbb05afa0074684cd195f6ae598f1f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -160,7 +160,7 @@ import org.bukkit.plugin.PluginManager; @@ -4456,7 +4434,7 @@ index 098c410f0285948d7ac48835c352f9c97742c5c7..2092ede561d14ace1c003ced051cd496 this.stuckSpeedMultiplier = Vec3.ZERO; @@ -1131,7 +1152,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S // Paper start - ignore movement changes while inactive. - if (isTemporarilyActive && !(this instanceof ItemEntity || this instanceof net.minecraft.world.entity.vehicle.AbstractMinecart) && movement == getDeltaMovement() && movementType == MoverType.SELF) { + if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && movementType == MoverType.SELF) { setDeltaMovement(Vec3.ZERO); - this.level.getProfiler().pop(); + //this.level.getProfiler().pop(); // Purpur @@ -4598,15 +4576,6 @@ index 098c410f0285948d7ac48835c352f9c97742c5c7..2092ede561d14ace1c003ced051cd496 } this.isInsidePortal = false; -@@ -3201,7 +3250,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S - } - - this.processPortalCooldown(); -- this.tickEndPortal(); // Paper - make end portalling safe -+ if (this.level().purpurConfig.endPortalSafeTeleporting) this.tickEndPortal(); // Paper - make end portalling safe // Purpur - } - } - @@ -3391,7 +3440,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } @@ -4856,7 +4825,7 @@ index 36422fb394a158f36c84ba0ee03cc704956c91b2..9a3210e34decb4096533c58f36687e31 public int getValue() { return this.value; diff --git a/src/main/java/net/minecraft/world/entity/GlowSquid.java b/src/main/java/net/minecraft/world/entity/GlowSquid.java -index 1bb8b6e91c44cd13411d96d749fa64835c75a267..b18cbe85330e26de6f6cbfcc3d51a7418bd93877 100644 +index 5de938f4a7f16fd3caff783564cbb7e6b2924f9a..09181e9a0d4ceac30d20f4ff488a85b0ab5b1d04 100644 --- a/src/main/java/net/minecraft/world/entity/GlowSquid.java +++ b/src/main/java/net/minecraft/world/entity/GlowSquid.java @@ -23,6 +23,39 @@ public class GlowSquid extends Squid { @@ -4900,7 +4869,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 25e30408c964b5257f1cf945892bd668df38252b..bfa69b2c37f07132f8b31c12d26f4ceb074901a5 100644 +index 366121188c5abb550ed0a5f99d25c001628685bb..d6705dce3bc8c1964184fe425386b3f3c0a8202e 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 { @@ -5363,7 +5332,7 @@ index 25e30408c964b5257f1cf945892bd668df38252b..bfa69b2c37f07132f8b31c12d26f4ceb }); } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 4cf2963fdbe9003fd18ac8c2035ccded57c02abd..1d1688fafc438a5957096118790d44fbd55476bb 100644 +index a6b48b4eab6e0e98205fd9cafc3cde5ad39651af..dd275ece5887f5215cb785564af27152b29b370e 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -66,6 +66,7 @@ import net.minecraft.world.item.ProjectileWeaponItem; @@ -5576,7 +5545,7 @@ index 4cf2963fdbe9003fd18ac8c2035ccded57c02abd..1d1688fafc438a5957096118790d44fb // CraftBukkit start - fire PlayerUnleashEntityEvent // Paper start - Expand EntityUnleashEvent org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.getAbilities().instabuild); -@@ -1398,7 +1434,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1399,7 +1435,7 @@ public abstract class Mob extends LivingEntity implements Targeting { protected void onOffspringSpawnedFromEgg(Player player, Mob child) {} protected InteractionResult mobInteract(Player player, InteractionHand hand) { @@ -5585,7 +5554,7 @@ index 4cf2963fdbe9003fd18ac8c2035ccded57c02abd..1d1688fafc438a5957096118790d44fb } public boolean isWithinRestriction() { -@@ -1709,6 +1745,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1710,6 +1746,7 @@ public abstract class Mob extends LivingEntity implements Targeting { this.setLastHurtMob(target); } @@ -5593,7 +5562,7 @@ index 4cf2963fdbe9003fd18ac8c2035ccded57c02abd..1d1688fafc438a5957096118790d44fb return flag; } -@@ -1729,17 +1766,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1730,17 +1767,7 @@ public abstract class Mob extends LivingEntity implements Targeting { } public boolean isSunBurnTick() { @@ -5612,7 +5581,7 @@ index 4cf2963fdbe9003fd18ac8c2035ccded57c02abd..1d1688fafc438a5957096118790d44fb } @Override -@@ -1787,4 +1814,56 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -1788,4 +1815,56 @@ public abstract class Mob extends LivingEntity implements Targeting { return itemmonsteregg == null ? null : new ItemStack(itemmonsteregg); } @@ -5683,7 +5652,7 @@ index 2ee48ac3b665db2b02bcb1a30ec972d43a3725b0..59e8f5431ce5026209e1428b5fa5b548 } // Paper end - custom shear drops diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -index 683c9693754d1a87b7e8fccc757a0d0963351f60..c47af2c9d023aba454343bab0b43268013c8bd08 100644 +index 8d6954d05d2bf6d6c1c4953db3127b011a858cec..49c45a0987b8393a9c92ab756c721f17c232ddb1 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java @@ -24,14 +24,21 @@ public class AttributeMap { @@ -5700,7 +5669,7 @@ index 683c9693754d1a87b7e8fccc757a0d0963351f60..c47af2c9d023aba454343bab0b432680 + this.entity = entity; + // Purpur end this.supplier = defaultAttributes; - this.createInstance = attribute -> this.supplier.createInstance(this::onAttributeModified, attribute); // Pufferfish + this.createInstance = attributex -> this.supplier.createInstance(this::onAttributeModified, attributex); // Pufferfish } private void onAttributeModified(AttributeInstance instance) { @@ -5708,111 +5677,29 @@ index 683c9693754d1a87b7e8fccc757a0d0963351f60..c47af2c9d023aba454343bab0b432680 + if (instance.getAttribute().isClientSyncable() && (entity == null || entity.shouldSendAttribute(instance.getAttribute()))) { // Purpur this.dirtyAttributes.add(instance); } - -@@ -43,7 +50,7 @@ public class AttributeMap { - - public Collection getSyncableAttributes() { - return this.attributes.values().stream().filter((attribute) -> { -- return attribute.getAttribute().isClientSyncable(); -+ return attribute.getAttribute().isClientSyncable() && (entity == null || entity.shouldSendAttribute(attribute.getAttribute())); // Purpur - }).collect(Collectors.toList()); + } +@@ -41,7 +48,7 @@ public class AttributeMap { } + public Collection getSyncableAttributes() { +- return this.attributes.values().stream().filter(attribute -> attribute.getAttribute().isClientSyncable()).collect(Collectors.toList()); ++ return this.attributes.values().stream().filter(attribute -> attribute.getAttribute().isClientSyncable() && (entity == null || entity.shouldSendAttribute(attribute.getAttribute()))).collect(Collectors.toList()); // Purpur + } + + diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java b/src/main/java/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java -index 0a13e076b42bc8c0e7d4962379c207dea89f0435..2d7afaa67c762107717486cb9dbbf6f8f967396c 100644 +index c92583b6d1527db32f4a644f30c8f8468e9e2fc2..b8f65dc8f0db4bbe5f9c223e4ba129738fbfd795 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java -@@ -81,7 +81,89 @@ import org.slf4j.Logger; - - public class DefaultAttributes { - private static final Logger LOGGER = LogUtils.getLogger(); -- private static final Map, AttributeSupplier> SUPPLIERS = ImmutableMap., AttributeSupplier>builder().put(EntityType.ALLAY, Allay.createAttributes().build()).put(EntityType.ARMOR_STAND, LivingEntity.createLivingAttributes().build()).put(EntityType.AXOLOTL, Axolotl.createAttributes().build()).put(EntityType.BAT, Bat.createAttributes().build()).put(EntityType.BEE, Bee.createAttributes().build()).put(EntityType.BLAZE, Blaze.createAttributes().build()).put(EntityType.CAT, Cat.createAttributes().build()).put(EntityType.CAMEL, Camel.createAttributes().build()).put(EntityType.CAVE_SPIDER, CaveSpider.createCaveSpider().build()).put(EntityType.CHICKEN, Chicken.createAttributes().build()).put(EntityType.COD, AbstractFish.createAttributes().build()).put(EntityType.COW, Cow.createAttributes().build()).put(EntityType.CREEPER, Creeper.createAttributes().build()).put(EntityType.DOLPHIN, Dolphin.createAttributes().build()).put(EntityType.DONKEY, AbstractChestedHorse.createBaseChestedHorseAttributes().build()).put(EntityType.DROWNED, Zombie.createAttributes().build()).put(EntityType.ELDER_GUARDIAN, ElderGuardian.createAttributes().build()).put(EntityType.ENDERMAN, EnderMan.createAttributes().build()).put(EntityType.ENDERMITE, Endermite.createAttributes().build()).put(EntityType.ENDER_DRAGON, EnderDragon.createAttributes().build()).put(EntityType.EVOKER, Evoker.createAttributes().build()).put(EntityType.BREEZE, Breeze.createAttributes().build()).put(EntityType.FOX, Fox.createAttributes().build()).put(EntityType.FROG, Frog.createAttributes().build()).put(EntityType.GHAST, Ghast.createAttributes().build()).put(EntityType.GIANT, Giant.createAttributes().build()).put(EntityType.GLOW_SQUID, GlowSquid.createAttributes().build()).put(EntityType.GOAT, Goat.createAttributes().build()).put(EntityType.GUARDIAN, Guardian.createAttributes().build()).put(EntityType.HOGLIN, Hoglin.createAttributes().build()).put(EntityType.HORSE, AbstractHorse.createBaseHorseAttributes().build()).put(EntityType.HUSK, Zombie.createAttributes().build()).put(EntityType.ILLUSIONER, Illusioner.createAttributes().build()).put(EntityType.IRON_GOLEM, IronGolem.createAttributes().build()).put(EntityType.LLAMA, Llama.createAttributes().build()).put(EntityType.MAGMA_CUBE, MagmaCube.createAttributes().build()).put(EntityType.MOOSHROOM, Cow.createAttributes().build()).put(EntityType.MULE, AbstractChestedHorse.createBaseChestedHorseAttributes().build()).put(EntityType.OCELOT, Ocelot.createAttributes().build()).put(EntityType.PANDA, Panda.createAttributes().build()).put(EntityType.PARROT, Parrot.createAttributes().build()).put(EntityType.PHANTOM, Monster.createMonsterAttributes().build()).put(EntityType.PIG, Pig.createAttributes().build()).put(EntityType.PIGLIN, Piglin.createAttributes().build()).put(EntityType.PIGLIN_BRUTE, PiglinBrute.createAttributes().build()).put(EntityType.PILLAGER, Pillager.createAttributes().build()).put(EntityType.PLAYER, Player.createAttributes().build()).put(EntityType.POLAR_BEAR, PolarBear.createAttributes().build()).put(EntityType.PUFFERFISH, AbstractFish.createAttributes().build()).put(EntityType.RABBIT, Rabbit.createAttributes().build()).put(EntityType.RAVAGER, Ravager.createAttributes().build()).put(EntityType.SALMON, AbstractFish.createAttributes().build()).put(EntityType.SHEEP, Sheep.createAttributes().build()).put(EntityType.SHULKER, Shulker.createAttributes().build()).put(EntityType.SILVERFISH, Silverfish.createAttributes().build()).put(EntityType.SKELETON, AbstractSkeleton.createAttributes().build()).put(EntityType.SKELETON_HORSE, SkeletonHorse.createAttributes().build()).put(EntityType.SLIME, Monster.createMonsterAttributes().build()).put(EntityType.SNIFFER, Sniffer.createAttributes().build()).put(EntityType.SNOW_GOLEM, SnowGolem.createAttributes().build()).put(EntityType.SPIDER, Spider.createAttributes().build()).put(EntityType.SQUID, Squid.createAttributes().build()).put(EntityType.STRAY, AbstractSkeleton.createAttributes().build()).put(EntityType.STRIDER, Strider.createAttributes().build()).put(EntityType.TADPOLE, Tadpole.createAttributes().build()).put(EntityType.TRADER_LLAMA, Llama.createAttributes().build()).put(EntityType.TROPICAL_FISH, AbstractFish.createAttributes().build()).put(EntityType.TURTLE, Turtle.createAttributes().build()).put(EntityType.VEX, Vex.createAttributes().build()).put(EntityType.VILLAGER, Villager.createAttributes().build()).put(EntityType.VINDICATOR, Vindicator.createAttributes().build()).put(EntityType.WARDEN, Warden.createAttributes().build()).put(EntityType.WANDERING_TRADER, Mob.createMobAttributes().build()).put(EntityType.WITCH, Witch.createAttributes().build()).put(EntityType.WITHER, WitherBoss.createAttributes().build()).put(EntityType.WITHER_SKELETON, AbstractSkeleton.createAttributes().build()).put(EntityType.WOLF, Wolf.createAttributes().build()).put(EntityType.ZOGLIN, Zoglin.createAttributes().build()).put(EntityType.ZOMBIE, Zombie.createAttributes().build()).put(EntityType.ZOMBIE_HORSE, ZombieHorse.createAttributes().build()).put(EntityType.ZOMBIE_VILLAGER, Zombie.createAttributes().build()).put(EntityType.ZOMBIFIED_PIGLIN, ZombifiedPiglin.createAttributes().build()).build(); -+ private static final Map, AttributeSupplier> SUPPLIERS = ImmutableMap., AttributeSupplier>builder() -+ .put(EntityType.ALLAY, Allay.createAttributes().build()) -+ .put(EntityType.ARMOR_STAND, LivingEntity.createLivingAttributes().build()) -+ .put(EntityType.AXOLOTL, Axolotl.createAttributes().build()) -+ .put(EntityType.BAT, Bat.createAttributes().build()) -+ .put(EntityType.BEE, Bee.createAttributes().build()) -+ .put(EntityType.BLAZE, Blaze.createAttributes().build()) -+ .put(EntityType.CAT, Cat.createAttributes().build()) -+ .put(EntityType.CAMEL, Camel.createAttributes().build()) -+ .put(EntityType.CAVE_SPIDER, CaveSpider.createCaveSpider().build()) -+ .put(EntityType.CHICKEN, Chicken.createAttributes().build()) -+ .put(EntityType.COD, AbstractFish.createAttributes().build()) -+ .put(EntityType.COW, Cow.createAttributes().build()) -+ .put(EntityType.CREEPER, Creeper.createAttributes().build()) -+ .put(EntityType.DOLPHIN, Dolphin.createAttributes().build()) -+ .put(EntityType.DONKEY, AbstractChestedHorse.createBaseChestedHorseAttributes().build()) -+ .put(EntityType.DROWNED, Zombie.createAttributes().build()) -+ .put(EntityType.ELDER_GUARDIAN, ElderGuardian.createAttributes().build()) -+ .put(EntityType.ENDERMAN, EnderMan.createAttributes().build()) -+ .put(EntityType.ENDERMITE, Endermite.createAttributes().build()) -+ .put(EntityType.ENDER_DRAGON, EnderDragon.createAttributes().build()) -+ .put(EntityType.EVOKER, Evoker.createAttributes().build()) -+ .put(EntityType.BREEZE, Breeze.createAttributes().build()) -+ .put(EntityType.FOX, Fox.createAttributes().build()) -+ .put(EntityType.FROG, Frog.createAttributes().build()) -+ .put(EntityType.GHAST, Ghast.createAttributes().build()) -+ .put(EntityType.GIANT, Giant.createAttributes().build()) -+ .put(EntityType.GLOW_SQUID, GlowSquid.createAttributes().build()) -+ .put(EntityType.GOAT, Goat.createAttributes().build()) -+ .put(EntityType.GUARDIAN, Guardian.createAttributes().build()) -+ .put(EntityType.HOGLIN, Hoglin.createAttributes().build()) -+ .put(EntityType.HORSE, AbstractHorse.createBaseHorseAttributes().build()) -+ .put(EntityType.HUSK, Zombie.createAttributes().build()) -+ .put(EntityType.ILLUSIONER, Illusioner.createAttributes().build()) -+ .put(EntityType.IRON_GOLEM, IronGolem.createAttributes().build()) -+ .put(EntityType.LLAMA, Llama.createAttributes().build()) -+ .put(EntityType.MAGMA_CUBE, MagmaCube.createAttributes().build()) -+ .put(EntityType.MOOSHROOM, Cow.createAttributes().build()) -+ .put(EntityType.MULE, AbstractChestedHorse.createBaseChestedHorseAttributes().build()) -+ .put(EntityType.OCELOT, Ocelot.createAttributes().build()) -+ .put(EntityType.PANDA, Panda.createAttributes().build()) -+ .put(EntityType.PARROT, Parrot.createAttributes().build()) +@@ -123,7 +123,7 @@ public class DefaultAttributes { + .put(EntityType.OCELOT, Ocelot.createAttributes().build()) + .put(EntityType.PANDA, Panda.createAttributes().build()) + .put(EntityType.PARROT, Parrot.createAttributes().build()) +- .put(EntityType.PHANTOM, Monster.createMonsterAttributes().build()) + .put(EntityType.PHANTOM, net.minecraft.world.entity.monster.Phantom.createAttributes().build()) // Purpur -+ .put(EntityType.PIG, Pig.createAttributes().build()) -+ .put(EntityType.PIGLIN, Piglin.createAttributes().build()) -+ .put(EntityType.PIGLIN_BRUTE, PiglinBrute.createAttributes().build()) -+ .put(EntityType.PILLAGER, Pillager.createAttributes().build()) -+ .put(EntityType.PLAYER, Player.createAttributes().build()) -+ .put(EntityType.POLAR_BEAR, PolarBear.createAttributes().build()) -+ .put(EntityType.PUFFERFISH, AbstractFish.createAttributes().build()) -+ .put(EntityType.RABBIT, Rabbit.createAttributes().build()) -+ .put(EntityType.RAVAGER, Ravager.createAttributes().build()) -+ .put(EntityType.SALMON, AbstractFish.createAttributes().build()) -+ .put(EntityType.SHEEP, Sheep.createAttributes().build()) -+ .put(EntityType.SHULKER, Shulker.createAttributes().build()) -+ .put(EntityType.SILVERFISH, Silverfish.createAttributes().build()) -+ .put(EntityType.SKELETON, AbstractSkeleton.createAttributes().build()) -+ .put(EntityType.SKELETON_HORSE, SkeletonHorse.createAttributes().build()) -+ .put(EntityType.SLIME, Monster.createMonsterAttributes().build()) -+ .put(EntityType.SNIFFER, Sniffer.createAttributes().build()) -+ .put(EntityType.SNOW_GOLEM, SnowGolem.createAttributes().build()) -+ .put(EntityType.SPIDER, Spider.createAttributes().build()) -+ .put(EntityType.SQUID, Squid.createAttributes().build()) -+ .put(EntityType.STRAY, AbstractSkeleton.createAttributes().build()) -+ .put(EntityType.STRIDER, Strider.createAttributes().build()) -+ .put(EntityType.TADPOLE, Tadpole.createAttributes().build()) -+ .put(EntityType.TRADER_LLAMA, Llama.createAttributes().build()) -+ .put(EntityType.TROPICAL_FISH, AbstractFish.createAttributes().build()) -+ .put(EntityType.TURTLE, Turtle.createAttributes().build()) -+ .put(EntityType.VEX, Vex.createAttributes().build()) -+ .put(EntityType.VILLAGER, Villager.createAttributes().build()) -+ .put(EntityType.VINDICATOR, Vindicator.createAttributes().build()) -+ .put(EntityType.WARDEN, Warden.createAttributes().build()) -+ .put(EntityType.WANDERING_TRADER, Mob.createMobAttributes().build()) -+ .put(EntityType.WITCH, Witch.createAttributes().build()) -+ .put(EntityType.WITHER, WitherBoss.createAttributes().build()) -+ .put(EntityType.WITHER_SKELETON, AbstractSkeleton.createAttributes().build()) -+ .put(EntityType.WOLF, Wolf.createAttributes().build()) -+ .put(EntityType.ZOGLIN, Zoglin.createAttributes().build()) -+ .put(EntityType.ZOMBIE, Zombie.createAttributes().build()) -+ .put(EntityType.ZOMBIE_HORSE, ZombieHorse.createAttributes().build()) -+ .put(EntityType.ZOMBIE_VILLAGER, Zombie.createAttributes().build()) -+ .put(EntityType.ZOMBIFIED_PIGLIN, ZombifiedPiglin.createAttributes().build()).build(); - - public static AttributeSupplier getSupplier(EntityType type) { - return SUPPLIERS.get(type); + .put(EntityType.PIG, Pig.createAttributes().build()) + .put(EntityType.PIGLIN, Piglin.createAttributes().build()) + .put(EntityType.PIGLIN_BRUTE, PiglinBrute.createAttributes().build()) diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/RangedAttribute.java b/src/main/java/net/minecraft/world/entity/ai/attributes/RangedAttribute.java index f0703302e7dbbda88de8c648d20d87c55ed9b1e0..a913ebabaa5f443afa987b972355a8f8d1723c78 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/RangedAttribute.java @@ -5825,11 +5712,24 @@ index f0703302e7dbbda88de8c648d20d87c55ed9b1e0..a913ebabaa5f443afa987b972355a8f8 return Double.isNaN(value) ? this.minValue : Mth.clamp(value, this.minValue, this.maxValue); } } +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +index e1b6fe9ecda25f86431baf414f1bfd3a26a8b2bd..6499e3fe49e453db11e51eaf717ca8b3b682056b 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +@@ -73,7 +73,7 @@ public class AcquirePoi { + }; + // Paper start - optimise POI access + java.util.List, BlockPos>> poiposes = new java.util.ArrayList<>(); +- io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); ++ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), world.purpurConfig.villagerAcquirePoiSearchRadius, world.purpurConfig.villagerAcquirePoiSearchRadius*world.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); // Purpur + Set, BlockPos>> set = new java.util.HashSet<>(poiposes); + // Paper end - optimise POI access + Path path = findPathToPois(entity, set); diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java -index 1e71cde7cb7654f1c21ae5e27e2fad7b58f593eb..4f3a1c2bfaec6787c8fc62c7df13c512dfc2cb7a 100644 +index 03092417cd8ab5c6d266f3af9f20f47b34cfaba3..8f7d9f8a5138bcd572691d66c814aaa7c308b317 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java -@@ -58,9 +58,9 @@ public abstract class Behavior implements BehaviorContro +@@ -59,9 +59,9 @@ public abstract class Behavior implements BehaviorContro this.status = Behavior.Status.RUNNING; int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration); this.endTimestamp = time + (long)i; @@ -5841,7 +5741,7 @@ index 1e71cde7cb7654f1c21ae5e27e2fad7b58f593eb..4f3a1c2bfaec6787c8fc62c7df13c512 return true; } else { return false; -@@ -72,13 +72,13 @@ public abstract class Behavior implements BehaviorContro +@@ -73,13 +73,13 @@ public abstract class Behavior implements BehaviorContro @Override public final void tickOrStop(ServerLevel world, E entity, long time) { @@ -5854,9 +5754,9 @@ index 1e71cde7cb7654f1c21ae5e27e2fad7b58f593eb..4f3a1c2bfaec6787c8fc62c7df13c512 } - this.timing.stopTiming(); // Paper - behavior timings + //this.timing.stopTiming(); // Paper - behavior timings // Purpur - } + protected void tick(ServerLevel world, E entity, long time) { diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java b/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java index d3a2a6dee2d83b3df0ddc521c080f7d72b709461..a1acc479c9d6a838e3180da3ac8a3a02d22db5c1 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java @@ -5956,22 +5856,22 @@ index 42ae4d293a420f0b8eb476df6389b2e7a693895f..97c20c5b89e6d7e4ed844eff39ee55df } else { DoorBlock blockdoor = (DoorBlock) iblockdata.getBlock(); diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java -index c3e0b1f11b58668f9f24eb421abc340e1b49dfac..d809fa4f96e2c528075f544355397903996ecaf6 100644 +index 18dad0825616c4167a0a7555689ee64910a87e09..6945992491027d43eca4f1ca697ad45ce06ded55 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShowTradesToPlayer.java -@@ -42,6 +42,7 @@ public class ShowTradesToPlayer extends Behavior { +@@ -46,6 +46,7 @@ public class ShowTradesToPlayer extends Behavior { @Override public boolean canStillUse(ServerLevel world, Villager entity, long time) { + if (!entity.level().purpurConfig.villagerDisplayTradeItem) return false; // Purpur - return this.checkExtraStartConditions(world, entity) && this.lookTime > 0 && entity.getBrain().getMemory(MemoryModuleType.INTERACTION_TARGET).isPresent(); - } - + return this.checkExtraStartConditions(world, entity) + && this.lookTime > 0 + && entity.getBrain().getMemory(MemoryModuleType.INTERACTION_TARGET).isPresent(); diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java b/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java -index 3af715e2f3f3949af614a8fcebbc4a835d48ca49..ade1e411ea1f3b4c9a417265e77b0d6861b222f9 100644 +index e215491ebaebfc51445adc01452ce768fff3e2dc..ff32c022fa213142ca4b3ff8e74b6eba8ef52169 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java -@@ -56,6 +56,12 @@ public class TradeWithVillager extends Behavior { +@@ -61,6 +61,12 @@ public class TradeWithVillager extends Behavior { throwHalfStack(entity, ImmutableSet.of(Items.WHEAT), villager); } @@ -5985,10 +5885,10 @@ index 3af715e2f3f3949af614a8fcebbc4a835d48ca49..ade1e411ea1f3b4c9a417265e77b0d68 throwHalfStack(entity, this.trades, villager); } diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java -index cd7a90ec1073b2b452ca70decefe6a594445003b..47672e48c1cae73cffe532d622b296343fc12ef0 100644 +index d2917f9b215919890f28b513601863ccaced17c7..58338e240079f2de1669e8c2ce839451511feafd 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java -@@ -30,8 +30,13 @@ public class VillagerGoalPackages { +@@ -49,8 +49,13 @@ public class VillagerGoalPackages { } public static ImmutableList>> getWorkPackage(VillagerProfession profession, float speed) { @@ -6021,7 +5921,7 @@ index 0cc411dd39d981187c9e9a3c5eb8043b19a09b98..f7032f4ea55f5aca293c2640686238b7 // CraftBukkit end world.broadcastEntityEvent(entityvillager2, (byte) 12); diff --git a/src/main/java/net/minecraft/world/entity/ai/control/MoveControl.java b/src/main/java/net/minecraft/world/entity/ai/control/MoveControl.java -index 03d77c6d4697d4934ca65e3329982f0efe089820..ce7e3e90993b76225dc820a21e04267e488f5f7b 100644 +index ca02566b20dd52a59bc7b150529a1d68bc560ab0..10265fd19c90cea34372a786bb272dbcdd91b993 100644 --- a/src/main/java/net/minecraft/world/entity/ai/control/MoveControl.java +++ b/src/main/java/net/minecraft/world/entity/ai/control/MoveControl.java @@ -29,6 +29,20 @@ public class MoveControl implements Control { @@ -6046,7 +5946,7 @@ index 03d77c6d4697d4934ca65e3329982f0efe089820..ce7e3e90993b76225dc820a21e04267e return this.operation == MoveControl.Operation.MOVE_TO; } diff --git a/src/main/java/net/minecraft/world/entity/ai/control/SmoothSwimmingLookControl.java b/src/main/java/net/minecraft/world/entity/ai/control/SmoothSwimmingLookControl.java -index 7df56705a4a0de2dc4ff7ab133fc26612c219162..384bed4505b6cabb1ae151cd2c4eb5e56f24563f 100644 +index fbfc2f2515ad709b2c1212aef9521e795547d66b..e77bd11af62682d5eca41f6c9e1aed30eb6879ce 100644 --- a/src/main/java/net/minecraft/world/entity/ai/control/SmoothSwimmingLookControl.java +++ b/src/main/java/net/minecraft/world/entity/ai/control/SmoothSwimmingLookControl.java @@ -3,7 +3,7 @@ package net.minecraft.world.entity.ai.control; @@ -6065,8 +5965,8 @@ index 7df56705a4a0de2dc4ff7ab133fc26612c219162..384bed4505b6cabb1ae151cd2c4eb5e5 - public void tick() { + public void vanillaTick() { // Purpur if (this.lookAtCooldown > 0) { - --this.lookAtCooldown; - this.getYRotD().ifPresent((yaw) -> { + this.lookAtCooldown--; + this.getYRotD().ifPresent(yaw -> this.mob.yHeadRot = this.rotateTowards(this.mob.yHeadRot, yaw + 20.0F, this.yMaxRotSpeed)); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java index a85885ee51df585fa11ae9f8fcd67ff2a71c5a18..d81509e08e70ec5b2f837c9dc66b1254c86854e4 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java @@ -6103,10 +6003,10 @@ index 4e2c23ccdf4e4a4d65b291dbe20952bae1838bff..0da884a833f6c707fea512e826658c3b this.level.setBlock(blockposition1, Blocks.DIRT.defaultBlockState(), 2); } diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -index 2d63ee8fef87264d4b61290effa6ba86a787aa61..bb068bffc9e2f035dee90276156129ce750a7cd7 100644 +index d78e1f6191738d426968efc24e734f04b0fc7edb..a2cca3d528625d49411a94e2b6ec578fec9b10da 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -@@ -105,8 +105,8 @@ public class GoalSelector { +@@ -104,8 +104,8 @@ public class GoalSelector { } public void tick() { @@ -6115,9 +6015,9 @@ index 2d63ee8fef87264d4b61290effa6ba86a787aa61..bb068bffc9e2f035dee90276156129ce + //ProfilerFiller profilerFiller = this.profiler.get(); // Purpur + //profilerFiller.push("goalCleanup"); // Purpur - for(WrappedGoal wrappedGoal : this.availableGoals) { - if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { -@@ -123,8 +123,8 @@ public class GoalSelector { + for (WrappedGoal wrappedGoal : this.availableGoals) { + if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper - Perf: optimize goal types by removing streams +@@ -122,8 +122,8 @@ public class GoalSelector { } } @@ -6126,9 +6026,9 @@ index 2d63ee8fef87264d4b61290effa6ba86a787aa61..bb068bffc9e2f035dee90276156129ce + //profilerFiller.pop(); // Purpur + //profilerFiller.push("goalUpdate"); // Purpur - for(WrappedGoal wrappedGoal2 : this.availableGoals) { + for (WrappedGoal wrappedGoal2 : this.availableGoals) { // Paper start -@@ -144,13 +144,13 @@ public class GoalSelector { +@@ -143,13 +143,13 @@ public class GoalSelector { } } @@ -6143,9 +6043,9 @@ index 2d63ee8fef87264d4b61290effa6ba86a787aa61..bb068bffc9e2f035dee90276156129ce + //ProfilerFiller profilerFiller = this.profiler.get(); // Purpur + //profilerFiller.push("goalTick"); // Purpur - for(WrappedGoal wrappedGoal : this.availableGoals) { + for (WrappedGoal wrappedGoal : this.availableGoals) { if (wrappedGoal.isRunning() && (tickAll || wrappedGoal.requiresUpdateEveryTick())) { -@@ -158,7 +158,7 @@ public class GoalSelector { +@@ -157,7 +157,7 @@ public class GoalSelector { } } @@ -6155,7 +6055,7 @@ index 2d63ee8fef87264d4b61290effa6ba86a787aa61..bb068bffc9e2f035dee90276156129ce public Set getAvailableGoals() { diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java -index 21725aee29e9120d1c7e1e19f91c21a73a28844f..3fc9528201fb96d6a0f905afe0b6a82ec88a7235 100644 +index df695b444fa2a993d381e2f197182c3e91a68502..0f4f546cd0eda4bd82b47446ae23ac32da8a9556 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java @@ -22,6 +22,7 @@ public class LlamaFollowCaravanGoal extends Goal { @@ -6164,7 +6064,7 @@ index 21725aee29e9120d1c7e1e19f91c21a73a28844f..3fc9528201fb96d6a0f905afe0b6a82e public boolean canUse() { + if (!this.llama.level().purpurConfig.llamaJoinCaravans || !this.llama.shouldJoinCaravan) return false; // Purpur if (!this.llama.isLeashed() && !this.llama.inCaravan()) { - List list = this.llama.level().getEntities(this.llama, this.llama.getBoundingBox().inflate(9.0D, 4.0D, 9.0D), (entity) -> { + List list = this.llama.level().getEntities(this.llama, this.llama.getBoundingBox().inflate(9.0, 4.0, 9.0), entity -> { EntityType entityType = entity.getType(); @@ -71,6 +72,7 @@ public class LlamaFollowCaravanGoal extends Goal { @@ -6173,12 +6073,12 @@ index 21725aee29e9120d1c7e1e19f91c21a73a28844f..3fc9528201fb96d6a0f905afe0b6a82e + if (!this.llama.shouldJoinCaravan) return false; // Purpur if (this.llama.inCaravan() && this.llama.getCaravanHead().isAlive() && this.firstIsLeashed(this.llama, 0)) { double d = this.llama.distanceToSqr(this.llama.getCaravanHead()); - if (d > 676.0D) { + if (d > 676.0) { diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java -index 87fb10096fc9dade33c663234b1cecc34d3d77bb..874c7b29a261b1b5ad6e86ca219ff935870aecb0 100644 +index 515c1f671cb2c3a7cc23053aedf404bbbe77af3e..42a1e5b9c08a9245dd0ce6d4025e3bb5d60feb62 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java -@@ -119,9 +119,9 @@ public class RangedBowAttackGoal extends Go +@@ -116,9 +116,9 @@ public class RangedBowAttackGoal extends Go } this.mob.lookAt(livingEntity, 30.0F, 30.0F); @@ -6217,7 +6117,7 @@ index b0944fa1f3849dd24cd010fa0a6638f5fd7179d1..a3074ec9b430c9d0a0ef33fe353db643 return; } diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java -index e241ae250f4f04a17ef2c583d00b065a4ca56a4c..7b99c3446b50939241d3e220d93e05649f72a6df 100644 +index 137ec75ee803789deb7b1ca93dd9369c9af362b9..ca95d25af3e9a0536868b0c7fd8e7d2ff1154ee3 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java @@ -54,6 +54,14 @@ public class SwellGoal extends Goal { @@ -6249,10 +6149,10 @@ index 0d9b194781d152e842c9a4b8d6f23d307b2e4452..00cf59524477ec79d4354cc403fc3e75 @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index a04fb58c29b462e20ed0b702cef478e3985b7cd2..43699f94dd0fd97513242fcdbc4ec4d0dc260f8e 100644 +index e3a7eaf31ab19cc9f23a0c87649b74bb42976cb4..e12cf130678bda7c1f5873cb03172a698e18fc85 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -173,12 +173,12 @@ public abstract class PathNavigation { +@@ -172,12 +172,12 @@ public abstract class PathNavigation { } } // Paper end - EntityPathfindEvent @@ -6267,8 +6167,21 @@ index a04fb58c29b462e20ed0b702cef478e3985b7cd2..43699f94dd0fd97513242fcdbc4ec4d0 if (path != null && path.getTarget() != null) { this.targetPos = path.getTarget(); this.reachRange = distance; +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java +index 92731b6b593289e9f583c9b705b219e81fcd8e73..9104d7010bda6f9f73b478c11490ef9c53f76da2 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java +@@ -56,7 +56,7 @@ public class NearestBedSensor extends Sensor { + // Paper start - optimise POI access + java.util.List, BlockPos>> poiposes = new java.util.ArrayList<>(); + // don't ask me why it's unbounded. ask mojang. +- io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes); ++ io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), world.purpurConfig.villagerNearestBedSensorSearchRadius, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes); // Purpur + Path path = AcquirePoi.findPathToPois(entity, new java.util.HashSet<>(poiposes)); + // Paper end - optimise POI access + if (path != null && path.canReach()) { diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java -index cb1d91f9fe98f21c2afbe3894dfd9bca3bdd3ba6..d2703432af207c74ea8d298a784329c3219d2f13 100644 +index a0e0692d17760f440fe81d52887284c787e562db..ab9bebc07b5228dbc0d3ba4b0f7d1bbe41814c9b 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java @@ -22,6 +22,13 @@ public class SecondaryPoiSensor extends Sensor { @@ -6311,10 +6224,10 @@ index 51772f03a3469b11e7166ec6f3a1b9c64a606221..02f2f46ccc48bb4d9bd08555818b0489 this.seen.add(i); } else { diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java -index fcdb9bde8e1605e30dde3e580491522d4b62cdc0..7094701d213c73ba47ace806962244c10fdf4dda 100644 +index 9e90cb2f51d1bacacb287e912d14ab9152523205..e553f52de2e0b30511ac1b73cb436374017cd7d7 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java -@@ -46,10 +46,10 @@ public abstract class Sensor { +@@ -53,10 +53,10 @@ public abstract class Sensor { if (--this.timeToTick <= 0L) { // Paper start - configurable sensor tick rate and timings this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate); @@ -6325,10 +6238,10 @@ index fcdb9bde8e1605e30dde3e580491522d4b62cdc0..7094701d213c73ba47ace806962244c1 - this.timing.stopTiming(); // Paper - sensor timings + //this.timing.stopTiming(); // Paper - sensor timings // Purpur } - } + diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -index 931cbbe41905d7ed3fd46c53d3ddd06a6b9a7c8a..d8642979b7296737d08529f6db4f64e463d9f936 100644 +index 28cff997a1b263784e245f692adbff2a888a2d53..13b8141bdb2a1663431be645eb091f9e7638f3d0 100644 --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java @@ -64,6 +64,10 @@ public class TargetingConditions { @@ -6485,28 +6398,27 @@ index 4fba7c2f6ec363846a772ef2a63e9b3fc1037de5..735445456bbfab8a64df488fed30f0be if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) { LocalDate localdate = LocalDate.now(); diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java -index 2249fc6dd98afb8d52623b5864955fdd3b3fc042..2ccfaab0a02cf5ff9779e250fb79a75a9852e10d 100644 +index 401cffccd3c6adedcbd3986cd13733772953b31b..b8f973505b184cf198b6782a6f423c921c3881a7 100644 --- a/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java +++ b/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java -@@ -94,7 +94,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { +@@ -94,6 +94,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { @Override protected void registerGoals() { super.registerGoals(); -- this.goalSelector.addGoal(0, new PanicGoal(this, 1.25D)); + this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - this.goalSelector.addGoal(2, new AvoidEntityGoal<>(this, Player.class, 8.0F, 1.6D, 1.4D, EntitySelector.NO_SPECTATORS::test)); + this.goalSelector.addGoal(0, new PanicGoal(this, 1.25)); + this.goalSelector.addGoal(2, new AvoidEntityGoal<>(this, Player.class, 8.0F, 1.6, 1.4, EntitySelector.NO_SPECTATORS::test)); this.goalSelector.addGoal(4, new AbstractFish.FishSwimGoal(this)); - } -@@ -107,7 +107,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { +@@ -107,7 +108,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { @Override public void travel(Vec3 movementInput) { if (this.isEffectiveAi() && this.isInWater()) { - this.moveRelative(0.01F, movementInput); + this.moveRelative(getRider() != null ? getSpeed() : 0.01F, movementInput); // Purpur this.move(MoverType.SELF, this.getDeltaMovement()); - this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); if (this.getTarget() == null) { -@@ -166,7 +166,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { +@@ -168,7 +169,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { protected void playStepSound(BlockPos pos, BlockState state) { } @@ -6515,7 +6427,7 @@ index 2249fc6dd98afb8d52623b5864955fdd3b3fc042..2ccfaab0a02cf5ff9779e250fb79a75a private final AbstractFish fish; FishMoveControl(AbstractFish owner) { -@@ -174,14 +174,22 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { +@@ -176,14 +177,22 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { this.fish = owner; } @@ -6531,7 +6443,7 @@ index 2249fc6dd98afb8d52623b5864955fdd3b3fc042..2ccfaab0a02cf5ff9779e250fb79a75a + @Override + public void vanillaTick() { // Purpur if (this.fish.isEyeInFluid(FluidTags.WATER)) { - this.fish.setDeltaMovement(this.fish.getDeltaMovement().add(0.0D, 0.005D, 0.0D)); + this.fish.setDeltaMovement(this.fish.getDeltaMovement().add(0.0, 0.005, 0.0)); } if (this.operation == MoveControl.Operation.MOVE_TO && !this.fish.getNavigation().isDone()) { @@ -8216,10 +8128,10 @@ index 24770540c51fe4831040d6b46b27636d25ebac40..10d6361077a74c5685eca72d12f99e33 if (!this.level().isClientSide) { player.startRiding(this); diff --git a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java -index 01e17bac2358c42fb9455974ab8141e32c4f9161..54b6d780d14c27f24d3d4dc9171818f6256afd5c 100644 +index c9e10d4ce00b711b30de5d346a5ac26e7b441390..2fecdd574b407eeb1d0cd4f1b34ff7931e620540 100644 --- a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java +++ b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java -@@ -60,11 +60,81 @@ public class PolarBear extends Animal implements NeutralMob { +@@ -59,11 +59,81 @@ public class PolarBear extends Animal implements NeutralMob { private int remainingPersistentAngerTime; @Nullable private UUID persistentAngerTarget; @@ -8301,7 +8213,7 @@ index 01e17bac2358c42fb9455974ab8141e32c4f9161..54b6d780d14c27f24d3d4dc9171818f6 @Nullable @Override public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) { -@@ -73,19 +143,27 @@ public class PolarBear extends Animal implements NeutralMob { +@@ -72,19 +142,27 @@ public class PolarBear extends Animal implements NeutralMob { @Override public boolean isFood(ItemStack stack) { @@ -8322,18 +8234,19 @@ index 01e17bac2358c42fb9455974ab8141e32c4f9161..54b6d780d14c27f24d3d4dc9171818f6 + this.goalSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.TemptGoal(this, 1.0D, net.minecraft.world.item.crafting.Ingredient.of(level().purpurConfig.polarBearBreedableItem), false)); + } + // Purpur end - this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25D)); - this.goalSelector.addGoal(5, new RandomStrollGoal(this, 1.0D)); + this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25)); + this.goalSelector.addGoal(5, new RandomStrollGoal(this, 1.0)); this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F)); this.goalSelector.addGoal(7, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur this.targetSelector.addGoal(1, new PolarBear.PolarBearHurtByTargetGoal()); this.targetSelector.addGoal(2, new PolarBear.PolarBearAttackPlayersGoal()); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt)); -@@ -202,6 +280,11 @@ public class PolarBear extends Animal implements NeutralMob { +@@ -201,6 +279,12 @@ public class PolarBear extends Animal implements NeutralMob { + if (!this.level().isClientSide) { this.updatePersistentAnger((ServerLevel)this.level(), true); } - ++ + // Purpur start + if (isStanding() && --standTimer <= 0) { + setStanding(false); @@ -8342,7 +8255,7 @@ index 01e17bac2358c42fb9455974ab8141e32c4f9161..54b6d780d14c27f24d3d4dc9171818f6 } @Override -@@ -231,6 +314,7 @@ public class PolarBear extends Animal implements NeutralMob { +@@ -230,6 +314,7 @@ public class PolarBear extends Animal implements NeutralMob { public void setStanding(boolean warning) { this.entityData.set(DATA_STANDING_ID, warning); @@ -8842,7 +8755,7 @@ index 9eab1170cb123d3b60a02314702516704f959ab7..b75d07f3af4addbb306ecb6baacf1607 } diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java -index 4f32597c7af34d599f6658fe4962d41624e60419..cba0823bfd10a3e7fd3a7548b9cc11a77ce07ce7 100644 +index 36506dc4b99f9de19a23a99c1bccdcb4e7102e72..38d1eb5680281b2812f2396677ffb959a6e089ce 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Squid.java +++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java @@ -44,13 +44,66 @@ public class Squid extends WaterAnimal { @@ -8850,7 +8763,7 @@ index 4f32597c7af34d599f6658fe4962d41624e60419..cba0823bfd10a3e7fd3a7548b9cc11a7 public Squid(EntityType type, Level world) { super(type, world); - //this.random.setSeed((long)this.getId()); // Paper - Share random for entities to make them more random -+ if (!world.purpurConfig.entitySharedRandom) this.random.setSeed((long) this.getId()); // Paper - Share random for entities to make them more random // Purpur ++ if (!world.purpurConfig.entitySharedRandom) this.random.setSeed((long)this.getId()); // Paper - Share random for entities to make them more random // Purpur this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; } @@ -8918,10 +8831,10 @@ index 4f32597c7af34d599f6658fe4962d41624e60419..cba0823bfd10a3e7fd3a7548b9cc11a7 if (this.isInWaterOrBubble()) { + if (canFly()) setNoGravity(!wasTouchingWater); // Purpur - if (this.tentacleMovement < (float)Math.PI) { - float f = this.tentacleMovement / (float)Math.PI; - this.tentacleAngle = Mth.sin(f * f * (float)Math.PI) * (float)Math.PI * 0.25F; -@@ -298,10 +352,41 @@ public class Squid extends WaterAnimal { + if (this.tentacleMovement < (float) Math.PI) { + float f = this.tentacleMovement / (float) Math.PI; + this.tentacleAngle = Mth.sin(f * f * (float) Math.PI) * (float) Math.PI * 0.25F; +@@ -292,10 +346,41 @@ public class Squid extends WaterAnimal { @Override public void tick() { @@ -8961,14 +8874,14 @@ index 4f32597c7af34d599f6658fe4962d41624e60419..cba0823bfd10a3e7fd3a7548b9cc11a7 this.squid.setMovementVector(0.0F, 0.0F, 0.0F); - } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.wasTouchingWater || !this.squid.hasMovementVector()) { + } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.isInWater() || !this.squid.hasMovementVector()) { // Purpur - float f = this.squid.getRandom().nextFloat() * ((float)Math.PI * 2F); + float f = this.squid.getRandom().nextFloat() * (float) (Math.PI * 2); float g = Mth.cos(f) * 0.2F; float h = -0.1F + this.squid.getRandom().nextFloat() * 0.2F; diff --git a/src/main/java/net/minecraft/world/entity/animal/TropicalFish.java b/src/main/java/net/minecraft/world/entity/animal/TropicalFish.java -index b05b560b7570e97bc234b75f26233909fcf575b3..87b6f6b10ba6e3d9c6a42298a2019a526a183d90 100644 +index 6e9e86b6d547d7437c990b65718b95ad0d60f020..98205d89aa0cca82863257abfad46ab834385a20 100644 --- a/src/main/java/net/minecraft/world/entity/animal/TropicalFish.java +++ b/src/main/java/net/minecraft/world/entity/animal/TropicalFish.java -@@ -42,6 +42,33 @@ public class TropicalFish extends AbstractSchoolingFish implements VariantHolder +@@ -65,6 +65,33 @@ public class TropicalFish extends AbstractSchoolingFish implements VariantHolder super(type, world); } @@ -9003,7 +8916,7 @@ index b05b560b7570e97bc234b75f26233909fcf575b3..87b6f6b10ba6e3d9c6a42298a2019a52 return "entity.minecraft.tropical_fish.predefined." + variant; } diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -index dbdb6c432448b151fa4421f14235f8bad23dc720..6bf8ed96eaed4a500164f21cb5ead32a7e5a224d 100644 +index 2eb099957a3d0bae3339ff4edbab103fb348abed..2153dac7c7c83ef3192d2b8370b8924ee67383a8 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java @@ -86,6 +86,43 @@ public class Turtle extends Animal { @@ -9094,10 +9007,10 @@ index dbdb6c432448b151fa4421f14235f8bad23dc720..6bf8ed96eaed4a500164f21cb5ead32a this.turtle.setSpeed(Mth.lerp(0.125F, this.turtle.getSpeed(), f1)); this.turtle.setDeltaMovement(this.turtle.getDeltaMovement().add(0.0D, (double) this.turtle.getSpeed() * d1 * 0.1D, 0.0D)); diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java -index 9b897cf53f4bb5d366e6ac88dbed93c59d8fe541..fc61f93e04e5bc893b89c746deb2b89c5be0d602 100644 +index 75884a9e69a28404752c1a2cf854335bb78cac01..1fd69e6ab765236b1a09e2791188d1eb7f12ecbb 100644 --- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java +++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java -@@ -77,6 +77,6 @@ public abstract class WaterAnimal extends PathfinderMob { +@@ -78,6 +78,6 @@ public abstract class WaterAnimal extends PathfinderMob { i = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(i); j = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(j); // Paper end - Make water animal spawn height configurable @@ -9473,7 +9386,7 @@ index d241ca4d0295f9fce39c11197bd435cfac7f6e54..c783ce59ea766e6c46a3313628b961f2 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 33c160994f70f71446d665e7487913437c9f9db4..472b76d6ec721fa46857097589aa879f237e3e0d 100644 +index 33c160994f70f71446d665e7487913437c9f9db4..e3f72230e94b15a401e45cf8c10a1890d3278431 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 brain = (Brain) this.getBrain(); // Paper - decompile fix - brain.tick((ServerLevel)this.level(), this); + Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error + + behaviorcontroller.tick((ServerLevel) this.level(), this); - this.level().getProfiler().pop(); - this.level().getProfiler().push("camelActivityUpdate"); + //this.level().getProfiler().pop(); // Purpur @@ -9614,7 +9528,7 @@ index 1f09d47b0ffb07b49b4d8bd79a371dd61f1c2a92..41773acc8e8e27daa1fe43726939b2d9 super.customServerAiStep(); } -@@ -313,6 +324,23 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl +@@ -318,6 +329,23 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl return this.dashCooldown; } @@ -9639,10 +9553,10 @@ index 1f09d47b0ffb07b49b4d8bd79a371dd61f1c2a92..41773acc8e8e27daa1fe43726939b2d9 protected SoundEvent getAmbientSound() { return SoundEvents.CAMEL_AMBIENT; 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 e88b058c0734e436ef24bab6364b206c13e5a9c2..d6340d0a1308bafd3ba176562bf08dcadec02b34 100644 +index 1767fd2df8cb37e9c36fa3008b5131ff4bdad12c..37f1d3c656997906cef57d9dbefc226d04fc65fe 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 -@@ -79,16 +79,69 @@ public class Frog extends Animal implements VariantHolder { +@@ -104,16 +104,69 @@ public class Frog extends Animal implements VariantHolder { public final AnimationState croakAnimationState = new AnimationState(); public final AnimationState tongueAnimationState = new AnimationState(); public final AnimationState swimIdleAnimationState = new AnimationState(); @@ -9713,7 +9627,7 @@ index e88b058c0734e436ef24bab6364b206c13e5a9c2..d6340d0a1308bafd3ba176562bf08dca @Override protected Brain.Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); -@@ -162,13 +215,13 @@ public class Frog extends Animal implements VariantHolder { +@@ -186,13 +239,13 @@ public class Frog extends Animal implements VariantHolder { private int behaviorTick = 0; // Pufferfish @Override protected void customServerAiStep() { @@ -9732,7 +9646,7 @@ index e88b058c0734e436ef24bab6364b206c13e5a9c2..d6340d0a1308bafd3ba176562bf08dca super.customServerAiStep(); } -@@ -349,7 +402,7 @@ public class Frog extends Animal implements VariantHolder { +@@ -376,7 +429,7 @@ public class Frog extends Animal implements VariantHolder { return world.getBlockState(pos.below()).is(BlockTags.FROGS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos); } @@ -9978,7 +9892,7 @@ index 815eb15086976b8f9e03bf8182d9ed50aec14720..3170f9044f18b8c609433ddbd3ef9ac3 } diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Donkey.java b/src/main/java/net/minecraft/world/entity/animal/horse/Donkey.java -index e0dfee0e0ce091d5ae0ec740e939c2c50915c104..72ad12175325091397459e06743875cce6df8d94 100644 +index 8c14f9f2ad383f87c498126f135b460a241da410..42efd14b59a2b7da3409895bdff49e83b6cb2fa5 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/Donkey.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/Donkey.java @@ -15,6 +15,43 @@ public class Donkey extends AbstractChestedHorse { @@ -10026,7 +9940,7 @@ index e0dfee0e0ce091d5ae0ec740e939c2c50915c104..72ad12175325091397459e06743875cc protected SoundEvent getAmbientSound() { return SoundEvents.DONKEY_AMBIENT; diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Horse.java b/src/main/java/net/minecraft/world/entity/animal/horse/Horse.java -index 5f5dc651d570989ec1294c31a14dcfede466b80a..3b1faa63e46a48e83ea672cf6da444a1d7e13270 100644 +index 2181d74ad955197eb4f1925a64914a6197fa9023..eab6efcae632a393924d7245a71c40b57c6e316d 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/Horse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/Horse.java @@ -40,6 +40,43 @@ public class Horse extends AbstractHorse implements VariantHolder { @@ -10382,7 +10296,7 @@ index 038de19633002e8f7c4b1ead7438cef0163456ce..c80324d79b74fc620568347289f4e396 public boolean isTraderLlama() { return true; diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java -index 2f7f1f01c5e99266e66f7b8324fc94d2130ea9a4..813501e8aac1c121569cb996b47f0293d99c7e36 100644 +index 0a6ad1ad18051dc6311a6c4dd97dddf70b012014..9493fa681327aa42751955029e5acac846d9a2a8 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java @@ -26,6 +26,48 @@ public class ZombieHorse extends AbstractHorse { @@ -10432,7 +10346,7 @@ index 2f7f1f01c5e99266e66f7b8324fc94d2130ea9a4..813501e8aac1c121569cb996b47f0293 + } + public static AttributeSupplier.Builder createAttributes() { - return createBaseHorseAttributes().add(Attributes.MAX_HEALTH, 15.0D).add(Attributes.MOVEMENT_SPEED, (double)0.2F); + return createBaseHorseAttributes().add(Attributes.MAX_HEALTH, 15.0).add(Attributes.MOVEMENT_SPEED, 0.2F); } @@ -76,6 +118,7 @@ public class ZombieHorse extends AbstractHorse { @@ -10505,7 +10419,7 @@ index 0a5b953bd8c0c7f181da4090b950e9e6524b6d61..5e7d76dcdc170b809ab82f6e2259c9b4 } diff --git a/src/main/java/net/minecraft/world/entity/boss/EnderDragonPart.java b/src/main/java/net/minecraft/world/entity/boss/EnderDragonPart.java -index a6f3fba3b02b0b4d2a4e9e5205301c6f52d0188a..4eebfc27ded55e4d764d04f35d3e9c9e0791c89f 100644 +index aa5416157abd155ffadf94f61b77fa36d694699f..1dd1bd40607e6da09abb0315097588aed550c0c5 100644 --- a/src/main/java/net/minecraft/world/entity/boss/EnderDragonPart.java +++ b/src/main/java/net/minecraft/world/entity/boss/EnderDragonPart.java @@ -24,6 +24,13 @@ public class EnderDragonPart extends Entity { @@ -11162,7 +11076,7 @@ index eadcebd7845ee716e33c0ac0544502da1a6c5941..fef18455da5ae020f9875663984b26e5 + // Purpur end } diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -index 80303f9466b8c7097151be313afc9a383693d18a..e5b7598a5613a8281a991e42af5b950bcc2995ca 100644 +index c34701f95580e4cf45fe086115563127432a28c5..2363d9eaad655389c7b7d67d545ef8025f550431 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java @@ -268,7 +268,13 @@ public class ItemFrame extends HangingEntity { @@ -11181,10 +11095,10 @@ index 80303f9466b8c7097151be313afc9a383693d18a..e5b7598a5613a8281a991e42af5b950b if (!itemstack.isEmpty()) { diff --git a/src/main/java/net/minecraft/world/entity/decoration/Painting.java b/src/main/java/net/minecraft/world/entity/decoration/Painting.java -index d9016807bc21c38a5c38170e1335c79b39355bcb..62cdc36a21c0203ed98d2946a1efdf549a5ca3ea 100644 +index fee2269b241cbfb10bbbb76b404aa5ef3997dfe0..af07901daaf6a0e5cd7e4b1e07fb491566807932 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/Painting.java +++ b/src/main/java/net/minecraft/world/entity/decoration/Painting.java -@@ -121,7 +121,7 @@ public class Painting extends HangingEntity implements VariantHolder(this, Player.class, true)); } public static AttributeSupplier.Builder createAttributes() { -- return Monster.createMonsterAttributes().add(Attributes.ATTACK_DAMAGE, 6.0D).add(Attributes.MOVEMENT_SPEED, (double)0.23F).add(Attributes.FOLLOW_RANGE, 48.0D); -+ return Monster.createMonsterAttributes().add(Attributes.ATTACK_DAMAGE, 6.0D).add(Attributes.MOVEMENT_SPEED, (double)0.23F).add(Attributes.FOLLOW_RANGE, 48.0D).add(Attributes.FLYING_SPEED, 0.6D); // Purpur +- return Monster.createMonsterAttributes().add(Attributes.ATTACK_DAMAGE, 6.0).add(Attributes.MOVEMENT_SPEED, 0.23F).add(Attributes.FOLLOW_RANGE, 48.0); ++ return Monster.createMonsterAttributes().add(Attributes.ATTACK_DAMAGE, 6.0).add(Attributes.MOVEMENT_SPEED, 0.23F).add(Attributes.FOLLOW_RANGE, 48.0).add(Attributes.FLYING_SPEED, 0.6D); // Purpur } @Override -@@ -101,11 +148,19 @@ public class Blaze extends Monster { +@@ -111,11 +158,18 @@ public class Blaze extends Monster { @Override public boolean isSensitiveToWater() { @@ -11519,8 +11411,7 @@ index 17aa7676ab624440651850bbe5689f8a6c9dbeed..a8b58469fd8a1ed4ec0ce443cf055579 + return; + } + // Purpur end -+ - --this.nextHeightOffsetChangeTick; + this.nextHeightOffsetChangeTick--; if (this.nextHeightOffsetChangeTick <= 0) { this.nextHeightOffsetChangeTick = 100; diff --git a/src/main/java/net/minecraft/world/entity/monster/CaveSpider.java b/src/main/java/net/minecraft/world/entity/monster/CaveSpider.java @@ -12319,7 +12210,7 @@ index c135bc245f59a1af706f98b9d140dee77016b12f..640f0c378a18cf0a820ad544bb3b172b if (this.floatDuration-- <= 0) { this.floatDuration += this.ghast.getRandom().nextInt(5) + 2; diff --git a/src/main/java/net/minecraft/world/entity/monster/Giant.java b/src/main/java/net/minecraft/world/entity/monster/Giant.java -index 793c72bb7b86e404926085629121d6cad19a2740..d13eed85d5399cd6991b3ad90f05a5805a3a2678 100644 +index a329395dd8ff2d5428de19018111373806fc8796..20d6fd08cc7b5964f74b7dd99ee117ac30273426 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Giant.java +++ b/src/main/java/net/minecraft/world/entity/monster/Giant.java @@ -1,18 +1,123 @@ @@ -12696,7 +12587,7 @@ index fb84b35e34063075e69e00e430bc00e7c3b9d62c..a8b3431c67442c5440b063426a1adc42 this.targetSelector.addGoal(2, (new NearestAttackableTargetGoal<>(this, Player.class, true)).setUnseenMemoryTicks(300)); this.targetSelector.addGoal(3, (new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)).setUnseenMemoryTicks(300)); diff --git a/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java b/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java -index 2858ea5562d06c11e5c7337a2b123f9be7a3f62e..1ad97267394d3717b1871336193cdc91f3ffb276 100644 +index c4b4ff79bfdf9e34bf73a7760369e24b28dbbd70..1bfd5ef9ce8a07375ff215d092368c3f5104ab13 100644 --- a/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java +++ b/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java @@ -25,6 +25,58 @@ public class MagmaCube extends Slime { @@ -12756,7 +12647,7 @@ index 2858ea5562d06c11e5c7337a2b123f9be7a3f62e..1ad97267394d3717b1871336193cdc91 + } + public static AttributeSupplier.Builder createAttributes() { - return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, (double)0.2F); + return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.2F); } @@ -70,11 +122,12 @@ public class MagmaCube extends Slime { } @@ -12773,10 +12664,10 @@ 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 fbca4d6bc84e8be359b989ef089469838f896910..1be6f724fa6447fe733c8374ac295c6d4db6eb87 100644 +index 759839e912c54598b257ad738481364940f88a18..e60e6b3e5ae5a468cfe649ed2222412f3bc8b268 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 { +@@ -88,6 +88,14 @@ public abstract class Monster extends PathfinderMob implements Enemy { } public static boolean isDarkEnoughToSpawn(ServerLevelAccessor world, BlockPos pos, RandomSource random) { @@ -13913,7 +13804,7 @@ index 7618364e5373fe17cfe45a5a4ee9ab25e591581c..b44ffeb4cc0ef63fdd25683f60c5a20f this.targetSelector.addGoal(2, new Spider.SpiderTargetGoal<>(this, Player.class)); this.targetSelector.addGoal(3, new Spider.SpiderTargetGoal<>(this, IronGolem.class)); diff --git a/src/main/java/net/minecraft/world/entity/monster/Stray.java b/src/main/java/net/minecraft/world/entity/monster/Stray.java -index 8185cef34b9300561a00f9e62b98f1aa818a3f5a..e01c91385935b71bb9aa7259b95cb963140e8c94 100644 +index 207a649d737adff440bd3f7cba15b0dbca338a35..18c0cf991c2e8418d7fdd4c8dbd7487a301e890d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Stray.java +++ b/src/main/java/net/minecraft/world/entity/monster/Stray.java @@ -21,6 +21,38 @@ public class Stray extends AbstractSkeleton { @@ -14178,10 +14069,10 @@ index f443006c1e32feee97b32312814e2447a50c45e2..834abf1160034543fe3e89fa1c8d4bb5 Vec3 vec3d1 = Vex.this.getDeltaMovement(); diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -index a6af5ac9d09834940d3dd4c80b16450b90484edb..ee9d5933f74584452a1b27a392e7d36dac5b9bc9 100644 +index 0ee020848cdfd0c069f1e8d3a9516a339d82467c..960b5e2c290f82501384f79d4653f47bedf926fb 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java +++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -@@ -58,14 +58,48 @@ public class Vindicator extends AbstractIllager { +@@ -56,14 +56,48 @@ public class Vindicator extends AbstractIllager { super(type, world); } @@ -14225,12 +14116,12 @@ index a6af5ac9d09834940d3dd4c80b16450b90484edb..ee9d5933f74584452a1b27a392e7d36d this.goalSelector.addGoal(1, new Vindicator.VindicatorBreakDoorGoal(this)); this.goalSelector.addGoal(2, new AbstractIllager.RaiderOpenDoorGoal(this)); this.goalSelector.addGoal(3, new Raider.HoldGroundAttackGoal(this, 10.0F)); - this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0D, false)); + this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0, false)); + this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, Raider.class)).setAlertOthers()); + this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Raider.class).setAlertOthers()); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, true)); -@@ -130,6 +164,12 @@ public class Vindicator extends AbstractIllager { +@@ -136,6 +170,12 @@ public class Vindicator extends AbstractIllager { RandomSource randomSource = world.getRandom(); this.populateDefaultEquipmentSlots(randomSource, difficulty); this.populateDefaultEquipmentEnchantments(randomSource, difficulty); @@ -14343,10 +14234,10 @@ index 20a65c11ededcd7170704b70118da6200151fbab..e97cb4e166c2e9ac6d93ed5b15350758 protected void registerGoals() { this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractPiglin.class, true)); diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java -index b79c86272f12c4b1173ea494cbe09e1ecdc23533..1d36459ee10da702d65b4a6d139a05fdd487556f 100644 +index 728f3dff42678ed48c8921ea0e960f48724a9183..abafb15ab1294e11810798795bd103fb8bd5f64a 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java -@@ -69,6 +69,38 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { +@@ -82,6 +82,38 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { this.xpReward = 5; } @@ -14385,16 +14276,7 @@ index b79c86272f12c4b1173ea494cbe09e1ecdc23533..1d36459ee10da702d65b4a6d139a05fd @Override protected Brain.Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); -@@ -184,7 +216,7 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { - - @Override - public Brain getBrain() { -- return super.getBrain(); -+ return (Brain) super.getBrain(); // Purpur - decompile error - } - - protected void updateActivity() { -@@ -200,9 +232,10 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { +@@ -241,9 +273,10 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { @Override protected void customServerAiStep() { @@ -14783,37 +14665,28 @@ index fbabbd0808304f5d0d12f987d00c9e43a89fb1c9..feba8a264bae656244f60296d0511a80 @Nullable diff --git a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -index 0b8992a9aea781470ab3b1880cf041972a20089d..94431d5c789a9f558c16c0d1fc8f1f7463421ec6 100644 +index b5ef8d9e55656100085a4d9858c3530bb08d3c16..aa27c014ce53e2dd49f02d413d5c4d763261a803 100644 --- a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java +++ b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -@@ -59,7 +59,7 @@ public class Breeze extends Monster { - - @Override - public Brain getBrain() { -- return super.getBrain(); -+ return (Brain) super.getBrain(); // Purpur - decompile error - } - - @Override -@@ -200,10 +200,10 @@ public class Breeze extends Monster { +@@ -202,10 +202,10 @@ public class Breeze extends Monster { @Override protected void customServerAiStep() { - this.level().getProfiler().push("breezeBrain"); -+ // this.level().getProfiler().push("breezeBrain"); // Purpur ++ //this.level().getProfiler().push("breezeBrain"); // Purpur this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().popPush("breezeActivityUpdate"); - this.level().getProfiler().pop(); -+ // this.level().getProfiler().popPush("breezeActivityUpdate"); // Purpur -+ // this.level().getProfiler().pop(); // Purpur ++ //this.level().getProfiler().popPush("breezeActivityUpdate"); // Purpur ++ //this.level().getProfiler().pop(); // Purpur super.customServerAiStep(); } 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 9921b160fb21f72fbd28fe81ea66fbc3dc05f83f..5c160d6aa4e3d51c1161f82e92e5e8c1e809a574 100644 +index 1299f93d4f983e6715e447add65df91ef9e9090a..cfa7ec9b5b3125cb80b591e80f8d42815c25f568 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 { +@@ -92,6 +92,43 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { this.xpReward = 5; } @@ -14857,7 +14730,7 @@ index 9921b160fb21f72fbd28fe81ea66fbc3dc05f83f..5c160d6aa4e3d51c1161f82e92e5e8c1 @Override public boolean canBeLeashed(Player player) { return !this.isLeashed(); -@@ -131,10 +168,10 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -158,10 +195,10 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { private int behaviorTick; // Pufferfish @Override protected void customServerAiStep() { @@ -14870,7 +14743,7 @@ index 9921b160fb21f72fbd28fe81ea66fbc3dc05f83f..5c160d6aa4e3d51c1161f82e92e5e8c1 + //this.level().getProfiler().pop(); // Purpur HoglinAi.updateActivity(this); if (this.isConverting()) { - ++this.timeInOverworld; + this.timeInOverworld++; 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 83d83e3f84bb6bd58761671c6cd4c8683545ff4c..1422c0f4ff6a3e61f229574cd7b50971bdbd8451 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java @@ -14978,10 +14851,10 @@ index 4f4f557b7f4232ec3b90dda43c6bed30521318ba..dd4313e0507d3adda0ec84c79f1af13e piglin.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET); piglin.getNavigation().stop(); diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -index d02ee11066fc4f07ccb110b09b86d895ff90d4f2..856e6e02c9424a6c06e310262cb4f5bdd34da516 100644 +index 1afd5245267866c498d4b0d90ca55cda2ede8ca9..40f6af92d1fc58a6115fc16b02d296aef897b607 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -@@ -41,6 +41,38 @@ public class PiglinBrute extends AbstractPiglin { +@@ -63,6 +63,38 @@ public class PiglinBrute extends AbstractPiglin { this.xpReward = 20; } @@ -15018,18 +14891,9 @@ index d02ee11066fc4f07ccb110b09b86d895ff90d4f2..856e6e02c9424a6c06e310262cb4f5bd + } + public static AttributeSupplier.Builder createAttributes() { - return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 50.0D).add(Attributes.MOVEMENT_SPEED, (double)0.35F).add(Attributes.ATTACK_DAMAGE, 7.0D); + return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 50.0).add(Attributes.MOVEMENT_SPEED, 0.35F).add(Attributes.ATTACK_DAMAGE, 7.0); } -@@ -70,7 +102,7 @@ public class PiglinBrute extends AbstractPiglin { - - @Override - public Brain getBrain() { -- return super.getBrain(); -+ return (Brain) super.getBrain(); // Purpur - decompile error - } - - @Override -@@ -85,9 +117,10 @@ public class PiglinBrute extends AbstractPiglin { +@@ -113,9 +145,10 @@ public class PiglinBrute extends AbstractPiglin { @Override protected void customServerAiStep() { @@ -15128,10 +14992,10 @@ index 4e6c2f6b2e54a4c126e9a026b9cad05ce835ad66..69553b5b3c56998e4ae40876b1458929 // CraftBukkit start private CraftMerchant craftMerchant; diff --git a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java -index 5f407535298a31a34cfe114dd863fd6a9b977707..29c7e33fe961020e5a0007287fe9b6631689f1b8 100644 +index 5d1610eddcaf0cf65c726a5438b42e53bab85332..5665aa461f8c943bd7373df28d7d152251cce431 100644 --- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java +++ b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java -@@ -30,7 +30,7 @@ public class CatSpawner implements CustomSpawner { +@@ -28,7 +28,7 @@ public class CatSpawner implements CustomSpawner { if (this.nextTick > 0) { return 0; } else { @@ -15140,35 +15004,30 @@ index 5f407535298a31a34cfe114dd863fd6a9b977707..29c7e33fe961020e5a0007287fe9b663 Player player = world.getRandomPlayer(); if (player == null) { return 0; -@@ -63,11 +63,15 @@ public class CatSpawner implements CustomSpawner { - } +@@ -62,8 +62,12 @@ public class CatSpawner implements CustomSpawner { private int spawnInVillage(ServerLevel world, BlockPos pos) { -- int i = 48; + int i = 48; +- if (world.getPoiManager().getCountInRange(entry -> entry.is(PoiTypes.HOME), pos, 48, PoiManager.Occupancy.IS_OCCUPIED) > 4L) { +- List list = world.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(48.0, 8.0, 48.0)); + // Purpur start + int range = world.purpurConfig.catSpawnVillageScanRange; + if (range <= 0) return 0; -+ - if (world.getPoiManager().getCountInRange((entry) -> { - return entry.is(PoiTypes.HOME); -- }, pos, 48, PoiManager.Occupancy.IS_OCCUPIED) > 4L) { -- List list = world.getEntitiesOfClass(Cat.class, (new AABB(pos)).inflate(48.0D, 8.0D, 48.0D)); -+ }, pos, range, PoiManager.Occupancy.IS_OCCUPIED) > 4L) { -+ List list = world.getEntitiesOfClass(Cat.class, (new AABB(pos)).inflate(range, 8.0D, range)); -+ // Purpur end ++ if (world.getPoiManager().getCountInRange(entry -> entry.is(PoiTypes.HOME), pos, range, PoiManager.Occupancy.IS_OCCUPIED) > 4L) { ++ List list = world.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range)); ++ // Purpur end if (list.size() < 5) { return this.spawnCat(pos, world); } -@@ -77,8 +81,11 @@ public class CatSpawner implements CustomSpawner { - } +@@ -74,7 +78,11 @@ public class CatSpawner implements CustomSpawner { private int spawnInHut(ServerLevel world, BlockPos pos) { -- int i = 16; -- List list = world.getEntitiesOfClass(Cat.class, (new AABB(pos)).inflate(16.0D, 8.0D, 16.0D)); + int i = 16; +- List list = world.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(16.0, 8.0, 16.0)); + // Purpur start + int range = world.purpurConfig.catSpawnSwampHutScanRange; + if (range <= 0) return 0; -+ List list = world.getEntitiesOfClass(Cat.class, (new AABB(pos)).inflate(range, 8.0D, range)); ++ List list = world.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range)); + // Purpur end return list.size() < 1 ? this.spawnCat(pos, world) : 0; } @@ -15390,18 +15249,18 @@ index 96ca567af2d8fb2ba39f995be80b935344550124..50202286a0d83f7fe5331eb669d99971 this.brain.setMemory(MemoryModuleType.LAST_SLEPT, this.level().getGameTime()); // CraftBukkit - decompile error this.brain.eraseMemory(MemoryModuleType.WALK_TARGET); diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java b/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java -index ac70c2c03241e73943bd517a8c69dd05e0873634..0318663a824d2a9515f867a075d148c3fcb1a907 100644 +index 1316f4475802e17039800cc6128e1b065328beb7..d02e2d1aceac651e06a3a3698b7ac64dd30d4b12 100644 --- a/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java +++ b/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java -@@ -26,7 +26,7 @@ public record VillagerProfession(String name, Predicate> heldJob +@@ -31,7 +31,7 @@ public record VillagerProfession( public static final VillagerProfession ARMORER = register("armorer", PoiTypes.ARMORER, SoundEvents.VILLAGER_WORK_ARMORER); public static final VillagerProfession BUTCHER = register("butcher", PoiTypes.BUTCHER, SoundEvents.VILLAGER_WORK_BUTCHER); public static final VillagerProfession CARTOGRAPHER = register("cartographer", PoiTypes.CARTOGRAPHER, SoundEvents.VILLAGER_WORK_CARTOGRAPHER); - public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, SoundEvents.VILLAGER_WORK_CLERIC); + public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, ImmutableSet.of(Items.NETHER_WART), ImmutableSet.of(Blocks.SOUL_SAND), SoundEvents.VILLAGER_WORK_CLERIC); // Purpur - public static final VillagerProfession FARMER = register("farmer", PoiTypes.FARMER, ImmutableSet.of(Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT_SEEDS, Items.BONE_MEAL), ImmutableSet.of(Blocks.FARMLAND), SoundEvents.VILLAGER_WORK_FARMER); - public static final VillagerProfession FISHERMAN = register("fisherman", PoiTypes.FISHERMAN, SoundEvents.VILLAGER_WORK_FISHERMAN); - public static final VillagerProfession FLETCHER = register("fletcher", PoiTypes.FLETCHER, SoundEvents.VILLAGER_WORK_FLETCHER); + public static final VillagerProfession FARMER = register( + "farmer", + PoiTypes.FARMER, diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java index 8d1cc1a644415be251f469ab1cb2ebc09fe5c3eb..b133c186d2d1412aa623ba3db68091bc69c282a5 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java @@ -15503,19 +15362,6 @@ index d7bddedb19c10f62fd1f7d3128453ad706ed16be..752b38d45d59d8b3cd492246e5aa4f37 if (NaturalSpawner.isSpawnPositionOk(SpawnPlacements.Type.ON_GROUND, world, blockposition2, EntityType.WANDERING_TRADER)) { blockposition1 = blockposition2; -diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java -index deabb3400ee2406a8ec179a96d8cfd86f8edbbd6..c6a925cbd35eb33b27b90bfa8344ac7515d28b76 100644 ---- a/src/main/java/net/minecraft/world/entity/player/Inventory.java -+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java -@@ -114,7 +114,7 @@ public class Inventory implements Container, Nameable { - } - - private boolean hasRemainingSpaceForItem(ItemStack existingStack, ItemStack stack) { -- return !existingStack.isEmpty() && ItemStack.isSameItemSameTags(existingStack, stack) && existingStack.isStackable() && existingStack.getCount() < existingStack.getMaxStackSize() && existingStack.getCount() < this.getMaxStackSize(); -+ return !existingStack.isEmpty() && existingStack.isStackable() && existingStack.getCount() < existingStack.getMaxStackSize() && existingStack.getCount() < this.getMaxStackSize() && ItemStack.isSameItemSameTags(existingStack, stack); // Paper - check if itemstack is stackable first - } - - // CraftBukkit start - Watch method above! :D diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java index 567704f61034363e48ef2a5b5566ebdc91682297..43199815ffe3d666577390b96187aa898ceb910e 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java @@ -15832,7 +15678,7 @@ index 5e82549ea2e80b3968b793b7b4b685c4891e9a91..bb61e1132c28274175215a679befdcfa protected void onHit(HitResult hitResult) { super.onHit(hitResult); diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -index 28690877c443ceb2bdf20e6d251c9d32f667814c..326d1db39e3d3cd46cb5a584e2a7b82dd46ff8fa 100644 +index 1fb1e729d6879568d8b4943071fa940325b2e5b0..d9761d8fe746e925a7a32dfc15eb8045c6150fe5 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java @@ -71,10 +71,11 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { @@ -15852,8 +15698,8 @@ index 28690877c443ceb2bdf20e6d251c9d32f667814c..326d1db39e3d3cd46cb5a584e2a7b82d entityplayer.connection.teleport(teleEvent.getTo()); entity.resetFallDistance(); -- entity.hurt(this.damageSources().fall().customCausingEntity(this), 5.0F); // CraftBukkit -+ entity.hurt(this.damageSources().fall().customCausingEntity(this), this.level().purpurConfig.enderPearlDamage); // CraftBukkit // Purpur +- entity.hurt(this.damageSources().fall().customEventDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API ++ entity.hurt(this.damageSources().fall().customEventDamager(this), this.level().purpurConfig.enderPearlDamage); // CraftBukkit // Paper - fix DamageSource API // Purpur } // CraftBukkit end this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_TELEPORT, SoundSource.PLAYERS); @@ -15871,7 +15717,7 @@ index 8ae7d62b72fb72d893e68b02b645d48374595ae6..2bd77524313ae7b32f710e7d197e81a2 if (!this.level().isClientSide && this.pickup == AbstractArrow.Pickup.ALLOWED) { this.spawnAtLocation(this.getPickupItem(), 0.1F); diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java -index 35e76fc8667d9fde5a8fc426699a617fb0a08e4b..beaa7e817fb923b9cb1a9df63ddce3fe9e087061 100644 +index 6f49b9b8707d74330adb973e0db3cd5bccf138b6..b4a38621b58e16b2bf48b3d45d85130e8883b477 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java +++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java @@ -99,7 +99,7 @@ public class WitherSkull extends AbstractHurtingProjectile { @@ -16146,19 +15992,18 @@ index 9967ba762567631f2bdb1e4f8fe16a13ea927b46..6c945ae8fe8b1517e312c688f829fab4 FoodProperties(int hunger, float saturationModifier, boolean meat, boolean alwaysEdible, boolean snack, List> statusEffects) { diff --git a/src/main/java/net/minecraft/world/food/Foods.java b/src/main/java/net/minecraft/world/food/Foods.java -index b16d9e2eaa589f19c563ee70b1a56d67dbcdecb0..71beab673f04cd051c46ea37f8c847316885d38d 100644 +index 4569cf30b33167a415256a8542820557ad38f89e..9c65eefa855f3622b6c9ae2a698cf332ba225c7f 100644 --- a/src/main/java/net/minecraft/world/food/Foods.java +++ b/src/main/java/net/minecraft/world/food/Foods.java -@@ -4,6 +4,9 @@ import net.minecraft.world.effect.MobEffectInstance; +@@ -4,6 +4,8 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; public class Foods { + public static final java.util.Map ALL_PROPERTIES = new java.util.HashMap<>(); // Purpur + public static final java.util.Map DEFAULT_PROPERTIES = new java.util.HashMap<>(); // Purpur -+ - public static final FoodProperties APPLE = (new FoodProperties.Builder()).nutrition(4).saturationMod(0.3F).build(); - public static final FoodProperties BAKED_POTATO = (new FoodProperties.Builder()).nutrition(5).saturationMod(0.6F).build(); - public static final FoodProperties BEEF = (new FoodProperties.Builder()).nutrition(3).saturationMod(0.3F).meat().build(); + public static final FoodProperties APPLE = new FoodProperties.Builder().nutrition(4).saturationMod(0.3F).build(); + public static final FoodProperties BAKED_POTATO = new FoodProperties.Builder().nutrition(5).saturationMod(0.6F).build(); + public static final FoodProperties BEEF = new FoodProperties.Builder().nutrition(3).saturationMod(0.3F).meat().build(); diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java index 48f634a7521d31c1e9dfd3cfc83139d428dbd37a..fa185a8145843edf44fc0aeedb6c36b2b13263ae 100644 --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java @@ -16405,7 +16250,7 @@ index 0dbfd23bbfc6ad203f048142f8c90ef741849fe1..9a80427d2bb470b6b1638e59aba57216 return new ChestMenu(MenuType.GENERIC_9x6, syncId, playerInventory, inventory, 6); } diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java -index 343f44db579839eb61376f876b5eff2e615dc2e5..849b6a30d412d10f1e2e6e88f2d8d990e4a720e4 100644 +index e6935b6632c7a7e07f4da459c95f564356242f98..1a686780e5aadcbdcfceb770ce8e283b38115209 100644 --- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java +++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java @@ -40,6 +40,12 @@ import org.bukkit.event.enchantment.PrepareItemEnchantEvent; @@ -16462,7 +16307,7 @@ index 343f44db579839eb61376f876b5eff2e615dc2e5..849b6a30d412d10f1e2e6e88f2d8d990 int j; for (j = 0; j < 3; ++j) { -@@ -344,6 +377,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { +@@ -351,6 +384,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { public void removed(net.minecraft.world.entity.player.Player player) { super.removed(player); this.access.execute((world, blockposition) -> { @@ -16629,10 +16474,10 @@ index 7cffc64573008502bdd14ae4906fe51166b12fb3..1feafdbb48cf760cb6ebf95d5be2c32b world.playSound((Player) null, entityarmorstand.getX(), entityarmorstand.getY(), entityarmorstand.getZ(), SoundEvents.ARMOR_STAND_PLACE, SoundSource.BLOCKS, 0.75F, 0.8F); entityarmorstand.gameEvent(GameEvent.ENTITY_PLACE, context.getPlayer()); diff --git a/src/main/java/net/minecraft/world/item/AxeItem.java b/src/main/java/net/minecraft/world/item/AxeItem.java -index 2e75fd06e9e379eb95ebfe55086ffc327706ab2f..2918b1aca8fae6a319881a631dc727b6d375a33c 100644 +index 4f8689e8cbc8b6b9f44168126b95cc864a383c9e..b05bb4caf57965b82d841f52d6ea27985a5efc84 100644 --- a/src/main/java/net/minecraft/world/item/AxeItem.java +++ b/src/main/java/net/minecraft/world/item/AxeItem.java -@@ -33,13 +33,15 @@ public class AxeItem extends DiggerItem { +@@ -55,13 +55,15 @@ public class AxeItem extends DiggerItem { Level level = context.getLevel(); BlockPos blockPos = context.getClickedPos(); Player player = context.getPlayer(); @@ -16650,7 +16495,7 @@ index 2e75fd06e9e379eb95ebfe55086ffc327706ab2f..2918b1aca8fae6a319881a631dc727b6 return InteractionResult.PASS; } // Paper end -@@ -47,35 +49,40 @@ public class AxeItem extends DiggerItem { +@@ -69,32 +71,41 @@ public class AxeItem extends DiggerItem { CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack); } @@ -16666,9 +16511,7 @@ index 2e75fd06e9e379eb95ebfe55086ffc327706ab2f..2918b1aca8fae6a319881a631dc727b6 + level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, state)); + // Purpur end if (player != null) { - itemStack.hurtAndBreak(1, player, (p) -> { - p.broadcastBreakEvent(context.getHand()); - }); + itemStack.hurtAndBreak(1, player, p -> p.broadcastBreakEvent(context.getHand())); } - return InteractionResult.sidedSuccess(level.isClientSide); @@ -16693,10 +16536,12 @@ index 2e75fd06e9e379eb95ebfe55086ffc327706ab2f..2918b1aca8fae6a319881a631dc727b6 world.levelEvent(player, 3005, pos, 0); return optional2; } else { -- Optional optional3 = Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(state.getBlock())).map((block) -> { -- return block.withPropertiesOf(state); -- }); -+ Optional optional3 = Optional.ofNullable(world.purpurConfig.axeWaxables.get(state.getBlock())); // Purpur +- Optional optional3 = Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(state.getBlock())) +- .map(block -> block.withPropertiesOf(state)); ++ // Purpur start ++ Optional optional3 = Optional.ofNullable(world.purpurConfig.axeWaxables.get(state.getBlock())); ++ // .map(block -> block.withPropertiesOf(state)); ++ // Purpur end if (optional3.isPresent()) { - world.playSound(player, pos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F); + world.playSound(HoneycombItem.WAX_OFF_BY_BLOCK.get().containsKey(state.getBlock()) ? player : null, pos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound @@ -16870,10 +16715,10 @@ index f3a428f80c265639250114498b10067b4bf1ada1..211d8e59a9b3460b346e5f8cf581df70 if (!itemstack1.isEmpty()) { if (i == 0) { diff --git a/src/main/java/net/minecraft/world/item/DyeColor.java b/src/main/java/net/minecraft/world/item/DyeColor.java -index 88e1c2431d51d8cdc3d555b711e506648225d289..ac8735cc9d127fc1f867b40d4000c033ef73bb83 100644 +index 52ff8331f2859ee4bf39bf2fa6631bed7eed2f18..848a36a740576a0dd9e4ad50d1dd3ff07bd1d537 100644 --- a/src/main/java/net/minecraft/world/item/DyeColor.java +++ b/src/main/java/net/minecraft/world/item/DyeColor.java -@@ -103,4 +103,10 @@ public enum DyeColor implements StringRepresentable { +@@ -101,4 +101,10 @@ public enum DyeColor implements StringRepresentable { public String getSerializedName() { return this.name; } @@ -16933,7 +16778,7 @@ index 8c8cf8705107c95d9a4eab28b5845ae13c4ffb3c..8031e38c66468676b3b4a7443d6678ee // Paper end - PlayerLaunchProjectileEvent if (user instanceof net.minecraft.server.level.ServerPlayer) { diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -index 0821c06a4c66edc8fcee09fc192335a588d2944b..56d7c05c93bc074f6caba51b1741f25d6f0861cd 100644 +index e1c8b24a92ea63a645406522a3c2fb5efd87f01a..0f6c1716103514dedf46e7068fd79e8b9b94e15d 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java @@ -15,6 +15,7 @@ import net.minecraft.util.ByIdMap; @@ -16944,8 +16789,8 @@ index 0821c06a4c66edc8fcee09fc192335a588d2944b..56d7c05c93bc074f6caba51b1741f25d import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.item.context.UseOnContext; -@@ -69,6 +70,14 @@ public class FireworkRocketItem extends Item { - com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Firework) fireworkRocketEntity.getBukkitEntity()); +@@ -76,6 +77,14 @@ public class FireworkRocketItem extends Item { + com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Firework) fireworkRocketEntity.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand)); if (event.callEvent() && world.addFreshEntity(fireworkRocketEntity)) { user.awardStat(Stats.ITEM_USED.get(this)); + // Purpur start @@ -16985,10 +16830,10 @@ index b2ad6d230de2c29f371178bccde1111c7532ee70..6667926519a0f1c151e53f59cce36e74 if (((HangingEntity) object).survives()) { diff --git a/src/main/java/net/minecraft/world/item/HoeItem.java b/src/main/java/net/minecraft/world/item/HoeItem.java -index 180aec596110309aade13d2080f8824d152b07cb..552c31c0f3746dd35388395036e70a925bf00bd4 100644 +index 9e5695eabd4c3ea165121b22fff93f09b170bc6b..18cbcfcd331f7b7a112383311e3e2b9984857028 100644 --- a/src/main/java/net/minecraft/world/item/HoeItem.java +++ b/src/main/java/net/minecraft/world/item/HoeItem.java -@@ -34,15 +34,23 @@ public class HoeItem extends DiggerItem { +@@ -45,15 +45,23 @@ public class HoeItem extends DiggerItem { public InteractionResult useOn(UseOnContext context) { Level level = context.getLevel(); BlockPos blockPos = context.getClickedPos(); @@ -17019,7 +16864,7 @@ index 180aec596110309aade13d2080f8824d152b07cb..552c31c0f3746dd35388395036e70a92 if (!level.isClientSide) { consumer.accept(context); if (player != null) { -@@ -52,7 +60,7 @@ public class HoeItem extends DiggerItem { +@@ -61,7 +69,7 @@ public class HoeItem extends DiggerItem { } } @@ -17110,7 +16955,7 @@ index 1ad126d992d95062a3db08374db7a927f23a0cac..f6664447c45b1d6f3371af7bed8b1175 this.getOrCreateTag().put(key, element); } diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java -index f692149d91b525bda6dc79d489d7496ea24037e8..cf68dca4096556b0c2594c76fcf113419e56dae0 100644 +index b43598ee4035d9c53a40629dd4021b58c04132c8..249c887af68f56739c3609bad2405ba2cbe11762 100644 --- a/src/main/java/net/minecraft/world/item/Items.java +++ b/src/main/java/net/minecraft/world/item/Items.java @@ -316,7 +316,7 @@ public class Items { @@ -17122,16 +16967,16 @@ index f692149d91b525bda6dc79d489d7496ea24037e8..cf68dca4096556b0c2594c76fcf11341 public static final Item CHEST = registerBlock(Blocks.CHEST); public static final Item CRAFTING_TABLE = registerBlock(Blocks.CRAFTING_TABLE); public static final Item FARMLAND = registerBlock(Blocks.FARMLAND); -@@ -1224,7 +1224,7 @@ public class Items { - public static final Item LANTERN = registerBlock(Blocks.LANTERN); - public static final Item SOUL_LANTERN = registerBlock(Blocks.SOUL_LANTERN); - public static final Item SWEET_BERRIES = registerItem("sweet_berries", new ItemNameBlockItem(Blocks.SWEET_BERRY_BUSH, (new Item.Properties()).food(Foods.SWEET_BERRIES))); -- public static final Item GLOW_BERRIES = registerItem("glow_berries", new ItemNameBlockItem(Blocks.CAVE_VINES, (new Item.Properties()).food(Foods.GLOW_BERRIES))); -+ public static final Item GLOW_BERRIES = registerItem("glow_berries", new org.purpurmc.purpur.item.GlowBerryItem(Blocks.CAVE_VINES, (new Item.Properties()).food(Foods.GLOW_BERRIES))); // Purpur +@@ -1535,7 +1535,7 @@ public class Items { + "sweet_berries", new ItemNameBlockItem(Blocks.SWEET_BERRY_BUSH, new Item.Properties().food(Foods.SWEET_BERRIES)) + ); + public static final Item GLOW_BERRIES = registerItem( +- "glow_berries", new ItemNameBlockItem(Blocks.CAVE_VINES, new Item.Properties().food(Foods.GLOW_BERRIES)) ++ "glow_berries", new org.purpurmc.purpur.item.GlowBerryItem(Blocks.CAVE_VINES, new Item.Properties().food(Foods.GLOW_BERRIES)) // Purpur + ); public static final Item CAMPFIRE = registerBlock(Blocks.CAMPFIRE); public static final Item SOUL_CAMPFIRE = registerBlock(Blocks.SOUL_CAMPFIRE); - public static final Item SHROOMLIGHT = registerBlock(Blocks.SHROOMLIGHT); -@@ -1367,6 +1367,13 @@ public class Items { +@@ -1715,6 +1715,13 @@ public class Items { ((BlockItem)item).registerBlocks(Item.BY_BLOCK, item); } @@ -17217,10 +17062,10 @@ index a0b3c2d3b3f86ecd6cb80ff767839d29ca4f4f68..61b4430d6dd73b5406c4879e41ff80a1 ((Mob) newEntity).setPersistenceRequired(); // Paper end - Add PlayerNameEntityEvent diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java -index 21212462e6b415e96536a27b2c009d1562f18946..193bcb12152347f5f02ce18b01ba918e5e838f30 100644 +index 9aba0211f37501bbd19b583d22fa83eae32390d9..f44e28bf44b9d39267d21eaf6a025b5f28f3cd72 100644 --- a/src/main/java/net/minecraft/world/item/ShovelItem.java +++ b/src/main/java/net/minecraft/world/item/ShovelItem.java -@@ -37,9 +37,12 @@ public class ShovelItem extends DiggerItem { +@@ -46,9 +46,12 @@ public class ShovelItem extends DiggerItem { BlockState blockState2 = FLATTENABLES.get(blockState.getBlock()); BlockState blockState3 = null; Runnable afterAction = null; // Paper @@ -17236,7 +17081,7 @@ index 21212462e6b415e96536a27b2c009d1562f18946..193bcb12152347f5f02ce18b01ba918e } else if (blockState.getBlock() instanceof CampfireBlock && blockState.getValue(CampfireBlock.LIT)) { afterAction = () -> { // Paper if (!level.isClientSide()) { -@@ -68,7 +71,7 @@ public class ShovelItem extends DiggerItem { +@@ -75,7 +78,7 @@ public class ShovelItem extends DiggerItem { } } @@ -17293,7 +17138,7 @@ index f47f793c62a919fb65c081ddb82d597a978d3b20..3bbb44ae3da68afbd6012df68dee277a com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Projectile) thrownPotion.getBukkitEntity()); if (event.callEvent() && world.addFreshEntity(thrownPotion)) { diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java -index fa876ddf54780728e7f3ecfe02aa8a16b8ef6f8d..dcd6f241271beecf9601e34547225d7921958c20 100644 +index a792c7b7a6179aa88fc473b27ef0ca13bd91a395..95f9dd3f8fbf593fd6898335454951868c867a06 100644 --- a/src/main/java/net/minecraft/world/item/TridentItem.java +++ b/src/main/java/net/minecraft/world/item/TridentItem.java @@ -77,11 +77,19 @@ public class TridentItem extends Item implements Vanishable { @@ -17317,10 +17162,10 @@ index fa876ddf54780728e7f3ecfe02aa8a16b8ef6f8d..dcd6f241271beecf9601e34547225d79 // CraftBukkit start // Paper start - PlayerLaunchProjectileEvent com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), (org.bukkit.entity.Projectile) entitythrowntrident.getBukkitEntity()); -@@ -131,6 +139,14 @@ public class TridentItem extends Item implements Vanishable { - f2 *= f6 / f5; +@@ -128,6 +136,14 @@ public class TridentItem extends Item implements Vanishable { f3 *= f6 / f5; f4 *= f6 / f5; + org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRiptideEvent(entityhuman, stack, f2, f3, f4); // CraftBukkit + + // Purpur start + ItemStack chestItem = entityhuman.getItemBySlot(EquipmentSlot.CHEST); @@ -17358,7 +17203,7 @@ index 7c29750e534eae4266bf7a63c50e3827401d6569..e8e9a3370ba07dc0ca47c8352f6f04a4 int i = aitemstack.length; diff --git a/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java b/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java -index 518d85a13c37a2f7d32ca0718323181048559986..27512787b37381a5236b1b473e9ce3f06df8e2d0 100644 +index 04c39359585d909dedbdfd78f6cbdc06b926607a..127950c54ae057b3d0eb62e8f81d5eef6f11a36c 100644 --- a/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java +++ b/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java @@ -7,6 +7,14 @@ public class ArrowInfiniteEnchantment extends Enchantment { @@ -17380,15 +17225,15 @@ index 518d85a13c37a2f7d32ca0718323181048559986..27512787b37381a5236b1b473e9ce3f0 @Override public boolean checkCompatibility(Enchantment other) { -- return other instanceof MendingEnchantment ? false : super.checkCompatibility(other); -+ return other instanceof MendingEnchantment ? org.purpurmc.purpur.PurpurConfig.allowInfinityMending : super.checkCompatibility(other); +- return !(other instanceof MendingEnchantment) && super.checkCompatibility(other); ++ return !(other instanceof MendingEnchantment) && super.checkCompatibility(other) || other instanceof MendingEnchantment && org.purpurmc.purpur.PurpurConfig.allowInfinityMending; // Purpur } } diff --git a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentCategory.java b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentCategory.java -index 246516e67db0b8b197b287c067d5a0163d8bde22..fc2c35f57436371cb0111aedfd289ac95d506d07 100644 +index afd74b274aa46b1e2187935ebeb2a8824a133867..4f8d8665cb90b746dc59913ec270839c4e5dba91 100644 --- a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentCategory.java +++ b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentCategory.java -@@ -121,6 +121,20 @@ public enum EnchantmentCategory { +@@ -113,6 +113,20 @@ public enum EnchantmentCategory { public boolean canEnchant(Item item) { return item instanceof Vanishable || Block.byItem(item) instanceof Vanishable || BREAKABLE.canEnchant(item); } @@ -17410,10 +17255,10 @@ index 246516e67db0b8b197b287c067d5a0163d8bde22..fc2c35f57436371cb0111aedfd289ac9 public abstract boolean canEnchant(Item item); diff --git a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java -index ecf640b00007a386290f8dfe9935a8aa610079fd..1eec84e217f6dc929091fa7451cd235ef3623822 100644 +index 496a9b9b095bd322fba8229a5d47e2a0107aeb96..8ffa04b583da86a9aa6cabe7d978373825b82b32 100644 --- a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java +++ b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java -@@ -46,7 +46,7 @@ public class EnchantmentHelper { +@@ -47,7 +47,7 @@ public class EnchantmentHelper { } public static int getEnchantmentLevel(CompoundTag nbt) { @@ -17422,7 +17267,7 @@ index ecf640b00007a386290f8dfe9935a8aa610079fd..1eec84e217f6dc929091fa7451cd235e } @Nullable -@@ -278,6 +278,29 @@ public class EnchantmentHelper { +@@ -266,6 +266,29 @@ public class EnchantmentHelper { return getItemEnchantmentLevel(Enchantments.CHANNELING, stack) > 0; } @@ -17450,8 +17295,8 @@ index ecf640b00007a386290f8dfe9935a8aa610079fd..1eec84e217f6dc929091fa7451cd235e + // Purpur end + @Nullable - public static Map.Entry getRandomItemWith(Enchantment enchantment, LivingEntity entity) { - return getRandomItemWith(enchantment, entity, (stack) -> { + public static Entry getRandomItemWith(Enchantment enchantment, LivingEntity entity) { + return getRandomItemWith(enchantment, entity, stack -> true); diff --git a/src/main/java/net/minecraft/world/item/enchantment/LootBonusEnchantment.java b/src/main/java/net/minecraft/world/item/enchantment/LootBonusEnchantment.java index 7f1ffc0ac402fcf0ec086986e959ecc9f78dde03..1351d52374d1c2367932e5ecd5f4637955fb14c9 100644 --- a/src/main/java/net/minecraft/world/item/enchantment/LootBonusEnchantment.java @@ -17502,20 +17347,20 @@ index 65c3e91ac4541c0150057dc9f012eb1ee566516e..40c199812ecf7b16fe5a17c18cb0d6d3 } diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index ed84c87a3f76bc0254c1abb189e6b8b808823465..5bc68b1ef33f297e9a4b1bdd7d69f86a46ad6fbd 100644 +index ea0aee88c7d901034427db201c1b2430f8a1d522..1f28bfb435c1e4d97da713f96c452abab3fda91a 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -191,7 +191,7 @@ public interface EntityGetter { +@@ -192,7 +192,7 @@ public interface EntityGetter { default boolean hasNearbyAlivePlayer(double x, double y, double z, double range) { - for(Player player : this.players()) { + for (Player player : this.players()) { - if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) { -+ if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player) && EntitySelector.notAfk.test(player)) { ++ if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player) && EntitySelector.notAfk.test(player)) { // Purpur double d = player.distanceToSqr(x, y, z); - if (range < 0.0D || d < range * range) { + if (range < 0.0 || d < range * range) { return true; diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index b678da2cbb93cea7971bc3c4d324cfca18b0bc97..059e545fd04b7919fb0cc86797b636e3cda61027 100644 +index 90a82bd7977ebe520bdcc2ab99e11452d5cf4a21..0be03430d8257d918b7cf646af518473ae027399 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -97,7 +97,7 @@ public class Explosion { @@ -17561,7 +17406,7 @@ index b678da2cbb93cea7971bc3c4d324cfca18b0bc97..059e545fd04b7919fb0cc86797b636e3 if (flag1) { - this.level.getProfiler().push("explosion_blocks"); -+ // this.level.getProfiler().push("explosion_blocks"); // Purpur ++ //this.level.getProfiler().push("explosion_blocks"); // Purpur List> list = new ArrayList(); Util.shuffle(this.toBlow, this.level.random); @@ -17570,12 +17415,12 @@ index b678da2cbb93cea7971bc3c4d324cfca18b0bc97..059e545fd04b7919fb0cc86797b636e3 } - this.level.getProfiler().pop(); -+ // this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().pop(); // Purpur } if (this.fire) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 506100b02e7e9a3eabfde6b1f93858c4cc048524..67a26f22d4eb7eaeee7900e6f4de421d0bfd5612 100644 +index a82de7111915b19cdc3f065910465a5e7e843aff..311c853f2150247350ab6ccb2dd92d58dbfc645c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -173,6 +173,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -17636,11 +17481,13 @@ index 506100b02e7e9a3eabfde6b1f93858c4cc048524..67a26f22d4eb7eaeee7900e6f4de421d public CraftWorld getWorld() { return this.world; } -@@ -207,11 +251,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -215,12 +259,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + // Paper end public abstract ResourceKey getTypeKey(); - +- - protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter ++ + //protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter // Purpur - dont break ABI protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, RegistryAccess iregistrycustom, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor @@ -17651,7 +17498,7 @@ index 506100b02e7e9a3eabfde6b1f93858c4cc048524..67a26f22d4eb7eaeee7900e6f4de421d this.generator = gen; this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); -@@ -1259,18 +1305,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1268,18 +1314,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } protected void tickBlockEntities() { @@ -17675,7 +17522,7 @@ index 506100b02e7e9a3eabfde6b1f93858c4cc048524..67a26f22d4eb7eaeee7900e6f4de421d // Spigot start // Iterator iterator = this.blockEntityTickers.iterator(); boolean flag = this.tickRateManager().runsNormally(); -@@ -1299,10 +1345,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1308,10 +1354,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 @@ -17688,7 +17535,7 @@ index 506100b02e7e9a3eabfde6b1f93858c4cc048524..67a26f22d4eb7eaeee7900e6f4de421d this.spigotConfig.currentPrimedTnt = 0; // Spigot } -@@ -1512,7 +1558,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1521,7 +1567,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @Override public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { @@ -17697,7 +17544,7 @@ index 506100b02e7e9a3eabfde6b1f93858c4cc048524..67a26f22d4eb7eaeee7900e6f4de421d List list = Lists.newArrayList(); ((ServerLevel)this).getEntityLookup().getEntities(except, box, list, predicate); // Paper - optimise this call return list; -@@ -1531,7 +1577,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1540,7 +1586,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } public void getEntities(EntityTypeTest filter, AABB box, Predicate predicate, List result, int limit) { @@ -17706,7 +17553,7 @@ index 506100b02e7e9a3eabfde6b1f93858c4cc048524..67a26f22d4eb7eaeee7900e6f4de421d // Paper start - optimise this call //TODO use limit if (filter instanceof net.minecraft.world.entity.EntityType entityTypeTest) { -@@ -1790,7 +1836,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1799,7 +1845,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } public ProfilerFiller getProfiler() { @@ -17715,7 +17562,7 @@ index 506100b02e7e9a3eabfde6b1f93858c4cc048524..67a26f22d4eb7eaeee7900e6f4de421d return (ProfilerFiller) this.profiler.get(); } -@@ -1900,4 +1946,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1909,4 +1955,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return null; } // Paper end - optimize redstone (Alternate Current) @@ -17765,7 +17612,7 @@ index 661acdf4b1f33d150b0caf179e925d3162d7be35..a2026900948e9157cb35ba0183dc3af2 if (entityhuman != null) { double d2 = entityhuman.distanceToSqr(d0, (double) i, d1); diff --git a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java -index 9fca247f51e8b4d445f61ab5c16faf3928626deb..583bb1282fedcab75dbe4359a9f53b76a538d903 100644 +index 18d2ff1baa2db0b97f2565eac006fbc4e81022fa..58d29c89e8e54fac143982c40c9aecc855b6cfd5 100644 --- a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java @@ -62,6 +62,54 @@ public class AnvilBlock extends FallingBlock { @@ -17824,7 +17671,7 @@ index 9fca247f51e8b4d445f61ab5c16faf3928626deb..583bb1282fedcab75dbe4359a9f53b76 return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java -index 3ecc92439fc85d224ff52f41c5e34079e042a5e6..2336fea8c65d64a77a1afa4b8b976fb0d7da00eb 100644 +index 85484d061090d989de8246df81f8e9e5f8906072..472e5d52e948d172b678b0f8e60b442b4d65bb5b 100644 --- a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java @@ -49,6 +49,20 @@ public class AzaleaBlock extends BushBlock implements BonemealableBlock { @@ -17849,10 +17696,10 @@ index 3ecc92439fc85d224ff52f41c5e34079e042a5e6..2336fea8c65d64a77a1afa4b8b976fb0 } diff --git a/src/main/java/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java b/src/main/java/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java -index 2a65c7b859b1126dbac9819a01ca2652e20498a9..3192edee23b899107b17e354ddfb3159ac2ef429 100644 +index ffcb4849d83e0f02adbb106f4543bb4898678267..700108e84cf3836a0542c5e04856a9fe254794e9 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java -@@ -39,6 +39,7 @@ public abstract class BaseCoralPlantTypeBlock extends Block implements SimpleWat +@@ -38,6 +38,7 @@ public abstract class BaseCoralPlantTypeBlock extends Block implements SimpleWat } protected static boolean scanForWater(BlockState state, BlockGetter world, BlockPos pos) { @@ -18035,29 +17882,25 @@ index 22036ed3ea0629bc12981a8d91a03e55cc2117d6..284149925440f413d23a9ec3ce704e70 public void updateEntityAfterFallOn(BlockGetter world, Entity entity) { diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java -index 9a2de546dc2af2ad4bf5d32ca6583f0e1f3f70d8..3d48293c34fa37ba5091c6058dadb32a8f74a009 100644 +index e7c8313cafc25858ac002e3c45e63db9e8cefee9..04eace0873f1133ccca9696282948dc7ebc6f398 100644 --- a/src/main/java/net/minecraft/world/level/block/Blocks.java +++ b/src/main/java/net/minecraft/world/level/block/Blocks.java -@@ -1145,8 +1145,8 @@ public class Blocks { - public static final Block CAVE_VINES = register("cave_vines", new CaveVinesBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).randomTicks().noCollission().lightLevel(CaveVines.emission(14)).instabreak().sound(SoundType.CAVE_VINES).pushReaction(PushReaction.DESTROY))); - public static final Block CAVE_VINES_PLANT = register("cave_vines_plant", new CaveVinesPlantBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().lightLevel(CaveVines.emission(14)).instabreak().sound(SoundType.CAVE_VINES).pushReaction(PushReaction.DESTROY))); - public static final Block SPORE_BLOSSOM = register("spore_blossom", new SporeBlossomBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).instabreak().noCollission().sound(SoundType.SPORE_BLOSSOM).pushReaction(PushReaction.DESTROY))); -- public static final Block AZALEA = register("azalea", new AzaleaBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).forceSolidOff().instabreak().sound(SoundType.AZALEA).noOcclusion().pushReaction(PushReaction.DESTROY))); -- public static final Block FLOWERING_AZALEA = register("flowering_azalea", new AzaleaBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).forceSolidOff().instabreak().sound(SoundType.FLOWERING_AZALEA).noOcclusion().pushReaction(PushReaction.DESTROY))); -+ public static final Block AZALEA = register("azalea", new AzaleaBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).forceSolidOff().randomTicks().instabreak().sound(SoundType.AZALEA).noOcclusion().pushReaction(PushReaction.DESTROY))); // Purpur -+ public static final Block FLOWERING_AZALEA = register("flowering_azalea", new AzaleaBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).forceSolidOff().randomTicks().instabreak().sound(SoundType.FLOWERING_AZALEA).noOcclusion().pushReaction(PushReaction.DESTROY))); // Purpur - public static final Block MOSS_CARPET = register("moss_carpet", new CarpetBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS_CARPET).pushReaction(PushReaction.DESTROY))); - public static final Block PINK_PETALS = register("pink_petals", new PinkPetalsBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().sound(SoundType.PINK_PETALS).pushReaction(PushReaction.DESTROY))); - public static final Block MOSS_BLOCK = register("moss_block", new MossBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS).pushReaction(PushReaction.DESTROY))); -@@ -1215,7 +1215,7 @@ public class Blocks { - } - - private static Boolean ocelotOrParrot(BlockState state, BlockGetter world, BlockPos pos, EntityType type) { -- return (boolean)type == EntityType.OCELOT || type == EntityType.PARROT; -+ return type == EntityType.OCELOT || type == EntityType.PARROT; // Purpur - decompile error - } - - private static Block bed(DyeColor color) { +@@ -7380,6 +7380,7 @@ public class Blocks { + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .forceSolidOff() ++ .randomTicks() // Purpur + .instabreak() + .sound(SoundType.AZALEA) + .noOcclusion() +@@ -7392,6 +7393,7 @@ public class Blocks { + BlockBehaviour.Properties.of() + .mapColor(MapColor.PLANT) + .forceSolidOff() ++ .randomTicks() // Purpur + .instabreak() + .sound(SoundType.FLOWERING_AZALEA) + .noOcclusion() diff --git a/src/main/java/net/minecraft/world/level/block/BushBlock.java b/src/main/java/net/minecraft/world/level/block/BushBlock.java index bed3d9c781c7d3ca260027b4737970889a54689c..db1941ed32d141327a8b11e54b3ff9900072ad36 100644 --- a/src/main/java/net/minecraft/world/level/block/BushBlock.java @@ -18210,7 +18053,7 @@ index 47b6b83842201620bd6620f5acf11bb14334e35d..b4d2499ae39fd3f14b2600a9663ea8a8 @Override diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java -index 1ec8c2d24ec8468d20f322d67143b9454ff266eb..558f243ee0923af9a8cb9e1bb6f4a0e5c8341fe4 100644 +index bdd9f38dcb16b74c5916b75713dbe5082b32497d..65bae6630a11aa1d8d1b08d1f8e2519545ad850c 100644 --- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java @@ -95,4 +95,11 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl @@ -18409,7 +18252,7 @@ index 7f365143ce5c62e734eceb855ba0a02ab3a99b27..bbb266cbe23da2573d3dfb3a6edd5746 BlockPos blockposition1 = pos.offset(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16)); diff --git a/src/main/java/net/minecraft/world/level/block/EnchantmentTableBlock.java b/src/main/java/net/minecraft/world/level/block/EnchantmentTableBlock.java -index 790cf30c2bfd4e2530ff563dfcf05e25554248b3..ba69e9b37ce9f2d8b439d471e6de770da38d6971 100644 +index f2157de3b52095657401a780a467da1f816eff98..b19461aafdb281a4eb6db6701fe7f97572ca321c 100644 --- a/src/main/java/net/minecraft/world/level/block/EnchantmentTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnchantmentTableBlock.java @@ -30,6 +30,8 @@ import net.minecraft.world.level.pathfinder.PathComputationType; @@ -18421,7 +18264,7 @@ index 790cf30c2bfd4e2530ff563dfcf05e25554248b3..ba69e9b37ce9f2d8b439d471e6de770d public class EnchantmentTableBlock extends BaseEntityBlock { public static final MapCodec CODEC = simpleCodec(EnchantmentTableBlock::new); -@@ -128,4 +130,18 @@ public class EnchantmentTableBlock extends BaseEntityBlock { +@@ -137,4 +139,18 @@ public class EnchantmentTableBlock extends BaseEntityBlock { public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) { return false; } @@ -18441,7 +18284,7 @@ index 790cf30c2bfd4e2530ff563dfcf05e25554248b3..ba69e9b37ce9f2d8b439d471e6de770d + // Purpur end } diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -index a0c1db8cfebaa0344012cc0af18d6231cdcdcbb8..f277a4a21b15627c45061e51c8f6c0812a176a10 100644 +index 4ba24bced9a2de4616a0418857d3738e0e322ea0..6660bea735dda46ab9493601f1f53b8e0075ca83 100644 --- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java @@ -54,6 +54,14 @@ public class EndPortalBlock extends BaseEntityBlock { @@ -18459,68 +18302,55 @@ index a0c1db8cfebaa0344012cc0af18d6231cdcdcbb8..f277a4a21b15627c45061e51c8f6c081 ResourceKey resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends ServerLevel worldserver = ((ServerLevel) world).getServer().getLevel(resourcekey); -@@ -61,6 +69,22 @@ public class EndPortalBlock extends BaseEntityBlock { - // return; // CraftBukkit - always fire event in case plugins wish to change it - } - -+ // Purpur start -+ if (!world.purpurConfig.endPortalSafeTeleporting) { -+ // CraftBukkit start - Entity in portal -+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); -+ world.getCraftServer().getPluginManager().callEvent(event); -+ -+ if (entity instanceof ServerPlayer) { -+ ((ServerPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL); -+ return; -+ } -+ // CraftBukkit end -+ entity.changeDimension(worldserver); -+ return; -+ } -+ // Purpur end -+ - // Paper start - move all of this logic into portal tick - entity.portalWorld = ((ServerLevel)world); - entity.portalBlock = pos.immutable(); diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java -index ddca14f1224327a738415fb8b37398d8df0aa9c8..fe3236295790b9e250486835176cae810160c33a 100644 +index 280041cc5f2a630571d9f4c8610c46e175ccf0c1..82c99b3e21f23d9142921159eebb6d80de3529b6 100644 --- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java -@@ -92,6 +92,34 @@ public class EnderChestBlock extends AbstractChestBlock i +@@ -92,7 +92,7 @@ public class EnderChestBlock extends AbstractChestBlock i EnderChestBlockEntity enderChestBlockEntity = (EnderChestBlockEntity)blockEntity; playerEnderChestContainer.setActiveChest(enderChestBlockEntity); - player.openMenu(new SimpleMenuProvider((syncId, inventory, playerx) -> { -+ // Purpur start -+ if (org.purpurmc.purpur.PurpurConfig.enderChestSixRows) { -+ if (org.purpurmc.purpur.PurpurConfig.enderChestPermissionRows) { -+ org.bukkit.craftbukkit.entity.CraftHumanEntity bukkitPlayer = player.getBukkitEntity(); -+ if (bukkitPlayer.hasPermission("purpur.enderchest.rows.six")) { -+ player.sixRowEnderchestSlotCount = 54; -+ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer); -+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.five")) { -+ player.sixRowEnderchestSlotCount = 45; -+ return ChestMenu.fiveRows(syncId, inventory, playerEnderChestContainer); -+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.four")) { -+ player.sixRowEnderchestSlotCount = 36; -+ return ChestMenu.fourRows(syncId, inventory, playerEnderChestContainer); -+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.three")) { -+ player.sixRowEnderchestSlotCount = 27; -+ return ChestMenu.threeRows(syncId, inventory, playerEnderChestContainer); -+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.two")) { -+ player.sixRowEnderchestSlotCount = 18; -+ return ChestMenu.twoRows(syncId, inventory, playerEnderChestContainer); -+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.one")) { -+ player.sixRowEnderchestSlotCount = 9; -+ return ChestMenu.oneRow(syncId, inventory, playerEnderChestContainer); -+ } -+ } -+ player.sixRowEnderchestSlotCount = -1; -+ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer); -+ } -+ // Purpur end - return ChestMenu.threeRows(syncId, inventory, playerEnderChestContainer); - }, CONTAINER_TITLE)); + player.openMenu( +- new SimpleMenuProvider((syncId, inventory, playerx) -> ChestMenu.threeRows(syncId, inventory, playerEnderChestContainer), CONTAINER_TITLE) ++ new SimpleMenuProvider((syncId, inventory, playerx) -> org.purpurmc.purpur.PurpurConfig.enderChestSixRows ? getEnderChestSixRows(syncId, inventory, player, playerEnderChestContainer) : ChestMenu.threeRows(syncId, inventory, playerEnderChestContainer), CONTAINER_TITLE) // Purpur + ); player.awardStat(Stats.OPEN_ENDERCHEST); + PiglinAi.angerNearbyPiglins(player, true); +@@ -103,6 +103,35 @@ public class EnderChestBlock extends AbstractChestBlock i + } + } + ++ // Purpur start ++ private ChestMenu getEnderChestSixRows(int syncId, net.minecraft.world.entity.player.Inventory inventory, Player player, PlayerEnderChestContainer playerEnderChestContainer) { ++ if (org.purpurmc.purpur.PurpurConfig.enderChestPermissionRows) { ++ org.bukkit.craftbukkit.entity.CraftHumanEntity bukkitPlayer = player.getBukkitEntity(); ++ if (bukkitPlayer.hasPermission("purpur.enderchest.rows.six")) { ++ player.sixRowEnderchestSlotCount = 54; ++ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer); ++ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.five")) { ++ player.sixRowEnderchestSlotCount = 45; ++ return ChestMenu.fiveRows(syncId, inventory, playerEnderChestContainer); ++ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.four")) { ++ player.sixRowEnderchestSlotCount = 36; ++ return ChestMenu.fourRows(syncId, inventory, playerEnderChestContainer); ++ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.three")) { ++ player.sixRowEnderchestSlotCount = 27; ++ return ChestMenu.threeRows(syncId, inventory, playerEnderChestContainer); ++ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.two")) { ++ player.sixRowEnderchestSlotCount = 18; ++ return ChestMenu.twoRows(syncId, inventory, playerEnderChestContainer); ++ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.one")) { ++ player.sixRowEnderchestSlotCount = 9; ++ return ChestMenu.oneRow(syncId, inventory, playerEnderChestContainer); ++ } ++ } ++ player.sixRowEnderchestSlotCount = -1; ++ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer); ++ } ++ // Purpur end ++ + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new EnderChestBlockEntity(pos, state); diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java index 6e4c852c93f2418ea69e485ed3a10cbe3a6e3bd2..0c39126ce51439cce05747161aba43bce33a12d8 100644 --- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java @@ -18666,7 +18496,7 @@ index 9c8c1df5187daefb1c8098b4d4a0976c71a7bbfd..cf4c1097d54c84b309ab02e9892d1b9e } else { world.setBlockAndUpdate(pos, IceBlock.meltsInto()); diff --git a/src/main/java/net/minecraft/world/level/block/KelpBlock.java b/src/main/java/net/minecraft/world/level/block/KelpBlock.java -index 4dbacee1930bc3955ce431e1d32353588b47afc9..a53c6ab63fd10ac94292836120152f54f23c1e13 100644 +index 1b83d44291029ce978187467832595b6dfd76dd5..69f2c6cae089aa7e1306c9dbe83d4ff582ec777c 100644 --- a/src/main/java/net/minecraft/world/level/block/KelpBlock.java +++ b/src/main/java/net/minecraft/world/level/block/KelpBlock.java @@ -72,4 +72,11 @@ public class KelpBlock extends GrowingPlantHeadBlock implements LiquidBlockConta @@ -18906,7 +18736,7 @@ index 09c61eb5ba129e9630a756b452ef6aa61745c533..837c8399b2f490d98ca556e66018bfd4 @Override diff --git a/src/main/java/net/minecraft/world/level/block/SlabBlock.java b/src/main/java/net/minecraft/world/level/block/SlabBlock.java -index adc7eba4bb5e8f7c507a16cdbd7497338a7658cf..512c528e0f2f3aa0da0253698a0189415329265a 100644 +index 481611d1759c161925524a8756060fb2cc0c0bf4..04852b896fc57028a970cce04d15c304749b592d 100644 --- a/src/main/java/net/minecraft/world/level/block/SlabBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SlabBlock.java @@ -138,4 +138,25 @@ public class SlabBlock extends Block implements SimpleWaterloggedBlock { @@ -19059,7 +18889,7 @@ index 8f3cca228f8ec1ea9379fa43af4baa7b18012dd2..7e87b4299979c9e46abb582da7a8e54a if (!iblockdata.is(Blocks.KELP) && !iblockdata.is(Blocks.KELP_PLANT) && !iblockdata.is(Blocks.SEAGRASS) && !iblockdata.is(Blocks.TALL_SEAGRASS)) { return false; diff --git a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java -index 77ae7b8ab24935d046cce1f8f7f476310876f9df..579abfbe791052507b15c14d8c81e39b2fdd6520 100644 +index 7c41b940dd915a27856f6fa6f9e536e296deeb53..51ba321172acc9908aac456f8209dd6af6987aa8 100644 --- a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java @@ -99,4 +99,14 @@ public class StonecutterBlock extends Block { @@ -19172,7 +19002,7 @@ index b4646e26965e0f1f26c5019e7c6a13fdf22bdb47..9a76665c6369b4106d152370dc3d2f56 } } diff --git a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java -index b4f75d034fbaea8ca68c1b5c5715773e0b8a9036..d05939c4b2ae42a09ee9e97431e83babfc8ed76c 100644 +index 6342bb11a162b9e6d9475c5989b1670d77e8f0fb..f8be92512446d3f0e5f0f21222bbefd04ab2838a 100644 --- a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java @@ -34,4 +34,11 @@ public class TwistingVinesBlock extends GrowingPlantHeadBlock { @@ -19188,7 +19018,7 @@ index b4f75d034fbaea8ca68c1b5c5715773e0b8a9036..d05939c4b2ae42a09ee9e97431e83bab + // Purpur end } diff --git a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java -index 98e62d2cd3c106753c3be4a217e9107397d388ab..6a1fd51423c17cd1498cb313fa52314daaca0a29 100644 +index 3dec5a082606ee35a8c8d7f746480262d6a189c5..b2f6ccae9576c176263e51a232e17a08d54543b3 100644 --- a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java +++ b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java @@ -34,4 +34,11 @@ public class WeepingVinesBlock extends GrowingPlantHeadBlock { @@ -19387,7 +19217,7 @@ index 4b81b0180dfc96fc6a88646838a886ca5b5d301b..428773361d12ecbcf3a6bf790aedfe12 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 55b0e2bf98a285cdcd30e40d94192b7a1802efd8..7810d763841825f68c60b7471026d71d89726bf0 100644 +index d445ed0895293dd45c36226051f5809be8587ebe..6afaab31539667667481f7e9bfc0c6846abe661a 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 @@ -47,7 +47,7 @@ public class BeehiveBlockEntity extends BlockEntity { @@ -19444,7 +19274,7 @@ index 55b0e2bf98a285cdcd30e40d94192b7a1802efd8..7810d763841825f68c60b7471026d71d // CraftBukkit end return false; } else { -@@ -429,9 +451,9 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -435,9 +457,9 @@ public class BeehiveBlockEntity extends BlockEntity { private BeeReleaseStatus() {} } @@ -19620,7 +19450,7 @@ index 37e0b762b86e74f607a4541ecb7b24ad7a591d0e..7e3edd41f3a39ef14382e18b20af21e6 }); diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java -index 65e1381bb2d10bd212463feb602c60f8fdb9ade1..b7370e64fd0d50e8725d7d5afc30af2e8bc8455d 100644 +index 4d1a895f3749bdcb132de199e81a9d93330c0ee6..5978f6bee32d31db8dd6af5c22ff0282fd81416a 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java @@ -24,6 +24,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable @@ -19636,17 +19466,17 @@ index 65e1381bb2d10bd212463feb602c60f8fdb9ade1..b7370e64fd0d50e8725d7d5afc30af2e nbt.putString("CustomName", Component.Serializer.toJson(this.name)); } + nbt.putInt("Purpur.Lapis", this.lapis); // Purpur - } -@@ -44,6 +46,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable + @Override +@@ -43,6 +45,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable if (nbt.contains("CustomName", 8)) { this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException } + this.lapis = nbt.getInt("Purpur.Lapis"); // Purpur - } + public static void bookAnimationTick(Level world, BlockPos pos, BlockState state, EnchantmentTableBlockEntity blockEntity) { @@ -117,4 +120,14 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable public Component getCustomName() { return this.name; @@ -19730,10 +19560,10 @@ index 927c7ea03560be0c86884cec70ee8e408e66cb07..93764bf849ad8e427bf119f6ff3dbcbc public CompoundTag getUpdateTag() { return this.saveWithoutMetadata(); diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index 54f7bdd0e003ed170d739593199a2bb8ff0bbd68..1b150b9fc444a248f6c01572447c7bb8eecfc76e 100644 +index 098fde8200a11f91f934ddab6b1486dac4014dfe..4997f120aa9877c199fbcaa0c2f65226e13b5a23 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -@@ -178,6 +178,15 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { +@@ -171,6 +171,15 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { public static void teleportEntity(Level world, BlockPos pos, BlockState state, Entity entity, TheEndGatewayBlockEntity blockEntity) { if (world instanceof ServerLevel && !blockEntity.isCoolingDown()) { @@ -19750,10 +19580,10 @@ index 54f7bdd0e003ed170d739593199a2bb8ff0bbd68..1b150b9fc444a248f6c01572447c7bb8 blockEntity.teleportCooldown = 100; diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonStructureResolver.java b/src/main/java/net/minecraft/world/level/block/piston/PistonStructureResolver.java -index 744d91546d1a810f60a43c15ed74b4158f341a4a..354538daefa603f6df5a139b6bff87dbb4cef178 100644 +index 205e223c356634bd6bc6bd58c6f0b7fda61a6f5f..bea05cb928d540a2f19b51bb7352d032b2dd69cd 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonStructureResolver.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonStructureResolver.java -@@ -86,7 +86,7 @@ public class PistonStructureResolver { +@@ -81,7 +81,7 @@ public class PistonStructureResolver { return true; } else { int i = 1; @@ -19761,17 +19591,17 @@ index 744d91546d1a810f60a43c15ed74b4158f341a4a..354538daefa603f6df5a139b6bff87db + if (i + this.toPush.size() > this.level.purpurConfig.pistonBlockPushLimit) { // Purpur return false; } else { - while(isSticky(blockState)) { -@@ -98,7 +98,7 @@ public class PistonStructureResolver { + while (isSticky(blockState)) { +@@ -95,7 +95,7 @@ public class PistonStructureResolver { + break; } - ++i; -- if (i + this.toPush.size() > 12) { -+ if (i + this.toPush.size() > this.level.purpurConfig.pistonBlockPushLimit) { // Purpur +- if (++i + this.toPush.size() > 12) { ++ if (++i + this.toPush.size() > this.level.purpurConfig.pistonBlockPushLimit) { // Purpur return false; } } -@@ -142,7 +142,7 @@ public class PistonStructureResolver { +@@ -140,7 +140,7 @@ public class PistonStructureResolver { return true; } @@ -19803,7 +19633,7 @@ index 2892e586146cbc560f0bcf4b9af6d0575cb0a82e..d38d8fc7ef22fb68e867cc29dab1171c protected ResourceLocation drops; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 922191159fadf8e89646d7299aadee4aa851f71a..1b49ecbf8fdbe8b734f8ca5191dc9ed70aa66af7 100644 +index 270a892373ecbb3982990d6201d79c8a66de4f60..97724cbd6c1bf172379e98d4a3f6e8cda5cda823 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -122,7 +122,7 @@ public class LevelChunk extends ChunkAccess { @@ -19862,8 +19692,8 @@ index 922191159fadf8e89646d7299aadee4aa851f71a..1b49ecbf8fdbe8b734f8ca5191dc9ed7 BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); if (this.blockEntity.getType().isValid(iblockdata)) { -@@ -1188,7 +1188,7 @@ public class LevelChunk extends ChunkAccess { - LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata}); +@@ -1193,7 +1193,7 @@ public class LevelChunk extends ChunkAccess { + // Paper end - Remove the Block Entity if it's invalid } - gameprofilerfiller.pop(); @@ -19871,7 +19701,7 @@ index 922191159fadf8e89646d7299aadee4aa851f71a..1b49ecbf8fdbe8b734f8ca5191dc9ed7 } catch (Throwable throwable) { if (throwable instanceof ThreadDeath) throw throwable; // Paper // Paper start - Prevent block entity and entity crashes -@@ -1199,7 +1199,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1204,7 +1204,7 @@ public class LevelChunk extends ChunkAccess { // Paper end - Prevent block entity and entity crashes // Spigot start } finally { @@ -19881,10 +19711,10 @@ index 922191159fadf8e89646d7299aadee4aa851f71a..1b49ecbf8fdbe8b734f8ca5191dc9ed7 } } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -index 23dc37ff1f92951817864963bf93220d5aae91bb..af563ffb67c43b50555951fe1b5e4320d429a7f1 100644 +index 995fbfa225efe40274c20608b9b30b8afa847698..c70f04cdee1e8ba6f8a15c9e38edbe0023b5ab96 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -@@ -112,6 +112,7 @@ public class EntityStorage implements EntityPersistentStorage { +@@ -111,6 +111,7 @@ public class EntityStorage implements EntityPersistentStorage { ListTag listTag = new ListTag(); final java.util.Map, Integer> savedEntityCounts = new java.util.HashMap<>(); // Paper - Entity load/save limit per chunk entities.forEach((entity) -> { // diff here: use entities parameter @@ -19981,10 +19811,10 @@ index 3bb4a9a1a6249e8ba2de237f801210e7f4fd5825..2d492d849ff73a738dfbcb16507feb89 protected boolean canConvertToSource(Level world) { return world.getGameRules().getBoolean(GameRules.RULE_LAVA_SOURCE_CONVERSION); diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -index cde93efaecd42b9081405638af3ba91cb5e184c9..c664fd77dd865037293a3e86699fd1fa6b703882 100644 +index 109f71401c65f476ccf6813137386fc9fef10254..9dcdb2f4001115db0c26fdbf86531dbe6098485d 100644 --- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java +++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -@@ -64,6 +64,13 @@ public abstract class WaterFluid extends FlowingFluid { +@@ -80,6 +80,13 @@ public abstract class WaterFluid extends FlowingFluid { return world.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION); } @@ -19999,7 +19829,7 @@ index cde93efaecd42b9081405638af3ba91cb5e184c9..c664fd77dd865037293a3e86699fd1fa @Override protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) { diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index eb18494bd7257fa5eb00dea16cf4d5667b796f2b..f039d6109ee6f55542adc8f30476ba9a9e4974bf 100644 +index d1e1f12451058f7f276f8277536a4c0a4d736601..2046ac397f5c46cc45f233e36abbdbe717753fc7 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java @@ -53,8 +53,8 @@ public class PathFinder { @@ -20013,20 +19843,29 @@ index eb18494bd7257fa5eb00dea16cf4d5667b796f2b..f039d6109ee6f55542adc8f30476ba9a // Set set = positions.keySet(); startNode.g = 0.0F; startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection +@@ -122,7 +122,7 @@ public class PathFinder { + if (best == null || comparator.compare(path, best) < 0) + best = path; + } +- profiler.pop(); ++ //profiler.pop(); // Purpur + return best; + // Paper end - Perf: remove streams and optimize collection + } diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -index 70c7c735fdd0c1b66243915622e47eab8a57e7cc..996bd26e95e766ce4ca7e61d060881feb9dd4a89 100644 +index 1cd7f0f1c7d62552e6609997c83f3df8dae13316..a6f745d21d982dfcbfb458472a7b2a8867d13504 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -241,7 +241,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { - } - - if (blockPathTypes != BlockPathTypes.WALKABLE && (!this.isAmphibious() || blockPathTypes != BlockPathTypes.WATER)) { -- if ((node == null || node.costMalus < 0.0F) && maxYStep > 0 && (blockPathTypes != BlockPathTypes.FENCE || this.canWalkOverFences()) && blockPathTypes != BlockPathTypes.UNPASSABLE_RAIL && blockPathTypes != BlockPathTypes.TRAPDOOR && blockPathTypes != BlockPathTypes.POWDER_SNOW) { -+ if ((node == null || node.costMalus < 0.0F) && maxYStep > 0 && (blockPathTypes != BlockPathTypes.FENCE || this.canWalkOverFences()) && (this.mob.level().purpurConfig.mobsIgnoreRails || blockPathTypes != BlockPathTypes.UNPASSABLE_RAIL) && blockPathTypes != BlockPathTypes.TRAPDOOR && blockPathTypes != BlockPathTypes.POWDER_SNOW) { // Purpur +@@ -259,7 +259,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { + if ((node == null || node.costMalus < 0.0F) + && maxYStep > 0 + && (blockPathTypes != BlockPathTypes.FENCE || this.canWalkOverFences()) +- && blockPathTypes != BlockPathTypes.UNPASSABLE_RAIL ++ && (this.mob.level().purpurConfig.mobsIgnoreRails || blockPathTypes != BlockPathTypes.UNPASSABLE_RAIL) // Purpur + && blockPathTypes != BlockPathTypes.TRAPDOOR + && blockPathTypes != BlockPathTypes.POWDER_SNOW) { node = this.findAcceptedNode(x, y + 1, z, maxYStep - 1, prevFeetY, direction, nodeType); - if (node != null && (node.type == BlockPathTypes.OPEN || node.type == BlockPathTypes.WALKABLE) && this.mob.getBbWidth() < 1.0F) { - double g = (double)(x - direction.getStepX()) + 0.5D; -@@ -471,7 +471,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -475,7 +475,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { return BlockPathTypes.BLOCKED; } else { // Paper end - Do not load chunks during pathfinding @@ -20035,15 +19874,15 @@ index 70c7c735fdd0c1b66243915622e47eab8a57e7cc..996bd26e95e766ce4ca7e61d060881fe return BlockPathTypes.DANGER_OTHER; } -@@ -504,7 +504,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { - } else if (!blockState.is(BlockTags.TRAPDOORS) && !blockState.is(Blocks.LILY_PAD) && !blockState.is(Blocks.BIG_DRIPLEAF)) { - if (blockState.is(Blocks.POWDER_SNOW)) { - return BlockPathTypes.POWDER_SNOW; -- } else if (!blockState.is(Blocks.CACTUS) && !blockState.is(Blocks.SWEET_BERRY_BUSH)) { -+ } else if (!blockState.is(Blocks.CACTUS) && !blockState.is(Blocks.SWEET_BERRY_BUSH) && !blockState.is(Blocks.STONECUTTER)) { // Purpur - if (blockState.is(Blocks.HONEY_BLOCK)) { - return BlockPathTypes.STICKY_HONEY; - } else if (blockState.is(Blocks.COCOA)) { +@@ -509,7 +509,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { + return BlockPathTypes.TRAPDOOR; + } else if (blockState.is(Blocks.POWDER_SNOW)) { + return BlockPathTypes.POWDER_SNOW; +- } else if (blockState.is(Blocks.CACTUS) || blockState.is(Blocks.SWEET_BERRY_BUSH)) { ++ } else if (blockState.is(Blocks.CACTUS) || blockState.is(Blocks.SWEET_BERRY_BUSH) || blockState.is(Blocks.STONECUTTER)) { // Purpur + return BlockPathTypes.DAMAGE_OTHER; + } else if (blockState.is(Blocks.HONEY_BLOCK)) { + return BlockPathTypes.STICKY_HONEY; diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java index 912cee9ec45876f831ca230b59a1be3b48ce6aa5..46910a3bdacc9df1835e16b300f9e107744d2660 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java @@ -20088,12 +19927,12 @@ index 3fb1e558c3510243c94981211f9a0e5e0ef1895b..e5177e5ffcac360f935f2139db4554c6 if (context.hasParam(LootContextParams.LOOTING_MOD)) { i = context.getParamOrNull(LootContextParams.LOOTING_MOD); diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java -index 67d595f75e0c3bffdb27b85b25ccd1f0bf1427d5..4d0c524af87d05dbd4a923ad6c40e1f26149e921 100644 +index 92394960fc76886f393cba02ac33c57739a4b383..494808b7bc2fb296b78e229ce138a937b7ac2c59 100644 --- a/src/main/java/net/minecraft/world/phys/AABB.java +++ b/src/main/java/net/minecraft/world/phys/AABB.java -@@ -374,4 +374,10 @@ public class AABB { +@@ -502,4 +502,10 @@ public class AABB { public static AABB ofSize(Vec3 center, double dx, double dy, double dz) { - return new AABB(center.x - dx / 2.0D, center.y - dy / 2.0D, center.z - dz / 2.0D, center.x + dx / 2.0D, center.y + dy / 2.0D, center.z + dz / 2.0D); + return new AABB(center.x - dx / 2.0, center.y - dy / 2.0, center.z - dz / 2.0, center.x + dx / 2.0, center.y + dy / 2.0, center.z + dz / 2.0); } + + // Purpur - tuinity added method @@ -20103,10 +19942,10 @@ index 67d595f75e0c3bffdb27b85b25ccd1f0bf1427d5..4d0c524af87d05dbd4a923ad6c40e1f2 + // Purpur } diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java -index 1d7c663fa0e550bd0cfb9a4b83ccd7e2968666f0..0043c0087896a6df6910b0500da37d84b287c901 100644 +index 7a69564572357a7acc043e35b9c113beeb738951..a6d62abd3102770652f914b9d697c6d3c2533cfc 100644 --- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java +++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java -@@ -86,20 +86,20 @@ public class LevelTicks implements LevelTickAccess { +@@ -81,20 +81,20 @@ public class LevelTicks implements LevelTickAccess { } public void tick(long time, int maxTicks, BiConsumer ticker) { @@ -20374,7 +20213,7 @@ index 4a875bce9563f3b9351ebecde9b0eb1287beb50e..42d83cfd9318d6ebe9a5392edef3b667 + // 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 9f5a6398a7dca841570a895054cee969dc96bca4..0a5867b01c1ebf21d9add1d4a2843d15b8e1acb7 100644 +index 18bfe2fb7efad66f5fae07a30593d640c597bf77..dabaf0cff6dafe8ca411996e67ead9a2cf84dfb8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper @@ -20487,7 +20326,7 @@ index 9f5a6398a7dca841570a895054cee969dc96bca4..0a5867b01c1ebf21d9add1d4a2843d15 @Override public List getRecipesFor(ItemStack result) { Preconditions.checkArgument(result != null, "ItemStack cannot be null"); -@@ -3018,6 +3084,18 @@ public final class CraftServer implements Server { +@@ -3033,6 +3099,18 @@ public final class CraftServer implements Server { return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); } @@ -20506,7 +20345,7 @@ index 9f5a6398a7dca841570a895054cee969dc96bca4..0a5867b01c1ebf21d9add1d4a2843d15 @Override public void restart() { org.spigotmc.RestartCommand.restart(); -@@ -3047,6 +3125,7 @@ public final class CraftServer implements Server { +@@ -3062,6 +3140,7 @@ public final class CraftServer implements Server { @Override public double[] getTPS() { return new double[] { @@ -20514,7 +20353,7 @@ index 9f5a6398a7dca841570a895054cee969dc96bca4..0a5867b01c1ebf21d9add1d4a2843d15 net.minecraft.server.MinecraftServer.getServer().tps1.getAverage(), net.minecraft.server.MinecraftServer.getServer().tps5.getAverage(), net.minecraft.server.MinecraftServer.getServer().tps15.getAverage() -@@ -3249,4 +3328,16 @@ public final class CraftServer implements Server { +@@ -3264,4 +3343,16 @@ public final class CraftServer implements Server { } // Paper end @@ -20532,10 +20371,10 @@ index 9f5a6398a7dca841570a895054cee969dc96bca4..0a5867b01c1ebf21d9add1d4a2843d15 + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index bfb178c69026e9759e9afaebb9da141b62d1f144..69f0c853ed7287c5a93b0a67e266255090e2a9ca 100644 +index 00357d78182b3ff87e3d9a45705b072af56739c8..69c12d9049af908380c48c7f13d3d5c7220f8e39 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2388,6 +2388,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2416,6 +2416,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { return (this.getHandle().getDragonFight() == null) ? null : new CraftDragonBattle(this.getHandle().getDragonFight()); } @@ -20585,7 +20424,7 @@ index bfb178c69026e9759e9afaebb9da141b62d1f144..69f0c853ed7287c5a93b0a67e2662550 public Collection getStructures(int x, int z) { return this.getStructures(x, z, struct -> true); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index ce341f42b3a5e17fb6d1f7de8057e73137ae2a6e..146f229b8e8888e2c0256c007c71c675c27e71a5 100644 +index 8d626fadcd4743b6472a2954d2b1b2ec89669814..409c0e81571e23c9d535b541c61538424259d60a 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -174,6 +174,20 @@ public class Main { @@ -20744,7 +20583,7 @@ index 4e56018b64d11f76c8da43fd8f85c6de72204e36..9607675e6c5bff2183c4420d11fc63ee @Override diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -index 5b7579395e61684592758f408d61cffe57f8b21d..015ea2ecac493c88f45d6ad66c2ef346252b4ec8 100644 +index a151b5d7c6e41b08e57c806bc43e067af48263ed..40d385c7865726545bb66f9a1856ed4e73e60202 100644 --- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java @@ -71,6 +71,8 @@ public class CraftEnchantment extends Enchantment implements Handleable) this.server.getHandle().players) { if (player.getBukkitEntity().canSee(this)) { - player.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME, this.getHandle())); -@@ -1351,6 +1356,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1353,6 +1358,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } if (entity.isVehicle() && !ignorePassengers) { // Paper - Teleport API @@ -21067,7 +20906,7 @@ index 616d2e479d91673695ade0db151a0099b568904f..988cc1290200de629a4c24cc67a03e69 private void validateSpeed(float value) { Preconditions.checkArgument(value <= 1f && value >= -1f, "Speed value (%s) need to be between -1f and 1f", value); } -@@ -3427,4 +3458,70 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3456,4 +3487,70 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void setSendViewDistance(final int viewDistance) { this.getHandle().setSendViewDistance(viewDistance); } @@ -21220,10 +21059,10 @@ index 38b6d2c377800134de592a780b737b45c8096a11..449acd9dc983be1cd51208bc8f8d843d + // 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 4c2e8129481384a143384d327e14320023735b1a..94be4f367f4c6cb2386d0e59d0417f29fca1cec7 100644 +index c0823c612de9dc2a64cc797f061eef25c5f31359..b82a6143526bd1d4ecd4591c1253cdb0b913fe09 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 { +@@ -593,6 +593,15 @@ public class CraftEventFactory { // Paper end craftServer.getPluginManager().callEvent(event); @@ -21239,7 +21078,7 @@ index 4c2e8129481384a143384d327e14320023735b1a..94be4f367f4c6cb2386d0e59d0417f29 return event; } -@@ -1125,7 +1134,7 @@ public class CraftEventFactory { +@@ -1124,7 +1133,7 @@ public class CraftEventFactory { return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), entity, DamageCause.LAVA, bukkitDamageSource, modifiers, modifierFunctions, cancelled); } else if (source.getDirectBlock() != null) { DamageCause cause; @@ -21248,7 +21087,7 @@ index 4c2e8129481384a143384d327e14320023735b1a..94be4f367f4c6cb2386d0e59d0417f29 cause = DamageCause.CONTACT; } else if (source.is(DamageTypes.HOT_FLOOR)) { cause = DamageCause.HOT_FLOOR; -@@ -1183,6 +1192,7 @@ public class CraftEventFactory { +@@ -1182,6 +1191,7 @@ public class CraftEventFactory { EntityDamageEvent event; if (damager != null) { event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, bukkitDamageSource, modifiers, modifierFunctions, critical); @@ -21552,10 +21391,10 @@ index b3e1adeb932da9b3bed16acd94e2f16da48a7c72..d3ec817e95628f1fc8be4a29c9a0f13c // Paper end - add timings for scoreboard search } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 0493e0cf3fac2d4e065118f60f1d7b19751b467f..d5f642e4b1c1ede7e9d2dea072aa5f22c73b5c23 100644 +index 94681c5d807019be5caf0b5d5156c0d670f45f8f..e29dc1101c7aa4b7b2a2d2e732e27a1a14a2a234 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -497,7 +497,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -502,7 +502,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @Override public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { @@ -22271,10 +22110,10 @@ index 0000000000000000000000000000000000000000..efe25d3894f3ad000257c72d9a5e06ef +} diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..65ac86d07aeabb019132e180e5ed6b197e9ccad3 +index 0000000000000000000000000000000000000000..7dc82ffccc157a17335f1bc56ab81be3813294f6 --- /dev/null +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -@@ -0,0 +1,3304 @@ +@@ -0,0 +1,3298 @@ +package org.purpurmc.purpur; + +import net.minecraft.core.registries.BuiltInRegistries; @@ -23313,11 +23152,6 @@ index 0000000000000000000000000000000000000000..65ac86d07aeabb019132e180e5ed6b19 + furnaceUseLavaFromUnderneath = getBoolean("blocks.furnace.use-lava-from-underneath", furnaceUseLavaFromUnderneath); + } + -+ public boolean endPortalSafeTeleporting = true; -+ private void endPortalSettings() { -+ endPortalSafeTeleporting = getBoolean("blocks.end_portal.safe-teleporting", endPortalSafeTeleporting); -+ } -+ + public boolean mobsSpawnOnPackedIce = true; + public boolean mobsSpawnOnBlueIce = true; + public boolean snowOnBlueIce = true; @@ -23379,11 +23213,6 @@ index 0000000000000000000000000000000000000000..65ac86d07aeabb019132e180e5ed6b19 + } + } + -+ public boolean fixSandDuping = true; -+ private void sandSettings() { -+ fixSandDuping = getBoolean("blocks.sand.fix-duping", fixSandDuping); -+ } -+ + public boolean sculkShriekerCanSummonDefault = false; + private void sculkShriekerSettings() { + sculkShriekerCanSummonDefault = getBoolean("blocks.sculk_shrieker.can-summon-default", sculkShriekerCanSummonDefault); @@ -25177,6 +25006,8 @@ index 0000000000000000000000000000000000000000..65ac86d07aeabb019132e180e5ed6b19 + public boolean villagerDisplayTradeItem = true; + public int villagerSpawnIronGolemRadius = 0; + public int villagerSpawnIronGolemLimit = 0; ++ public int villagerAcquirePoiSearchRadius = 48; ++ public int villagerNearestBedSensorSearchRadius = 48; + private void villagerSettings() { + villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable); + villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater); @@ -25213,6 +25044,8 @@ index 0000000000000000000000000000000000000000..65ac86d07aeabb019132e180e5ed6b19 + villagerDisplayTradeItem = getBoolean("mobs.villager.display-trade-item", villagerDisplayTradeItem); + villagerSpawnIronGolemRadius = getInt("mobs.villager.spawn-iron-golem.radius", villagerSpawnIronGolemRadius); + villagerSpawnIronGolemLimit = getInt("mobs.villager.spawn-iron-golem.limit", villagerSpawnIronGolemLimit); ++ villagerAcquirePoiSearchRadius = getInt("mobs.villager.search-radius.acquire-poi", villagerAcquirePoiSearchRadius); ++ villagerNearestBedSensorSearchRadius = getInt("mobs.villager.search-radius.nearest-bed-sensor", villagerNearestBedSensorSearchRadius); + } + + public boolean vindicatorRidable = false; @@ -26900,10 +26733,10 @@ index 0000000000000000000000000000000000000000..9660716f4162a4441c6e1b0baddef8f5 +} diff --git a/src/main/java/org/purpurmc/purpur/gui/GUIColor.java b/src/main/java/org/purpurmc/purpur/gui/GUIColor.java new file mode 100644 -index 0000000000000000000000000000000000000000..0f2e7e0b81620c8581949bd5f0bdb567cd93c17e +index 0000000000000000000000000000000000000000..550222758bf0e7deff26a6e813a860b7be365e87 --- /dev/null +++ b/src/main/java/org/purpurmc/purpur/gui/GUIColor.java -@@ -0,0 +1,54 @@ +@@ -0,0 +1,58 @@ +package org.purpurmc.purpur.gui; + +import net.md_5.bungee.api.ChatColor; @@ -26944,6 +26777,10 @@ index 0000000000000000000000000000000000000000..0f2e7e0b81620c8581949bd5f0bdb567 + return color; + } + ++ public ChatColor getChatColor() { ++ return chat; ++ } ++ + public String getCode() { + return chat.toString(); + } @@ -26960,14 +26797,14 @@ index 0000000000000000000000000000000000000000..0f2e7e0b81620c8581949bd5f0bdb567 +} diff --git a/src/main/java/org/purpurmc/purpur/gui/JColorTextPane.java b/src/main/java/org/purpurmc/purpur/gui/JColorTextPane.java new file mode 100644 -index 0000000000000000000000000000000000000000..33e89b4c00fa8318506b36cbe49fe4e412e0a9a1 +index 0000000000000000000000000000000000000000..d75fb5e77eff27d86135ed7d605dbc250b660f7d --- /dev/null +++ b/src/main/java/org/purpurmc/purpur/gui/JColorTextPane.java -@@ -0,0 +1,78 @@ +@@ -0,0 +1,83 @@ +package org.purpurmc.purpur.gui; + +import com.google.common.collect.Sets; -+import net.md_5.bungee.api.ChatColor; ++import javax.swing.UIManager; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.TextComponent; + @@ -26981,11 +26818,16 @@ index 0000000000000000000000000000000000000000..33e89b4c00fa8318506b36cbe49fe4e4 +import java.util.Set; + +public class JColorTextPane extends JTextPane { -+ private static final GUIColor DEFAULT_COLOR = GUIColor.BLACK; ++ private static final GUIColor DEFAULT_COLOR; ++ static { ++ DEFAULT_COLOR = UIManager.getSystemLookAndFeelClassName().equals("com.sun.java.swing.plaf.gtk.GTKLookAndFeel") ++ ? GUIColor.WHITE : GUIColor.BLACK; ++ } ++ + + public void append(String msg) { + // TODO: update to use adventure instead -+ BaseComponent[] components = TextComponent.fromLegacyText(DEFAULT_COLOR.getCode() + msg, ChatColor.BLACK); ++ BaseComponent[] components = TextComponent.fromLegacyText(DEFAULT_COLOR.getCode() + msg, DEFAULT_COLOR.getChatColor()); + for (BaseComponent component : components) { + String text = component.toPlainText(); + if (text == null || text.isEmpty()) { @@ -27851,7 +27693,7 @@ index 0000000000000000000000000000000000000000..b7586f494528f30eb0da82420d3bcf5b + } +} diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 41cddf7e42f0e8f80973e482a95e55d3bd19f659..2e9aed328e576abbe216fdb2071c13421e6645b8 100644 +index d7c7e12c0b8f77e59d94de130972f762ed227726..56e52b16b419c882440a15947f037ae1a902bc70 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; @@ -27862,7 +27704,7 @@ index 41cddf7e42f0e8f80973e482a95e55d3bd19f659..2e9aed328e576abbe216fdb2071c1342 import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.animal.horse.Llama; import net.minecraft.world.entity.boss.EnderDragonPart; -@@ -169,7 +170,7 @@ public class ActivationRange +@@ -171,7 +172,7 @@ public class ActivationRange */ public static void activateEntities(Level world) { @@ -27871,7 +27713,7 @@ index 41cddf7e42f0e8f80973e482a95e55d3bd19f659..2e9aed328e576abbe216fdb2071c1342 final int miscActivationRange = world.spigotConfig.miscActivationRange; final int raiderActivationRange = world.spigotConfig.raiderActivationRange; final int animalActivationRange = world.spigotConfig.animalActivationRange; -@@ -203,6 +204,7 @@ public class ActivationRange +@@ -205,6 +206,7 @@ public class ActivationRange continue; } @@ -27879,7 +27721,7 @@ index 41cddf7e42f0e8f80973e482a95e55d3bd19f659..2e9aed328e576abbe216fdb2071c1342 // Paper start int worldHeight = world.getHeight(); ActivationRange.maxBB = player.getBoundingBox().inflate( maxRange, worldHeight, maxRange ); -@@ -247,7 +249,7 @@ public class ActivationRange +@@ -249,7 +251,7 @@ public class ActivationRange } // Paper end } @@ -27888,7 +27730,7 @@ index 41cddf7e42f0e8f80973e482a95e55d3bd19f659..2e9aed328e576abbe216fdb2071c1342 } /** -@@ -400,6 +402,7 @@ public class ActivationRange +@@ -402,6 +404,7 @@ public class ActivationRange */ public static boolean checkIfActive(Entity entity) { diff --git a/patches/server/0003-Use-Gradle-Version-Catalogs.patch b/patches/server/0003-Use-Gradle-Version-Catalogs.patch index 3718487..380e77f 100644 --- a/patches/server/0003-Use-Gradle-Version-Catalogs.patch +++ b/patches/server/0003-Use-Gradle-Version-Catalogs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use Gradle Version Catalogs diff --git a/build.gradle.kts b/build.gradle.kts -index 32366253c04c493135f2b22d1940f83669104723..be06b9b282c53bc135963447e19185d9ff41d19a 100644 +index 1cad0728d..b97182b80 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -19,21 +19,37 @@ dependencies { +@@ -19,21 +19,38 @@ dependencies { exclude("io.papermc.paper", "paper-api") } // Purpur end @@ -48,11 +48,12 @@ index 32366253c04c493135f2b22d1940f83669104723..be06b9b282c53bc135963447e19185d9 + + testImplementation(common.bundles.test) + testImplementation(server.bundles.test) ++ + /* implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol // Paper end implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion -@@ -46,10 +62,13 @@ dependencies { +@@ -46,8 +63,11 @@ dependencies { runtimeOnly("com.lmax:disruptor:3.4.4") // Paper // Paper start - Use Velocity cipher implementation("com.velocitypowered:velocity-native:3.1.2-SNAPSHOT") { @@ -60,13 +61,11 @@ index 32366253c04c493135f2b22d1940f83669104723..be06b9b282c53bc135963447e19185d9 + implementation(server.velocity) { isTransitive = false } ++ /* // Paper end - Use Velocity cipher -+ /* runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6") - runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") - runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") -@@ -57,20 +76,25 @@ dependencies { +@@ -57,8 +77,11 @@ dependencies { // Pufferfish start implementation("org.yaml:snakeyaml:1.32") implementation ("com.github.carleslc.Simple-YAML:Simple-Yaml:1.8.4") { @@ -74,23 +73,15 @@ index 32366253c04c493135f2b22d1940f83669104723..be06b9b282c53bc135963447e19185d9 + implementation(server.simpleyaml) { exclude(group="org.yaml", module="snakeyaml") } ++ /* // Pufferfish end -- implementation("org.mozilla:rhino-runtime:1.7.14") // Purpur -- implementation("org.mozilla:rhino-engine:1.7.14") // Purpur -+ //implementation("org.mozilla:rhino-runtime:1.7.14") // Purpur -+ //implementation("org.mozilla:rhino-engine:1.7.14") // Purpur - implementation("dev.omega24:upnp4j:1.0") // Purpur - -+ /* - testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test - 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") + implementation("org.mozilla:rhino-runtime:1.7.14") // Purpur +@@ -71,6 +94,7 @@ dependencies { + testImplementation("org.mockito:mockito-core:5.11.0") + testImplementation("org.ow2.asm:asm-tree:9.7") testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest -+ */ -+ // Plazma end - Use Gradle Version Catalogs ++ */ } val craftbukkitPackageVersion = "1_20_R3" // Paper diff --git a/patches/server/0004-MC-Dev-fixes.patch b/patches/server/0004-MC-Dev-fixes.patch deleted file mode 100644 index f2475de..0000000 --- a/patches/server/0004-MC-Dev-fixes.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: IPECTER -Date: Tue, 30 May 2023 12:12:29 +0900 -Subject: [PATCH] MC Dev fixes - - -diff --git a/src/main/java/net/minecraft/util/datafix/fixes/LeavesFix.java b/src/main/java/net/minecraft/util/datafix/fixes/LeavesFix.java -index 733134401fcba393053c7a2dfa1d0d44f8f79ff5..79fba35fc74723529bff7d8fdcca7de6407fb5ad 100644 ---- a/src/main/java/net/minecraft/util/datafix/fixes/LeavesFix.java -+++ b/src/main/java/net/minecraft/util/datafix/fixes/LeavesFix.java -@@ -71,14 +71,14 @@ public class LeavesFix extends DataFix { - return this.fixTypeEverywhereTyped("Leaves fix", type, (typed) -> { - return typed.updateTyped(opticFinder, (typedx) -> { - int[] is = new int[]{0}; -- Typed typed2 = typedx.updateTyped(opticFinder2, (typed) -> { -- Int2ObjectMap int2ObjectMap = new Int2ObjectOpenHashMap<>(typed.getAllTyped(opticFinder3).stream().map((typedx) -> { -- return new LeavesFix.LeavesSection(typedx, this.getInputSchema()); -+ Typed typed2 = typedx.updateTyped(opticFinder2, (typed2x) -> { // Plazma - decompile fix -+ Int2ObjectMap int2ObjectMap = new Int2ObjectOpenHashMap<>(typed2x.getAllTyped(opticFinder3).stream().map((typedx2) -> { // Plazma - decompile fix -+ return new LeavesFix.LeavesSection(typedx2, this.getInputSchema()); // Plazma - decompile fix - }).collect(Collectors.toMap(LeavesFix.Section::getIndex, (leavesSection) -> { - return leavesSection; - }))); - if (int2ObjectMap.values().stream().allMatch(LeavesFix.Section::isSkippable)) { -- return typed; -+ return typed2x; // Plazma - decompile fix - } else { - List list = Lists.newArrayList(); - -@@ -134,8 +134,8 @@ public class LeavesFix extends DataFix { - } - } - -- return typed.updateTyped(opticFinder3, (typedx) -> { -- return int2ObjectMap.get(typedx.get(DSL.remainderFinder()).get("Y").asInt(0)).write(typedx); -+ return typed.updateTyped(opticFinder3, (typedx2) -> { // Plazma - decompile fix -+ return int2ObjectMap.get(typedx2.get(DSL.remainderFinder()).get("Y").asInt(0)).write(typedx2); // Plazma - decompile fix - }); - } - }); -@@ -298,8 +298,8 @@ public class LeavesFix extends DataFix { - throw new IllegalStateException("Block state type is not what was expected."); - } else { - Optional>>> optional = typed.getOptional(this.paletteFinder); -- this.palette = optional.map((list) -> { -- return list.stream().map(Pair::getSecond).collect(Collectors.toList()); -+ this.palette = (List) optional.map((list) -> { // Plazma - decompile fix -+ return (List) list.stream().map(Pair::getSecond).collect(Collectors.toList()); // Plazma - decompile fix - }).orElse(ImmutableList.of()); - Dynamic dynamic = typed.get(DSL.remainderFinder()); - this.index = dynamic.get("Y").asInt(0); -@@ -321,7 +321,7 @@ public class LeavesFix extends DataFix { - public Typed write(Typed typed) { - return this.isSkippable() ? typed : typed.update(DSL.remainderFinder(), (dynamic) -> { - return dynamic.set("BlockStates", dynamic.createLongList(Arrays.stream(this.storage.getRaw()))); -- }).set(this.paletteFinder, this.palette.stream().map((dynamic) -> { -+ }).set(this.paletteFinder, (List) this.palette.stream().map((dynamic) -> { // Plazma - decompile fix - return Pair.of(References.BLOCK_STATE.typeName(), dynamic); - }).collect(Collectors.toList())); - } diff --git a/patches/server/0005-Rebrand.patch b/patches/server/0004-Rebrand.patch similarity index 97% rename from patches/server/0005-Rebrand.patch rename to patches/server/0004-Rebrand.patch index dda319b..ce1423a 100644 --- a/patches/server/0005-Rebrand.patch +++ b/patches/server/0004-Rebrand.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Rebrand diff --git a/build.gradle.kts b/build.gradle.kts -index be06b9b282c53bc135963447e19185d9ff41d19a..97b12b0b00bdf37ab122f8b8ea8b42ac65e30bce 100644 +index b97182b806fddf53ddcdbe57a43500d36e97e2a4..055627fc478a3e64b0e0644cbd9ef4cf5438c696 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,12 +13,10 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { @@ -165,7 +165,7 @@ index f91ea723a1c85f6cf8c4f6dd7f182b948c2f2e81..c5a3f9c2daf3da135cccecb757353534 stringbuilder.append("// "); stringbuilder.append(CrashReport.getErrorComment()); diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index b4a009a1108758110181af3321a91b3ec9cf74dc..3e1079e9af85c62684ce19a7afaac5adc2167cb6 100644 +index 4ef8eaad4485a2ee920f80556f9dda04e59d2b2a..b91c3b8ca8f840335ba6470658d82c5d71bb75e1 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -105,6 +105,18 @@ public class Main { @@ -184,11 +184,11 @@ index b4a009a1108758110181af3321a91b3ec9cf74dc..3e1079e9af85c62684ce19a7afaac5ad + if (!org.plazmamc.plazma.Options.iKnowWhatIAmDoing) + LOGGER.warn("Warning! Plazma may cause unexpected problems, so be sure to test it thoroughly before using it on a public server."); + // Plazma end - // Paper start - if (Boolean.getBoolean("Paper.isRunDev")) { - net.minecraft.server.packs.VanillaPackResourcesBuilder.developmentConfig = builder -> { + + Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit + diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b1dd8d66a524254a270a725f5f7a46f28e13b749..c7d748675b51ea69f31d87c74e4125a48a62ef48 100644 +index 60b5e0643d933393b5473681ac9261db29fe2416..ac12ccf60b45b150982e79f32d3cdd21c4017cc8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -956,7 +956,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop completableFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); + CompletableFuture completableFuture = CompletableFuture.allOf(futures.toArray(org.plazmamc.plazma.constants.Empty.FUTURE)); // Plazma - Reduce allocations - return completableFuture.thenApply((void_) -> { - return futures.stream().map(CompletableFuture::join).toList(); - }); + return completableFuture.thenApply(void_ -> futures.stream().map(CompletableFuture::join).toList()); + } + } diff --git a/src/main/java/net/minecraft/nbt/ByteArrayTag.java b/src/main/java/net/minecraft/nbt/ByteArrayTag.java index 06648f9751fd8a322d0809ffebf6a544596ee1a4..b0ea87e2ed8f9bf04b33c2ff8a827d4f6f57a435 100644 --- a/src/main/java/net/minecraft/nbt/ByteArrayTag.java @@ -250,10 +250,10 @@ index 06648f9751fd8a322d0809ffebf6a544596ee1a4..b0ea87e2ed8f9bf04b33c2ff8a827d4f @Override diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index eea9866aecb7189455319d83561fcef35a777d7a..56cff647c4e89a12b116426ebf84df6675601a01 100644 +index 23916b011ed0645ab284fb080c9555921290d875..2abe6c8dcbf20bf550bb790fd4e18ccc848d1065 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -420,7 +420,7 @@ public class CompoundTag implements Tag { +@@ -409,7 +409,7 @@ public class CompoundTag implements Tag { throw new ReportedException(this.createReport(key, ByteArrayTag.TYPE, var3)); } @@ -262,7 +262,7 @@ index eea9866aecb7189455319d83561fcef35a777d7a..56cff647c4e89a12b116426ebf84df66 } public int[] getIntArray(String key) { -@@ -432,7 +432,7 @@ public class CompoundTag implements Tag { +@@ -421,7 +421,7 @@ public class CompoundTag implements Tag { throw new ReportedException(this.createReport(key, IntArrayTag.TYPE, var3)); } @@ -271,7 +271,7 @@ index eea9866aecb7189455319d83561fcef35a777d7a..56cff647c4e89a12b116426ebf84df66 } public long[] getLongArray(String key) { -@@ -444,7 +444,7 @@ public class CompoundTag implements Tag { +@@ -433,7 +433,7 @@ public class CompoundTag implements Tag { throw new ReportedException(this.createReport(key, LongArrayTag.TYPE, var3)); } @@ -316,10 +316,10 @@ index 24ad8d22b5180cd7d7f793e3074e438f9192448f..c902b478d331a1cad9ac66a6eeb66c19 public double getDouble(int index) { diff --git a/src/main/java/net/minecraft/nbt/LongArrayTag.java b/src/main/java/net/minecraft/nbt/LongArrayTag.java -index 3604e22f593275140d706c296355ee06ca8ec888..6974ca1efbef05c845dc41e643bfed6d1c1c8e28 100644 +index 2e5c34ebb94a1536cf09d71bdf052a49ecb9159d..144d3bbe80fc0f459a06017a19929e3e849aabd0 100644 --- a/src/main/java/net/minecraft/nbt/LongArrayTag.java +++ b/src/main/java/net/minecraft/nbt/LongArrayTag.java -@@ -190,7 +190,7 @@ public class LongArrayTag extends CollectionTag { +@@ -185,7 +185,7 @@ public class LongArrayTag extends CollectionTag { @Override public void clear() { @@ -357,10 +357,10 @@ index a2920b8a9eff77d9c5d1d7f70ad3abdacba8f0fa..70d776d5cfdb0612f65d92333d6f872a protected CipherBase(Cipher cipher) { this.cipher = cipher; diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index b41cab778f446434b788946ea9d3e02c152e570e..1c71cea8554a055973bb85c7a8181f08e3246148 100644 +index 9e31954212b1d6162dca2fbc91d373e908560335..5e7b4363e6f83d4145954a96d6b6b610d392c7d1 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -321,7 +321,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -322,7 +322,7 @@ public class Connection extends SimpleChannelInboundHandler> { } public void setListener(PacketListener packetListener) { @@ -392,26 +392,24 @@ index d3a80d0a23be762c05931ae8001d98e43cab2b4a..a94feef330b1836a2fc009405c529455 static MutableComponent translatableWithFallback(String key, @Nullable String fallback, Object... args) { diff --git a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java -index 084ffde43447f6ff5e45e9fe3fc6a86bde65fd5a..2e7b3260085986e26567e50a0c42feb121dba4cd 100644 +index 18e53db59082bae94922edc4baa812aa6f089576..c922919e15a4157b7a46728caa4a7df0b5fcce1f 100644 --- a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java +++ b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java -@@ -28,7 +28,7 @@ import net.minecraft.util.ExtraCodecs; +@@ -29,7 +29,7 @@ import net.minecraft.util.ExtraCodecs; import net.minecraft.world.entity.Entity; public class TranslatableContents implements ComponentContents { - public static final Object[] NO_ARGS = new Object[0]; -+ //public static final Object[] NO_ARGS = new Object[0]; // Plazma - Reduce allocations ++ // public static final Object[] NO_ARGS = new Object[0]; // Plazma - Reduce allocations private static final Codec PRIMITIVE_ARG_CODEC = ExtraCodecs.validate(ExtraCodecs.JAVA, TranslatableContents::filterAllowedArguments); - private static final Codec ARG_CODEC = Codec.either(PRIMITIVE_ARG_CODEC, ComponentSerialization.CODEC).xmap((either) -> { - return either.map((object) -> { -@@ -83,8 +83,8 @@ public class TranslatableContents implements ComponentContents { + private static final Codec ARG_CODEC = Codec.either(PRIMITIVE_ARG_CODEC, ComponentSerialization.CODEC) + .xmap( +@@ -69,7 +69,7 @@ public class TranslatableContents implements ComponentContents { + } private static Object[] adjustArgs(Optional> args) { - return args.map((list) -> { -- return list.isEmpty() ? NO_ARGS : list.toArray(); -- }).orElse(NO_ARGS); -+ return list.isEmpty() ? org.plazmamc.plazma.constants.Empty.OBJECT : list.toArray(); -+ }).orElse(org.plazmamc.plazma.constants.Empty.OBJECT); +- return args.map(list -> list.isEmpty() ? NO_ARGS : list.toArray()).orElse(NO_ARGS); ++ return args.map(list -> list.isEmpty() ? org.plazmamc.plazma.constants.Empty.OBJECT : list.toArray()).orElse(org.plazmamc.plazma.constants.Empty.OBJECT); } private static TranslatableContents create(String key, Optional fallback, Optional> args) { @@ -429,10 +427,10 @@ index ccdc2345465313991f065e1176b58fb7d5e8722f..bb50e69a4d84e4753db77be071cc6fc7 // Paper end - Multi Block Change API diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fcc197256be00621bb3875c20849fe083a453c5c..2ce7351231aa921604698d45220d7e3e34289b62 100644 +index ac12ccf60b45b150982e79f32d3cdd21c4017cc8..1032916def98f0607fabb1bbb550ba2ff70b3019 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1505,13 +1505,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop loadStatusIcon() { @@ -444,9 +442,9 @@ index fcc197256be00621bb3875c20849fe083a453c5c..2ce7351231aa921604698d45220d7e3e - }); - }); + // Plazma start - Reduce allocations -+ Optional optional = Optional.of(this.getFile("server-icon.png").toPath()). -+ filter(Files::isRegularFile).or(() -> this.storageSource.getIconFile().filter(Files::isRegularFile)); -+ // Plazma end - Reduce allocations ++ Optional optional = Optional.of(this.getFile("server-icon.png").toPath()).filter(Files::isRegularFile) ++ .or(() -> this.storageSource.getIconFile().filter(Files::isRegularFile)); ++ // Plazma end return optional.flatMap((path) -> { try { @@ -483,20 +481,20 @@ index 0f52e8a61ca7e57e9f52473dceb9cc3464c0c86d..f54bde32760541a653460682e5a3ddd0 } } diff --git a/src/main/java/net/minecraft/server/ServerFunctionLibrary.java b/src/main/java/net/minecraft/server/ServerFunctionLibrary.java -index f65d6dc2b1596232707be402cf0377b5ab90cc01..6735382b229bf6ab66f1ccdf6122215e51d8b10e 100644 +index bae0d208b31aa0a6977c30f2f8484ab3c316bc71..981c3023044f3cc6dc22ada20cd4bedcf7a28db3 100644 --- a/src/main/java/net/minecraft/server/ServerFunctionLibrary.java +++ b/src/main/java/net/minecraft/server/ServerFunctionLibrary.java -@@ -81,7 +81,7 @@ public class ServerFunctionLibrary implements PreparableReloadListener { - }, prepareExecutor)); - } +@@ -92,7 +92,7 @@ public class ServerFunctionLibrary implements PreparableReloadListener { + }, prepareExecutor)); + } -- CompletableFuture[] completableFutures = map.values().toArray(new CompletableFuture[0]); -+ CompletableFuture[] completableFutures = map.values().toArray(org.plazmamc.plazma.constants.Empty.FUTURE); // Plazma - Reduce allocations - return CompletableFuture.allOf(completableFutures).handle((unused, ex) -> { - return map; - }); +- CompletableFuture[] completableFutures = map.values().toArray(new CompletableFuture[0]); ++ CompletableFuture[] completableFutures = map.values().toArray(org.plazmamc.plazma.constants.Empty.FUTURE); // Plazma - Reduce allocations + return CompletableFuture.allOf(completableFutures).handle((unused, ex) -> map); + } + ); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index d1056b1c91edc3ec06c78e65c8fa2dd1f000c43f..618f2166417b88c92d99a7cf6f10e769eedc95a3 100644 +index bb412ca874b85d777c0e3565fcefcee15b23182b..9116b3d298a9bb6e550d299f76ff1243da824cbe 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -109,6 +109,7 @@ import org.bukkit.craftbukkit.generator.CustomChunkGenerator; @@ -517,7 +515,7 @@ index d1056b1c91edc3ec06c78e65c8fa2dd1f000c43f..618f2166417b88c92d99a7cf6f10e769 this.updatePlayer(conn.getPlayer()); } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 611916db3f9a6d2fbfa720e883fb03973b4a65c2..0aee1fb44f19fd838ca206335764b04f4a3f8a26 100644 +index 00ac2902be93327c7dd1bf78ee5922d7954f1b26..2ac8c77684c2e4cfc30bc0d39bcaf853dcd3bfb9 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1449,7 +1449,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -530,7 +528,7 @@ index 611916db3f9a6d2fbfa720e883fb03973b4a65c2..0aee1fb44f19fd838ca206335764b04f return ret; } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 01069a21857f9f3b7905861ee38c3891903af3b8..d45a435a3aa8fc5b8f028e0455c3789b36cbdf12 100644 +index 8b62f992ec61d0a66a3856b4928ee2d705548291..c0729d3a38e0b9924711c0ca96afd138fa69fa3b 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -138,8 +138,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -563,7 +561,7 @@ index 01069a21857f9f3b7905861ee38c3891903af3b8..d45a435a3aa8fc5b8f028e0455c3789b ServerConfigurationPacketListenerImpl serverconfigurationpacketlistenerimpl = new ServerConfigurationPacketListenerImpl(this.server, this.connection, commonlistenercookie, this.player); // CraftBukkit diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f3b081abd82036c928655923c44a62a0e9889031..0250b9a90e62ca5a9a7172f6e1012e89514fd6e6 100644 +index ac1e0c66f167218306504db6037cc1d6509072a0..60aa2984e490374ab2659f9d0a4821f1ea17c700 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -133,6 +133,7 @@ public abstract class PlayerList { @@ -609,7 +607,7 @@ index 0ee04fe6ff6a4d09754f326526ae04fe7226bab2..5663ce568a1daa638b7387bee8b9917c } } diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java -index f8de91393564b3691c17339ac9196cc0fc1cf748..d0e380e51562f423a0dd937026dfec08d6bd5e18 100644 +index 01f5b946fabbe34f31110e75973dab9f39897346..2564c21900df7ca3c58872741ec8f68bce80a903 100644 --- a/src/main/java/net/minecraft/util/ZeroBitStorage.java +++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java @@ -5,7 +5,7 @@ import java.util.function.IntConsumer; @@ -617,10 +615,19 @@ index f8de91393564b3691c17339ac9196cc0fc1cf748..d0e380e51562f423a0dd937026dfec08 public class ZeroBitStorage implements BitStorage { - public static final long[] RAW = new long[0]; -+ public static final long[] RAW = org.plazmamc.plazma.constants.Empty.LONG; // Plazma - Reduce allocations ++ // public static final long[] RAW = new long[0]; // Plazma - Reduce allocations private final int size; public ZeroBitStorage(int size) { +@@ -33,7 +33,7 @@ public class ZeroBitStorage implements BitStorage { + + @Override + public long[] getRaw() { +- return RAW; ++ return org.plazmamc.plazma.constants.Empty.LONG; // Plazma - Reduce allocations + } + + @Override 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 997ab942be9f742804041b07d607e7dd6473ba96..14a61e58987464d7865caf98e6232fb1334c6d88 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java @@ -687,7 +694,7 @@ index a90055fe8819a32180754b6060a0f88e81d1a3b6..68825a2ad5a6ea1b0784a935206bd150 // this.targetSelector.addGoal(5, new NonTameRandomTargetGoal<>(this, Animal.class, false, Wolf.PREY_SELECTOR)); // Purpur - moved to updatePathfinders() this.targetSelector.addGoal(6, new NonTameRandomTargetGoal<>(this, Turtle.class, false, Turtle.BABY_ON_LAND_SELECTOR)); 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 8adcffc1e6434e06ca52d119a7326a1272897307..a6a697868b22224a26d6c39e594533c3b33e724b 100644 +index c783ce59ea766e6c46a3313628b961f27e01ee8b..518660609566ffe943103b305472590ee9f0a257 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 @@ -84,7 +84,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @@ -908,10 +915,10 @@ index 6cf83502a954cce9c562ec036bfeddb477d38b73..d28bffce82d0b40c31f240c016621ac0 } } else { diff --git a/src/main/java/net/minecraft/world/level/levelgen/DebugLevelSource.java b/src/main/java/net/minecraft/world/level/levelgen/DebugLevelSource.java -index c68736b023127c7b395835f4fa82d9062110697b..71ca67be643254b49afa963068b5813c8abee8f0 100644 +index bf74c054e800104cd47208a29594d3c1340fd668..0320662df9bb039094ecd2bccc94dd59bcdd9d1d 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/DebugLevelSource.java +++ b/src/main/java/net/minecraft/world/level/levelgen/DebugLevelSource.java -@@ -88,7 +88,7 @@ public class DebugLevelSource extends ChunkGenerator { +@@ -89,7 +89,7 @@ public class DebugLevelSource extends ChunkGenerator { @Override public NoiseColumn getBaseColumn(int x, int z, LevelHeightAccessor world, RandomState noiseConfig) { @@ -988,10 +995,10 @@ index 399da9d43aefbb95897df4697860d5bce5317152..df7816c1c5f069d89a22dbd876a2d663 public void close() throws IOException { diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -index 3dca62446fbb7c92f5f2908b36926bbe5e905dbb..042617c7de30707f66e60536cebc31e210647b64 100644 +index 63e187c65cb855031f286aad0d25ac4694f7a331..e0f085169fafa5e574caf368efa343514540b348 100644 --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -@@ -125,7 +125,7 @@ public class PlayerDataStorage { +@@ -124,7 +124,7 @@ public class PlayerDataStorage { String[] astring = this.playerDir.list(); if (astring == null) { @@ -1001,10 +1008,10 @@ index 3dca62446fbb7c92f5f2908b36926bbe5e905dbb..042617c7de30707f66e60536cebc31e2 for (int i = 0; i < astring.length; ++i) { diff --git a/src/main/java/net/minecraft/world/scores/Team.java b/src/main/java/net/minecraft/world/scores/Team.java -index 16d2aa4556bc9f32a2def7f9ca282aa3fa23fb87..8514da343ce287298477f2c977e49491e621ddde 100644 +index f00791b89fdb1bb0fb358eff2af2e687bda15e85..aa16c93a4333b603729e2704b92f6d38aec0fd7b 100644 --- a/src/main/java/net/minecraft/world/scores/Team.java +++ b/src/main/java/net/minecraft/world/scores/Team.java -@@ -80,7 +80,7 @@ public abstract class Team { +@@ -70,7 +70,7 @@ public abstract class Team { public final int id; public static String[] getAllNames() { @@ -1014,7 +1021,7 @@ index 16d2aa4556bc9f32a2def7f9ca282aa3fa23fb87..8514da343ce287298477f2c977e49491 @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 988cc1290200de629a4c24cc67a03e69c2fcc727..eb709829d84a4536208b39572e265ffb230ddd8a 100644 +index fb2d05e43df3bfb72b1f6e325736dd3cbc6c3096..de4e1d713e5ec182ea8d4832b8359556095ac214 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -426,7 +426,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1061,19 +1068,6 @@ index b25dc23b81687dd4d4e70b3615ffb91f8c03c68b..acb98770b9d01e930642a5794f917966 } @Override -diff --git a/src/main/java/org/plazmamc/plazma/commands/plazma/subcommand/VersionCommand.java b/src/main/java/org/plazmamc/plazma/commands/plazma/subcommand/VersionCommand.java -index b6664ba0fce55f5cfa0c8d3051dc8c2be0fd0703..7c4ac7748ab93a0c8a706d74c4d442f803a4cc97 100644 ---- a/src/main/java/org/plazmamc/plazma/commands/plazma/subcommand/VersionCommand.java -+++ b/src/main/java/org/plazmamc/plazma/commands/plazma/subcommand/VersionCommand.java -@@ -14,7 +14,7 @@ public class VersionCommand implements PlazmaSubCommand { - @Override - public boolean execute(final CommandSender sender, final String subCommand, final String[] args) { - final @Nullable Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version"); -- if (ver != null) return ver.execute(sender, "plazma", new String[0]); -+ if (ver != null) return ver.execute(sender, "plazma", org.plazmamc.plazma.constants.Empty.STRING); // Plazma - Reduce allocations - return false; - } - diff --git a/src/main/java/org/plazmamc/plazma/constants/Empty.java b/src/main/java/org/plazmamc/plazma/constants/Empty.java new file mode 100644 index 0000000000000000000000000000000000000000..2b6eb7997986ab73ccb3b1baca945a3234ae916e diff --git a/patches/server/0008-Plazma-Configurations.patch b/patches/server/0007-Plazma-Configurations.patch similarity index 94% rename from patches/server/0008-Plazma-Configurations.patch rename to patches/server/0007-Plazma-Configurations.patch index dd27d11..ee59dd7 100644 --- a/patches/server/0008-Plazma-Configurations.patch +++ b/patches/server/0007-Plazma-Configurations.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Plazma Configurations diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java -index c01b4393439838976965823298f12e4762e72eff..ca03933d30cb3a6243f6fa243af8dc62cba05050 100644 +index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e6556d3f094 100644 --- a/src/main/java/io/papermc/paper/configuration/Configurations.java +++ b/src/main/java/io/papermc/paper/configuration/Configurations.java @@ -36,28 +36,93 @@ public abstract class Configurations { @@ -173,7 +173,7 @@ index c01b4393439838976965823298f12e4762e72eff..ca03933d30cb3a6243f6fa243af8dc62 final YamlConfigurationLoader loader = this.createGlobalLoaderBuilder() .defaultOptions(this.applyObjectMapperFactory(this.createGlobalObjectMapperFactoryBuilder().build())) .path(configFile) -@@ -147,6 +216,13 @@ public abstract class Configurations { +@@ -148,6 +217,13 @@ public abstract class Configurations { } protected void applyGlobalConfigTransformations(final ConfigurationNode node) throws ConfigurateException { @@ -187,7 +187,7 @@ index c01b4393439838976965823298f12e4762e72eff..ca03933d30cb3a6243f6fa243af8dc62 } @MustBeInvokedByOverriders -@@ -154,6 +230,7 @@ public abstract class Configurations { +@@ -155,6 +231,7 @@ public abstract class Configurations { return ContextMap.builder() .put(WORLD_NAME, WORLD_DEFAULTS) .put(WORLD_KEY, WORLD_DEFAULTS_KEY) @@ -195,7 +195,7 @@ index c01b4393439838976965823298f12e4762e72eff..ca03933d30cb3a6243f6fa243af8dc62 .put(REGISTRY_ACCESS, registryAccess); } -@@ -161,7 +238,7 @@ public abstract class Configurations { +@@ -162,7 +239,7 @@ public abstract class Configurations { final ContextMap contextMap = this.createDefaultContextMap(registryAccess) .put(FIRST_DEFAULT) .build(); @@ -204,7 +204,7 @@ index c01b4393439838976965823298f12e4762e72eff..ca03933d30cb3a6243f6fa243af8dc62 final DefaultWorldLoader result = this.createDefaultWorldLoader(false, contextMap, configFile); final YamlConfigurationLoader loader = result.loader(); final ConfigurationNode node = loader.load(); -@@ -171,8 +248,8 @@ public abstract class Configurations { +@@ -172,8 +249,8 @@ public abstract class Configurations { this.verifyWorldConfigVersion(contextMap, node); } this.applyWorldConfigTransformations(contextMap, node); @@ -215,7 +215,7 @@ index c01b4393439838976965823298f12e4762e72eff..ca03933d30cb3a6243f6fa243af8dc62 trySaveFileNode(loader, node, configFile.toString()); } -@@ -193,30 +270,41 @@ public abstract class Configurations { +@@ -194,30 +271,41 @@ public abstract class Configurations { private record DefaultWorldLoader(YamlConfigurationLoader loader, boolean isNewFile) { } @@ -264,7 +264,7 @@ index c01b4393439838976965823298f12e4762e72eff..ca03933d30cb3a6243f6fa243af8dc62 Files.createFile(worldConfigFile); // create empty file as template newFile = true; } -@@ -245,7 +333,7 @@ public abstract class Configurations { +@@ -246,7 +334,7 @@ public abstract class Configurations { if (worldName.equals(WORLD_DEFAULTS)) { LOGGER.warn("The world defaults config file didn't have a version set, assuming latest"); } else { @@ -273,7 +273,7 @@ index c01b4393439838976965823298f12e4762e72eff..ca03933d30cb3a6243f6fa243af8dc62 } version.raw(this.worldConfigVersion()); } else if (version.getInt() > this.worldConfigVersion()) { -@@ -260,6 +348,13 @@ public abstract class Configurations { +@@ -261,6 +349,13 @@ public abstract class Configurations { } protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node) throws ConfigurateException { @@ -287,7 +287,7 @@ index c01b4393439838976965823298f12e4762e72eff..ca03933d30cb3a6243f6fa243af8dc62 } protected void applyDefaultsAwareWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode worldNode, final ConfigurationNode defaultsNode) throws ConfigurateException { -@@ -272,7 +367,7 @@ public abstract class Configurations { +@@ -273,7 +368,7 @@ public abstract class Configurations { } public Path getWorldConfigFile(ServerLevel level) { @@ -512,10 +512,18 @@ index fa1c0aee8c3a4d0868482cf5c703bbfd08e09874..4a444ac90d357e1b5cc432bccad95805 + */ // Plazma - Configurable Plazma } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c7d748675b51ea69f31d87c74e4125a48a62ef48..c81695902775f345d77154ea309bb71d34d08175 100644 +index 1032916def98f0607fabb1bbb550ba2ff70b3019..1cbb3c1142a480201971fae718e6b15a3e4c9d53 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -307,6 +307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop projectileTimeouts; private static void projectileTimeouts() { // Set some defaults -+ // Plazma start - Optimize default configurations ++ // Plazma start - Optimize default configurations + if (org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()) { + getInt("entity_timeouts.ARROW", 200); + getInt("entity_timeouts.EGG", 200); @@ -60,18 +60,18 @@ index 3fea9b69f4cfc94e7f01d4e3ca4ce7506a8e5d5c..5a88d2e4c7a533e420cef33830a0cc64 + getInt("entity_timeouts.SNOWBALL", 200); + getInt("entity_timeouts.LLAMA_SPIT", 200); + } else { -+ // Plazma end ++ // Plazma end - Optimize default configurations getInt("entity_timeouts.SNOWBALL", -1); getInt("entity_timeouts.LLAMA_SPIT", -1); -+ } // Plazma ++ } // Plazma - Optimize default configurations setComment("entity_timeouts", "These values define a entity's maximum lifespan. If an", "entity is in this list and it has survived for longer than", diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index a6f58b3457b7477015c5c6d969e7d83017dd3fa1..85e56d726eb7780811e0a990e1ef7d3ec767e36d 100644 +index 30fe1c0645a07d663b08c0f988a1ab3a750bf7c4..c71daa5d3665cec2836770e5f04da222bc5f90ed 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -155,7 +155,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -156,7 +156,7 @@ public class GlobalConfiguration extends ConfigurationPart { public class Watchdog extends ConfigurationPart { public int earlyWarningEvery = 5000; @@ -80,7 +80,7 @@ index a6f58b3457b7477015c5c6d969e7d83017dd3fa1..85e56d726eb7780811e0a990e1ef7d3e } public SpamLimiter spamLimiter; -@@ -193,7 +193,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -198,7 +198,7 @@ public class GlobalConfiguration extends ConfigurationPart { public Commands commands; public class Commands extends ConfigurationPart { @@ -89,7 +89,7 @@ index a6f58b3457b7477015c5c6d969e7d83017dd3fa1..85e56d726eb7780811e0a990e1ef7d3e public boolean fixTargetSelectorTagCompletion = true; public boolean timeCommandAffectsAllWorlds = false; } -@@ -242,7 +242,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -247,7 +247,7 @@ public class GlobalConfiguration extends ConfigurationPart { public BookSize bookSize; public class BookSize extends ConfigurationPart { @@ -98,7 +98,7 @@ index a6f58b3457b7477015c5c6d969e7d83017dd3fa1..85e56d726eb7780811e0a990e1ef7d3e public double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class } public boolean resolveSelectorsInBooks = false; -@@ -253,7 +253,15 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -258,7 +258,15 @@ public class GlobalConfiguration extends ConfigurationPart { public class PacketLimiter extends ConfigurationPart { public Component kickMessage = Component.translatable("disconnect.exceeded_packet_rate", NamedTextColor.RED); public PacketLimit allPackets = new PacketLimit(7.0, 500.0, PacketLimit.ViolateAction.KICK); @@ -115,7 +115,7 @@ index a6f58b3457b7477015c5c6d969e7d83017dd3fa1..85e56d726eb7780811e0a990e1ef7d3e @ConfigSerializable public record PacketLimit(@Required double interval, @Required double maxPacketRate, ViolateAction action) { -@@ -321,7 +329,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -326,7 +334,7 @@ public class GlobalConfiguration extends ConfigurationPart { executor.setMaximumPoolSize(_chatExecutorMaxSize); } } @@ -125,7 +125,7 @@ index a6f58b3457b7477015c5c6d969e7d83017dd3fa1..85e56d726eb7780811e0a990e1ef7d3e public boolean loadPermissionsYmlBeforePlugins = true; @Constraints.Min(4) diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -index 385ca2c1022e0985550a5cc2bbff953f1aa33f5c..121ee93d65bcaa26bdc3e57750107cdb54f8d6d7 100644 +index d3fdf62912d190f8b468b77230a927023c361074..6be96d4a772255ac03addd1775008d897ab34ac8 100644 --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java @@ -96,12 +96,32 @@ public class WorldConfiguration extends ConfigurationPart { @@ -142,24 +142,24 @@ index 385ca2c1022e0985550a5cc2bbff953f1aa33f5c..121ee93d65bcaa26bdc3e57750107cdb - public List hiddenBlocks = List.of( + // Plazma start - Optimize default configurations + public List hiddenBlocks = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? List.of( -+ // -+ Blocks.AIR, -+ Blocks.COPPER_ORE, -+ Blocks.DEEPSLATE_COPPER_ORE, -+ Blocks.RAW_COPPER_BLOCK, -+ Blocks.IRON_ORE, -+ Blocks.DEEPSLATE_IRON_ORE, -+ Blocks.RAW_IRON_BLOCK, -+ Blocks.GOLD_ORE, -+ Blocks.DEEPSLATE_GOLD_ORE, -+ Blocks.RAW_GOLD_BLOCK, -+ Blocks.REDSTONE_ORE, -+ Blocks.DEEPSLATE_REDSTONE_ORE, -+ Blocks.LAPIS_ORE, -+ Blocks.DEEPSLATE_LAPIS_ORE, -+ Blocks.DIAMOND_ORE, -+ Blocks.DEEPSLATE_DIAMOND_ORE -+ // ++ // ++ Blocks.AIR, ++ Blocks.COPPER_ORE, ++ Blocks.DEEPSLATE_COPPER_ORE, ++ Blocks.RAW_COPPER_BLOCK, ++ Blocks.IRON_ORE, ++ Blocks.DEEPSLATE_IRON_ORE, ++ Blocks.RAW_IRON_BLOCK, ++ Blocks.GOLD_ORE, ++ Blocks.DEEPSLATE_GOLD_ORE, ++ Blocks.RAW_GOLD_BLOCK, ++ Blocks.REDSTONE_ORE, ++ Blocks.DEEPSLATE_REDSTONE_ORE, ++ Blocks.LAPIS_ORE, ++ Blocks.DEEPSLATE_LAPIS_ORE, ++ Blocks.DIAMOND_ORE, ++ Blocks.DEEPSLATE_DIAMOND_ORE ++ // + ) : List.of( // Blocks.COPPER_ORE, @@ -170,7 +170,7 @@ index 385ca2c1022e0985550a5cc2bbff953f1aa33f5c..121ee93d65bcaa26bdc3e57750107cdb ); - public List replacementBlocks = List.of(Blocks.STONE, Blocks.OAK_PLANKS, Blocks.DEEPSLATE); + public List replacementBlocks = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? List.of( -+ // ++ // + Blocks.CHEST, + Blocks.AMETHYST_BLOCK, + Blocks.ANDESITE, @@ -218,10 +218,10 @@ index 385ca2c1022e0985550a5cc2bbff953f1aa33f5c..121ee93d65bcaa26bdc3e57750107cdb @MergeMap - public Map despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), category.getDespawnDistance()))); + public Map despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? (net.minecraft.server.MinecraftServer.getServer().server.getSimulationDistance() * 16) + 8 : category.getDespawnDistance()))); // Plazma - Optimize default configurations + @MergeMap + public Reference2IntMap ticksPerSpawn = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1))); - @ConfigSerializable - public record DespawnRange(@Required int soft, @Required int hard) { -@@ -381,7 +422,7 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -383,7 +424,7 @@ public class WorldConfiguration extends ConfigurationPart { public class Environment extends ConfigurationPart { public boolean disableThunder = false; public boolean disableIceAndSnow = false; @@ -230,7 +230,7 @@ index 385ca2c1022e0985550a5cc2bbff953f1aa33f5c..121ee93d65bcaa26bdc3e57750107cdb public boolean disableExplosionKnockback = false; public boolean generateFlatBedrock = false; public FrostedIce frostedIce; -@@ -433,7 +474,7 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -438,7 +479,7 @@ public class WorldConfiguration extends ConfigurationPart { public Fixes fixes; public class Fixes extends ConfigurationPart { @@ -239,7 +239,7 @@ index 385ca2c1022e0985550a5cc2bbff953f1aa33f5c..121ee93d65bcaa26bdc3e57750107cdb public boolean disableUnloadedChunkEnderpearlExploit = true; public boolean preventTntFromMovingInWater = false; public boolean splitOverstackedLoot = true; -@@ -460,9 +501,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -466,9 +507,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Collisions extends ConfigurationPart { public boolean onlyPlayersCollide = false; public boolean allowVehicleCollisions = true; @@ -251,7 +251,7 @@ index 385ca2c1022e0985550a5cc2bbff953f1aa33f5c..121ee93d65bcaa26bdc3e57750107cdb public boolean allowPlayerCrammingDamage = false; } -@@ -470,18 +511,41 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -476,18 +517,41 @@ public class WorldConfiguration extends ConfigurationPart { public class Chunks extends ConfigurationPart { public AutosavePeriod autoSaveInterval = AutosavePeriod.def(); @@ -301,7 +301,7 @@ index 385ca2c1022e0985550a5cc2bbff953f1aa33f5c..121ee93d65bcaa26bdc3e57750107cdb }); public boolean flushRegionsOnSave = false; } -@@ -496,9 +560,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -502,9 +566,9 @@ public class WorldConfiguration extends ConfigurationPart { public TickRates tickRates; public class TickRates extends ConfigurationPart { @@ -313,7 +313,7 @@ index 385ca2c1022e0985550a5cc2bbff953f1aa33f5c..121ee93d65bcaa26bdc3e57750107cdb public int wetFarmland = 1; public int dryFarmland = 1; public Table, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40)); -@@ -532,9 +596,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -538,9 +602,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Misc extends ConfigurationPart { public int lightQueueSize = 20; @@ -338,10 +338,10 @@ index 24763d3d270c29c95e0b3e85111145234f660a62..80ddc627e02e3c749e6b074afa93d357 } diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 60382055ccb199e32fb201fddfe34f05bf919195..d83bd5774f49af33119ea5224a2300d435898095 100644 +index 23f0302f2d90b7229828890eb364bc2c9abc11d2..a9753f799ef944a46ee3cedd68c8aad7aacc2612 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -164,7 +164,7 @@ public class Main { +@@ -153,7 +153,7 @@ public class Main { File configFile = (File) optionset.valueOf("bukkit-settings"); YamlConfiguration configuration = YamlConfiguration.loadConfiguration(configFile); configuration.options().copyDefaults(true); @@ -383,7 +383,7 @@ index a66dcea06424518290576c7647ae0717040586f9..41d5d15dfa2affdee68501efb2447a20 this.enableStatus = this.get("enable-status", true); this.hideOnlinePlayers = this.get("hide-online-players", false); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 30729e47d546b9bf18f15024516c2ebcb3b722e5..2d3f8bb3954d552d4bbcc9ec7286845a8d76da8a 100644 +index ceea71c3e6886b03d017c44c287dc20928f63f09..e250196a4210c5b2fe5eadda6312ebc5e17590b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -426,7 +426,7 @@ public final class CraftServer implements Server { @@ -437,7 +437,7 @@ index a937993f318ef5703420f57fe65c5d990ce2c4dd..65b9e4fc073d0e97c6f90587d20e3ecb private static void networkSettings() { useUPnP = getBoolean("settings.network.upnp-port-forwarding", useUPnP); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 65ac86d07aeabb019132e180e5ed6b197e9ccad3..213559bdf83c5a07b4f7c0e32f425c2e17dc3db4 100644 +index 7dc82ffccc157a17335f1bc56ab81be3813294f6..d756c25e6d0af3153e510d0162e65348b1675366 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -425,7 +425,7 @@ public class PurpurWorldConfig { @@ -449,7 +449,7 @@ index 65ac86d07aeabb019132e180e5ed6b197e9ccad3..213559bdf83c5a07b4f7c0e32f425c2e public boolean teleportOnNetherCeilingDamage = false; public boolean totemOfUndyingWorksInInventory = false; public boolean playerFixStuckPortal = false; -@@ -3133,7 +3133,7 @@ public class PurpurWorldConfig { +@@ -3127,7 +3127,7 @@ public class PurpurWorldConfig { public boolean zombieJockeyOnlyBaby = true; public double zombieJockeyChance = 0.05D; public boolean zombieJockeyTryExistingChickens = true; diff --git a/patches/server/0014-Tweak-console-logging.patch b/patches/server/0013-Tweak-console-logging.patch similarity index 96% rename from patches/server/0014-Tweak-console-logging.patch rename to patches/server/0013-Tweak-console-logging.patch index c5833b7..dcde573 100644 --- a/patches/server/0014-Tweak-console-logging.patch +++ b/patches/server/0013-Tweak-console-logging.patch @@ -61,10 +61,10 @@ index b7709cbb1a78eb1daac2112cb9fbf5d379aaa662..2a73508dd8a59c6af8b65ab2db97b6e2 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index ac1e0c66f167218306504db6037cc1d6509072a0..ef4b1fb1532e1939d9a7e5337edc80b334b78318 100644 +index 60aa2984e490374ab2659f9d0a4821f1ea17c700..14d15dd0d4973957871f5c06042fcaa4ea8b7a8a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1468,6 +1468,7 @@ public abstract class PlayerList { +@@ -1469,6 +1469,7 @@ public abstract class PlayerList { public void broadcastChatMessage(PlayerChatMessage message, Predicate shouldSendFiltered, @Nullable ServerPlayer sender, ChatType.Bound params, @Nullable Function unsignedFunction) { // Paper end boolean flag = this.verifyChatTrusted(message); @@ -73,7 +73,7 @@ index ac1e0c66f167218306504db6037cc1d6509072a0..ef4b1fb1532e1939d9a7e5337edc80b3 this.server.logChatMessage((unsignedFunction == null ? message.decoratedContent() : unsignedFunction.apply(this.server.console)), params, flag ? null : "Not Secure"); // Paper OutgoingChatMessage outgoingchatmessage = OutgoingChatMessage.create(message); diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 2adaa7c6433ac3f54c9d75ee3c14772b4c538418..294fdbba44191427a841f8ac82b18ed8d706f53e 100644 +index 9c830ec9129ac94aa08e914a82792210c13fc1a3..f7457660566d64a8149db414e005f0b8ed2202b5 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -67,4 +67,13 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0015-Add-missing-purpur-configuration-options.patch b/patches/server/0014-Add-missing-purpur-configuration-options.patch similarity index 94% rename from patches/server/0015-Add-missing-purpur-configuration-options.patch rename to patches/server/0014-Add-missing-purpur-configuration-options.patch index 55dde0e..2c60529 100644 --- a/patches/server/0015-Add-missing-purpur-configuration-options.patch +++ b/patches/server/0014-Add-missing-purpur-configuration-options.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add missing purpur configuration options 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 c783ce59ea766e6c46a3313628b961f27e01ee8b..8adcffc1e6434e06ca52d119a7326a1272897307 100644 +index 518660609566ffe943103b305472590ee9f0a257..a6a697868b22224a26d6c39e594533c3b33e724b 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 @@ -150,6 +150,23 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @@ -33,10 +33,10 @@ index c783ce59ea766e6c46a3313628b961f27e01ee8b..8adcffc1e6434e06ca52d119a7326a12 @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index 41773acc8e8e27daa1fe43726939b2d95da92c30..7574da6cb1844305f965f9725c7d8cb91c92cbd7 100644 +index 8616a8c09a21f576a07daaa93ebf64e0f03d0c88..77c1bcde8cc5c2f51418a6f385ce84f202a13787 100644 --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -@@ -95,6 +95,18 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl +@@ -97,6 +97,18 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl public int getPurpurBreedTime() { return this.level().purpurConfig.camelBreedingTicks; } @@ -56,10 +56,10 @@ index 41773acc8e8e27daa1fe43726939b2d95da92c30..7574da6cb1844305f965f9725c7d8cb9 @Override 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 d6340d0a1308bafd3ba176562bf08dcadec02b34..e079f0994c81561510e5d223d2203e349daf07e1 100644 +index 37f1d3c656997906cef57d9dbefc226d04fc65fe..b3880426148bb1ffbf36113343c54850fc344d1c 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 -@@ -136,6 +136,23 @@ public class Frog extends Animal implements VariantHolder { +@@ -161,6 +161,23 @@ public class Frog extends Animal implements VariantHolder { public float getJumpPower() { return (getRider() != null && isControllable()) ? level().purpurConfig.frogRidableJumpHeight * this.getBlockJumpFactor() : super.getJumpPower(); } @@ -205,10 +205,10 @@ index 65b9e4fc073d0e97c6f90587d20e3ecbdaaf2c71..fc48ff9270e32c3b3dbf7ffd310cab7c org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27); enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 213559bdf83c5a07b4f7c0e32f425c2e17dc3db4..c7d8f22ecaf22232aef015da5a330dc39db4b695 100644 +index d756c25e6d0af3153e510d0162e65348b1675366..d723b9b6818eae3c40f16f9aeab9604bf6ab03ae 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -@@ -1180,7 +1180,15 @@ public class PurpurWorldConfig { +@@ -1170,7 +1170,15 @@ public class PurpurWorldConfig { public boolean allayRidableInWater = true; public boolean allayControllable = true; public List allayRespectNBT = new ArrayList<>(); @@ -224,7 +224,7 @@ index 213559bdf83c5a07b4f7c0e32f425c2e17dc3db4..c7d8f22ecaf22232aef015da5a330dc3 allayRidable = getBoolean("mobs.allay.ridable", allayRidable); allayRidableInWater = getBoolean("mobs.allay.ridable-in-water", allayRidableInWater); allayControllable = getBoolean("mobs.allay.controllable", allayControllable); -@@ -1299,7 +1307,15 @@ public class PurpurWorldConfig { +@@ -1289,7 +1297,15 @@ public class PurpurWorldConfig { public double camelMovementSpeedMin = 0.09D; public double camelMovementSpeedMax = 0.09D; public int camelBreedingTicks = 6000; @@ -240,7 +240,7 @@ index 213559bdf83c5a07b4f7c0e32f425c2e17dc3db4..c7d8f22ecaf22232aef015da5a330dc3 camelRidableInWater = getBoolean("mobs.camel.ridable-in-water", camelRidableInWater); camelMaxHealthMin = getDouble("mobs.camel.attributes.max_health.min", camelMaxHealthMin); camelMaxHealthMax = getDouble("mobs.camel.attributes.max_health.max", camelMaxHealthMax); -@@ -1727,7 +1743,15 @@ public class PurpurWorldConfig { +@@ -1717,7 +1733,15 @@ public class PurpurWorldConfig { public boolean frogControllable = true; public float frogRidableJumpHeight = 0.65F; public int frogBreedingTicks = 6000; @@ -256,7 +256,7 @@ index 213559bdf83c5a07b4f7c0e32f425c2e17dc3db4..c7d8f22ecaf22232aef015da5a330dc3 frogRidable = getBoolean("mobs.frog.ridable", frogRidable); frogRidableInWater = getBoolean("mobs.frog.ridable-in-water", frogRidableInWater); frogControllable = getBoolean("mobs.frog.controllable", frogControllable); -@@ -2678,7 +2702,13 @@ public class PurpurWorldConfig { +@@ -2668,7 +2692,13 @@ public class PurpurWorldConfig { public boolean snifferControllable = true; public double snifferMaxHealth = 14.0D; public int snifferBreedingTicks = 6000; @@ -270,7 +270,7 @@ index 213559bdf83c5a07b4f7c0e32f425c2e17dc3db4..c7d8f22ecaf22232aef015da5a330dc3 snifferRidable = getBoolean("mobs.sniffer.ridable", snifferRidable); snifferRidableInWater = getBoolean("mobs.sniffer.ridable-in-water", snifferRidableInWater); snifferControllable = getBoolean("mobs.sniffer.controllable", snifferControllable); -@@ -2777,7 +2807,15 @@ public class PurpurWorldConfig { +@@ -2767,7 +2797,15 @@ public class PurpurWorldConfig { public boolean tadpoleRidable = false; public boolean tadpoleRidableInWater = true; public boolean tadpoleControllable = true; @@ -286,7 +286,7 @@ index 213559bdf83c5a07b4f7c0e32f425c2e17dc3db4..c7d8f22ecaf22232aef015da5a330dc3 tadpoleRidable = getBoolean("mobs.tadpole.ridable", tadpoleRidable); tadpoleRidableInWater = getBoolean("mobs.tadpole.ridable-in-water", tadpoleRidableInWater); tadpoleControllable = getBoolean("mobs.tadpole.controllable", tadpoleControllable); -@@ -2989,7 +3027,15 @@ public class PurpurWorldConfig { +@@ -2983,7 +3021,15 @@ public class PurpurWorldConfig { public boolean wardenRidable = false; public boolean wardenRidableInWater = true; public boolean wardenControllable = true; diff --git a/patches/server/0016-Add-some-missing-Pufferfish-configurations.patch b/patches/server/0015-Add-some-missing-Pufferfish-configurations.patch similarity index 90% rename from patches/server/0016-Add-some-missing-Pufferfish-configurations.patch rename to patches/server/0015-Add-some-missing-Pufferfish-configurations.patch index 290d9ee..444ae74 100644 --- a/patches/server/0016-Add-some-missing-Pufferfish-configurations.patch +++ b/patches/server/0015-Add-some-missing-Pufferfish-configurations.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add some missing Pufferfish configurations diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index 61d4a78bde54dd90fc7a207f88709be25593c9f4..ef09fae1a46f4b37adfad059b0accb80845c8b7c 100644 +index 77c1bcde8cc5c2f51418a6f385ce84f202a13787..8ac2f6749f3bd85b73ac543bc9040aacb6032623 100644 --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -@@ -168,10 +168,12 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl +@@ -170,11 +170,12 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl return dimensions.height - 0.1F * this.getScale(); } @@ -16,9 +16,10 @@ index 61d4a78bde54dd90fc7a207f88709be25593c9f4..ef09fae1a46f4b37adfad059b0accb80 @Override protected void customServerAiStep() { //this.level().getProfiler().push("camelBrain"); // Purpur - Brain brain = (Brain) this.getBrain(); // Paper - decompile fix + Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error +- + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations - brain.tick((ServerLevel)this.level(), this); + behaviorcontroller.tick((ServerLevel) this.level(), this); //this.level().getProfiler().pop(); // Purpur //this.level().getProfiler().push("camelActivityUpdate"); // Purpur diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java diff --git a/patches/server/0017-Completely-remove-Mojang-Profiler.patch b/patches/server/0016-Completely-remove-Mojang-Profiler.patch similarity index 60% rename from patches/server/0017-Completely-remove-Mojang-Profiler.patch rename to patches/server/0016-Completely-remove-Mojang-Profiler.patch index bd45af2..fa254d0 100644 --- a/patches/server/0017-Completely-remove-Mojang-Profiler.patch +++ b/patches/server/0016-Completely-remove-Mojang-Profiler.patch @@ -18,7 +18,7 @@ index b203394ed62807e7d5df433830993f1d2ee14939..e86d6dc83f77ef17c0e4458470009e5c try { Commands.CURRENT_EXECUTION_CONTEXT.set(executioncontext1); diff --git a/src/main/java/net/minecraft/commands/execution/ExecutionContext.java b/src/main/java/net/minecraft/commands/execution/ExecutionContext.java -index 38854a047c6da7e2551f206478d17628e765168d..c989f0ddca966cb522fca68734baa5cc5231272f 100644 +index f626a2f28f2aebb3237cebb6afef3c4fa1a6cb37..ec845d3d371021f1c16a4c5466cd1a1d94092d3b 100644 --- a/src/main/java/net/minecraft/commands/execution/ExecutionContext.java +++ b/src/main/java/net/minecraft/commands/execution/ExecutionContext.java @@ -12,7 +12,7 @@ import net.minecraft.commands.ExecutionCommandSource; @@ -52,7 +52,7 @@ index 38854a047c6da7e2551f206478d17628e765168d..c989f0ddca966cb522fca68734baa5cc this.commandQuota = maxCommandChainLength; } -@@ -127,9 +127,11 @@ public class ExecutionContext implements AutoCloseable { +@@ -129,9 +129,11 @@ public class ExecutionContext implements AutoCloseable { return this.tracer; } @@ -65,49 +65,66 @@ index 38854a047c6da7e2551f206478d17628e765168d..c989f0ddca966cb522fca68734baa5cc public int forkLimit() { return this.forkLimit; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c81695902775f345d77154ea309bb71d34d08175..c153becedc7c8573dc1d8a736581db2a31a8d4f5 100644 +index 1cbb3c1142a480201971fae718e6b15a3e4c9d53..74be6ec20b6484ddbffcc5f9e5c6d742640183df 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -113,16 +113,18 @@ import net.minecraft.util.Unit; +@@ -111,18 +111,18 @@ import net.minecraft.util.SignatureValidator; + import net.minecraft.util.TimeUtil; + import net.minecraft.util.Unit; import net.minecraft.util.datafix.DataFixers; - import net.minecraft.util.profiling.EmptyProfileResults; - import net.minecraft.util.profiling.ProfileResults; +-import net.minecraft.util.profiling.EmptyProfileResults; +-import net.minecraft.util.profiling.ProfileResults; -import net.minecraft.util.profiling.ProfilerFiller; -+// import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler - import net.minecraft.util.profiling.ResultField; +-import net.minecraft.util.profiling.ResultField; -import net.minecraft.util.profiling.SingleTickProfiler; ++// import net.minecraft.util.profiling.EmptyProfileResults; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.ProfileResults; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.ResultField; // Plazma - Completely remove Mojang Profiler +// import net.minecraft.util.profiling.SingleTickProfiler; // Plazma - Completely remove Mojang Profiler import net.minecraft.util.profiling.jfr.JvmProfiler; import net.minecraft.util.profiling.jfr.callback.ProfiledDuration; -+/* // Plazma - Completely remove Mojang Profiler - import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; - import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; - import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; - import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider; - import net.minecraft.util.profiling.metrics.storage.MetricsPersister; -+ */ // Plazma - Completely remove Mojang Profiler +-import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; +-import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; +-import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; +-import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider; +-import net.minecraft.util.profiling.metrics.storage.MetricsPersister; ++// import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.metrics.storage.MetricsPersister; // Plazma - Completely remove Mojang Profiler import net.minecraft.util.thread.ReentrantBlockableEventLoop; import net.minecraft.world.Difficulty; import net.minecraft.world.RandomSequences; -@@ -217,11 +219,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop tickables = Lists.newArrayList(); -+ /* // Plazma - Completely remove Mojang Profiler - private MetricsRecorder metricsRecorder; - private ProfilerFiller profiler; - private Consumer onMetricsRecordingStopped; - private Consumer onMetricsRecordingFinished; - private boolean willStartRecordingMetrics; -+ */ // Plazma - Completely remove Mojang Profiler +- private MetricsRecorder metricsRecorder; +- private ProfilerFiller profiler; +- private Consumer onMetricsRecordingStopped; +- private Consumer onMetricsRecordingFinished; +- private boolean willStartRecordingMetrics; +- @Nullable +- private MinecraftServer.TimeProfiler debugCommandProfiler; +- private boolean debugCommandProfilerDelayStart; ++ // private MetricsRecorder metricsRecorder; // Plazma - Completely remove Mojang Profiler ++ // private ProfilerFiller profiler; // Plazma - Completely remove Mojang Profiler ++ // private Consumer onMetricsRecordingStopped; // Plazma - Completely remove Mojang Profiler ++ // private Consumer onMetricsRecordingFinished; // Plazma - Completely remove Mojang Profiler ++ // private boolean willStartRecordingMetrics; // Plazma - Completely remove Mojang Profiler ++ // @Nullable // Plazma - Completely remove Mojang Profiler ++ // private MinecraftServer.TimeProfiler debugCommandProfiler; // Plazma - Completely remove Mojang Profiler ++ // private boolean debugCommandProfilerDelayStart; // Plazma - Completely remove Mojang Profiler + private ServerConnectionListener connection; + public final ChunkProgressListenerFactory progressListenerFactory; @Nullable - private MinecraftServer.TimeProfiler debugCommandProfiler; - private boolean debugCommandProfilerDelayStart; -@@ -2487,10 +2491,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -@@ -2753,12 +2760,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop resultConsumer, Consumer dumpConsumer) { - /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur -+ /this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur // Plazma - Fix for IDE - this.stopRecordingMetrics(); - resultConsumer.accept(methodprofilerresults); - }; - this.onMetricsRecordingFinished = dumpConsumer; +- this.stopRecordingMetrics(); +- resultConsumer.accept(methodprofilerresults); +- }; +- this.onMetricsRecordingFinished = dumpConsumer; - this.willStartRecordingMetrics = true;*/ // Purpur -+ this.willStartRecordingMetrics = true;/ // Purpur // Plazma - Fix for IDE ++ // Plazma start - IDE Error ++ // this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur ++ // this.stopRecordingMetrics(); ++ // resultConsumer.accept(methodprofilerresults); ++ // }; ++ // this.onMetricsRecordingFinished = dumpConsumer; ++ // this.willStartRecordingMetrics = true; // Purpur } public void stopRecordingMetrics() { -@@ -2773,6 +2780,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { diff --git a/src/main/java/net/minecraft/server/ServerFunctionLibrary.java b/src/main/java/net/minecraft/server/ServerFunctionLibrary.java -index de2eb71bb6933f2bd06859bc2c56fd0ad15ab71a..f65d6dc2b1596232707be402cf0377b5ab90cc01 100644 +index 981c3023044f3cc6dc22ada20cd4bedcf7a28db3..75a7f4db9fee80cceea268d3a61b54d81b004605 100644 --- a/src/main/java/net/minecraft/server/ServerFunctionLibrary.java +++ b/src/main/java/net/minecraft/server/ServerFunctionLibrary.java -@@ -25,7 +25,7 @@ import net.minecraft.server.packs.resources.PreparableReloadListener; +@@ -26,7 +26,7 @@ import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.tags.TagLoader; -import net.minecraft.util.profiling.ProfilerFiller; +//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler - import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; -@@ -62,7 +62,7 @@ public class ServerFunctionLibrary implements PreparableReloadListener { - } - - @Override -- public CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) { -+ public CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, /*ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler,*/ Executor prepareExecutor, Executor applyExecutor) { // Plazma - Completely remove Mojang Profiler - CompletableFuture>> completableFuture = CompletableFuture.supplyAsync(() -> { - return this.tagsLoader.load(manager); - }, prepareExecutor); + import org.slf4j.Logger; +@@ -65,8 +65,8 @@ public class ServerFunctionLibrary implements PreparableReloadListener { + public CompletableFuture reload( + PreparableReloadListener.PreparationBarrier synchronizer, + ResourceManager manager, +- ProfilerFiller prepareProfiler, +- ProfilerFiller applyProfiler, ++ //ProfilerFiller prepareProfiler, // Plazma - Completely remove Mojang Profiler ++ //ProfilerFiller applyProfiler, // Plazma - Completely remove Mojang Profiler + Executor prepareExecutor, + Executor applyExecutor + ) { diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java -index 5dd0dcb47211cec69189115bf4eab1dffc3ca8cf..1b54ec6a39f40f3334b49348941290b5efa7f07b 100644 +index 92aa26881818fec92d0663e2ccf507165c34c733..3b162ddc8dd57abf5ad37e22ed7f0f6f0379c1e1 100644 --- a/src/main/java/net/minecraft/server/ServerFunctionManager.java +++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java @@ -16,7 +16,7 @@ import net.minecraft.commands.functions.CommandFunction; @@ -204,8 +260,113 @@ index 5dd0dcb47211cec69189115bf4eab1dffc3ca8cf..1b54ec6a39f40f3334b49348941290b5 import org.slf4j.Logger; public class ServerFunctionManager { +diff --git a/src/main/java/net/minecraft/server/commands/PerfCommand.java b/src/main/java/net/minecraft/server/commands/PerfCommand.java +index 8c587f829c5e8c6b6df3150024c4ae704988c47b..a350f18b6be2fa1f18898dac69ebf0b1cba95b38 100644 +--- a/src/main/java/net/minecraft/server/commands/PerfCommand.java ++++ b/src/main/java/net/minecraft/server/commands/PerfCommand.java +@@ -1,36 +1,39 @@ + package net.minecraft.server.commands; + ++// Plazma start - Completely remove Mojang Profiler + import com.mojang.brigadier.CommandDispatcher; + import com.mojang.brigadier.exceptions.CommandSyntaxException; +-import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; +-import com.mojang.logging.LogUtils; +-import java.io.IOException; +-import java.nio.file.Path; +-import java.nio.file.Paths; +-import java.util.Locale; +-import java.util.function.Consumer; +-import net.minecraft.FileUtil; +-import net.minecraft.SharedConstants; +-import net.minecraft.SystemReport; +-import net.minecraft.Util; ++// import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; ++// import com.mojang.logging.LogUtils; ++// import java.io.IOException; ++// import java.nio.file.Path; ++// import java.nio.file.Paths; ++// import java.util.Locale; ++// import java.util.function.Consumer; ++// import net.minecraft.FileUtil; ++// import net.minecraft.SharedConstants; ++// import net.minecraft.SystemReport; ++// import net.minecraft.Util; + import net.minecraft.commands.CommandSourceStack; + import net.minecraft.commands.Commands; + import net.minecraft.network.chat.Component; +-import net.minecraft.server.MinecraftServer; +-import net.minecraft.util.FileZipper; +-import net.minecraft.util.TimeUtil; +-import net.minecraft.util.profiling.EmptyProfileResults; +-import net.minecraft.util.profiling.ProfileResults; +-import net.minecraft.util.profiling.metrics.storage.MetricsPersister; +-import org.apache.commons.io.FileUtils; +-import org.slf4j.Logger; ++// import net.minecraft.server.MinecraftServer; ++// import net.minecraft.util.FileZipper; ++// import net.minecraft.util.TimeUtil; ++// import net.minecraft.util.profiling.EmptyProfileResults; ++// import net.minecraft.util.profiling.ProfileResults; ++// import net.minecraft.util.profiling.metrics.storage.MetricsPersister; ++// import org.apache.commons.io.FileUtils; ++// import org.slf4j.Logger; + + public class PerfCommand { ++ /* + private static final Logger LOGGER = LogUtils.getLogger(); + private static final SimpleCommandExceptionType ERROR_NOT_RUNNING = new SimpleCommandExceptionType(Component.translatable("commands.perf.notRunning")); + private static final SimpleCommandExceptionType ERROR_ALREADY_RUNNING = new SimpleCommandExceptionType( + Component.translatable("commands.perf.alreadyRunning") + ); ++ */ + + public static void register(CommandDispatcher dispatcher) { + dispatcher.register( +@@ -42,6 +45,9 @@ public class PerfCommand { + } + + private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { ++ source.sendFailure(Component.literal("Vanilla Profiler is removed due to Performance issues. Use Spark instead.")); ++ return 1; ++ /* + MinecraftServer minecraftServer = source.getServer(); + if (minecraftServer.isRecordingMetrics()) { + throw ERROR_ALREADY_RUNNING.create(); +@@ -52,9 +58,13 @@ public class PerfCommand { + source.sendSuccess(() -> Component.translatable("commands.perf.started"), false); + return 0; + } ++ */ + } + + private static int stopProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { ++ source.sendFailure(Component.literal("Vanilla Profiler is removed due to Performance issues. Use Spark instead.")); ++ return 1; ++ /* + MinecraftServer minecraftServer = source.getServer(); + if (!minecraftServer.isRecordingMetrics()) { + throw ERROR_NOT_RUNNING.create(); +@@ -62,8 +72,10 @@ public class PerfCommand { + minecraftServer.finishRecordingMetrics(); + return 0; + } ++ */ + } + ++ /* + private static void saveResults(CommandSourceStack source, Path tempProfilingDirectory, MinecraftServer server) { + String string = String.format( + Locale.ROOT, "%s-%s-%s", Util.getFilenameFormattedDateTime(), server.getWorldData().getLevelName(), SharedConstants.getCurrentVersion().getId() +@@ -104,4 +116,6 @@ public class PerfCommand { + ); + } + } ++ */ + } ++// Plazma end - Completely remove Mojang Profiler diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index bb412ca874b85d777c0e3565fcefcee15b23182b..d1056b1c91edc3ec06c78e65c8fa2dd1f000c43f 100644 +index 9116b3d298a9bb6e550d299f76ff1243da824cbe..618f2166417b88c92d99a7cf6f10e769eedc95a3 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -68,7 +68,7 @@ import net.minecraft.server.level.progress.ChunkProgressListener; @@ -218,7 +379,7 @@ index bb412ca874b85d777c0e3565fcefcee15b23182b..d1056b1c91edc3ec06c78e65c8fa2dd1 import net.minecraft.util.thread.ProcessorHandle; import net.minecraft.util.thread.ProcessorMailbox; diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 6167ffb1263a1a65b582b7d295d1d77ef38c3ee3..37f14f17b50d1ea23c859858d2dbdfcf56c125af 100644 +index 7b3ba500f465b999ce11964b0e4e30f36005536e..a57b6db99d8b2a41c43a84662b6d023b5a3c470a 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -23,7 +23,7 @@ import net.minecraft.core.SectionPos; @@ -231,7 +392,7 @@ index 6167ffb1263a1a65b582b7d295d1d77ef38c3ee3..37f14f17b50d1ea23c859858d2dbdfcf import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.ai.village.poi.PoiManager; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 08a5afa3b0f9729bc0883054e2255dee4d9ed815..611916db3f9a6d2fbfa720e883fb03973b4a65c2 100644 +index f5d1c1629a762b0ff5534d546610b1f59f385921..8fc95714ceebc5d5c1b4015a039b7bd375decb6d 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -78,7 +78,7 @@ import net.minecraft.util.Mth; @@ -257,16 +418,16 @@ index 08a5afa3b0f9729bc0883054e2255dee4d9ed815..611916db3f9a6d2fbfa720e883fb0397 this.entityTickList = new EntityTickList(); - this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier()); - this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier()); -+ this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded); //, this.getProfilerSupplier()); // Plazma - Completely remove Mojang Profiler -+ this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded); //, this.getProfilerSupplier()); // Plazma - Completely remove Mojang Profiler ++ this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded/*, this.getProfilerSupplier()*/); // Plazma - Completely remove Mojang Profiler ++ this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded/*, this.getProfilerSupplier()*/); // Plazma - Completely remove Mojang Profiler this.navigatingMobs = new ObjectOpenHashSet(); this.blockEvents = new ObjectLinkedOpenHashSet(); this.blockEventsToReschedule = new ArrayList(64); diff --git a/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java -index 828196decc89e7e03f88c4a3208ee1ab2bb69242..daa0e38490d576ba143636d2a4c3e308461ad408 100644 +index 60d33ac7ab7b610e9d5104ac9c7029ba4fc26cdf..dcbb7f0aadf106ecfe0a0935213e6143b84688aa 100644 --- a/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java +++ b/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java -@@ -2,10 +2,10 @@ package net.minecraft.server.packs.resources; +@@ -2,14 +2,14 @@ package net.minecraft.server.packs.resources; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -274,16 +435,21 @@ index 828196decc89e7e03f88c4a3208ee1ab2bb69242..daa0e38490d576ba143636d2a4c3e308 +//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler public interface PreparableReloadListener { -- CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor); -+ CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager/*, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler*/, Executor prepareExecutor, Executor applyExecutor); // Plazma - Completely remove Mojang Profiler - - default String getName() { - return this.getClass().getSimpleName(); + CompletableFuture reload( + PreparableReloadListener.PreparationBarrier synchronizer, + ResourceManager manager, +- ProfilerFiller prepareProfiler, +- ProfilerFiller applyProfiler, ++ //ProfilerFiller prepareProfiler, // Plazma - Completely remove Mojang Profiler ++ //ProfilerFiller applyProfiler, // Plazma - Completely remove Mojang Profiler + Executor prepareExecutor, + Executor applyExecutor + ); diff --git a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -index 7383c7d3820dce06108eaafd236a7c6c06a10a42..6324dafd01eafcf8663c1b739efbc064c8498782 100644 +index 0c25f3ed0a8a538edc7cadd3476100c9b3631f7a..dd6229790a66c1f4cb726f4606b188308683dfb0 100644 --- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -@@ -3,11 +3,11 @@ package net.minecraft.server.packs.resources; +@@ -3,15 +3,15 @@ package net.minecraft.server.packs.resources; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import net.minecraft.util.Unit; @@ -292,16 +458,21 @@ index 7383c7d3820dce06108eaafd236a7c6c06a10a42..6324dafd01eafcf8663c1b739efbc064 public interface ResourceManagerReloadListener extends PreparableReloadListener { @Override -- default CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) { -+ default CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager/*, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler*/, Executor prepareExecutor, Executor applyExecutor) { // Plazma - Completely remove Mojang Profiler - return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> { - //applyProfiler.startTick(); // Purpur - //applyProfiler.push("listener"); // Purpur + default CompletableFuture reload( + PreparableReloadListener.PreparationBarrier synchronizer, + ResourceManager manager, +- ProfilerFiller prepareProfiler, +- ProfilerFiller applyProfiler, ++ //ProfilerFiller prepareProfiler, // Plazma - Completely remove Mojang Profiler ++ //ProfilerFiller applyProfiler, // Plazma - Completely remove Mojang Profiler + Executor prepareExecutor, + Executor applyExecutor + ) { diff --git a/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -index 9cc09f0415a09299102dbcf022326944368ea033..13b5b1b9ddea35d9b4bc69bba1e15deb5669c4e0 100644 +index 8246e06392c06f70309c1876561bd00b59ba589f..027a0f2cb9c02fe0af7ba9e3824682aee30495ec 100644 --- a/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java +++ b/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -@@ -11,7 +11,7 @@ import java.util.Map; +@@ -12,7 +12,7 @@ import java.util.Map.Entry; import net.minecraft.resources.FileToIdConverter; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; @@ -310,20 +481,20 @@ index 9cc09f0415a09299102dbcf022326944368ea033..13b5b1b9ddea35d9b4bc69bba1e15deb import org.slf4j.Logger; public abstract class SimpleJsonResourceReloadListener extends SimplePreparableReloadListener> { -@@ -25,7 +25,7 @@ public abstract class SimpleJsonResourceReloadListener extends SimplePreparableR +@@ -26,7 +26,7 @@ public abstract class SimpleJsonResourceReloadListener extends SimplePreparableR } @Override - protected Map prepare(ResourceManager resourceManager, ProfilerFiller profilerFiller) { -+ protected Map prepare(ResourceManager resourceManager/*, ProfilerFiller profilerFiller*/) { // Plazma - Completely remove Profiler ++ protected Map prepare(ResourceManager resourceManager/*, ProfilerFiller profilerFiller*/) { // Plazma - Completely remove Mojang Profiler Map map = new HashMap<>(); scanDirectory(resourceManager, this.directory, this.gson, map); return map; diff --git a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java -index 7ab57748b2f2aea1003d9b7e70e76c372aa1e432..c5d72ce3a55110c9d53477adba5e56ea4108665a 100644 +index 298e3eddd600f0b2e48ce2d4080cf68adff59a3a..2b3aef017a31dbf859c0525de6f24cd2b971236d 100644 --- a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java +++ b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java -@@ -2,19 +2,19 @@ package net.minecraft.server.packs.resources; +@@ -2,24 +2,24 @@ package net.minecraft.server.packs.resources; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -332,15 +503,21 @@ index 7ab57748b2f2aea1003d9b7e70e76c372aa1e432..c5d72ce3a55110c9d53477adba5e56ea public abstract class SimplePreparableReloadListener implements PreparableReloadListener { @Override -- public final CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) { -+ public final CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager/*, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler*/, Executor prepareExecutor, Executor applyExecutor) { // Plazma - Completely remove Mojang Profiler - return CompletableFuture.supplyAsync(() -> { -- return this.prepare(manager, prepareProfiler); -+ return this.prepare(manager/*, prepareProfiler*/); // Plazma - Completely remove Mojang Profiler - }, prepareExecutor).thenCompose(synchronizer::wait).thenAcceptAsync((prepared) -> { -- this.apply(prepared, manager, applyProfiler); -+ this.apply(prepared, manager/*, applyProfiler*/); // Plazma - Completely remove Mojang Profiler - }, applyExecutor); + public final CompletableFuture reload( + PreparableReloadListener.PreparationBarrier synchronizer, + ResourceManager manager, +- ProfilerFiller prepareProfiler, +- ProfilerFiller applyProfiler, ++ //ProfilerFiller prepareProfiler, // Plazma - Completely remove Mojang Profiler ++ //ProfilerFiller applyProfiler, // Plazma - Completely remove Mojang Profiler + Executor prepareExecutor, + Executor applyExecutor + ) { +- return CompletableFuture.supplyAsync(() -> this.prepare(manager, prepareProfiler), prepareExecutor) ++ return CompletableFuture.supplyAsync(() -> this.prepare(manager/*, prepareProfiler*/), prepareExecutor) // Plazma - Completely remove Mojang Profiler + .thenCompose(synchronizer::wait) +- .thenAcceptAsync(prepared -> this.apply((T)prepared, manager, applyProfiler), applyExecutor); ++ .thenAcceptAsync(prepared -> this.apply((T)prepared, manager/*, applyProfiler*/), applyExecutor); // Plazma - Completely remove Mojang Profiler } - protected abstract T prepare(ResourceManager manager, ProfilerFiller profiler); @@ -350,29 +527,29 @@ index 7ab57748b2f2aea1003d9b7e70e76c372aa1e432..c5d72ce3a55110c9d53477adba5e56ea + protected abstract void apply(T prepared, ResourceManager manager/*, ProfilerFiller profiler*/); // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/server/packs/resources/SimpleReloadInstance.java b/src/main/java/net/minecraft/server/packs/resources/SimpleReloadInstance.java -index de2ecc7c69fb870f843f60596115866214267ee4..b9c89ce6d94aeb16fa6ea28d6b82aeea270790bf 100644 +index 5a8ed7c2a0217366c0d7e6341006037c114f8097..138be404edcac9c6a9e8080114ce742ebc4c2e95 100644 --- a/src/main/java/net/minecraft/server/packs/resources/SimpleReloadInstance.java +++ b/src/main/java/net/minecraft/server/packs/resources/SimpleReloadInstance.java -@@ -9,7 +9,7 @@ import java.util.concurrent.Executor; +@@ -10,7 +10,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicInteger; import net.minecraft.Util; import net.minecraft.util.Unit; -import net.minecraft.util.profiling.InactiveProfiler; -+//import net.minecraft.util.profiling.InactiveProfiler; // Plazma - Completely remove Profiler ++//import net.minecraft.util.profiling.InactiveProfiler; // Plazma - Completely remove Mojang Profiler public class SimpleReloadInstance implements ReloadInstance { private static final int PREPARATION_PROGRESS_WEIGHT = 2; -@@ -26,7 +26,7 @@ public class SimpleReloadInstance implements ReloadInstance { - - public static SimpleReloadInstance of(ResourceManager manager, List reloaders, Executor prepareExecutor, Executor applyExecutor, CompletableFuture initialStage) { - return new SimpleReloadInstance<>(prepareExecutor, applyExecutor, manager, reloaders, (synchronizer, resourceManager, reloader, prepare, apply) -> { -- return reloader.reload(synchronizer, resourceManager, InactiveProfiler.INSTANCE, InactiveProfiler.INSTANCE, prepareExecutor, apply); -+ return reloader.reload(synchronizer, resourceManager/*, InactiveProfiler.INSTANCE, InactiveProfiler.INSTANCE*/, prepareExecutor, apply); // Plazma - Completely remove Profiler - }, initialStage); - } - +@@ -38,7 +38,7 @@ public class SimpleReloadInstance implements ReloadInstance { + manager, + reloaders, + (synchronizer, resourceManager, reloader, prepare, apply) -> reloader.reload( +- synchronizer, resourceManager, InactiveProfiler.INSTANCE, InactiveProfiler.INSTANCE, prepareExecutor, apply ++ synchronizer, resourceManager, /*InactiveProfiler.INSTANCE, InactiveProfiler.INSTANCE,*/ prepareExecutor, apply + ), + initialStage + ); diff --git a/src/main/java/net/minecraft/tags/TagManager.java b/src/main/java/net/minecraft/tags/TagManager.java -index 60ed9413c32d91ce33583cc24998d08869d07a23..2919eaa15c64165c826b68dacc3e8c6905e7630a 100644 +index 7b9b8a6824fe5587773c1108628a0144d94169a1..d960cf466ffbdcf3f157b6e410eb0755d09543a3 100644 --- a/src/main/java/net/minecraft/tags/TagManager.java +++ b/src/main/java/net/minecraft/tags/TagManager.java @@ -14,7 +14,7 @@ import net.minecraft.resources.ResourceKey; @@ -383,24 +560,26 @@ index 60ed9413c32d91ce33583cc24998d08869d07a23..2919eaa15c64165c826b68dacc3e8c69 +//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler public class TagManager implements PreparableReloadListener { - private static final Map>, String> CUSTOM_REGISTRY_DIRECTORIES = Map.of(Registries.BLOCK, "tags/blocks", Registries.ENTITY_TYPE, "tags/entity_types", Registries.FLUID, "tags/fluids", Registries.GAME_EVENT, "tags/game_events", Registries.ITEM, "tags/items"); -@@ -35,7 +35,7 @@ public class TagManager implements PreparableReloadListener { - } - - @Override -- public CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) { -+ public CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager/*, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler*/, Executor prepareExecutor, Executor applyExecutor) { // Plazma - Completely remove Mojang Profiler - List>> list = this.registryAccess.registries().map((registry) -> { - return this.createLoader(manager, prepareExecutor, registry); - }).toList(); + private static final Map>, String> CUSTOM_REGISTRY_DIRECTORIES = Map.of( +@@ -49,8 +49,8 @@ public class TagManager implements PreparableReloadListener { + public CompletableFuture reload( + PreparableReloadListener.PreparationBarrier synchronizer, + ResourceManager manager, +- ProfilerFiller prepareProfiler, +- ProfilerFiller applyProfiler, ++ //ProfilerFiller prepareProfiler, // Plazma - Completely remove Mojang Profiler ++ //ProfilerFiller applyProfiler, // Plazma - Completely remove Mojang Profiler + Executor prepareExecutor, + Executor applyExecutor + ) { diff --git a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java -index c6c30d99399c5cde2b0ec2f320d81d952b422d78..ff4f6f23086913b45a58407e31f2a5edc10e5bdd 100644 +index 600a7036b503f60cc9c95f189f73c2dbf020e2e1..5d8dddca2a9e3a3440ccd2a2fd565f2afcffbb40 100644 --- a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java +++ b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java @@ -1,5 +1,6 @@ package net.minecraft.util.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.mojang.logging.LogUtils; @@ -411,24 +590,24 @@ index c6c30d99399c5cde2b0ec2f320d81d952b422d78..ff4f6f23086913b45a58407e31f2a5ed + */ // Plazma - Completely remove Mojang Profiler -public class ActiveProfiler implements ProfileCollector { -+interface ActiveProfiler { /*implements ProfileCollector { // Plazma - Completely remove Mojang Profiler ++interface ActiveProfiler {/* implements ProfileCollector { // Plazma - Completely remove Mojang Profiler private static final long WARNING_TIME_NANOS = Duration.ofMillis(100L).toNanos(); private static final Logger LOGGER = LogUtils.getLogger(); private final List paths = Lists.newArrayList(); -@@ -205,4 +207,5 @@ public class ActiveProfiler implements ProfileCollector { +@@ -203,4 +205,5 @@ public class ActiveProfiler implements ProfileCollector { return Object2LongMaps.unmodifiable(this.counters); } } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/ContinuousProfiler.java b/src/main/java/net/minecraft/util/profiling/ContinuousProfiler.java -index 4424bca7effa4fef26453afcd06d86e6a30d7b8f..76044b62cba0e2d1956b932eb8bdb99049ac79af 100644 +index 4424bca7effa4fef26453afcd06d86e6a30d7b8f..e8e662b07d9a31bbaa6e3bcc22c0b036dfe4def6 100644 --- a/src/main/java/net/minecraft/util/profiling/ContinuousProfiler.java +++ b/src/main/java/net/minecraft/util/profiling/ContinuousProfiler.java @@ -1,9 +1,11 @@ package net.minecraft.util.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import java.util.function.IntSupplier; import java.util.function.LongSupplier; + */ // Plazma - Completely remove Mojang Profiler @@ -442,16 +621,40 @@ index 4424bca7effa4fef26453afcd06d86e6a30d7b8f..76044b62cba0e2d1956b932eb8bdb990 public ProfileResults getResults() { return this.profiler.getResults(); } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler + } +diff --git a/src/main/java/net/minecraft/util/profiling/EmptyProfileResults.java b/src/main/java/net/minecraft/util/profiling/EmptyProfileResults.java +index 843e28baf089349851d7794c496e518ca396e92d..3bfd3d5d88a8b9ba790693ee45b7f21f87a34e5a 100644 +--- a/src/main/java/net/minecraft/util/profiling/EmptyProfileResults.java ++++ b/src/main/java/net/minecraft/util/profiling/EmptyProfileResults.java +@@ -1,10 +1,12 @@ + package net.minecraft.util.profiling; + ++/* // Plazma - Completely remove Mojang Profiler + import java.nio.file.Path; + import java.util.Collections; + import java.util.List; ++ */ // Plazma - Completely remove Mojang Profiler + +-public class EmptyProfileResults implements ProfileResults { ++interface EmptyProfileResults { /*implements ProfileResults { // Plazma - Completely remove Mojang Profiler + public static final EmptyProfileResults EMPTY = new EmptyProfileResults(); + + private EmptyProfileResults() { +@@ -44,4 +46,5 @@ public class EmptyProfileResults implements ProfileResults { + public String getProfilerResults() { + return ""; + } ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/FilledProfileResults.java b/src/main/java/net/minecraft/util/profiling/FilledProfileResults.java -index 253a5221bc0d99f0bcbab18ad0d15b99b0d8f5f6..92886cebd9dca26524b7d970fde4f2d31798a7f3 100644 +index fc3a3a32e6432c284b29216989385f8b0993c315..50fc93ec6bedccb74ec0347299c148daf0fb5abb 100644 --- a/src/main/java/net/minecraft/util/profiling/FilledProfileResults.java +++ b/src/main/java/net/minecraft/util/profiling/FilledProfileResults.java @@ -1,5 +1,6 @@ package net.minecraft.util.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import com.google.common.base.Splitter; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -462,24 +665,24 @@ index 253a5221bc0d99f0bcbab18ad0d15b99b0d8f5f6..92886cebd9dca26524b7d970fde4f2d3 + */ // Plazma - Completely remove Mojang Profiler -public class FilledProfileResults implements ProfileResults { -+final class FilledProfileResults { /* implements ProfileResults { // Plazma - Completely remove Mojang Profiler ++interface FilledProfileResults {/* implements ProfileResults { // Plazma - Completely remove Mojang Profiler private static final Logger LOGGER = LogUtils.getLogger(); private static final ProfilerPathEntry EMPTY = new ProfilerPathEntry() { @Override -@@ -291,4 +293,5 @@ public class FilledProfileResults implements ProfileResults { - +@@ -338,4 +340,5 @@ public class FilledProfileResults implements ProfileResults { + } } } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/InactiveProfiler.java b/src/main/java/net/minecraft/util/profiling/InactiveProfiler.java -index 5d2d8018460c04f7314c872441a8b21bc296c1ea..a4249befbdd2098fd391120542715ddd85e2fe9a 100644 +index 5d2d8018460c04f7314c872441a8b21bc296c1ea..bbab8ea9b07cca407c8b0a5a62cd7cf2e712e0cf 100644 --- a/src/main/java/net/minecraft/util/profiling/InactiveProfiler.java +++ b/src/main/java/net/minecraft/util/profiling/InactiveProfiler.java @@ -1,13 +1,15 @@ package net.minecraft.util.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import com.google.common.collect.ImmutableSet; import java.util.Set; import java.util.function.Supplier; @@ -497,16 +700,16 @@ index 5d2d8018460c04f7314c872441a8b21bc296c1ea..a4249befbdd2098fd391120542715ddd public Set> getChartedPaths() { return ImmutableSet.of(); } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/ProfileCollector.java b/src/main/java/net/minecraft/util/profiling/ProfileCollector.java -index fe47a3ce6318ad74bd4d9b10dbf5ee06c94b6939..97864e2adcc7651435cf1cafca816dbf36ca397a 100644 +index fe47a3ce6318ad74bd4d9b10dbf5ee06c94b6939..eb3287d06f2072624a95d3a15355cab8c6cadf31 100644 --- a/src/main/java/net/minecraft/util/profiling/ProfileCollector.java +++ b/src/main/java/net/minecraft/util/profiling/ProfileCollector.java @@ -1,15 +1,18 @@ package net.minecraft.util.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import java.util.Set; import javax.annotation.Nullable; import net.minecraft.util.profiling.metrics.MetricCategory; @@ -521,16 +724,39 @@ index fe47a3ce6318ad74bd4d9b10dbf5ee06c94b6939..97864e2adcc7651435cf1cafca816dbf ActiveProfiler.PathEntry getEntry(String name); Set> getChartedPaths(); -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler + } +diff --git a/src/main/java/net/minecraft/util/profiling/ProfileResults.java b/src/main/java/net/minecraft/util/profiling/ProfileResults.java +index afefd549cf9792a91dd8919c12697a693200d042..0e81cf4d0cbf23eae5b9713a8f969742c7e63dec 100644 +--- a/src/main/java/net/minecraft/util/profiling/ProfileResults.java ++++ b/src/main/java/net/minecraft/util/profiling/ProfileResults.java +@@ -1,9 +1,11 @@ + package net.minecraft.util.profiling; + ++/* // Plazma - Completely remove Mojang Profiler + import java.nio.file.Path; + import java.util.List; ++ */ + +-public interface ProfileResults { ++interface ProfileResults { /* { // Plazma - Completely remove Mojang Profiler + char PATH_SEPARATOR = '\u001e'; + + List getTimes(String parentPath); +@@ -31,4 +33,5 @@ public interface ProfileResults { + static String demanglePath(String path) { + return path.replace('\u001e', '.'); + } ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java -index 863343a87fe34d72f04af89d75268b477b2adc7a..995ad7365636ac1845bf136cd98b31f21b7ba400 100644 +index 223c3665126c576eddb1a8f7c9f5bc60c6ff9818..7fc5aa5b468186d793ebbdbafbf757367a6f9b1a 100644 --- a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java +++ b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java @@ -1,9 +1,11 @@ package net.minecraft.util.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import java.util.function.Supplier; import net.minecraft.util.profiling.metrics.MetricCategory; + */ // Plazma - Completely remove Mojang Profiler @@ -544,17 +770,17 @@ index 863343a87fe34d72f04af89d75268b477b2adc7a..995ad7365636ac1845bf136cd98b31f2 }; } } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/ProfilerPathEntry.java b/src/main/java/net/minecraft/util/profiling/ProfilerPathEntry.java -index c073262f663309e6f73e67b303927b3996ea0c16..cac51347b479837c92e4269ba93ef4b157d5fce0 100644 +index c073262f663309e6f73e67b303927b3996ea0c16..c2788315122e34ba4725e9fdbb4f471e0a168aff 100644 --- a/src/main/java/net/minecraft/util/profiling/ProfilerPathEntry.java +++ b/src/main/java/net/minecraft/util/profiling/ProfilerPathEntry.java @@ -1,8 +1,8 @@ package net.minecraft.util.profiling; -import it.unimi.dsi.fastutil.objects.Object2LongMap; -+//import it.unimi.dsi.fastutil.objects.Object2LongMap; // Plazma - Completely remove Mojang Profiler ++// import it.unimi.dsi.fastutil.objects.Object2LongMap; // Plazma - Completely remove Mojang Profiler -public interface ProfilerPathEntry { +interface ProfilerPathEntry { /* // Plazma - Completely remove Mojang Profiler @@ -565,16 +791,34 @@ index c073262f663309e6f73e67b303927b3996ea0c16..cac51347b479837c92e4269ba93ef4b1 long getCount(); Object2LongMap getCounters(); -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler + } +diff --git a/src/main/java/net/minecraft/util/profiling/ResultField.java b/src/main/java/net/minecraft/util/profiling/ResultField.java +index 179dd48aeeacc0b2a42c99f6213dd23683159681..9e225f5181465032bc517bc2dec3ec129375a0ad 100644 +--- a/src/main/java/net/minecraft/util/profiling/ResultField.java ++++ b/src/main/java/net/minecraft/util/profiling/ResultField.java +@@ -1,6 +1,6 @@ + package net.minecraft.util.profiling; + +-public final class ResultField implements Comparable { ++interface ResultField { /* implements Comparable { // Plazma - Completely remove Mojang Profiler + public final double percentage; + public final double globalPercentage; + public final long count; +@@ -25,4 +25,5 @@ public final class ResultField implements Comparable { + public int getColor() { + return (this.name.hashCode() & 11184810) + 4473924; + } ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/SingleTickProfiler.java b/src/main/java/net/minecraft/util/profiling/SingleTickProfiler.java -index 38c9b686212c0f78eb702b1897d491e450267ca7..b9f35d744a5aed7fe39df0586e8a3b5aa7540bf2 100644 +index 563d82c9153c88b651d6991caae4374c285a3065..b590a585dd4fd07a84e5971586c9a31c2a4273f0 100644 --- a/src/main/java/net/minecraft/util/profiling/SingleTickProfiler.java +++ b/src/main/java/net/minecraft/util/profiling/SingleTickProfiler.java @@ -1,13 +1,15 @@ package net.minecraft.util.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import com.mojang.logging.LogUtils; import java.io.File; import java.util.function.LongSupplier; @@ -588,20 +832,93 @@ index 38c9b686212c0f78eb702b1897d491e450267ca7..b9f35d744a5aed7fe39df0586e8a3b5a private static final Logger LOGGER = LogUtils.getLogger(); private final LongSupplier realTime; private final long saveThreshold; -@@ -50,4 +52,5 @@ public class SingleTickProfiler { +@@ -47,4 +49,5 @@ public class SingleTickProfiler { public static ProfilerFiller decorateFiller(ProfilerFiller profiler, @Nullable SingleTickProfiler monitor) { return monitor != null ? ProfilerFiller.tee(monitor.startTick(), profiler) : profiler; } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler + } +diff --git a/src/main/java/net/minecraft/util/profiling/metrics/MetricCategory.java b/src/main/java/net/minecraft/util/profiling/metrics/MetricCategory.java +index 6c40f626197337826f2172211b9b05015ff659bd..a6a17ee7dcd464095bb26cd8f77b1c9b3a923389 100644 +--- a/src/main/java/net/minecraft/util/profiling/metrics/MetricCategory.java ++++ b/src/main/java/net/minecraft/util/profiling/metrics/MetricCategory.java +@@ -1,6 +1,6 @@ + package net.minecraft.util.profiling.metrics; + +-public enum MetricCategory { ++interface MetricCategory { /* // Plazma - Completely remove Mojang Profiler + PATH_FINDING("pathfinding"), + EVENT_LOOPS("event-loops"), + MAIL_BOXES("mailboxes"), +@@ -20,4 +20,5 @@ public enum MetricCategory { + public String getDescription() { + return this.description; + } ++ */ // Plazma - Completely remove Mojang Profiler + } +diff --git a/src/main/java/net/minecraft/util/profiling/metrics/MetricSampler.java b/src/main/java/net/minecraft/util/profiling/metrics/MetricSampler.java +index dd2bf15d22e5839ca986d3e824fb785786af86c8..1c9a40dfb43fa5bd473f59db365ecf08297bac3d 100644 +--- a/src/main/java/net/minecraft/util/profiling/metrics/MetricSampler.java ++++ b/src/main/java/net/minecraft/util/profiling/metrics/MetricSampler.java +@@ -1,5 +1,6 @@ + package net.minecraft.util.profiling.metrics; + ++/* // Plazma - Completely remove Mojang Profiler + import io.netty.buffer.ByteBuf; + import io.netty.buffer.ByteBufAllocator; + import it.unimi.dsi.fastutil.ints.Int2DoubleMap; +@@ -9,8 +10,9 @@ import java.util.function.Consumer; + import java.util.function.DoubleSupplier; + import java.util.function.ToDoubleFunction; + import javax.annotation.Nullable; ++ */ // Plazma - Completely remove Mojang Profiler + +-public class MetricSampler { ++interface MetricSampler { /* // Plazma - Completely remove Mojang Profiler + private final String name; + private final MetricCategory category; + private final DoubleSupplier sampler; +@@ -210,4 +212,5 @@ public class MetricSampler { + return bl2; + } + } ++ */ // Plazma - Completely remove Mojang Profiler + } +diff --git a/src/main/java/net/minecraft/util/profiling/metrics/MetricsRegistry.java b/src/main/java/net/minecraft/util/profiling/metrics/MetricsRegistry.java +index c22a91ee393744a4eaffe1fff168b18ac1bc55bd..d2e6a7b661d1d3166a58cc3cc681bebdb229215c 100644 +--- a/src/main/java/net/minecraft/util/profiling/metrics/MetricsRegistry.java ++++ b/src/main/java/net/minecraft/util/profiling/metrics/MetricsRegistry.java +@@ -1,13 +1,15 @@ + package net.minecraft.util.profiling.metrics; + ++/* + import java.util.List; + import java.util.Map; + import java.util.Objects; + import java.util.WeakHashMap; + import java.util.stream.Collectors; + import javax.annotation.Nullable; ++ */ // Plazma - Completely remove Mojang Profiler + +-public class MetricsRegistry { ++interface MetricsRegistry { /* // Plazma - Completely remove Mojang Profiler + public static final MetricsRegistry INSTANCE = new MetricsRegistry(); + private final WeakHashMap measuredInstances = new WeakHashMap<>(); + +@@ -82,4 +84,5 @@ public class MetricsRegistry { + return Objects.hash(super.hashCode(), this.delegates); + } + } ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/metrics/MetricsSamplerProvider.java b/src/main/java/net/minecraft/util/profiling/metrics/MetricsSamplerProvider.java -index 07f78c451e5330296c38f6b599d979610a03381f..c16b85bcc4c0b497b8eeb8d46c5774f5e9e2213e 100644 +index 07f78c451e5330296c38f6b599d979610a03381f..54f78126dda64bb5f624eb8bd88b310b22c8c973 100644 --- a/src/main/java/net/minecraft/util/profiling/metrics/MetricsSamplerProvider.java +++ b/src/main/java/net/minecraft/util/profiling/metrics/MetricsSamplerProvider.java @@ -1,9 +1,11 @@ package net.minecraft.util.profiling.metrics; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import java.util.Set; import java.util.function.Supplier; import net.minecraft.util.profiling.ProfileCollector; @@ -610,16 +927,29 @@ index 07f78c451e5330296c38f6b599d979610a03381f..c16b85bcc4c0b497b8eeb8d46c5774f5 -public interface MetricsSamplerProvider { - Set samplers(Supplier profilerSupplier); +interface MetricsSamplerProvider { -+ //Set samplers(Supplier profilerSupplier); // Plazma - Completely remove Mojang Profiler ++ //Set samplers(Supplier profilerSupplier); // Plazma - Completely remove Mojang Profiler + } +diff --git a/src/main/java/net/minecraft/util/profiling/metrics/ProfilerMeasured.java b/src/main/java/net/minecraft/util/profiling/metrics/ProfilerMeasured.java +index 3057e9caa1936d114e07b3dfbd0dffd8aca1223c..4103faed61d1c2296bf46ce99ee8d165be12e839 100644 +--- a/src/main/java/net/minecraft/util/profiling/metrics/ProfilerMeasured.java ++++ b/src/main/java/net/minecraft/util/profiling/metrics/ProfilerMeasured.java +@@ -2,6 +2,6 @@ package net.minecraft.util.profiling.metrics; + + import java.util.List; + +-public interface ProfilerMeasured { +- List profiledMetrics(); ++interface ProfilerMeasured { // Plazma - Completely remove Mojang Profiler ++ // List profiledMetrics(); // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java -index 157e6562bc2fa0946ea6be825cd740d067b4e84f..cc0d5704d244d09c740c8eb99e5bb75a35809f64 100644 +index 9b8e774dfbfc9e06e9bf04ff789737511d6966ba..a42cbf219342bf12fc0d36ba5a4d394cf0562e17 100644 --- a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java +++ b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java @@ -1,5 +1,6 @@ package net.minecraft.util.profiling.metrics.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; @@ -630,24 +960,24 @@ index 157e6562bc2fa0946ea6be825cd740d067b4e84f..cc0d5704d244d09c740c8eb99e5bb75a + */ // Plazma - Completely remove Mojang Profiler -public class ActiveMetricsRecorder implements MetricsRecorder { -+interface ActiveMetricsRecorder { /*implements MetricsRecorder { // Plazma - Completely remove Mojang Profiler ++interface ActiveMetricsRecorder {/*implements MetricsRecorder { // Plazma - Completely remove Mojang Profiler public static final int PROFILING_MAX_DURATION_SECONDS = 10; @Nullable private static Consumer globalOnReportFinished = null; -@@ -161,4 +163,5 @@ public class ActiveMetricsRecorder implements MetricsRecorder { +@@ -165,4 +167,5 @@ public class ActiveMetricsRecorder implements MetricsRecorder { public static void registerGlobalCompletionCallback(Consumer consumer) { globalOnReportFinished = consumer; } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/metrics/profiling/InactiveMetricsRecorder.java b/src/main/java/net/minecraft/util/profiling/metrics/profiling/InactiveMetricsRecorder.java -index 12d7b7c86115b667bd8f940206985d9ed4b837d4..70732d7f72660e30b4265ddb9c3172f27131ec56 100644 +index 12d7b7c86115b667bd8f940206985d9ed4b837d4..cf58add13a2de5db5e9db1712cef7d1c203ec6db 100644 --- a/src/main/java/net/minecraft/util/profiling/metrics/profiling/InactiveMetricsRecorder.java +++ b/src/main/java/net/minecraft/util/profiling/metrics/profiling/InactiveMetricsRecorder.java @@ -1,9 +1,11 @@ package net.minecraft.util.profiling.metrics.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import net.minecraft.util.profiling.InactiveProfiler; import net.minecraft.util.profiling.ProfilerFiller; + */ // Plazma - Completely remove Mojang Profiler @@ -661,17 +991,17 @@ index 12d7b7c86115b667bd8f940206985d9ed4b837d4..70732d7f72660e30b4265ddb9c3172f2 @Override public void endTick() { } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/metrics/profiling/MetricsRecorder.java b/src/main/java/net/minecraft/util/profiling/metrics/profiling/MetricsRecorder.java -index 48e7211e01691a677c52cf1f5982b0c179eaf83b..9279d9c67c803e580f5bfc595bddf7a24a686806 100644 +index 48e7211e01691a677c52cf1f5982b0c179eaf83b..f9f64aa5d8a8215d4a7f549c4a2cde2993df17f4 100644 --- a/src/main/java/net/minecraft/util/profiling/metrics/profiling/MetricsRecorder.java +++ b/src/main/java/net/minecraft/util/profiling/metrics/profiling/MetricsRecorder.java @@ -1,8 +1,8 @@ package net.minecraft.util.profiling.metrics.profiling; -import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler -public interface MetricsRecorder { +interface MetricsRecorder { /* // Plazma - Completely remove Mojang Profiler @@ -682,16 +1012,16 @@ index 48e7211e01691a677c52cf1f5982b0c179eaf83b..9279d9c67c803e580f5bfc595bddf7a2 ProfilerFiller getProfiler(); void endTick(); -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ProfilerSamplerAdapter.java b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ProfilerSamplerAdapter.java -index 5bdfad52aa555c1720ca9eb8abc94d6e3f9be86c..6c14448b30863919082d3661b94b84fdca640cdd 100644 +index cf47ee0f4ec9ffb130b04c7cf92e7907f9b791ef..db2e6ac76b31c15767a202b7426555ae9cf9fa93 100644 --- a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ProfilerSamplerAdapter.java +++ b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ProfilerSamplerAdapter.java @@ -1,5 +1,6 @@ package net.minecraft.util.profiling.metrics.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import java.util.Set; import java.util.function.Supplier; @@ -702,92 +1032,80 @@ index 5bdfad52aa555c1720ca9eb8abc94d6e3f9be86c..6c14448b30863919082d3661b94b84fd + */ // Plazma - Completely remove Mojang Profiler -public class ProfilerSamplerAdapter { -+interface ProfilerSamplerAdapter { /* // Plazma - Completely remove Mojang Profiler ++interface ProfilerSamplerAdapter {/* // Plazma - Completely remove Mojang Profiler private final Set previouslyFoundSamplerNames = new ObjectOpenHashSet<>(); public Set newSamplersFoundInProfiler(Supplier profilerSupplier) { -@@ -33,4 +35,5 @@ public class ProfilerSamplerAdapter { - return pathEntry == null ? 0.0D : (double)pathEntry.getMaxDuration() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND; +@@ -34,4 +36,5 @@ public class ProfilerSamplerAdapter { + return pathEntry == null ? 0.0 : (double)pathEntry.getMaxDuration() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND; }); } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ServerMetricsSamplersProvider.java b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ServerMetricsSamplersProvider.java -index 42fc60456bc651345c5f6e13b975c7874532231e..3108ddd081e51066acaa867e4d3680d1bc4683e6 100644 +index 978412a8b9e24d7d79c94911f0cf7d20796389e1..c8bcf6f053beb3197fdfaec629f0896199b34165 100644 --- a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ServerMetricsSamplersProvider.java +++ b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ServerMetricsSamplersProvider.java @@ -1,5 +1,6 @@ package net.minecraft.util.profiling.metrics.profiling; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import com.google.common.base.Stopwatch; import com.google.common.base.Ticker; import com.google.common.collect.ImmutableSet; -@@ -19,8 +20,9 @@ import net.minecraft.util.profiling.metrics.MetricsSamplerProvider; +@@ -20,8 +21,9 @@ import net.minecraft.util.profiling.metrics.MetricsSamplerProvider; import org.slf4j.Logger; import oshi.SystemInfo; import oshi.hardware.CentralProcessor; + */ // Plazma - Completely remove Mojang Profiler -public class ServerMetricsSamplersProvider implements MetricsSamplerProvider { -+interface ServerMetricsSamplersProvider { /* implements MetricsSamplerProvider { // Plazma - Completely remove Mojang Profiler ++interface ServerMetricsSamplersProvider {/*implements MetricsSamplerProvider { private static final Logger LOGGER = LogUtils.getLogger(); private final Set samplers = new ObjectOpenHashSet<>(); private final ProfilerSamplerAdapter samplerFactory = new ProfilerSamplerAdapter(); -@@ -99,4 +101,5 @@ public class ServerMetricsSamplersProvider implements MetricsSamplerProvider { - return this.currentLoad[index] * 100.0D; +@@ -102,4 +104,5 @@ public class ServerMetricsSamplersProvider implements MetricsSamplerProvider { + return this.currentLoad[index] * 100.0; } } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/metrics/storage/MetricsPersister.java b/src/main/java/net/minecraft/util/profiling/metrics/storage/MetricsPersister.java -index 2c2b8bf76ea213b111f3a76b0823146565dc3880..310ee93b974b8e88e7ac614d1003425ea6e171a3 100644 +index 8579309bf1b6ad0e42aa9431a8d274ee810911fd..9f030526c7dec8ecca146a034c1266de6b15dafc 100644 --- a/src/main/java/net/minecraft/util/profiling/metrics/storage/MetricsPersister.java +++ b/src/main/java/net/minecraft/util/profiling/metrics/storage/MetricsPersister.java -@@ -1,13 +1,14 @@ +@@ -1,5 +1,6 @@ package net.minecraft.util.profiling.metrics.storage; -+import java.nio.file.Path; -+import java.nio.file.Paths; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import com.mojang.logging.LogUtils; import java.io.IOException; import java.io.UncheckedIOException; - import java.io.Writer; - import java.nio.charset.StandardCharsets; - import java.nio.file.Files; --import java.nio.file.Path; --import java.nio.file.Paths; - import java.time.ZoneId; - import java.time.format.DateTimeFormatter; - import java.util.List; -@@ -24,9 +25,11 @@ import net.minecraft.util.profiling.metrics.MetricCategory; +@@ -24,8 +25,9 @@ import net.minecraft.util.profiling.metrics.MetricCategory; import net.minecraft.util.profiling.metrics.MetricSampler; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; + */ // Plazma - Completely remove Mojang Profiler -public class MetricsPersister { -+public interface MetricsPersister { // Plazma - Completely remove Mojang Profiler ++interface MetricsPersister { /* // Plazma - Completely remove Mojang Profiler public static final Path PROFILING_RESULTS_DIR = Paths.get("debug/profiling"); -+ /* // Plazma - Completely remove Mojang Profiler public static final String METRICS_DIR_NAME = "metrics"; public static final String DEVIATIONS_DIR_NAME = "deviations"; - public static final String PROFILING_RESULT_FILENAME = "profiling.txt"; -@@ -126,4 +129,5 @@ public class MetricsPersister { +@@ -122,4 +124,5 @@ public class MetricsPersister { private void saveProfilingTaskExecutionResult(ProfileResults result, Path directory) { result.saveResults(directory.resolve("profiling.txt")); } -+ */ // Plazma - Completely remove Mojang Profiler ++ */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/util/profiling/metrics/storage/RecordedDeviation.java b/src/main/java/net/minecraft/util/profiling/metrics/storage/RecordedDeviation.java -index f012d23b22b1a9d1acb6c020c66dc727f7fe9e1a..23cf0ff4c86c3d05668b1ed176364606a9a66056 100644 +index f012d23b22b1a9d1acb6c020c66dc727f7fe9e1a..0f8874fa65e2614388cdf3f79d714b600697191e 100644 --- a/src/main/java/net/minecraft/util/profiling/metrics/storage/RecordedDeviation.java +++ b/src/main/java/net/minecraft/util/profiling/metrics/storage/RecordedDeviation.java @@ -1,9 +1,11 @@ package net.minecraft.util.profiling.metrics.storage; -+/* // Plazma - Completely remove Mojang Profiler ++/* // Plazma - Completely remove Mojang Profiler import java.time.Instant; import net.minecraft.util.profiling.ProfileResults; + */ // Plazma - Completely remove Mojang Profiler @@ -801,10 +1119,96 @@ index f012d23b22b1a9d1acb6c020c66dc727f7fe9e1a..23cf0ff4c86c3d05668b1ed176364606 this.tick = ticks; this.profilerResultAtTick = result; } ++ */ // Plazma - Completely remove Mojang Profiler + } +diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +index d0dbe7e3c7c9c2727d5de456808765b2666108e4..698fb4881fe754502196fcc93fa636ba4e858cdd 100644 +--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java ++++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +@@ -10,13 +10,13 @@ import java.util.concurrent.Executor; + import java.util.concurrent.locks.LockSupport; + import java.util.function.BooleanSupplier; + import java.util.function.Supplier; +-import net.minecraft.util.profiling.metrics.MetricCategory; +-import net.minecraft.util.profiling.metrics.MetricSampler; +-import net.minecraft.util.profiling.metrics.MetricsRegistry; +-import net.minecraft.util.profiling.metrics.ProfilerMeasured; ++// import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.metrics.MetricSampler; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.metrics.MetricsRegistry; // Plazma - Completely remove Mojang Profiler ++// import net.minecraft.util.profiling.metrics.ProfilerMeasured; // Plazma - Completely remove Mojang Profiler + import org.slf4j.Logger; + +-public abstract class BlockableEventLoop implements ProfilerMeasured, ProcessorHandle, Executor { ++public abstract class BlockableEventLoop implements /*ProfilerMeasured,*/ ProcessorHandle, Executor { // Plazma - Completely remove Mojang Profiler + private final String name; + private static final Logger LOGGER = LogUtils.getLogger(); + private final Queue pendingRunnables = Queues.newConcurrentLinkedQueue(); +@@ -24,7 +24,7 @@ public abstract class BlockableEventLoop implements Profiler + + protected BlockableEventLoop(String name) { + this.name = name; +- MetricsRegistry.INSTANCE.add(this); ++ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang Profiler + } + + protected abstract R wrapRunnable(Runnable runnable); +@@ -153,8 +153,10 @@ public abstract class BlockableEventLoop implements Profiler + } + } + ++ /* // Plazma - Completely remove Mojang Profiler + @Override + public List profiledMetrics() { + return ImmutableList.of(MetricSampler.create(this.name + "-pending-tasks", MetricCategory.EVENT_LOOPS, this::getPendingTasksCount)); + } ++ */ // Plazma - Completely remove Mojang Profiler + } +diff --git a/src/main/java/net/minecraft/util/thread/ProcessorMailbox.java b/src/main/java/net/minecraft/util/thread/ProcessorMailbox.java +index 97c129f5949ca7cb7430e1cf56e881c00f129530..45d6803d6627c383ea99c74699994ee08acd9afe 100644 +--- a/src/main/java/net/minecraft/util/thread/ProcessorMailbox.java ++++ b/src/main/java/net/minecraft/util/thread/ProcessorMailbox.java +@@ -9,13 +9,13 @@ import java.util.concurrent.Executor; + import java.util.concurrent.RejectedExecutionException; + import java.util.concurrent.atomic.AtomicInteger; + import net.minecraft.Util; +-import net.minecraft.util.profiling.metrics.MetricCategory; +-import net.minecraft.util.profiling.metrics.MetricSampler; +-import net.minecraft.util.profiling.metrics.MetricsRegistry; +-import net.minecraft.util.profiling.metrics.ProfilerMeasured; ++//import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang Profiler ++//import net.minecraft.util.profiling.metrics.MetricSampler; // Plazma - Completely remove Mojang Profiler ++//import net.minecraft.util.profiling.metrics.MetricsRegistry; // Plazma - Completely remove Mojang Profiler ++//import net.minecraft.util.profiling.metrics.ProfilerMeasured; // Plazma - Completely remove Mojang Profiler + import org.slf4j.Logger; + +-public class ProcessorMailbox implements ProfilerMeasured, ProcessorHandle, AutoCloseable, Runnable { ++public class ProcessorMailbox implements /*ProfilerMeasured,*/ ProcessorHandle, AutoCloseable, Runnable { + private static final Logger LOGGER = LogUtils.getLogger(); + private static final int CLOSED_BIT = 1; + private static final int SCHEDULED_BIT = 2; +@@ -32,7 +32,7 @@ public class ProcessorMailbox implements ProfilerMeasured, ProcessorHandle + this.dispatcher = executor; + this.queue = queue; + this.name = name; +- MetricsRegistry.INSTANCE.add(this); ++ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang Profiler + } + + private boolean setAsScheduled() { +@@ -151,8 +151,10 @@ public class ProcessorMailbox implements ProfilerMeasured, ProcessorHandle + return this.name; + } + ++ /* // Plazma - Completely remove Mojang Profiler + @Override + public List profiledMetrics() { + return ImmutableList.of(MetricSampler.create(this.name + "-queue-size", MetricCategory.MAIL_BOXES, this::size)); + } + */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 1d1688fafc438a5957096118790d44fbd55476bb..546b14cc2cf0c4145a059142aa33ad113d7479bf 100644 +index dd275ece5887f5215cb785564af27152b29b370e..41ee792f572b13054084b9ad6c6e4cf67ed10290 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -149,8 +149,8 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -813,16 +1217,16 @@ index 1d1688fafc438a5957096118790d44fbd55476bb..546b14cc2cf0c4145a059142aa33ad11 this.restrictRadius = -1.0F; - this.goalSelector = new GoalSelector(world.getProfilerSupplier()); - this.targetSelector = new GoalSelector(world.getProfilerSupplier()); -+ this.goalSelector = new GoalSelector(); //world.getProfilerSupplier()); // Plazma - Completely remove Mojang Profiler -+ this.targetSelector = new GoalSelector(); //world.getProfilerSupplier()); // Plazma - Completely remove Mojang Profiler ++ this.goalSelector = new GoalSelector(/*world.getProfilerSupplier()*/); // Plazma - Completely remove Mojang Profiler ++ this.targetSelector = new GoalSelector(/*world.getProfilerSupplier()*/); // Plazma - Completely remove Mojang Profiler this.lookControl = new org.purpurmc.purpur.controller.LookControllerWASD(this); // Purpur this.moveControl = new org.purpurmc.purpur.controller.MoveControllerWASD(this); // Purpur this.jumpControl = new JumpControl(this); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -index bb068bffc9e2f035dee90276156129ce750a7cd7..766349777b3b2d947e3b05dfaacae3e747806b86 100644 +index a2cca3d528625d49411a94e2b6ec578fec9b10da..8f73b73eb472683c9a5cd5aea1d8f57ed7d810ed 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -@@ -11,7 +11,7 @@ import java.util.Set; +@@ -12,7 +12,7 @@ import java.util.Map.Entry; import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Stream; @@ -831,7 +1235,7 @@ index bb068bffc9e2f035dee90276156129ce750a7cd7..766349777b3b2d947e3b05dfaacae3e7 import org.slf4j.Logger; public class GoalSelector { -@@ -29,7 +29,7 @@ public class GoalSelector { +@@ -30,7 +30,7 @@ public class GoalSelector { }; private final Map lockedFlags = new EnumMap<>(Goal.Flag.class); private final Set availableGoals = Sets.newLinkedHashSet(); @@ -840,7 +1244,7 @@ index bb068bffc9e2f035dee90276156129ce750a7cd7..766349777b3b2d947e3b05dfaacae3e7 private final EnumSet disabledFlags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector private int tickCount; -@@ -37,9 +37,11 @@ public class GoalSelector { +@@ -38,9 +38,11 @@ public class GoalSelector { private int curRate; private static final Goal.Flag[] GOAL_FLAG_VALUES = Goal.Flag.values(); // Paper - remove streams from pathfindergoalselector @@ -875,7 +1279,7 @@ index d87124f5356180a37e581febc6141fdc5f1395a7..681e3fcd759a26578e054f88e8048e39 // CraftBukkit start - SPIGOT-5667 make sure all types are populated and mutable Map, Object2ObjectLinkedOpenHashMap>> map1 = Maps.newHashMap(); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c4bfdf19651a3c8ef66795a6c7f5a29c72f9ee2d..4eb8cab1f7f2d3d2dcba15bb0bd64b60c027882a 100644 +index 7578b6d4ee52ebafea16b7eaf88dcedbd1f093d8..16e6716f70d5b9090f29f8b2320302d98dd087c2 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -36,7 +36,7 @@ import net.minecraft.sounds.SoundSource; @@ -883,7 +1287,7 @@ index c4bfdf19651a3c8ef66795a6c7f5a29c72f9ee2d..4eb8cab1f7f2d3d2dcba15bb0bd64b60 import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.util.profiling.ProfilerFiller; -+// import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler import net.minecraft.world.DifficultyInstance; import net.minecraft.world.TickRateManager; import net.minecraft.world.damagesource.DamageSource; @@ -892,11 +1296,11 @@ index c4bfdf19651a3c8ef66795a6c7f5a29c72f9ee2d..4eb8cab1f7f2d3d2dcba15bb0bd64b60 private final Holder dimensionTypeRegistration; public final WritableLevelData levelData; - private final Supplier profiler; -+ // private final Supplier profiler; // Plazma - Completely remove Mojang Profiler ++ //private final Supplier profiler; // Plazma - Completely remove Mojang Profiler public final boolean isClientSide; private final WorldBorder worldBorder; private final BiomeManager biomeManager; -@@ -258,7 +258,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -267,7 +267,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { //protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter // Purpur - dont break ABI @@ -905,7 +1309,7 @@ index c4bfdf19651a3c8ef66795a6c7f5a29c72f9ee2d..4eb8cab1f7f2d3d2dcba15bb0bd64b60 this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.plazmaConfig = plazmaWorldConfigurationCreator.apply(this.spigotConfig); // Plazma - Configurable Plazma -@@ -275,7 +275,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -284,7 +284,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } // CraftBukkit end @@ -914,7 +1318,7 @@ index c4bfdf19651a3c8ef66795a6c7f5a29c72f9ee2d..4eb8cab1f7f2d3d2dcba15bb0bd64b60 this.levelData = worlddatamutable; this.dimensionTypeRegistration = holder; this.dimensionTypeId = (ResourceKey) holder.unwrapKey().orElseThrow(() -> { -@@ -1841,6 +1841,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1850,6 +1850,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return false; } @@ -922,7 +1326,7 @@ index c4bfdf19651a3c8ef66795a6c7f5a29c72f9ee2d..4eb8cab1f7f2d3d2dcba15bb0bd64b60 public ProfilerFiller getProfiler() { if (true || gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish // Purpur return (ProfilerFiller) this.profiler.get(); -@@ -1849,6 +1850,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1858,6 +1859,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public Supplier getProfilerSupplier() { return this.profiler; } @@ -931,7 +1335,7 @@ index c4bfdf19651a3c8ef66795a6c7f5a29c72f9ee2d..4eb8cab1f7f2d3d2dcba15bb0bd64b60 @Override public BiomeManager getBiomeManager() { diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java -index 0f1025495237aebe30132ace0832aa5718d6f9bb..cb12c0a7db86a1f3e1e34a9fbe0b67e5d5a64741 100644 +index c5454b92ca2565461c799d7340160f9fb72c1b0f..9c242badd7e13f522e2b3c501d2fbbf5958b07b3 100644 --- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java +++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java @@ -8,7 +8,7 @@ import net.minecraft.core.BlockPos; @@ -943,7 +1347,7 @@ index 0f1025495237aebe30132ace0832aa5718d6f9bb..cb12c0a7db86a1f3e1e34a9fbe0b67e5 import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.biome.Biome; -@@ -155,7 +155,9 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { +@@ -152,7 +152,9 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { return this.level.getHeight(); } @@ -954,7 +1358,7 @@ index 0f1025495237aebe30132ace0832aa5718d6f9bb..cb12c0a7db86a1f3e1e34a9fbe0b67e5 + */ // Plazma - Completely remove Mojang Profiler } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 1b49ecbf8fdbe8b734f8ca5191dc9ed70aa66af7..88bf97e8a8242b5bf182ec84688671ca5a6106cb 100644 +index 97724cbd6c1bf172379e98d4a3f6e8cda5cda823..17a13cc7b681afc9131fb919604a352961b81f60 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -25,7 +25,7 @@ import net.minecraft.network.FriendlyByteBuf; @@ -976,7 +1380,7 @@ index 1b49ecbf8fdbe8b734f8ca5191dc9ed70aa66af7..88bf97e8a8242b5bf182ec84688671ca //gameprofilerfiller.push("updateSkyLightSources"); // Purpur // Paper - starlight - remove skyLightSources diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index f039d6109ee6f55542adc8f30476ba9a9e4974bf..c61d12cfc5e169df825d83cb946eb0be93d312db 100644 +index 2046ac397f5c46cc45f233e36abbdbe717753fc7..2363169eaa8a4bf84810e7b46811ac23ca2d56e8 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java @@ -12,8 +12,8 @@ import java.util.function.Function; @@ -985,8 +1389,8 @@ index f039d6109ee6f55542adc8f30476ba9a9e4974bf..c61d12cfc5e169df825d83cb946eb0be import net.minecraft.core.BlockPos; -import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.util.profiling.metrics.MetricCategory; -+// import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler -+// import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang Profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang Profiler ++//import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang Profiler import net.minecraft.world.entity.Mob; import net.minecraft.world.level.PathNavigationRegion; @@ -1031,10 +1435,10 @@ index 3ddf6ab00de2456ebf504985b88994f970e3b5c4..61c36d6d2a4a958ca63adbd2b4f68052 CompletableFuture[] acompletablefuture = (CompletableFuture[]) LootDataType.values().map((lootdatatype) -> { return LootDataManager.scheduleElementParse(lootdatatype, manager, prepareExecutor, map); diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java -index 0043c0087896a6df6910b0500da37d84b287c901..af959513cdbccafd86e2d747aea3e1518ebc6792 100644 +index a6d62abd3102770652f914b9d697c6d3c2533cfc..bc46276b820b81b7686c31e1ccfb4a4be99fa812 100644 --- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java +++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java -@@ -23,7 +23,7 @@ import net.minecraft.Util; +@@ -24,14 +24,14 @@ import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.core.Vec3i; @@ -1043,17 +1447,16 @@ index 0043c0087896a6df6910b0500da37d84b287c901..af959513cdbccafd86e2d747aea3e151 import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.levelgen.structure.BoundingBox; -@@ -32,7 +32,7 @@ public class LevelTicks implements LevelTickAccess { - return ScheduledTick.INTRA_TICK_DRAIN_ORDER.compare(a.peek(), b.peek()); - }; + public class LevelTicks implements LevelTickAccess { + private static final Comparator> CONTAINER_DRAIN_ORDER = (a, b) -> ScheduledTick.INTRA_TICK_DRAIN_ORDER.compare(a.peek(), b.peek()); private final LongPredicate tickCheck; - private final Supplier profiler; + //private final Supplier profiler; // Plazma - Completely remove Mojang Profiler private final Long2ObjectMap> allContainers = new Long2ObjectOpenHashMap<>(); - private final Long2LongMap nextTickForContainer = Util.make(new Long2LongOpenHashMap(), (map) -> { - map.defaultReturnValue(Long.MAX_VALUE); -@@ -48,9 +48,9 @@ public class LevelTicks implements LevelTickAccess { - + private final Long2LongMap nextTickForContainer = Util.make(new Long2LongOpenHashMap(), map -> map.defaultReturnValue(Long.MAX_VALUE)); + private final Queue> containersToTick = new PriorityQueue<>(CONTAINER_DRAIN_ORDER); +@@ -44,9 +44,9 @@ public class LevelTicks implements LevelTickAccess { + } }; - public LevelTicks(LongPredicate tickingFutureReadyPredicate, Supplier profilerGetter) { @@ -1064,16 +1467,16 @@ index 0043c0087896a6df6910b0500da37d84b287c901..af959513cdbccafd86e2d747aea3e151 } public void addContainer(ChunkPos pos, LevelChunkTicks scheduler) { -@@ -88,7 +88,7 @@ public class LevelTicks implements LevelTickAccess { +@@ -83,7 +83,7 @@ public class LevelTicks implements LevelTickAccess { public void tick(long time, int maxTicks, BiConsumer ticker) { //ProfilerFiller profilerFiller = this.profiler.get(); // Purpur //profilerFiller.push("collect"); // Purpur - this.collectTicks(time, maxTicks, null); // Purpur -+ this.collectTicks(time, maxTicks); // Purpur // Plazma - Completely remove Mojang Profiler ++ this.collectTicks(time, maxTicks/*, null*/); // Purpur // Plazma - Completely remove Mojang Profiler //profilerFiller.popPush("run"); // Purpur //profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); // Purpur this.runCollectedTicks(ticker); -@@ -97,7 +97,7 @@ public class LevelTicks implements LevelTickAccess { +@@ -92,7 +92,7 @@ public class LevelTicks implements LevelTickAccess { //profilerFiller.pop(); // Purpur } diff --git a/patches/server/0018-Add-option-to-change-nether-portal-size.patch b/patches/server/0017-Add-option-to-change-nether-portal-size.patch similarity index 97% rename from patches/server/0018-Add-option-to-change-nether-portal-size.patch rename to patches/server/0017-Add-option-to-change-nether-portal-size.patch index 2891b89..83b007c 100644 --- a/patches/server/0018-Add-option-to-change-nether-portal-size.patch +++ b/patches/server/0017-Add-option-to-change-nether-portal-size.patch @@ -36,7 +36,7 @@ index 46910a3bdacc9df1835e16b300f9e107744d2660..9b372b494b831c374bab478267309544 // CraftBukkit start - return boolean diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index a372b5be3b1da5868d3766a8ba58997a48118581..d79410cc8b6054e5d3297b3e768fb232f97062e4 100644 +index 42d639688b6f0b9ff53debf49a920f5c8e232a19..36728e206de513e071f387d36a608e70a5984a58 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -42,6 +42,21 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0019-Reduce-create-random-instance.patch b/patches/server/0018-Reduce-create-random-instance.patch similarity index 89% rename from patches/server/0019-Reduce-create-random-instance.patch rename to patches/server/0018-Reduce-create-random-instance.patch index 24b8cc9..82497e7 100644 --- a/patches/server/0019-Reduce-create-random-instance.patch +++ b/patches/server/0018-Reduce-create-random-instance.patch @@ -4,18 +4,6 @@ Date: Wed, 27 Sep 2023 21:18:22 +0900 Subject: [PATCH] Reduce create random instance -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c153becedc7c8573dc1d8a736581db2a31a8d4f5..fcc197256be00621bb3875c20849fe083a453c5c 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -236,6 +236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> SUSPECT_ANGER_PAIR = RecordCodecBuilder.create((instance) -> { - return instance.group(UUIDUtil.CODEC.fieldOf("uuid").forGetter(Pair::getFirst), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("anger").forGetter(Pair::getSecond)).apply(instance, Pair::of); + private static final Codec> SUSPECT_ANGER_PAIR = RecordCodecBuilder.create( + instance -> instance.group( diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java index 752b38d45d59d8b3cd492246e5aa4f378a78734d..38b534e4613641046ed3cd048f52dff0888acda2 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java @@ -143,10 +131,10 @@ index 91497f5e6c07fcf1b05eca6846c51e1a15ed3bc0..1317d8289898798a9d86a4c995a4a1a3 this.currentState = FishingHook.FishHookState.FLYING; this.noCulling = true; diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java -index eaa2943b667967f93f28d9d794d702fdaeb670ec..689a4ee7b3f136b14e8e56709cac7d2da89c8efd 100644 +index bf2c23fad919820512ce031cf28a000b249b2876..cb81994735650ec7c54b3f5a97d94e069d254c35 100644 --- a/src/main/java/net/minecraft/world/entity/raid/Raid.java +++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java -@@ -109,7 +109,7 @@ public class Raid { +@@ -114,7 +114,7 @@ public class Raid { public Raid(int id, ServerLevel world, BlockPos pos) { this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10); @@ -155,7 +143,7 @@ index eaa2943b667967f93f28d9d794d702fdaeb670ec..689a4ee7b3f136b14e8e56709cac7d2d this.waveSpawnPos = Optional.empty(); this.id = id; this.level = world; -@@ -123,7 +123,7 @@ public class Raid { +@@ -128,7 +128,7 @@ public class Raid { public Raid(ServerLevel world, CompoundTag nbt) { this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10); @@ -165,7 +153,7 @@ index eaa2943b667967f93f28d9d794d702fdaeb670ec..689a4ee7b3f136b14e8e56709cac7d2d this.level = world; this.id = nbt.getInt("Id"); diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java -index 849b6a30d412d10f1e2e6e88f2d8d990e4a720e4..5534c8c65588724f2c6f178caacc2ddabad9a9e3 100644 +index 1a686780e5aadcbdcfceb770ce8e283b38115209..6c1ba9631e56c336ed3ddee8e6435734597a3aa3 100644 --- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java +++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java @@ -97,7 +97,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { @@ -178,7 +166,7 @@ index 849b6a30d412d10f1e2e6e88f2d8d990e4a720e4..5534c8c65588724f2c6f178caacc2dda this.costs = new int[3]; this.enchantClue = new int[]{-1, -1, -1}; diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 059e545fd04b7919fb0cc86797b636e3cda61027..8c90c4ff41b2a12cb6ba70d0bc80755ba8246872 100644 +index 0be03430d8257d918b7cf646af518473ae027399..824f210af6d8467ed596ece1573740d99b92b7ba 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -92,7 +92,7 @@ public class Explosion { @@ -191,7 +179,7 @@ index 059e545fd04b7919fb0cc86797b636e3cda61027..8c90c4ff41b2a12cb6ba70d0bc80755b this.hitPlayers = Maps.newHashMap(); this.level = world; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 4eb8cab1f7f2d3d2dcba15bb0bd64b60c027882a..11c864f3947b93f0ebeae8c6fd006a5891162b44 100644 +index 16e6716f70d5b9090f29f8b2320302d98dd087c2..72420d9e79d4b480fa060f9b910cea7b677a1427 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -122,16 +122,16 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -214,10 +202,10 @@ index 4eb8cab1f7f2d3d2dcba15bb0bd64b60c027882a..11c864f3947b93f0ebeae8c6fd006a58 private final Holder dimensionTypeRegistration; public final WritableLevelData levelData; diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index 1b150b9fc444a248f6c01572447c7bb8eecfc76e..9579f730c8de447bed6634d0e2af85547949698b 100644 +index 4997f120aa9877c199fbcaa0c2f65226e13b5a23..af393eaf3d21a260f0bfff5eaeb78c389161bffd 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -@@ -369,7 +369,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { +@@ -363,7 +363,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { } private static void spawnGatewayPortal(ServerLevel world, BlockPos pos, EndGatewayConfiguration config) { @@ -293,7 +281,7 @@ index 1309fabd357eb9b8f90f882ec7ff3de9e60f187d..d300668899c3382a42e6a25dd084fb81 // Paper start - Expose firework item directly // ItemStack item = this.getHandle().getEntityData().get(FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM); diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 294fdbba44191427a841f8ac82b18ed8d706f53e..be9e364a02eb872940443e3ba3349c3ccad3cb0f 100644 +index f7457660566d64a8149db414e005f0b8ed2202b5..d922c572e2410fa1f719fe2371f65cd1542ca8b4 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -64,6 +64,8 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -306,7 +294,7 @@ index 294fdbba44191427a841f8ac82b18ed8d706f53e..be9e364a02eb872940443e3ba3349c3c } diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index d79410cc8b6054e5d3297b3e768fb232f97062e4..e9850b634c4e9bbebea6534690632b067b69b0b6 100644 +index 36728e206de513e071f387d36a608e70a5984a58..c8b10b3499fbdf41f0b268d8a9da729e3432bb66 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -22,6 +22,7 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0020-Apply-various-optimizations.patch b/patches/server/0019-Apply-various-optimizations.patch similarity index 94% rename from patches/server/0020-Apply-various-optimizations.patch rename to patches/server/0019-Apply-various-optimizations.patch index 28e343f..2ef1b64 100644 --- a/patches/server/0020-Apply-various-optimizations.patch +++ b/patches/server/0019-Apply-various-optimizations.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Apply various optimizations Akarin - Swaps the predicate order of collision diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2092ede561d14ace1c003ced051cd4967bb41beb..0cf2180519457817a5985cf34e5564cd0ec1b1a2 100644 +index f2c6b52fe7fbb05afa0074684cd195f6ae598f1f..f16a347e0e263a0479a73cb14626e31c9de37e6c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2154,8 +2154,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0021-Avoid-double-I-O-operation-on-load-player-file.patch b/patches/server/0020-Avoid-double-I-O-operation-on-load-player-file.patch similarity index 94% rename from patches/server/0021-Avoid-double-I-O-operation-on-load-player-file.patch rename to patches/server/0020-Avoid-double-I-O-operation-on-load-player-file.patch index 1b72f40..b321a5a 100644 --- a/patches/server/0021-Avoid-double-I-O-operation-on-load-player-file.patch +++ b/patches/server/0020-Avoid-double-I-O-operation-on-load-player-file.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Avoid double I/O operation on load player file diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -index 63e187c65cb855031f286aad0d25ac4694f7a331..3dca62446fbb7c92f5f2908b36926bbe5e905dbb 100644 +index e0f085169fafa5e574caf368efa343514540b348..042617c7de30707f66e60536cebc31e210647b64 100644 --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java @@ -60,7 +60,8 @@ public class PlayerDataStorage { diff --git a/patches/server/0022-Do-not-refresh-LootTable-for-non-player-interaction.patch b/patches/server/0021-Do-not-refresh-LootTable-for-non-player-interaction.patch similarity index 90% rename from patches/server/0022-Do-not-refresh-LootTable-for-non-player-interaction.patch rename to patches/server/0021-Do-not-refresh-LootTable-for-non-player-interaction.patch index 82d5e6e..f6be859 100644 --- a/patches/server/0022-Do-not-refresh-LootTable-for-non-player-interaction.patch +++ b/patches/server/0021-Do-not-refresh-LootTable-for-non-player-interaction.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Do not refresh LootTable for non player interaction diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java -index b41635dd0569ff7df909df492d3e850aef7214be..afc567b789ee003e1b10059db2864a423c682669 100644 +index fa64bf5ad13c278438039b663ea3134e72108411..3ec9cb7c98cd5d3cb26e4a27174a75fe243c81c0 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java @@ -68,6 +68,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc @@ -17,7 +17,7 @@ index b41635dd0569ff7df909df492d3e850aef7214be..afc567b789ee003e1b10059db2864a42 net.minecraft.world.level.Level level = this.getLevel(); BlockPos blockPos = this.getBlockPos(); diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index be9e364a02eb872940443e3ba3349c3ccad3cb0f..472069754c6e297474578ff237ae8d02c827b61c 100644 +index d922c572e2410fa1f719fe2371f65cd1542ca8b4..a060257a62da7ed02b342b426e18e5f02ecdbdc9 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -66,6 +66,7 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0023-Do-not-load-chunks-to-spawn-phantom.patch b/patches/server/0022-Do-not-load-chunks-to-spawn-phantom.patch similarity index 95% rename from patches/server/0023-Do-not-load-chunks-to-spawn-phantom.patch rename to patches/server/0022-Do-not-load-chunks-to-spawn-phantom.patch index b6ce3f9..6a41f78 100644 --- a/patches/server/0023-Do-not-load-chunks-to-spawn-phantom.patch +++ b/patches/server/0022-Do-not-load-chunks-to-spawn-phantom.patch @@ -17,7 +17,7 @@ index 0847aef56d8608cb1403485f231f30b2527f35ab..fee30f686a5d1ee50a00c2073efd5b0a FluidState fluid = world.getFluidState(blockposition1); diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index e9850b634c4e9bbebea6534690632b067b69b0b6..036c0b12553ae203e8c73d44dc2e3d625b812af5 100644 +index c8b10b3499fbdf41f0b268d8a9da729e3432bb66..922d1d250f2e2e5a4177bcf5fe7487ff2b43413b 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -32,6 +32,7 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0024-Add-option-to-disable-moved-to-quickly-check-for-spe.patch b/patches/server/0023-Add-option-to-disable-moved-to-quickly-check-for-spe.patch similarity index 91% rename from patches/server/0024-Add-option-to-disable-moved-to-quickly-check-for-spe.patch rename to patches/server/0023-Add-option-to-disable-moved-to-quickly-check-for-spe.patch index d0b7818..b8dbcb2 100644 --- a/patches/server/0024-Add-option-to-disable-moved-to-quickly-check-for-spe.patch +++ b/patches/server/0023-Add-option-to-disable-moved-to-quickly-check-for-spe.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add option to disable moved to quickly check for specific diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ae5a2152cde8922deeb8d1d8a85bf39518ccd759..d4672d73df93c597a19e98e5d9b7dfa377b3f200 100644 +index f7ac60e1aa188ec25a4c5d326cdd4a109a54101c..613f12a7194920690c42ffca2fdf6908700516e5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1472,6 +1472,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -18,7 +18,7 @@ index ae5a2152cde8922deeb8d1d8a85bf39518ccd759..d4672d73df93c597a19e98e5d9b7dfa3 float f2 = this.player.isFallFlying() ? 300.0F : 100.0F; diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 472069754c6e297474578ff237ae8d02c827b61c..e1c4551a83f8ce996ebed3e2ba7bf50cd532d6ac 100644 +index a060257a62da7ed02b342b426e18e5f02ecdbdc9..f7e4d14a7eaa3e35c9b03f3c6a01ae8712ded569 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -27,6 +27,7 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0026-Ignore-useless-entity-packets.patch b/patches/server/0024-Ignore-useless-entity-packets.patch similarity index 96% rename from patches/server/0026-Ignore-useless-entity-packets.patch rename to patches/server/0024-Ignore-useless-entity-packets.patch index e4912b8..a5ce977 100644 --- a/patches/server/0026-Ignore-useless-entity-packets.patch +++ b/patches/server/0024-Ignore-useless-entity-packets.patch @@ -40,7 +40,7 @@ index cf098d4a3111771c13766285c5ec5f1fc1f539a4..433e9a06db191f8a0ff6c23d1ac61226 this.entity.stopSeenByPlayer(player); player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()})); diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 036c0b12553ae203e8c73d44dc2e3d625b812af5..909a74c19501d9440f3d2435b6514d738efcfc05 100644 +index 922d1d250f2e2e5a4177bcf5fe7487ff2b43413b..c8a3e91d0d6510b519e927027f5a534cddf7d0a3 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -29,6 +29,8 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0025-Implement-No-Chat-Reports.patch b/patches/server/0025-Implement-No-Chat-Reports.patch deleted file mode 100644 index 0d4297d..0000000 --- a/patches/server/0025-Implement-No-Chat-Reports.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Thu, 28 Sep 2023 11:47:50 +0900 -Subject: [PATCH] Implement No Chat Reports - -Implemented: 644bb6bb4a8012c75900c643d9863fe92c799e1d - -diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index bdcfd80f937c34956911373905d66424bbff8e1d..6c575aeeef323c8eb0837eb9d9eea8fcff21da17 100644 ---- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java -+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -@@ -145,9 +145,13 @@ public class FriendlyByteBuf extends ByteBuf { - // Paper end - Adventure; add max length parameter - DataResult dataresult = codec.encodeStart(JsonOps.INSTANCE, value); - -- this.writeUtf(FriendlyByteBuf.GSON.toJson((JsonElement) Util.getOrThrow(dataresult, (s) -> { -- return new EncoderException("Failed to encode: " + s + " " + value); -- })), maxLength); // Paper - Adventure; add max length parameter -+ // Plazma start - Implement No Chat Reports -+ JsonElement element = Util.getOrThrow(dataresult, s -> new EncoderException("Failed to encode: " + s + " " + value)); -+ if (codec == net.minecraft.network.protocol.status.ServerStatus.CODEC -+ && org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.queryData()) -+ element.getAsJsonObject().addProperty("preventsChatReports", true); -+ this.writeUtf(GSON.toJson(element), maxLength); -+ // Plazma end - Implement No Chat Reports - } - - public void writeId(IdMap registry, T value) { -diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java -index b8c1f3b9afddc87d56541c8af63cffecfcdd2653..4fe3de84fbbd16ecfe0b27922d5bfeaa9c89f61b 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java -@@ -24,4 +24,13 @@ public record ServerboundChatCommandPacket(String command, Instant timeStamp, lo - public void handle(ServerGamePacketListener listener) { - listener.handleChatCommand(this); - } -+ -+ // Plazma start - Implement No Chat Reports -+ @Override -+ public ArgumentSignatures argumentSignatures() { -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.enabled) -+ return ArgumentSignatures.EMPTY; -+ return this.argumentSignatures; -+ } -+ // Plazma end - Implement No Chat Reports - } -diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java -index d1d2fc0c57523c1abf1e8bfec913c78927c3dafc..bd69821b153b692b508505264899bdfda4805f0f 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java -@@ -25,4 +25,12 @@ public record ServerboundChatPacket(String message, Instant timeStamp, long salt - public void handle(ServerGamePacketListener listener) { - listener.handleChat(this); - } -+ -+ // Plazma start - Implement No Chat Reports -+ @Override -+ public @Nullable MessageSignature signature() { -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.enabled) return null; -+ return this.signature; -+ } -+ // Plazma end - Implement No Chat Reports - } -diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java -index 9d6db4a378036559efab91c8b7dcf2a6b0c2cce6..587d89d67afe9108b5e810463fb3cb21f1b8accf 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java -@@ -16,6 +16,15 @@ public record ServerboundChatSessionUpdatePacket(RemoteChatSession.Data chatSess - - @Override - public void handle(ServerGamePacketListener listener) { -+ // Plazma start - Implement No Chat Reports -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.requireModInstallation()) { -+ ((net.minecraft.server.network.ServerGamePacketListenerImpl) listener).disconnect( -+ net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.requireModInstallation.message), -+ org.bukkit.event.player.PlayerKickEvent.Cause.NCR_NOT_INSTALLED -+ ); -+ return; -+ } -+ // Plazma end - Implement No Chat Reports - listener.handleChatSessionUpdate(this); - } - } -diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 2a73508dd8a59c6af8b65ab2db97b6e20b104c57..eb6bcea28df735efe53ed62080bb726f7314c280 100644 ---- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -682,6 +682,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - - @Override - public boolean enforceSecureProfile() { -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.enabled) return false; // Plazma - Implement No Chat Reports - DedicatedServerProperties dedicatedserverproperties = this.getProperties(); - - // Paper start - Add setting for proxy online mode status -diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 02e65b0bd212d46855baee48fab35dc95a88b43f..59c96512dcdac551e9919c3893e1340f86e3e861 100644 ---- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -271,10 +271,31 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - } - - public void send(Packet packet) { -+ // Plazma start - Implement No Chat Reports -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.convertToSystemMessage() -+ && this instanceof ServerGamePacketListenerImpl impl -+ && packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket p) { -+ impl.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket( -+ p.chatType().resolve(impl.player.level().registryAccess()) -+ .orElseThrow().decorate(p.unsignedContent() != null ? p.unsignedContent() : Component.literal(p.body().content())), -+ false -+ )); -+ return; -+ } -+ // Plazma end - Implement No Chat Reports - this.send(packet, (PacketSendListener) null); - } - - public void send(Packet packet, @Nullable PacketSendListener callbacks) { -+ // Plazma start - Implement No Chat Reports -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.convertToSystemMessage() -+ && callbacks != null -+ && this instanceof ServerGamePacketListenerImpl impl -+ && packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket p) { -+ impl.send(p); -+ return; -+ } -+ // Plazma end - Implement No Chat Reports - // CraftBukkit start - if (packet == null || this.processedDisconnect) { // Spigot - return; -diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index ef4b1fb1532e1939d9a7e5337edc80b334b78318..f3b081abd82036c928655923c44a62a0e9889031 100644 ---- a/src/main/java/net/minecraft/server/players/PlayerList.java -+++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1499,6 +1499,7 @@ public abstract class PlayerList { - } - - public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.enabled) return true; // Plazma - Implement No Chat Reports - return message.hasSignature() && !message.hasExpiredServer(Instant.now()); - } - -diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index e1c4551a83f8ce996ebed3e2ba7bf50cd532d6ac..62d891f05b90b323f0282fe26665965a10c317e6 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -80,4 +80,22 @@ public class GlobalConfiguration extends ConfigurationPart { - - } - -+ public NoChatReports noChatReports; -+ public class NoChatReports extends ConfigurationPart { -+ -+ public boolean enabled = false; -+ boolean queryData = true; public boolean queryData() { return this.enabled && this.queryData; } -+ boolean convertToSystemMessage = true; public boolean convertToSystemMessage() { return this.enabled && this.convertToSystemMessage; } -+ public boolean requireModInstallation() { return this.enabled && this.requireModInstallation.enabled; } -+ -+ public RequireModInstallation requireModInstallation; -+ public class RequireModInstallation extends ConfigurationPart { -+ -+ boolean enabled = false; -+ public String message = "You do not have No Chat Reports, and this server is configured to require it on client!"; -+ -+ } -+ -+ } -+ - } diff --git a/patches/server/0027-Improve-biome-temperature-cache.patch b/patches/server/0025-Improve-biome-temperture-cache.patch similarity index 73% rename from patches/server/0027-Improve-biome-temperature-cache.patch rename to patches/server/0025-Improve-biome-temperture-cache.patch index 377ba6b..0a3c874 100644 --- a/patches/server/0027-Improve-biome-temperature-cache.patch +++ b/patches/server/0025-Improve-biome-temperture-cache.patch @@ -1,25 +1,23 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: AlphaKR93 -Date: Mon, 6 Nov 2023 10:39:01 +0900 -Subject: [PATCH] Improve biome temperature cache +Date: Sat, 27 Apr 2024 14:14:49 +0900 +Subject: [PATCH] Improve biome temperture cache -[REFERENCE] -- FxMorin/MemoryLeakFix diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java -index efca73d4de33028cf9df944f36e51b7b50f7a4c5..a4aee46177a771c492d46e6996fb2c6e5eed3921 100644 +index 0c317b0147a73a8075e0883f0c132f4db0bdfea7..97c5cc3e2e6721321d9c500e331cab1aee37a0fc 100644 --- a/src/main/java/net/minecraft/world/level/biome/Biome.java +++ b/src/main/java/net/minecraft/world/level/biome/Biome.java -@@ -67,7 +67,7 @@ public final class Biome { +@@ -64,7 +64,7 @@ public final class Biome { private final MobSpawnSettings mobSettings; private final BiomeSpecialEffects specialEffects; // Pufferfish start - use our cache -- private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> { -+ private static final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> { // Plazma - Improve biome temperature cache - return Util.make(() -> { +- private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> Util.make(() -> { ++ private static final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> Util.make(() -> { // Plazma - Improve biome temperature cache /* Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) { -@@ -125,7 +125,7 @@ public final class Biome { + protected void rehash(int i) { +@@ -118,7 +118,7 @@ public final class Biome { public float getTemperature(BlockPos blockPos) { long l = blockPos.asLong(); // Pufferfish start diff --git a/patches/server/0028-Configurable-entity-sensor-tick.patch b/patches/server/0026-Configurable-entity-sensor-tick.patch similarity index 90% rename from patches/server/0028-Configurable-entity-sensor-tick.patch rename to patches/server/0026-Configurable-entity-sensor-tick.patch index 5073163..c189ea6 100644 --- a/patches/server/0028-Configurable-entity-sensor-tick.patch +++ b/patches/server/0026-Configurable-entity-sensor-tick.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable entity sensor tick diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 546b14cc2cf0c4145a059142aa33ad113d7479bf..0c1e3cb455d2a184ab9f0084d10bd7cde83f9027 100644 +index 41ee792f572b13054084b9ad6c6e4cf67ed10290..0d83baabdfabff925c11d363a78414afebe513d3 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -938,10 +938,11 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -22,7 +22,7 @@ index 546b14cc2cf0c4145a059142aa33ad113d7479bf..0c1e3cb455d2a184ab9f0084d10bd7cd //this.level().getProfiler().push("targetSelector"); // Purpur if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 909a74c19501d9440f3d2435b6514d738efcfc05..b036b54d551c892cc48d0a6816382bce5e38efd4 100644 +index c8a3e91d0d6510b519e927027f5a534cddf7d0a3..bc283729cab4df2c596febf1df54241571227564 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -30,6 +30,7 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0029-Configurable-cave-lava-sea-level.patch b/patches/server/0027-Configurable-cave-lava-sea-level.patch similarity index 97% rename from patches/server/0029-Configurable-cave-lava-sea-level.patch rename to patches/server/0027-Configurable-cave-lava-sea-level.patch index 5c5f4bd..0d5b060 100644 --- a/patches/server/0029-Configurable-cave-lava-sea-level.patch +++ b/patches/server/0027-Configurable-cave-lava-sea-level.patch @@ -26,7 +26,7 @@ index 98c7f695093acbcf9382a5f07a7a89e373709763..a85b1ebb4236f131b9be0104c4aa56f2 int i = settings.seaLevel(); Aquifer.FluidStatus aquifer_b1 = new Aquifer.FluidStatus(i, settings.defaultFluid()); diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 3e1d646ead7105f4955d47cb224f23ee4d9e3e69..7408401e7e9bd80c1e179c5eca994294f4c01950 100644 +index f7e4d14a7eaa3e35c9b03f3c6a01ae8712ded569..4f3ed01e12ccb8a6f1a5c4f605451bb36370a236 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -35,6 +35,25 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0030-Variable-entity-wakeup-duration.patch b/patches/server/0028-Variable-entity-wakeup-duration.patch similarity index 95% rename from patches/server/0030-Variable-entity-wakeup-duration.patch rename to patches/server/0028-Variable-entity-wakeup-duration.patch index dd2a6df..9b8b96b 100644 --- a/patches/server/0030-Variable-entity-wakeup-duration.patch +++ b/patches/server/0028-Variable-entity-wakeup-duration.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Variable entity wakeup duration diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index b036b54d551c892cc48d0a6816382bce5e38efd4..459cba838468b95547b2a515c497fcbb7bd45718 100644 +index bc283729cab4df2c596febf1df54241571227564..1e7c23c8851ba1d0f37d2b17fd334220e060888e 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -39,6 +39,20 @@ public class WorldConfigurations extends ConfigurationPart { @@ -30,7 +30,7 @@ index b036b54d551c892cc48d0a6816382bce5e38efd4..459cba838468b95547b2a515c497fcbb public Structure structure; diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 2e9aed328e576abbe216fdb2071c13421e6645b8..cb6ad8ffef606a4074fa2ef4a5f92438124e8f11 100644 +index 56e52b16b419c882440a15947f037ae1a902bc70..583647f6c9ca0fb092f30c97693bd548f692dfd3 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -68,29 +68,36 @@ public class ActivationRange diff --git a/patches/server/0031-Optimise-state-lookup-more.patch b/patches/server/0029-Optimise-state-lookup-more.patch similarity index 91% rename from patches/server/0031-Optimise-state-lookup-more.patch rename to patches/server/0029-Optimise-state-lookup-more.patch index dc8f708..a1e1afa 100644 --- a/patches/server/0031-Optimise-state-lookup-more.patch +++ b/patches/server/0029-Optimise-state-lookup-more.patch @@ -17,10 +17,10 @@ index 57d0cd3ad6f972e986c72a57f1a6e36003f190c2..50d97c5ab33f33b81dbafd7cf42da5af public ZeroCollidingReferenceStateTable(final StateHolder state, final Map, Comparable> this_map) { diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -index 5f285d190186a2ff5a61d05070593e1d633dd79a..bcb0ba74f4162437d43199d365ff468222f59985 100644 +index 2630f54d499abbe52798f97c8ea14a8d0bd75e99..014ccbafd8beecb7f3bfeea0cdaa6627a81796bd 100644 --- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java +++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -@@ -114,6 +114,12 @@ public abstract class StateHolder { +@@ -115,6 +115,12 @@ public abstract class StateHolder { } public , V extends T> S trySetValue(Property property, V value) { @@ -33,7 +33,7 @@ index 5f285d190186a2ff5a61d05070593e1d633dd79a..bcb0ba74f4162437d43199d365ff4682 Comparable comparable = this.values.get(property); if (comparable != null && !comparable.equals(value)) { S object = this.neighbours.get(property, value); -@@ -125,10 +131,11 @@ public abstract class StateHolder { +@@ -126,10 +132,11 @@ public abstract class StateHolder { } else { return (S)this; } @@ -46,7 +46,7 @@ index 5f285d190186a2ff5a61d05070593e1d633dd79a..bcb0ba74f4162437d43199d365ff4682 throw new IllegalStateException(); } else { Table, Comparable, S> table = HashBasedTable.create(); -@@ -143,7 +150,7 @@ public abstract class StateHolder { +@@ -144,7 +151,7 @@ public abstract class StateHolder { } } diff --git a/patches/server/0032-Suppress-errors-from-dirty-attributes.patch b/patches/server/0030-Suppress-errors-from-dirty-attributes.patch similarity index 95% rename from patches/server/0032-Suppress-errors-from-dirty-attributes.patch rename to patches/server/0030-Suppress-errors-from-dirty-attributes.patch index 03b28c1..7b0f4ac 100644 --- a/patches/server/0032-Suppress-errors-from-dirty-attributes.patch +++ b/patches/server/0030-Suppress-errors-from-dirty-attributes.patch @@ -28,7 +28,7 @@ index 433e9a06db191f8a0ff6c23d1ac6122606e67959..149ea6b62c88200ecfc50c825a1dcdff } diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 459cba838468b95547b2a515c497fcbb7bd45718..b1293935e55fcb1c45224e5bda9be8d1045ff4e8 100644 +index 1e7c23c8851ba1d0f37d2b17fd334220e060888e..29514dd01d46ba9f6b123bf3af56981541f670db 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -31,6 +31,7 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0033-Skip-event-if-no-listeners.patch b/patches/server/0031-Skip-event-if-no-listeners.patch similarity index 100% rename from patches/server/0033-Skip-event-if-no-listeners.patch rename to patches/server/0031-Skip-event-if-no-listeners.patch diff --git a/patches/server/0034-Optimize-spigot-event-bus.patch b/patches/server/0032-Optimize-spigot-event-bus.patch similarity index 100% rename from patches/server/0034-Optimize-spigot-event-bus.patch rename to patches/server/0032-Optimize-spigot-event-bus.patch diff --git a/patches/server/0035-Add-entity-spawn-deadlock-timer.patch b/patches/server/0033-Add-entity-spawn-deadlock-timer.patch similarity index 97% rename from patches/server/0035-Add-entity-spawn-deadlock-timer.patch rename to patches/server/0033-Add-entity-spawn-deadlock-timer.patch index d16cb35..a410529 100644 --- a/patches/server/0035-Add-entity-spawn-deadlock-timer.patch +++ b/patches/server/0033-Add-entity-spawn-deadlock-timer.patch @@ -60,7 +60,7 @@ index 40c199812ecf7b16fe5a17c18cb0d6d3ce258910..f01390790cab0425e5d702d93b6755be return nbt; } diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index b1293935e55fcb1c45224e5bda9be8d1045ff4e8..e5e0b0f0bd3b2249dc1db029682b8957b0addcac 100644 +index 29514dd01d46ba9f6b123bf3af56981541f670db..6a0cfec24618227d9a5ddc6c71e37d1986147799 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -54,6 +54,14 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0037-Lithium-HashedList.patch b/patches/server/0034-Lithium-HashedList.patch similarity index 100% rename from patches/server/0037-Lithium-HashedList.patch rename to patches/server/0034-Lithium-HashedList.patch diff --git a/patches/server/0038-Improve-SwingTime-ticking.patch b/patches/server/0035-Improve-SwingTime-ticking.patch similarity index 88% rename from patches/server/0038-Improve-SwingTime-ticking.patch rename to patches/server/0035-Improve-SwingTime-ticking.patch index 74c6101..5ff007a 100644 --- a/patches/server/0038-Improve-SwingTime-ticking.patch +++ b/patches/server/0035-Improve-SwingTime-ticking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Improve SwingTime ticking diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index bfa69b2c37f07132f8b31c12d26f4ceb074901a5..61cf0db77966e35da9ca30718b7e667f4c8a9297 100644 +index d6705dce3bc8c1964184fe425386b3f3c0a8202e..6ca6d44114bb2e18786b9fa3c0e2c78c1b07ea75 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2624,6 +2624,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0036-Save-Json-list-asynchronously.patch b/patches/server/0036-Save-Json-list-asynchronously.patch new file mode 100644 index 0000000..668c1b5 --- /dev/null +++ b/patches/server/0036-Save-Json-list-asynchronously.patch @@ -0,0 +1,239 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Thu, 11 Jan 2024 13:40:41 +0900 +Subject: [PATCH] Save Json list asynchronously + + +diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java b/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java +index 554f4d4e63c1431721989e6f502a32ccc53a8807..b85bc5834d90f20d46f640621abec891456b47a0 100644 +--- a/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java ++++ b/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java +@@ -17,7 +17,7 @@ public final class ChunkList implements Iterable { + this.chunkToIndex.defaultReturnValue(Integer.MIN_VALUE); + } + +- protected static final LevelChunk[] EMPTY_LIST = new LevelChunk[0]; ++ protected static final LevelChunk[] EMPTY_LIST = new LevelChunk[0]; // Plazma - Reduce allocations (mark) + + protected LevelChunk[] chunks = EMPTY_LIST; + protected int count; +diff --git a/src/main/java/io/papermc/paper/plugin/manager/DummyBukkitPluginLoader.java b/src/main/java/io/papermc/paper/plugin/manager/DummyBukkitPluginLoader.java +index aef19b44075a3b2e8696315baa89117dd8ebb513..6370d3f4451de4ca12a8bcc2661e4b2b4833fc0e 100644 +--- a/src/main/java/io/papermc/paper/plugin/manager/DummyBukkitPluginLoader.java ++++ b/src/main/java/io/papermc/paper/plugin/manager/DummyBukkitPluginLoader.java +@@ -30,7 +30,7 @@ import java.util.regex.Pattern; + @ApiStatus.Internal + public class DummyBukkitPluginLoader implements PluginLoader { + +- private static final Pattern[] PATTERNS = new Pattern[0]; ++ private static final Pattern[] PATTERNS = new Pattern[0]; // Plazma - Reduce allocations (mark) + + @Override + public @NotNull Plugin loadPlugin(@NotNull File file) throws InvalidPluginException, UnknownDependencyException { +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java +index 22c4f8dea99f92a1eb3da2baf0a15bf9d2ca0462..20c531f11b310dab0a867e589c769393ed835df5 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java +@@ -58,21 +58,23 @@ public class DedicatedPlayerList extends PlayerList { + this.loadWhiteList(); + } + ++ // Plazma start - Save JSON list asynchronously + private void saveIpBanList() { +- try { +- this.getIpBans().save(); +- } catch (IOException var2) { +- LOGGER.warn("Failed to save ip banlist: ", (Throwable)var2); +- } ++ this.getIpBans().save(); + } + + private void saveUserBanList() { +- try { +- this.getBans().save(); +- } catch (IOException var2) { +- LOGGER.warn("Failed to save user banlist: ", (Throwable)var2); +- } ++ this.getBans().save(); ++ } ++ ++ private void saveOps() { ++ this.getOps().save(); ++ } ++ ++ private void saveWhiteList() { ++ this.getWhiteList().save(); + } ++ // Plazma end - Save JSON list asynchronously + + private void loadIpBanList() { + try { +@@ -98,14 +100,6 @@ public class DedicatedPlayerList extends PlayerList { + } + } + +- private void saveOps() { +- try { +- this.getOps().save(); +- } catch (Exception var2) { +- LOGGER.warn("Failed to save operators list: ", (Throwable)var2); +- } +- } +- + private void loadWhiteList() { + try { + this.getWhiteList().load(); +@@ -114,14 +108,6 @@ public class DedicatedPlayerList extends PlayerList { + } + } + +- private void saveWhiteList() { +- try { +- this.getWhiteList().save(); +- } catch (Exception var2) { +- LOGGER.warn("Failed to save white-list: ", (Throwable)var2); +- } +- } +- + @Override + public boolean isWhiteListed(GameProfile profile) { + return !this.isUsingWhitelist() || this.isOp(profile) || this.getWhiteList().isWhiteListed(profile); +diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java +index 1289e8e9c54a584f5037ea8e852df37376af093d..2014e0c4f412bead5881de588ec941a9a5ae3565 100644 +--- a/src/main/java/net/minecraft/server/players/StoredUserList.java ++++ b/src/main/java/net/minecraft/server/players/StoredUserList.java +@@ -43,11 +43,11 @@ public abstract class StoredUserList> { + public void add(V entry) { + this.map.put(this.getKeyForUser(entry.getUser()), entry); + +- try { ++ //try { // Plazma - Save Json list asynchronously + this.save(); +- } catch (IOException ioexception) { ++ /*} catch (IOException ioexception) { // Plazma - Save Json list asynchronously + StoredUserList.LOGGER.warn("Could not save the list after adding a user.", ioexception); +- } ++ }*/ // Plazma - Save Json list asynchronously + + } + +@@ -63,11 +63,11 @@ public abstract class StoredUserList> { + public void remove(K key) { + this.map.remove(this.getKeyForUser(key)); + +- try { ++ //try { // Plazma - Save Json list asynchronously + this.save(); +- } catch (IOException ioexception) { ++ /*} catch (IOException ioexception) { // Plazma - Save Json list asynchronously + StoredUserList.LOGGER.warn("Could not save the list after removing a user.", ioexception); +- } ++ }*/ // Plazma - Save Json list asynchronously + + } + +@@ -102,7 +102,10 @@ public abstract class StoredUserList> { + return this.map.values(); + } + +- public void save() throws IOException { ++ // Plazma start - Save Json list asynchronously ++ public void save()/* throws IOException*/ { ++ io.papermc.paper.util.MCUtil.scheduleAsyncTask(() -> { ++ + this.removeExpired(); // Paper - remove expired values before saving + JsonArray jsonarray = new JsonArray(); + Stream stream = this.map.values().stream().map((jsonlistentry) -> { // CraftBukkit - decompile error +@@ -114,27 +117,16 @@ public abstract class StoredUserList> { + + Objects.requireNonNull(jsonarray); + stream.forEach(jsonarray::add); +- BufferedWriter bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8); + +- try { ++ try (BufferedWriter bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8)) { + StoredUserList.GSON.toJson(jsonarray, bufferedwriter); +- } catch (Throwable throwable) { +- if (bufferedwriter != null) { +- try { +- bufferedwriter.close(); +- } catch (Throwable throwable1) { +- throwable.addSuppressed(throwable1); +- } +- } +- +- throw throwable; +- } +- +- if (bufferedwriter != null) { +- bufferedwriter.close(); ++ } catch (IOException e) { ++ StoredUserList.LOGGER.warn("Failed to asynchronously save file " + this.file, e); + } + ++ }); + } ++ // Plazma end - Save Json list asynchronously + + public void load() throws IOException { + if (this.file.exists()) { +diff --git a/src/main/java/net/minecraft/world/entity/monster/Endermite.java b/src/main/java/net/minecraft/world/entity/monster/Endermite.java +index 965362c281315c15fb70a83a6949d7825bebf15b..e463df132c9b3cbb2217e7019b1bd9a0e0027c10 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Endermite.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Endermite.java +@@ -94,7 +94,7 @@ public class Endermite extends Monster { + this.goalSelector.addGoal(7, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur +- this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers()); ++ this.targetSelector.addGoal(1, (new HurtByTargetGoal(this/*, new Class[0]*/)).setAlertOthers()); // Plazma - Reduce allocations + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); + } + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +index 6b9cd8543a5bfc2b936ba18f66ffd60f2f792e43..d99c56194d1a16c34a62d8f2f01026974a242921 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +@@ -832,7 +832,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + + // Paper start - Perf: Optimize Hoppers + static final AABB HOPPER_ITEM_SUCK_OVERALL = Hopper.SUCK.bounds(); +- static final AABB[] HOPPER_ITEM_SUCK_INDIVIDUAL = Hopper.SUCK.toAabbs().toArray(new AABB[0]); ++ static final AABB[] HOPPER_ITEM_SUCK_INDIVIDUAL = Hopper.SUCK.toAabbs().toArray(new AABB[0]); // Plazma - Reduce allocations (mark) + // Paper end - Perf: Optimize Hoppers + + public static List getItemsAtAndAbove(Level world, Hopper hopper) { +diff --git a/src/main/java/org/bukkit/craftbukkit/bootstrap/Main.java b/src/main/java/org/bukkit/craftbukkit/bootstrap/Main.java +index 8a4f95049c63afb28bef6719c77b7a7092e75aae..e117350504e0c37b27f10ff102781ed78210cad2 100644 +--- a/src/main/java/org/bukkit/craftbukkit/bootstrap/Main.java ++++ b/src/main/java/org/bukkit/craftbukkit/bootstrap/Main.java +@@ -50,7 +50,7 @@ public class Main { + System.exit(0); + } + +- URLClassLoader classLoader = new URLClassLoader(extractedUrls.toArray(new URL[0])); ++ URLClassLoader classLoader = new URLClassLoader(extractedUrls.toArray(new URL[0])); // Plazma - Reduce allocations (mark) + + System.out.println("Starting server"); + Thread runThread = new Thread(() -> { +diff --git a/src/main/java/org/plazmamc/plazma/commands/plazma/subcommand/VersionCommand.java b/src/main/java/org/plazmamc/plazma/commands/plazma/subcommand/VersionCommand.java +index b6664ba0fce55f5cfa0c8d3051dc8c2be0fd0703..ccb5008987dff2365fe58eddc86227e4515cbbfc 100644 +--- a/src/main/java/org/plazmamc/plazma/commands/plazma/subcommand/VersionCommand.java ++++ b/src/main/java/org/plazmamc/plazma/commands/plazma/subcommand/VersionCommand.java +@@ -7,6 +7,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; + import org.checkerframework.checker.nullness.qual.Nullable; + import org.checkerframework.framework.qual.DefaultQualifier; + import org.plazmamc.plazma.commands.PlazmaSubCommand; ++import org.plazmamc.plazma.constants.Empty; + + @DefaultQualifier(NonNull.class) + public class VersionCommand implements PlazmaSubCommand { +@@ -14,7 +15,7 @@ public class VersionCommand implements PlazmaSubCommand { + @Override + public boolean execute(final CommandSender sender, final String subCommand, final String[] args) { + final @Nullable Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version"); +- if (ver != null) return ver.execute(sender, "plazma", new String[0]); ++ if (ver != null) return ver.execute(sender, "plazma", Empty.STRING); + return false; + } + diff --git a/patches/server/0037-Implement-FreedomChat.patch b/patches/server/0037-Implement-FreedomChat.patch new file mode 100644 index 0000000..db56900 --- /dev/null +++ b/patches/server/0037-Implement-FreedomChat.patch @@ -0,0 +1,191 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Mon, 29 Apr 2024 14:49:37 +0900 +Subject: [PATCH] Implement FreedomChat + +ocelotpotpie/FreedomChat +Copyright (C) 2022-2024 ocelotpotpie, Licensed under GNU GPL v3.0 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 14d15dd0d4973957871f5c06042fcaa4ea8b7a8a..2a45bebb2b83efd4ffcecad6c0a979198ab985c7 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -134,6 +134,7 @@ public abstract class PlayerList { + private static final int SEND_PLAYER_INFO_INTERVAL = 600; + private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); + private static final org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[] EMPTY_FLAG = new org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[0]; // Plazma - Reduce allocations ++ private static final ru.bk.oharass.freedomchat.FreedomChat FREEDOM_HANDLER = new ru.bk.oharass.freedomchat.FreedomChat(); // Plazma - Implement FreedomChat + private final MinecraftServer server; + public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety + private final Map playersByUUID = Maps.newHashMap(); +@@ -287,6 +288,8 @@ public abstract class PlayerList { + // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", new Object[]{entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ()}); + LevelData worlddata = worldserver1.getLevelData(); + ++ connection.channel.pipeline().addAfter("packet_handler", "freedom_handler", FREEDOM_HANDLER); // Plazma - Implement FreedomChat ++ + player.loadGameTypes(nbttagcompound); + ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, clientData); + GameRules gamerules = worldserver1.getGameRules(); +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhase.java +index 48826eb0a960f7af6dd2ef184a8aed744a1d8f83..c6df4262d660a1043705c3a4041f959490fae79e 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhase.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhase.java +@@ -5,7 +5,7 @@ import java.util.Arrays; + import net.minecraft.world.entity.boss.enderdragon.EnderDragon; + + public class EnderDragonPhase { +- private static EnderDragonPhase[] phases = new EnderDragonPhase[0]; ++ private static EnderDragonPhase[] phases = new EnderDragonPhase[0]; // Plazma - Reduce allocations (mark) + public static final EnderDragonPhase HOLDING_PATTERN = create(DragonHoldingPatternPhase.class, "HoldingPattern"); + public static final EnderDragonPhase STRAFE_PLAYER = create(DragonStrafePlayerPhase.class, "StrafePlayer"); + public static final EnderDragonPhase LANDING_APPROACH = create(DragonLandingApproachPhase.class, "LandingApproach"); +diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipePattern.java b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipePattern.java +index d8fe760bb74c8ea0d6fb8321d2c8a49d838c5362..6e910d74bac39735020d553cf31eb65b750163e0 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipePattern.java ++++ b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipePattern.java +@@ -85,7 +85,7 @@ public record ShapedRecipePattern(int width, int height, NonNullList + } + + if (pattern.size() == l) { +- return new String[0]; ++ return org.plazmamc.plazma.constants.Empty.STRING; // Plazma - Reduce allocations + } else { + String[] strings = new String[pattern.size() - l - k]; + +diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +index 4f3ed01e12ccb8a6f1a5c4f605451bb36370a236..98f26e3de66a881163e84295e9156c7f362bf7cb 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +@@ -29,6 +29,16 @@ public class GlobalConfiguration extends ConfigurationPart { + + public boolean checkSpectatorMovedToQuickly = !OPTIMIZE; + ++ public FreedomChat freedomChat; ++ public class FreedomChat extends ConfigurationPart { ++ ++ public boolean enabled = false; ++ public boolean rewriteChat = true; ++ public boolean claimSecureChatEnforced = true; ++ public boolean noChatReports = true; ++ ++ } ++ + } + + @Setting("world-generation") +diff --git a/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java b/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java +new file mode 100644 +index 0000000000000000000000000000000000000000..67f21c23e80881f52e7b92f22c6cbbe3a0bd55b5 +--- /dev/null ++++ b/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java +@@ -0,0 +1,96 @@ ++package ru.bk.oharass.freedomchat; ++ ++import com.google.gson.JsonObject; ++import com.mojang.logging.LogUtils; ++import com.mojang.serialization.JsonOps; ++import io.netty.buffer.ByteBuf; ++import io.netty.channel.ChannelHandler; ++import io.netty.channel.ChannelHandlerContext; ++import io.netty.handler.codec.EncoderException; ++import io.netty.handler.codec.MessageToByteEncoder; ++import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; ++import net.minecraft.network.Connection; ++import net.minecraft.network.FriendlyByteBuf; ++import net.minecraft.network.chat.ChatType; ++import net.minecraft.network.chat.Component; ++import net.minecraft.network.protocol.Packet; ++import net.minecraft.network.protocol.game.ClientboundPlayerChatPacket; ++import net.minecraft.network.protocol.game.ClientboundServerDataPacket; ++import net.minecraft.network.protocol.game.ClientboundSystemChatPacket; ++import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket; ++import net.minecraft.network.protocol.status.ServerStatus; ++import org.slf4j.Logger; ++ ++import java.util.Optional; ++ ++import static org.plazmamc.plazma.configurations.GlobalConfiguration.get; ++import static net.minecraft.server.MinecraftServer.getServer; ++ ++@ChannelHandler.Sharable ++public class FreedomChat extends MessageToByteEncoder> { ++ ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ ++ @Override ++ public boolean acceptOutboundMessage(final Object msg) { ++ return get().player.freedomChat.rewriteChat && msg instanceof ClientboundPlayerChatPacket ++ || get().player.freedomChat.claimSecureChatEnforced && msg instanceof ClientboundServerDataPacket ++ || get().player.freedomChat.noChatReports && msg instanceof ClientboundStatusResponsePacket; ++ } ++ ++ @Override ++ protected void encode(final ChannelHandlerContext context, final Packet packet, final ByteBuf byteBuf) throws Exception { ++ final FriendlyByteBuf buf = new FriendlyByteBuf(byteBuf); ++ ++ // TODO: JDK 21 - Change to pattern matching ++ if (packet instanceof ClientboundPlayerChatPacket chat) ++ encodeChat(context, chat, buf); ++ else if (packet instanceof ClientboundServerDataPacket data) ++ encodeData(context, data, buf); ++ else if (packet instanceof ClientboundStatusResponsePacket query) ++ encodeQuery(context, query, buf); ++ } ++ ++ private static void encodeChat( ++ final ChannelHandlerContext context, final ClientboundPlayerChatPacket packet, final FriendlyByteBuf byteBuf ++ ) { ++ final Optional bound = packet.chatType().resolve(getServer().registryAccess()); ++ if (bound.isEmpty()) { ++ LOGGER.warn("Failed to resolve chat type: {}", packet.chatType().chatType(), new Throwable()); ++ return; ++ } ++ ++ final ClientboundSystemChatPacket after = new ClientboundSystemChatPacket( bound.orElseThrow().decorate( ++ Optional.ofNullable( packet.unsignedContent() ).orElse( Component.literal(packet.body().content()) ) ++ ), false ); ++ write(context, after, byteBuf); ++ after.write(byteBuf); ++ } ++ ++ private static void encodeData( ++ final ChannelHandlerContext context, final ClientboundServerDataPacket packet, final FriendlyByteBuf byteBuf ++ ) { ++ write(context, packet, byteBuf); ++ byteBuf.writeComponent(packet.getMotd()); ++ byteBuf.writeOptional(packet.getIconBytes(), FriendlyByteBuf::writeByteArray); ++ byteBuf.writeBoolean(true); ++ } ++ ++ private static void encodeQuery( ++ final ChannelHandlerContext context, final ClientboundStatusResponsePacket packet, final FriendlyByteBuf byteBuf ++ ) { ++ final JsonObject status = ServerStatus.CODEC.encodeStart(JsonOps.INSTANCE, packet.status()).get().left() ++ .orElseThrow(() -> new EncoderException("Failed to encode server status query response")).getAsJsonObject(); ++ ++ status.addProperty("preventsChatReports", true); ++ write(context, packet, byteBuf); ++ byteBuf.writeUtf(GsonComponentSerializer.gson().serializer().toJson(status)); ++ } ++ ++ private static void write( ++ final ChannelHandlerContext context, final Packet packet, final FriendlyByteBuf byteBuf ++ ) { ++ byteBuf.writeVarInt(context.channel().attr(Connection.ATTRIBUTE_CLIENTBOUND_PROTOCOL).get().packetId(packet)); ++ } ++ ++} diff --git a/patches/server/0039-Save-Json-list-asynchronously.patch b/patches/server/0039-Save-Json-list-asynchronously.patch deleted file mode 100644 index 660fc61..0000000 --- a/patches/server/0039-Save-Json-list-asynchronously.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Thu, 11 Jan 2024 13:40:41 +0900 -Subject: [PATCH] Save Json list asynchronously - - -diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java -index 1c9cf5e1c4ee05724ffcdbd77a19bca1ab2be4d3..bc3b251a3f8ad345bdaaf67be59ff2c143d4d130 100644 ---- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java -+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java -@@ -60,20 +60,20 @@ public class DedicatedPlayerList extends PlayerList { - } - - private void saveIpBanList() { -- try { -+ //try { // Plazma - Save Json list asynchronously - this.getIpBans().save(); -- } catch (IOException var2) { -+ /*} catch (IOException var2) { // Plazma - Save Json list asynchronously - LOGGER.warn("Failed to save ip banlist: ", (Throwable)var2); -- } -+ }*/ // Plazma - Save Json list asynchronously - - } - - private void saveUserBanList() { -- try { -+ //try { // Plazma - Save Json list asynchronously - this.getBans().save(); -- } catch (IOException var2) { -+ /*} catch (IOException var2) { // Plazma - Save Json list asynchronously - LOGGER.warn("Failed to save user banlist: ", (Throwable)var2); -- } -+ }*/ // Plazma - Save Json list asynchronously - - } - -diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java -index 1289e8e9c54a584f5037ea8e852df37376af093d..2014e0c4f412bead5881de588ec941a9a5ae3565 100644 ---- a/src/main/java/net/minecraft/server/players/StoredUserList.java -+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java -@@ -43,11 +43,11 @@ public abstract class StoredUserList> { - public void add(V entry) { - this.map.put(this.getKeyForUser(entry.getUser()), entry); - -- try { -+ //try { // Plazma - Save Json list asynchronously - this.save(); -- } catch (IOException ioexception) { -+ /*} catch (IOException ioexception) { // Plazma - Save Json list asynchronously - StoredUserList.LOGGER.warn("Could not save the list after adding a user.", ioexception); -- } -+ }*/ // Plazma - Save Json list asynchronously - - } - -@@ -63,11 +63,11 @@ public abstract class StoredUserList> { - public void remove(K key) { - this.map.remove(this.getKeyForUser(key)); - -- try { -+ //try { // Plazma - Save Json list asynchronously - this.save(); -- } catch (IOException ioexception) { -+ /*} catch (IOException ioexception) { // Plazma - Save Json list asynchronously - StoredUserList.LOGGER.warn("Could not save the list after removing a user.", ioexception); -- } -+ }*/ // Plazma - Save Json list asynchronously - - } - -@@ -102,7 +102,10 @@ public abstract class StoredUserList> { - return this.map.values(); - } - -- public void save() throws IOException { -+ // Plazma start - Save Json list asynchronously -+ public void save()/* throws IOException*/ { -+ io.papermc.paper.util.MCUtil.scheduleAsyncTask(() -> { -+ - this.removeExpired(); // Paper - remove expired values before saving - JsonArray jsonarray = new JsonArray(); - Stream stream = this.map.values().stream().map((jsonlistentry) -> { // CraftBukkit - decompile error -@@ -114,27 +117,16 @@ public abstract class StoredUserList> { - - Objects.requireNonNull(jsonarray); - stream.forEach(jsonarray::add); -- BufferedWriter bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8); - -- try { -+ try (BufferedWriter bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8)) { - StoredUserList.GSON.toJson(jsonarray, bufferedwriter); -- } catch (Throwable throwable) { -- if (bufferedwriter != null) { -- try { -- bufferedwriter.close(); -- } catch (Throwable throwable1) { -- throwable.addSuppressed(throwable1); -- } -- } -- -- throw throwable; -- } -- -- if (bufferedwriter != null) { -- bufferedwriter.close(); -+ } catch (IOException e) { -+ StoredUserList.LOGGER.warn("Failed to asynchronously save file " + this.file, e); - } - -+ }); - } -+ // Plazma end - Save Json list asynchronously - - public void load() throws IOException { - if (this.file.exists()) { diff --git a/patches/unapplied/api/0007-Completely-remove-Timings.patch b/patches/unapplied/api/0007-Completely-remove-Timings.patch new file mode 100644 index 0000000..3ab5c34 --- /dev/null +++ b/patches/unapplied/api/0007-Completely-remove-Timings.patch @@ -0,0 +1,937 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sat, 27 Apr 2024 14:01:42 +0900 +Subject: [PATCH] Completely remove Timings + + +diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java +index 36b8fe86335df851f9c85d6bb2a91368b4d945d1..acf3df70e17aa8b2b155c83a56226fcc69c2f367 100644 +--- a/src/main/java/co/aikar/timings/FullServerTickHandler.java ++++ b/src/main/java/co/aikar/timings/FullServerTickHandler.java +@@ -1,12 +1,14 @@ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import static co.aikar.timings.TimingsManager.*; + + import org.bukkit.Bukkit; + import org.jetbrains.annotations.NotNull; ++ */ // Plazma - Remove timings + + @Deprecated(forRemoval = true) +-public class FullServerTickHandler extends TimingHandler { ++interface FullServerTickHandler { /* extends TimingHandler { // Plazma - Remove timings + private static final TimingIdentifier IDENTITY = new TimingIdentifier("Minecraft", "Full Server Tick", null); + final TimingData minuteData; + double avgFreeMemory = -1D; +@@ -83,4 +85,5 @@ public class FullServerTickHandler extends TimingHandler { + boolean isViolated() { + return record.getCurTickTotal() > 50000000; + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/NullTimingHandler.java b/src/main/java/co/aikar/timings/NullTimingHandler.java +index 81671cf40feeed2844ee8d92348d48062aaf2c46..ac3b2d321b43ed73bfe8c30742e3574e3603d1ae 100644 +--- a/src/main/java/co/aikar/timings/NullTimingHandler.java ++++ b/src/main/java/co/aikar/timings/NullTimingHandler.java +@@ -23,11 +23,13 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; ++ */ // Plazma - Remove timings + + @Deprecated(forRemoval = true) +-public final class NullTimingHandler implements Timing { ++interface NullTimingHandler { /* implements Timing { // Plazma - Remove timings + public static final Timing NULL = new NullTimingHandler(); + @NotNull + @Override +@@ -66,4 +68,5 @@ public final class NullTimingHandler implements Timing { + public void close() { + + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java +index 6fbc64e0f214d0c8e5afcbe385e414a4e1fe1c72..ed9580da2bfa1e3423bd63962008c00f29f6ff98 100644 +--- a/src/main/java/co/aikar/timings/TimedEventExecutor.java ++++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java +@@ -23,6 +23,7 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import org.bukkit.Bukkit; + import org.bukkit.event.Event; + import org.bukkit.event.EventException; +@@ -33,21 +34,14 @@ import org.bukkit.plugin.Plugin; + import java.lang.reflect.Method; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; ++ */ // Plazma - Remove timings + + @Deprecated(forRemoval = true) +-public class TimedEventExecutor implements EventExecutor { ++interface TimedEventExecutor { /* implements EventExecutor { // Plazma - Remove timings + + private final EventExecutor executor; + private final Timing timings; + +- /** +- * Wraps an event executor and associates a timing handler to it. +- * +- * @param executor Executor to wrap +- * @param plugin Owning plugin +- * @param method EventHandler method +- * @param eventClass Owning class +- */ + public TimedEventExecutor(@NotNull EventExecutor executor, @NotNull Plugin plugin, @Nullable Method method, @NotNull Class eventClass) { + this.executor = executor; + String id; +@@ -87,4 +81,5 @@ public class TimedEventExecutor implements EventExecutor { + public String toString() { + return "TimedEventExecutor['" + this.executor.toString() + "']"; + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java +index 1d866e980abc542bdfee1ce082cd9cdd7761e9f7..409d698de83fb72569813d15d4fb5afbaecda68b 100644 +--- a/src/main/java/co/aikar/timings/Timing.java ++++ b/src/main/java/co/aikar/timings/Timing.java +@@ -23,8 +23,10 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; ++ */ // Plazma - Remove timings + + /** + * Provides an ability to time sections of code within the Minecraft Server +@@ -32,61 +34,30 @@ import org.jetbrains.annotations.Nullable; + * @deprecated Timings will likely be replaced with Spark in the future + */ + @Deprecated(forRemoval = true) +-public interface Timing extends AutoCloseable { +- /** +- * Starts timing the execution until {@link #stopTiming()} is called. +- * +- * @return Timing +- */ ++interface Timing { /* extends AutoCloseable { // Plazma - Remove timings + @NotNull + @io.papermc.paper.annotation.DoNotUse // Purpur + Timing startTiming(); + +- /** +- *

Stops timing and records the data. Propagates the data up to group handlers.

+- * +- * Will automatically be called when this Timing is used with try-with-resources +- */ + @io.papermc.paper.annotation.DoNotUse // Purpur + void stopTiming(); + +- /** +- * Starts timing the execution until {@link #stopTiming()} is called. +- * +- * But only if we are on the primary thread. +- * +- * @return Timing +- */ + @NotNull + @io.papermc.paper.annotation.DoNotUse // Purpur + Timing startTimingIfSync(); + +- /** +- *

Stops timing and records the data. Propagates the data up to group handlers.

+- * +- *

Will automatically be called when this Timing is used with try-with-resources

+- * +- * But only if we are on the primary thread. +- */ + @io.papermc.paper.annotation.DoNotUse // Purpur + void stopTimingIfSync(); + +- /** +- * @deprecated Doesn't do anything - Removed +- */ + @Deprecated + @io.papermc.paper.annotation.DoNotUse // Purpur + void abort(); + +- /** +- * Used internally to get the actual backing Handler in the case of delegated Handlers +- * +- * @return TimingHandler +- */ + @Nullable + TimingHandler getTimingHandler(); + + @Override + @io.papermc.paper.annotation.DoNotUse // Purpur + void close(); ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/TimingData.java b/src/main/java/co/aikar/timings/TimingData.java +index a5d13a1e44edb861f45c83a9b4309fbf799d407d..51449d3bbf204f7fee4730af80121bdc1e2c467d 100644 +--- a/src/main/java/co/aikar/timings/TimingData.java ++++ b/src/main/java/co/aikar/timings/TimingData.java +@@ -23,17 +23,19 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import java.util.List; + import org.jetbrains.annotations.NotNull; + + import static co.aikar.util.JSONUtil.toArray; ++ */ // Plazma - Remove timings + + /** + *

Lightweight object for tracking timing data

+ * + * This is broken out to reduce memory usage + */ +-class TimingData { ++interface TimingData { /* // Plazma - Remove timings + private final int id; + private int count = 0; + private int lagCount = 0; +@@ -119,4 +121,5 @@ class TimingData { + void setCurTickTotal(long curTickTotal) { + this.curTickTotal = curTickTotal; + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java +index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..2a070b9882462226be4547da9a47907df2f64b9d 100644 +--- a/src/main/java/co/aikar/timings/TimingHandler.java ++++ b/src/main/java/co/aikar/timings/TimingHandler.java +@@ -23,6 +23,7 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import co.aikar.util.LoadingIntMap; + import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + +@@ -35,8 +36,9 @@ import java.util.logging.Logger; + import org.bukkit.Bukkit; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; ++ */ // Plazma - Remove timings + +-class TimingHandler implements Timing { ++interface TimingHandler { /* implements Timing { // Plazma - Remove timings + + private static AtomicInteger idPool = new AtomicInteger(1); + private static Deque TIMING_STACK = new ArrayDeque<>(); +@@ -163,9 +165,6 @@ class TimingHandler implements Timing { + } + } + +- /** +- * Reset this timer, setting all values to zero. +- */ + void reset(boolean full) { + record.reset(); + if (full) { +@@ -194,9 +193,6 @@ class TimingHandler implements Timing { + return id; + } + +- /** +- * This is simply for the Closeable interface so it can be used with try-with-resources () +- */ + @Override + public void close() { + stopTimingIfSync(); +@@ -223,4 +219,5 @@ class TimingHandler implements Timing { + } + return clonedChildren; + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java +index 02e88db63be2d5e31da6b65157ba7b971b1f10f3..bda95eeacd244892ea3a114bfdcb8b24dfdfccfa 100644 +--- a/src/main/java/co/aikar/timings/TimingHistory.java ++++ b/src/main/java/co/aikar/timings/TimingHistory.java +@@ -23,6 +23,7 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import co.aikar.timings.TimingHistory.RegionData.RegionId; + import com.google.common.base.Function; + import com.google.common.collect.Sets; +@@ -49,10 +50,11 @@ import org.jetbrains.annotations.Nullable; + import static co.aikar.timings.TimingsManager.FULL_SERVER_TICK; + import static co.aikar.timings.TimingsManager.MINUTE_REPORTS; + import static co.aikar.util.JSONUtil.*; ++ */ // Plazma - Remove timings + + @Deprecated(forRemoval = true) + @SuppressWarnings({"deprecation", "SuppressionAnnotation", "Convert2Lambda", "Anonymous2MethodRef"}) +-public class TimingHistory { ++interface TimingHistory { /* + public static long lastMinuteTime; + public static long timedTicks; + public static long playerTicks; +@@ -352,4 +354,5 @@ public class TimingHistory { + return count; + } + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/TimingHistoryEntry.java b/src/main/java/co/aikar/timings/TimingHistoryEntry.java +index 86d5ac6bd0d7d0003688761aceb3f3343575319f..c862c14eb99ac9c55cfb367cf3d8c2db59f8a50e 100644 +--- a/src/main/java/co/aikar/timings/TimingHistoryEntry.java ++++ b/src/main/java/co/aikar/timings/TimingHistoryEntry.java +@@ -23,14 +23,16 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import com.google.common.base.Function; + + import java.util.List; + import org.jetbrains.annotations.NotNull; + + import static co.aikar.util.JSONUtil.toArrayMapper; ++ */ // Plazma - Remove timings + +-class TimingHistoryEntry { ++interface TimingHistoryEntry { /* // Plazma - Remove timings + final TimingData data; + private final TimingData[] children; + +@@ -55,4 +57,5 @@ class TimingHistoryEntry { + } + return result; + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/TimingIdentifier.java b/src/main/java/co/aikar/timings/TimingIdentifier.java +index df142a89b8c43acb81eb383eac0ef048a1f49a6e..b273b4bc96cc756fa246b8b4c8efa1cac23cd957 100644 +--- a/src/main/java/co/aikar/timings/TimingIdentifier.java ++++ b/src/main/java/co/aikar/timings/TimingIdentifier.java +@@ -23,6 +23,7 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import co.aikar.util.LoadingMap; + + import java.util.ArrayList; +@@ -34,16 +35,14 @@ import java.util.concurrent.ConcurrentHashMap; + import java.util.concurrent.atomic.AtomicInteger; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; ++ */ // Plazma - Remove timings + + /** + *

Used as a basis for fast HashMap key comparisons for the Timing Map.

+ * + * This class uses interned strings giving us the ability to do an identity check instead of equals() on the strings + */ +-final class TimingIdentifier { +- /** +- * Holds all groups. Autoloads on request for a group by name. +- */ ++interface TimingIdentifier { /* // Plazma - Remove timings + static final Map GROUP_MAP = LoadingMap.of(new ConcurrentHashMap<>(64, .5F), TimingGroup::new); + private static final TimingGroup DEFAULT_GROUP = getGroup("Minecraft"); + final String group; +@@ -113,4 +112,5 @@ final class TimingIdentifier { + return id; + } + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java +index 752d54830aa8baa1450bf72da03ae55ed30293c2..d2bab3cc02f7dfef2852cd705870351c81376061 100644 +--- a/src/main/java/co/aikar/timings/Timings.java ++++ b/src/main/java/co/aikar/timings/Timings.java +@@ -23,6 +23,7 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import com.google.common.base.Preconditions; + import com.google.common.collect.EvictingQueue; + import com.google.common.collect.Lists; +@@ -39,13 +40,14 @@ import java.util.Queue; + import java.util.logging.Level; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; ++ */ // Plazma - Remove timings + + /** + * @deprecated Timings will likely be replaced with Spark in the future + */ + @Deprecated(forRemoval = true) + @SuppressWarnings({"UnusedDeclaration", "WeakerAccess", "SameParameterValue"}) +-public final class Timings { ++interface Timings { /* // Plazma - Remove timings + + final static List requestingReport = Lists.newArrayList(); + private static final int MAX_HISTORY_FRAMES = 12; +@@ -58,13 +60,6 @@ public final class Timings { + + private Timings() {} + +- /** +- * Returns a Timing for a plugin corresponding to a name. +- * +- * @param plugin Plugin to own the Timing +- * @param name Name of Timing +- * @return Handler +- */ + @NotNull + public static Timing of(@NotNull Plugin plugin, @NotNull String name) { + Timing pluginHandler = null; +@@ -74,18 +69,6 @@ public final class Timings { + return of(plugin, name, pluginHandler); + } + +- /** +- *

Returns a handler that has a groupHandler timer handler. Parent timers should not have their +- * start/stop methods called directly, as the children will call it for you.

+- * +- * Parent Timers are used to group multiple subsections together and get a summary of them combined +- * Parent Handler can not be changed after first call +- * +- * @param plugin Plugin to own the Timing +- * @param name Name of Timing +- * @param groupHandler Parent handler to mirror .start/stop calls to +- * @return Timing Handler +- */ + @NotNull + public static Timing of(@NotNull Plugin plugin, @NotNull String name, @Nullable Timing groupHandler) { + Preconditions.checkNotNull(plugin, "Plugin can not be null"); +@@ -93,34 +76,11 @@ public final class Timings { + return TimingsManager.getHandler(plugin.getName(), name, groupHandler); + } + +- /** +- * Returns a Timing object after starting it, useful for Java7 try-with-resources. +- * +- * try (Timing ignored = Timings.ofStart(plugin, someName)) { +- * // timed section +- * } +- * +- * @param plugin Plugin to own the Timing +- * @param name Name of Timing +- * @return Timing Handler +- */ + @NotNull + public static Timing ofStart(@NotNull Plugin plugin, @NotNull String name) { + return ofStart(plugin, name, null); + } + +- /** +- * Returns a Timing object after starting it, useful for Java7 try-with-resources. +- * +- * try (Timing ignored = Timings.ofStart(plugin, someName, groupHandler)) { +- * // timed section +- * } +- * +- * @param plugin Plugin to own the Timing +- * @param name Name of Timing +- * @param groupHandler Parent handler to mirror .start/stop calls to +- * @return Timing Handler +- */ + @NotNull + public static Timing ofStart(@NotNull Plugin plugin, @NotNull String name, @Nullable Timing groupHandler) { + Timing timing = of(plugin, name, groupHandler); +@@ -128,22 +88,10 @@ public final class Timings { + return timing; + } + +- /** +- * Gets whether or not the Spigot Timings system is enabled +- * +- * @return Enabled or not +- */ + public static boolean isTimingsEnabled() { + return timingsEnabled; + } + +- /** +- *

Sets whether or not the Spigot Timings system should be enabled

+- * +- * Calling this will reset timing data. +- * +- * @param enabled Should timings be reported +- */ + public static void setTimingsEnabled(boolean enabled) { + // Purpur start - we don't do that here... + timingsEnabled = false; +@@ -182,51 +130,19 @@ public final class Timings { + .build(); + } + +- /** +- *

Sets whether or not the Timings should monitor at Verbose level.

+- * +- *

When Verbose is disabled, high-frequency timings will not be available.

+- * +- * @return Enabled or not +- */ + public static boolean isVerboseTimingsEnabled() { + return verboseEnabled; + } + +- /** +- *

Sets whether or not the Timings should monitor at Verbose level.

+- * +- * When Verbose is disabled, high-frequency timings will not be available. +- * Calling this will reset timing data. +- * +- * @param enabled Should high-frequency timings be reported +- */ + public static void setVerboseTimingsEnabled(boolean enabled) { + verboseEnabled = enabled; + TimingsManager.needsRecheckEnabled = true; + } + +- /** +- *

Gets the interval between Timing History report generation.

+- * +- * Defaults to 5 minutes (6000 ticks) +- * +- * @return Interval in ticks +- */ + public static int getHistoryInterval() { + return historyInterval; + } + +- /** +- *

Sets the interval between Timing History report generations.

+- * +- *

Defaults to 5 minutes (6000 ticks)

+- * +- * This will recheck your history length, so lowering this value will lower your +- * history length if you need more than 60 history windows. +- * +- * @param interval Interval in ticks +- */ + public static void setHistoryInterval(int interval) { + historyInterval = Math.max(20*60, interval); + // Recheck the history length with the new Interval +@@ -235,28 +151,10 @@ public final class Timings { + } + } + +- /** +- * Gets how long in ticks Timings history is kept for the server. +- * +- * Defaults to 1 hour (72000 ticks) +- * +- * @return Duration in Ticks +- */ + public static int getHistoryLength() { + return historyLength; + } + +- /** +- * Sets how long Timing History reports are kept for the server. +- * +- * Defaults to 1 hours(72000 ticks) +- * +- * This value is capped at a maximum of getHistoryInterval() * MAX_HISTORY_FRAMES (12) +- * +- * Will not reset Timing Data but may truncate old history if the new length is less than old length. +- * +- * @param length Duration in ticks +- */ + public static void setHistoryLength(int length) { + // Cap at 12 History Frames, 1 hour at 5 minute frames. + int maxLength = historyInterval * MAX_HISTORY_FRAMES; +@@ -276,19 +174,10 @@ public final class Timings { + TimingsManager.HISTORY.addAll(oldQueue); + } + +- /** +- * Resets all Timing Data +- */ + public static void reset() { + TimingsManager.reset(); + } + +- /** +- * Generates a report and sends it to the specified command sender. +- * +- * If sender is null, ConsoleCommandSender will be used. +- * @param sender The sender to send to, or null to use the ConsoleCommandSender +- */ + public static void generateReport(@Nullable CommandSender sender) { + if (sender == null) { + sender = Bukkit.getConsoleSender(); +@@ -296,22 +185,11 @@ public final class Timings { + requestingReport.add(sender); + } + +- /** +- * Generates a report and sends it to the specified listener. +- * Use with {@link org.bukkit.command.BufferedCommandSender} to get full response when done! +- * @param sender The listener to send responses too. +- */ + public static void generateReport(@NotNull TimingsReportListener sender) { + Preconditions.checkNotNull(sender); + requestingReport.add(sender); + } + +- /* +- ================= +- Protected API: These are for internal use only in Bukkit/CraftBukkit +- These do not have isPrimaryThread() checks in the startTiming/stopTiming +- ================= +- */ + @NotNull + static TimingHandler ofSafe(@NotNull String name) { + return ofSafe(null, name, null); +@@ -335,5 +213,6 @@ public final class Timings { + static TimingHandler ofSafe(@Nullable String groupName, @NotNull String name, @Nullable Timing groupHandler) { + return TimingsManager.getHandler(groupName, name, groupHandler); + } ++ */ // Plazma - Remove timings + } + +diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java +index 1abfcee0f6d632f4cd8d74b4994a90c9ea9d254c..18ddc321c4a23689d93c4340e0010dc67e84f138 100644 +--- a/src/main/java/co/aikar/timings/TimingsCommand.java ++++ b/src/main/java/co/aikar/timings/TimingsCommand.java +@@ -61,6 +61,7 @@ public class TimingsCommand extends BukkitCommand { + sender.sendMessage(mm.deserialize("https://spark.lucko.me/docs/Command-Usage")); + return true; + } ++ /* // Plazma - Remove timings + if (args.length < 1) { + sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED)); + return true; +@@ -109,6 +110,7 @@ public class TimingsCommand extends BukkitCommand { + } else { + sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED)); + } ++ */ // Plazma - Remove timings + return true; + } + +diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java +index 5e1558ca3ffeeaf2645fa003965474a442d650bf..f6aa204db5ef216e1eb06be5e5e307067cfcf05c 100644 +--- a/src/main/java/co/aikar/timings/TimingsManager.java ++++ b/src/main/java/co/aikar/timings/TimingsManager.java +@@ -23,6 +23,7 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import co.aikar.util.LoadingMap; + import com.google.common.collect.EvictingQueue; + import org.bukkit.Bukkit; +@@ -38,12 +39,13 @@ import java.util.concurrent.ConcurrentHashMap; + import java.util.logging.Level; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; ++ */ // Plazma - Remove timings + + /** + * @deprecated Timings will likely be replaced with Spark in the future + */ + @Deprecated(forRemoval = true) +-public final class TimingsManager { ++interface TimingsManager { /* // Plazma - Remove timings + static final Map TIMING_MAP = LoadingMap.of( + new ConcurrentHashMap<>(4096, .5F), TimingHandler::new + ); +@@ -65,17 +67,10 @@ public final class TimingsManager { + + private TimingsManager() {} + +- /** +- * Resets all timing data on the next tick +- */ + static void reset() { + needsFullReset = true; + } + +- /** +- * Ticked every tick by CraftBukkit to count the number of times a timer +- * caused TPS loss. +- */ + static void tick() { + if (Timings.timingsEnabled) { + boolean violated = FULL_SERVER_TICK.isViolated(); +@@ -139,16 +134,6 @@ public final class TimingsManager { + return TIMING_MAP.get(new TimingIdentifier(group, name, parent)); + } + +- +- /** +- *

Due to access restrictions, we need a helper method to get a Command TimingHandler with String group

+- * +- * Plugins should never call this +- * +- * @param pluginName Plugin this command is associated with +- * @param command Command to get timings for +- * @return TimingHandler +- */ + @NotNull + public static Timing getCommandTiming(@Nullable String pluginName, @NotNull Command command) { + Plugin plugin = null; +@@ -170,13 +155,6 @@ public final class TimingsManager { + return Timings.ofSafe(plugin, "Command: " + pluginName + ":" + command.getTimingName()); + } + +- /** +- * Looks up the class loader for the specified class, and if it is a PluginClassLoader, return the +- * Plugin that created this class. +- * +- * @param clazz Class to check +- * @return Plugin if created by a plugin +- */ + @Nullable + public static Plugin getPluginByClassloader(@Nullable Class clazz) { + if (clazz == null) { +@@ -189,4 +167,5 @@ public final class TimingsManager { + } + return null; + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/TimingsReportListener.java b/src/main/java/co/aikar/timings/TimingsReportListener.java +index 3af5b8ea795311582044c712de50d29412024b77..d5b52c8bf0bd23d9e3c0ba708c758694771a07ac 100644 +--- a/src/main/java/co/aikar/timings/TimingsReportListener.java ++++ b/src/main/java/co/aikar/timings/TimingsReportListener.java +@@ -1,5 +1,6 @@ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import com.google.common.base.Preconditions; + import com.google.common.collect.Lists; + import org.bukkit.Bukkit; +@@ -11,10 +12,11 @@ import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; + + import java.util.List; ++ */ // Plazma - Remove timings + + @Deprecated(forRemoval = true) + @SuppressWarnings("WeakerAccess") +-public class TimingsReportListener implements net.kyori.adventure.audience.ForwardingAudience, MessageCommandSender { ++interface TimingsReportListener { /* implements net.kyori.adventure.audience.ForwardingAudience, MessageCommandSender { // Plazma - Remove timings + private final List senders; + private final Runnable onDone; + private String timingsURL; +@@ -84,4 +86,5 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa + this.senders.add(Bukkit.getConsoleSender()); + } + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/co/aikar/timings/UnsafeTimingHandler.java b/src/main/java/co/aikar/timings/UnsafeTimingHandler.java +index 632c4961515f5052551f841cfa840e60bba7a257..0656b8e86eaee12161a8bb16d1b46301fd5cea13 100644 +--- a/src/main/java/co/aikar/timings/UnsafeTimingHandler.java ++++ b/src/main/java/co/aikar/timings/UnsafeTimingHandler.java +@@ -23,10 +23,12 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Remove timings + import org.bukkit.Bukkit; + import org.jetbrains.annotations.NotNull; ++ */ // Plazma - Remove timings + +-class UnsafeTimingHandler extends TimingHandler { ++interface UnsafeTimingHandler { /* extends TimingHandler { // Plazma - Remove timings + + UnsafeTimingHandler(@NotNull TimingIdentifier id) { + super(id); +@@ -50,4 +52,5 @@ class UnsafeTimingHandler extends TimingHandler { + checkThread(); + super.stopTiming(); + } ++ */ // Plazma - Remove timings + } +diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java +index b791358f90fe92bc2264d9a26492245763813af3..8c10f2dc17cfede217f3a1b615777ea4dd308f76 100644 +--- a/src/main/java/org/bukkit/command/Command.java ++++ b/src/main/java/org/bukkit/command/Command.java +@@ -33,7 +33,7 @@ public abstract class Command { + protected String usageMessage; + private String permission; + private net.kyori.adventure.text.Component permissionMessage; // Paper +- public co.aikar.timings.Timing timings; // Paper ++ // public co.aikar.timings.Timing timings; // Paper // Plazma - Remove timings + @NotNull public String getTimingName() {return getName();} // Paper + + protected Command(@NotNull String name) { +diff --git a/src/main/java/org/bukkit/command/FormattedCommandAlias.java b/src/main/java/org/bukkit/command/FormattedCommandAlias.java +index 9d4f553c04784cca63901a56a7aea62a5cae1d72..321082710aa84627405d4f1453246b6a729659cc 100644 +--- a/src/main/java/org/bukkit/command/FormattedCommandAlias.java ++++ b/src/main/java/org/bukkit/command/FormattedCommandAlias.java +@@ -12,7 +12,7 @@ public class FormattedCommandAlias extends Command { + + public FormattedCommandAlias(@NotNull String alias, @NotNull String[] formatStrings) { + super(alias); +- timings = co.aikar.timings.TimingsManager.getCommandTiming("minecraft", this); // Spigot ++ //timings = co.aikar.timings.TimingsManager.getCommandTiming("minecraft", this); // Spigot // Plazma - Remove timings + this.formatStrings = formatStrings; + } + +diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java +index 5349f16136d9348c374a7dfe5b89a71dfcb0e66d..c0c2f7671122f767af3a94a3aadefdfa4b492f3a 100644 +--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java ++++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java +@@ -34,7 +34,7 @@ public class SimpleCommandMap implements CommandMap { + register("bukkit", new VersionCommand("version")); + register("bukkit", new ReloadCommand("reload")); + //register("bukkit", new PluginsCommand("plugins")); // Paper +- register("bukkit", new co.aikar.timings.TimingsCommand("timings")); // Paper ++ //register("bukkit", new co.aikar.timings.TimingsCommand("timings")); // Paper // Plazma - Remove timings + } + + public void setFallbackCommands() { +@@ -66,7 +66,7 @@ public class SimpleCommandMap implements CommandMap { + */ + @Override + public boolean register(@NotNull String label, @NotNull String fallbackPrefix, @NotNull Command command) { +- command.timings = co.aikar.timings.TimingsManager.getCommandTiming(fallbackPrefix, command); // Paper ++ // command.timings = co.aikar.timings.TimingsManager.getCommandTiming(fallbackPrefix, command); // Paper // Plazma - Remove timings + label = label.toLowerCase(java.util.Locale.ENGLISH).trim(); + fallbackPrefix = fallbackPrefix.toLowerCase(java.util.Locale.ENGLISH).trim(); + boolean registered = register(label, command, false, fallbackPrefix); +@@ -156,11 +156,13 @@ public class SimpleCommandMap implements CommandMap { + parsedArgs = event.getArgs(); + // Purpur end + ++ /* // Plazma - Remove timings + // Paper start - Plugins do weird things to workaround normal registration + if (target.timings == null) { + target.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, target); + } + // Paper end ++ */ // Plazma - Remove timings + + try { + //try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources // Purpur +diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +index 899d67fa782fac639fe7fb096e05c551d75bd647..1d9906c508ca916297b8e121f8826532b66f83e2 100644 +--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java ++++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +@@ -707,6 +707,7 @@ public final class SimplePluginManager implements PluginManager { + Preconditions.checkArgument(plugin != null, "Plugin cannot be null"); + if (true) {this.paperPluginManager.registerEvent(event, listener, priority, executor, plugin, ignoreCancelled); return;} // Paper + ++ /* // Plazma - Remove timings + if (!plugin.isEnabled()) { + throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); + } +@@ -717,6 +718,7 @@ public final class SimplePluginManager implements PluginManager { + } else { + getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); + } ++ */ // Plazma - Remove timings + } + + @NotNull +@@ -946,8 +948,9 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public boolean useTimings() { +- if (true) {return this.paperPluginManager.useTimings();} // Paper +- return co.aikar.timings.Timings.isTimingsEnabled(); // Spigot ++ return false; ++ // if (true) {return this.paperPluginManager.useTimings();} // Paper // Plazma - Remove timings ++ // return co.aikar.timings.Timings.isTimingsEnabled(); // Spigot // Plazma - Remove timings + } + + /** +@@ -956,7 +959,7 @@ public final class SimplePluginManager implements PluginManager { + * @param use True if per event timing code should be used + */ + public void useTimings(boolean use) { +- co.aikar.timings.Timings.setTimingsEnabled(use); // Paper ++ // co.aikar.timings.Timings.setTimingsEnabled(use); // Paper // Plazma - Remove timings + } + + // Paper start +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +index 0c6ca7588fb3d6b6497ddf032fe75e5c6c9719e5..e5d4ac1b8b4ca3846e2a9ea63f6b6eb05f7b70bd 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +@@ -43,7 +43,7 @@ import org.bukkit.plugin.TimedRegisteredListener; + import org.bukkit.plugin.UnknownDependencyException; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; +-import org.spigotmc.CustomTimingsHandler; // Spigot ++// import org.spigotmc.CustomTimingsHandler; // Spigot // Plazma - Remove timings + import org.yaml.snakeyaml.error.YAMLException; + + /** +@@ -294,7 +294,7 @@ public final class JavaPluginLoader implements PluginLoader { + } + } + +- EventExecutor executor = new co.aikar.timings.TimedEventExecutor(new EventExecutor() { // Paper ++ EventExecutor executor = new EventExecutor() { // Paper // Plazma - Remove timings + @Override + public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper + try { +@@ -308,7 +308,7 @@ public final class JavaPluginLoader implements PluginLoader { + throw new EventException(t); + } + } +- }, plugin, method, eventClass); // Paper ++ }; // Paper // Plazma - Remove timings + if (false) { // Spigot - RL handles useTimings check now + eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); + } else { +diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java +index 9c2d605c50cbf9aefa56ec209df9f6cea1392e89..cb2bd5f58544493a5ae0d2b765be806e35639baa 100644 +--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java ++++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java +@@ -23,6 +23,7 @@ + */ + package org.spigotmc; + ++/* // Plazma - Remove timings + import org.bukkit.Bukkit; + import org.jetbrains.annotations.NotNull; + import org.bukkit.plugin.AuthorNagException; +@@ -32,6 +33,7 @@ import co.aikar.timings.TimingsManager; + + import java.lang.reflect.Method; + import java.util.logging.Level; ++ */ // Plazma - Remove timings + + /** + * This is here for legacy purposes incase any plugin used it. +@@ -39,10 +41,9 @@ import java.util.logging.Level; + * If you use this, migrate ASAP as this will be removed in the future! + * + * @deprecated +- * @see co.aikar.timings.Timings#of + */ + @Deprecated(forRemoval = true) +-public final class CustomTimingsHandler { ++interface CustomTimingsHandler { /* // Plazma - Remove timings + private final Timing handler; + + public CustomTimingsHandler(@NotNull String name) { +@@ -61,7 +62,7 @@ public final class CustomTimingsHandler { + handler = timing; + } + +- public void startTiming() { /*handler.startTiming();*/ } // Purpur +- public void stopTiming() { /*handler.stopTiming();*/ } // Purpur +- ++ public void startTiming() { handler.startTiming(); } // Purpur // Plazma - IDE Parsing problem ++ public void stopTiming() { handler.stopTiming(); } // Purpur // Plazma - IDE Parsing problem ++ */ // Plazma - Remove timings + } diff --git a/patches/unapplied/server/0016-Completely-remove-Timings.patch b/patches/unapplied/server/0016-Completely-remove-Timings.patch new file mode 100644 index 0000000..cfa8b93 --- /dev/null +++ b/patches/unapplied/server/0016-Completely-remove-Timings.patch @@ -0,0 +1,641 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sat, 27 Apr 2024 14:02:18 +0900 +Subject: [PATCH] Completely remove Timings + + +diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java +index 4b467f1af93452d13829f756d55dee18b8889d40..7e20ec279c9fb75b92ca3bf938adeeb126641aa5 100644 +--- a/src/main/java/co/aikar/timings/MinecraftTimings.java ++++ b/src/main/java/co/aikar/timings/MinecraftTimings.java +@@ -1,5 +1,6 @@ + package co.aikar.timings; + ++/* // Plazma - Completely remove Timings + import com.google.common.collect.MapMaker; + import io.papermc.paper.configuration.GlobalConfiguration; + import net.minecraft.commands.functions.CommandFunction; +@@ -12,10 +13,11 @@ import org.bukkit.scheduler.BukkitTask; + import org.bukkit.craftbukkit.scheduler.CraftTask; + + import java.util.Map; ++ */ // Plazma - Completely remove Timings + +-// TODO: Re-implement missing timers ++// TODO: Re-implement missing timers // Plazma - nah you cant + @Deprecated(forRemoval = true) +-public final class MinecraftTimings { ++interface MinecraftTimings { /* // Plazma - Completely remove Timings + + public static final Timing serverOversleep = Timings.ofSafe("Server Oversleep"); + public static final Timing playerListTimer = Timings.ofSafe("Player List"); +@@ -59,12 +61,6 @@ public final class MinecraftTimings { + return Timings.ofSafe(taskName); + } + +- /** +- * Gets a timer associated with a plugins tasks. +- * @param bukkitTask +- * @param period +- * @return +- */ + public static Timing getPluginTaskTimings(BukkitTask bukkitTask, long period) { + if (!bukkitTask.isSync()) { + return NullTimingHandler.NULL; +@@ -110,11 +106,6 @@ public final class MinecraftTimings { + return Timings.ofSafe(plugin, name.toString()); + } + +- /** +- * Get a named timer for the specified entity type to track type specific timings. +- * @param entityType +- * @return +- */ + public static Timing getEntityTimings(String entityType, String type) { + return Timings.ofSafe("Minecraft", "## tickEntity - " + entityType + " - " + type, tickEntityTimer); + } +@@ -127,11 +118,6 @@ public final class MinecraftTimings { + return Timings.ofSafe("## Sensor - " + type + " (Default rate: " + rate + ")"); + } + +- /** +- * Get a named timer for the specified tile entity type to track type specific timings. +- * @param entity +- * @return +- */ + public static Timing getTileEntityTimings(BlockEntity entity) { + String entityType = entity.getClass().getName(); + return Timings.ofSafe("Minecraft", "## tickTileEntity - " + entityType, tickTileEntityTimer); +@@ -150,10 +136,10 @@ public final class MinecraftTimings { + public static Timing getBlockTiming(Block block) { + return Timings.ofSafe("## Scheduled Block: " + block.toString(), scheduledBlocksTimer); + } +-/* ++ + public static Timing getStructureTiming(StructureGenerator structureGenerator) { + return Timings.ofSafe("Structure Generator - " + structureGenerator.getName(), structureGenerationTimer); +- }*/ ++ } + + public static Timing getPacketTiming(Packet packet) { + return Timings.ofSafe("## Packet - " + packet.getClass().getName(), packetProcessTimer); +@@ -178,4 +164,6 @@ public final class MinecraftTimings { + co.aikar.timings.Timings.setHistoryInterval(config.historyInterval * 20); + co.aikar.timings.Timings.setHistoryLength(config.historyLength * 20); + } ++ */ // Plazma - Completely remove Timings ++ + } +diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java +index b35a9f4c5f8960864c402ede8a51fb5ab9c4fcc0..46085a9c12efc6a1766e704c9bb0fbf454d60c8a 100644 +--- a/src/main/java/co/aikar/timings/TimingsExport.java ++++ b/src/main/java/co/aikar/timings/TimingsExport.java +@@ -23,6 +23,7 @@ + */ + package co.aikar.timings; + ++/* // Plazma - Completely remove Timings + import com.google.common.collect.Sets; + import io.papermc.paper.adventure.PaperAdventure; + import net.kyori.adventure.text.event.ClickEvent; +@@ -64,10 +65,11 @@ import static co.aikar.util.JSONUtil.toArray; + import static co.aikar.util.JSONUtil.toArrayMapper; + import static co.aikar.util.JSONUtil.toObjectMapper; + import static net.kyori.adventure.text.Component.text; ++ */ // Plazma - Completely remove Timings + + @SuppressWarnings({"rawtypes", "SuppressionAnnotation"}) + @Deprecated(forRemoval = true) +-public class TimingsExport extends Thread { ++interface TimingsExport { /* extends Thread { // Plazma - Completely remove Timings + + private final TimingsReportListener listeners; + private final Map out; +@@ -81,9 +83,6 @@ public class TimingsExport extends Thread { + this.history = history; + } + +- /** +- * Checks if any pending reports are being requested, and builds one if needed. +- */ + public static void reportTimings() { + if (Timings.requestingReport.isEmpty()) { + return; +@@ -386,4 +385,6 @@ public class TimingsExport extends Thread { + } + } + } ++ */ // Plazma - Completely remove Timings ++ + } +diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java +index 22687667ec69a954261e55e59261286ac1b8b8cd..9115fab47c5d69aa9c563b8ade7f916b99827e4f 100644 +--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java ++++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java +@@ -1,15 +1,18 @@ + package co.aikar.timings; + ++/* // Plazma - Completely remove Timings + import net.minecraft.server.level.ServerLevel; + import net.minecraft.world.level.Level; + import net.minecraft.world.level.storage.PrimaryLevelData; ++ */ // Plazma - Completely remove Timings + + /** + * Set of timers per world, to track world specific timings. + */ + // TODO: Re-implement missing timers + @Deprecated(forRemoval = true) +-public class WorldTimingsHandler { ++interface WorldTimingsHandler { ++ /* // Plazma - Completely remove Timings + public final Timing mobSpawn; + public final Timing doChunkUnload; + public final Timing doPortalForcer; +@@ -137,4 +140,5 @@ public class WorldTimingsHandler { + public static Timing getTickList(ServerLevel worldserver, String timingsType) { + return Timings.ofSafe(((PrimaryLevelData) worldserver.getLevelData()).getLevelName() + " - Scheduled " + timingsType); + } ++ */ // Plazma - Completely remove Timings + } +diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +index c71daa5d3665cec2836770e5f04da222bc5f90ed..da06919b1911f87e64732716217f85d6ba606e8f 100644 +--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java ++++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +@@ -1,6 +1,6 @@ + package io.papermc.paper.configuration; + +-import co.aikar.timings.MinecraftTimings; ++// import co.aikar.timings.MinecraftTimings; // Plazma - Completely remove Timings + import com.mojang.logging.LogUtils; + import io.papermc.paper.configuration.constraint.Constraints; + import io.papermc.paper.configuration.type.number.IntOr; +@@ -91,6 +91,7 @@ public class GlobalConfiguration extends ConfigurationPart { + public boolean useDisplayNameInQuitMessage = false; + } + ++ /* // Plazma - Completely remove Timings + @Deprecated(forRemoval = true) + public Timings timings; + +@@ -113,6 +114,7 @@ public class GlobalConfiguration extends ConfigurationPart { + MinecraftTimings.processConfig(this); + } + } ++ */ // Plazma - Completely remove Timings + + public Proxies proxies; + +diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..2a79e3423724b5005f1918b80e06051dfcfc5bf9 100644 +--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java ++++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +@@ -1,6 +1,6 @@ + package io.papermc.paper.plugin.manager; + +-import co.aikar.timings.TimedEventExecutor; ++// import co.aikar.timings.TimedEventExecutor; // Plazma - Completely remove Timings + import com.destroystokyo.paper.event.server.ServerExceptionEvent; + import com.destroystokyo.paper.exception.ServerEventException; + import com.google.common.collect.Sets; +@@ -95,7 +95,7 @@ class PaperEventManager { + throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); + } + +- executor = new TimedEventExecutor(executor, plugin, null, event); ++ // executor = new TimedEventExecutor(executor, plugin, null, event); // Plazma - Completely remove Timings + this.getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); + } + +@@ -182,7 +182,7 @@ class PaperEventManager { + } + } + +- EventExecutor executor = new TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass); ++ EventExecutor executor = EventExecutor.create(method, eventClass); // Plazma - Completely remove Timings + eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); + } + return ret; +diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java +index dab211c458311869c61779305580a1c7da830f71..efa194f99807a61c02923dbaf58fac542bd9229f 100644 +--- a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java ++++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java +@@ -227,7 +227,8 @@ public class PaperPluginManagerImpl implements PluginManager, DependencyContext + + @Override + public boolean useTimings() { +- return co.aikar.timings.Timings.isTimingsEnabled(); ++ return false; ++ // return co.aikar.timings.Timings.isTimingsEnabled(); // Plazma - Completely remove Timings + } + + @Override +diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +index 620edb63cacd15e38f7fc859efd4095bfb5e5f72..85e6a5d5d3266d0d042ee62a89adbb5f0d3880e6 100644 +--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java ++++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +@@ -49,7 +49,7 @@ public class PacketUtils { + try { // Paper - detailed watchdog information + if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players + if (listener.shouldHandleMessage(packet)) { +- co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings ++ // co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings // Plazma - Completely remove Timings + try { // Paper - timings // Purpur + packet.handle(listener); + } catch (Exception exception) { +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 93564ba734f6b82ffde07b1321180fc24a0ff50f..25d560594d2fb38a6b94bb4b1677ff79603d5645 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -3,7 +3,7 @@ package net.minecraft.server; + import com.google.common.base.Preconditions; + import com.google.common.base.Splitter; + import com.google.common.collect.ImmutableList; +-import co.aikar.timings.Timings; ++// import co.aikar.timings.Timings; // Plazma - Completely remove Timings + import com.destroystokyo.paper.event.server.PaperServerListPingEvent; + import com.google.common.base.Stopwatch; + import com.google.common.collect.Lists; +@@ -189,7 +189,7 @@ import org.bukkit.craftbukkit.Main; + import org.bukkit.event.server.ServerLoadEvent; + // CraftBukkit end + +-import co.aikar.timings.MinecraftTimings; // Paper ++//import co.aikar.timings.MinecraftTimings; // Paper // Plazma - Completely remove Timings + + public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, CommandSource, AutoCloseable { + +@@ -975,7 +975,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements FeatureElement, EntityTypeT + this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, maxTrackDistance, trackTickInterval, requiredFeatures, "custom"); + } + 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, String id) { +- this.tickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "tick"); +- this.inactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "inactiveTick"); +- this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick"); +- this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick"); ++ // this.tickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "tick"); // Plazma - Completely remove Timings ++ // this.inactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "inactiveTick"); // Plazma - Completely remove Timings ++ // this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick"); // Plazma - Completely remove Timings ++ // this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick"); // Plazma - Completely remove Timings + // Paper end + this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this); + this.factory = factory; +@@ -721,10 +721,10 @@ public class EntityType implements FeatureElement, EntityTypeT + } + + // Paper start - timings +- public final co.aikar.timings.Timing tickTimer; +- public final co.aikar.timings.Timing inactiveTickTimer; +- public final co.aikar.timings.Timing passengerTickTimer; +- public final co.aikar.timings.Timing passengerInactiveTickTimer; ++ // public final co.aikar.timings.Timing tickTimer; // Plazma - Completely remove Timings ++ // public final co.aikar.timings.Timing inactiveTickTimer; // Plazma - Completely remove Timings ++ // public final co.aikar.timings.Timing passengerTickTimer; // Plazma - Completely remove Timings ++ // public final co.aikar.timings.Timing passengerInactiveTickTimer; // Plazma - Completely remove Timings + // Paper end + 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; +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java +index 8f7d9f8a5138bcd572691d66c814aaa7c308b317..5db4a2b790680ed86a6106473d43fb0b2887f875 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java +@@ -16,7 +16,7 @@ public abstract class Behavior implements BehaviorContro + private final int maxDuration; + // Paper start - configurable behavior tick rate and timings + private final String configKey; +- private final co.aikar.timings.Timing timing; ++ // private final co.aikar.timings.Timing timing; // Plazma - Completely remove Timings + // Paper end - configurable behavior tick rate and timings + + public Behavior(Map, MemoryStatus> requiredMemoryState) { +@@ -38,7 +38,7 @@ public abstract class Behavior implements BehaviorContro + key = key.substring(lastSeparator + 1); + } + this.configKey = key.toLowerCase(java.util.Locale.ROOT); +- this.timing = co.aikar.timings.MinecraftTimings.getBehaviorTimings(configKey); ++ // this.timing = co.aikar.timings.MinecraftTimings.getBehaviorTimings(configKey); // Plazma - Completely remove Timings + // Paper end - configurable behavior tick rate and timings + } + +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java +index e553f52de2e0b30511ac1b73cb436374017cd7d7..21f4e5c3dd3e528f3184940a2351259a02fcb131 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java +@@ -28,7 +28,7 @@ public abstract class Sensor { + private long timeToTick; + // Paper start - configurable sensor tick rate and timings + private final String configKey; +- private final co.aikar.timings.Timing timing; ++ // private final co.aikar.timings.Timing timing; // Plazma - Completely remove Timings + // Paper end + + public Sensor(int senseInterval) { +@@ -39,7 +39,7 @@ public abstract class Sensor { + key = key.substring(lastSeparator + 1); + } + this.configKey = key.toLowerCase(java.util.Locale.ROOT); +- this.timing = co.aikar.timings.MinecraftTimings.getSensorTimings(configKey, senseInterval); ++ // this.timing = co.aikar.timings.MinecraftTimings.getSensorTimings(configKey, senseInterval); // Plazma - Completely remove Timings + // Paper end + this.scanRate = senseInterval; + this.timeToTick = (long)RANDOM.nextInt(senseInterval); +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 16e6716f70d5b9090f29f8b2320302d98dd087c2..c20f3dfdfb4efced687da115be0293887d69f966 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -179,7 +179,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + // Plazma end - Configurable Plazma + public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur +- public final co.aikar.timings.WorldTimingsHandler timings; // Paper ++ // public final co.aikar.timings.WorldTimingsHandler timings; // Paper // Plazma - Completely remove Timings + public static BlockPos lastPhysicsProblem; // Spigot + private org.spigotmc.TickLimiter entityLimiter; + private org.spigotmc.TickLimiter tileLimiter; +@@ -352,7 +352,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {} + }); + // CraftBukkit end +- this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings ++ // this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings // Plazma - Completely remove Timings + this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper - Option to keep spawn chunks loaded + this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); + this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); +@@ -1362,7 +1362,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + + //this.timings.tileEntityTick.stopTiming(); // Spigot // Purpur + this.tickingBlockEntities = false; +- co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper ++ // co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper // Plazma - Completely remove Timings + //gameprofilerfiller.pop(); // Purpur + this.spigotConfig.currentPrimedTnt = 0; // Spigot + } +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 284149925440f413d23a9ec3ce704e70a74f4c08..608a00e6be7c8c5ae922aaa738f875559ab708f5 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -114,6 +114,7 @@ public class Block extends BlockBehaviour implements ItemLike { + this != Blocks.STRUCTURE_BLOCK && + this != Blocks.JIGSAW; + } ++ /* // Plazma - Completely remove Timings + public co.aikar.timings.Timing timing; + public co.aikar.timings.Timing getTiming() { + if (timing == null) { +@@ -121,6 +122,7 @@ public class Block extends BlockBehaviour implements ItemLike { + } + return timing; + } ++ */ // Plazma - Completely remove Timings + // Paper end + @Nullable + private String descriptionId; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +index e9701ed4e5b35ace1accd2b46f082191d8ab6497..f2200a6098210ae3137e266a1f079ffd6971504d 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +@@ -23,14 +23,14 @@ import org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry; + import org.bukkit.inventory.InventoryHolder; + // CraftBukkit end + +-import org.spigotmc.CustomTimingsHandler; // Spigot +-import co.aikar.timings.MinecraftTimings; // Paper +-import co.aikar.timings.Timing; // Paper ++// import org.spigotmc.CustomTimingsHandler; // Spigot // Plazma - Completely remove Timings ++// import co.aikar.timings.MinecraftTimings; // Paper // Plazma - Completely remove Timings ++// import co.aikar.timings.Timing; // Paper // Plazma - Completely remove Timings + + public abstract class BlockEntity { + static boolean ignoreTileUpdates; // Paper - Perf: Optimize Hoppers + +- public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper ++ // public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper // Plazma - Completely remove Timings + // CraftBukkit start - data containers + private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); + public CraftPersistentDataContainer persistentDataContainer; +diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java +index e8df8e8520cea5d21197c61a172f7211a3a2c34d..27a106e3844309e5b7ca12d1fd2374cf20f4ba48 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Main.java ++++ b/src/main/java/org/bukkit/craftbukkit/Main.java +@@ -366,8 +366,8 @@ public class Main { + tryPreloadClass("org.jline.terminal.impl.MouseSupport"); + tryPreloadClass("org.jline.terminal.impl.MouseSupport$1"); + tryPreloadClass("org.jline.terminal.Terminal$MouseTracking"); +- tryPreloadClass("co.aikar.timings.TimingHistory"); +- tryPreloadClass("co.aikar.timings.TimingHistory$MinuteReport"); ++ // tryPreloadClass("co.aikar.timings.TimingHistory"); // Plazma - Completely remove Timings ++ // tryPreloadClass("co.aikar.timings.TimingHistory$MinuteReport"); // Plazma - Completely remove Timings + tryPreloadClass("io.netty.channel.AbstractChannelHandlerContext"); + tryPreloadClass("io.netty.channel.AbstractChannelHandlerContext$11"); + tryPreloadClass("io.netty.channel.AbstractChannelHandlerContext$12"); +diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +index 6bab5f9e40987d1a8ca9c17118d2a14135df5dff..14fd658f987f21993f334ae1524f880e3ce12b86 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java ++++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +@@ -1,6 +1,6 @@ + package org.bukkit.craftbukkit.scheduler; + +-import co.aikar.timings.MinecraftTimings; // Paper ++// import co.aikar.timings.MinecraftTimings; // Paper // Plazma - Completely remove Timings + import com.google.common.base.Preconditions; + import com.google.common.util.concurrent.ThreadFactoryBuilder; + import java.util.ArrayList; +@@ -304,7 +304,7 @@ public class CraftScheduler implements BukkitScheduler { + } + return false; + } +- }){{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer();}}; // Paper ++ });//{{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer();}}; // Paper // Plazma - Completely remove Timings + this.handle(task, 0L); + for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { + if (taskPending == task) { +@@ -344,7 +344,7 @@ public class CraftScheduler implements BukkitScheduler { + } + } + } +- }){{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer(plugin);}}; // Paper ++ });//{{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer(plugin);}}; // Paper // Plazma - Completely remove Timings + this.handle(task, 0L); + for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { + if (taskPending == task) { +diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +index 5835dc236b3f5291a804f7fb14a12eb466d4e0ba..5b943a792f6b005a094bc06f59899bd28cf576a1 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java ++++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +@@ -2,14 +2,14 @@ package org.bukkit.craftbukkit.scheduler; + + import java.util.function.Consumer; + +-import co.aikar.timings.NullTimingHandler; ++// import co.aikar.timings.NullTimingHandler; // Plazma - Completely remove Timings + import org.bukkit.Bukkit; + import org.bukkit.plugin.Plugin; + import org.bukkit.scheduler.BukkitTask; + +-import org.spigotmc.CustomTimingsHandler; // Spigot +-import co.aikar.timings.MinecraftTimings; // Paper +-import co.aikar.timings.Timing; // Paper ++// import org.spigotmc.CustomTimingsHandler; // Spigot // Plazma - Completely remove Timings ++// import co.aikar.timings.MinecraftTimings; // Paper // Plazma - Completely remove Timings ++// import co.aikar.timings.Timing; // Paper // Plazma - Completely remove Timings + + public class CraftTask implements BukkitTask, Runnable { // Spigot + +@@ -31,7 +31,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot + private long nextRun; + public final Runnable rTask; // Paper + public final Consumer cTask; // Paper +- public Timing timings; // Paper ++ // public Timing timings; // Paper // Plazma - Completely remove Timings + private final Plugin plugin; + private final int id; + private final long createdAt = System.nanoTime(); +@@ -55,7 +55,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot + this.id = id; + this.period = CraftTask.NO_REPEATING; + this.taskName = taskName; +- this.timings = MinecraftTimings.getInternalTaskName(taskName); ++ // this.timings = MinecraftTimings.getInternalTaskName(taskName); // Plazma - Completely remove Timings + } + // Paper end + +@@ -76,7 +76,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot + } + this.id = id; + this.period = period; +- timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : NullTimingHandler.NULL; // Paper ++ // timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : NullTimingHandler.NULL; // Paper // Plazma - Completely remove Timings + } + + @Override +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +index e29dc1101c7aa4b7b2a2d2e732e27a1a14a2a234..544d6f4831341802ac156080e30b2b500cd9f0da 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +@@ -217,7 +217,7 @@ public final class CraftMagicNumbers implements UnsafeValues { + // Paper start + @Override + public void reportTimings() { +- co.aikar.timings.TimingsExport.reportTimings(); ++ //co.aikar.timings.TimingsExport.reportTimings(); // Plazma - Completely remove Timings + } + // Paper end + +@@ -495,9 +495,9 @@ public final class CraftMagicNumbers implements UnsafeValues { + return new CraftDamageSourceBuilder(damageType); + } + // Paper start +- @Override ++ @Override @Deprecated // Plazma - Completely remove Timings + public String getTimingsServerName() { +- return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; ++ return null; //io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; // Plazma - Completely remove Timings + } + + @Override +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index 56e52b16b419c882440a15947f037ae1a902bc70..e0e1c873703c1d3482d5bc82294490a44dd3a7a9 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -35,7 +35,7 @@ import net.minecraft.world.entity.projectile.FireworkRocketEntity; + import net.minecraft.world.entity.projectile.ThrowableProjectile; + import net.minecraft.world.entity.projectile.ThrownTrident; + import net.minecraft.world.entity.raid.Raider; +-import co.aikar.timings.MinecraftTimings; ++// import co.aikar.timings.MinecraftTimings; // Plazma - Completely remove Timings + import net.minecraft.world.entity.schedule.Activity; + import net.minecraft.world.level.Level; + import net.minecraft.world.phys.AABB;