From ea29b2ca5550fab256c0e0c95f6df74fedd2bc2a Mon Sep 17 00:00:00 2001 From: nostalgic853 Date: Fri, 9 Dec 2022 23:36:52 +0800 Subject: [PATCH] First 1.19.3 build --- build.gradle.kts | 2 +- gradle.properties | 4 +- ...hing.patch => 0005-Maven-publishing.patch} | 4 +- ...-API.patch => 0006-Player-Skull-API.patch} | 4 +- patches/api/0007-Revert-Spark-Profiler.patch | 24 + .../1.19.3}/api/0003-Smooth-Teleports.patch | 4 +- .../0005-Add-Java19-Support-for-SIMD.patch | 0 ...003-Use-our-logo-instead-of-Purpur-s.patch | 0 .../server/0005-Smooth-Teleports.patch | 0 ...0015-Use-Timings-v2-instead-of-spark.patch | 0 ...ached-pool-for-mob-spawning-executor.patch | 0 .../0019-Add-Java19-Support-for-SIMD.patch | 0 patches/server/0001-Rebrand.patch | 16 +- patches/server/0002-Config-and-command.patch | 10 +- ... => 0003-Smarter-statistics-ticking.patch} | 6 +- ...heck.patch => 0004-Fast-speed-check.patch} | 4 +- ...s.patch => 0005-Options-of-warnings.patch} | 8 +- ...6-Add-an-option-for-tripwire-duping.patch} | 0 ...n-for-spigot-item-merging-mechanism.patch} | 4 +- ...> 0008-Add-global-eula-file-feature.patch} | 9 +- ...ork-entities-or-the-server-may-be-l.patch} | 2 +- ...le-arrow-despawn-counter-by-default.patch} | 2 +- ...11-Don-t-create-new-random-instance.patch} | 6 +- ...012-Skip-entity-move-if-no-movement.patch} | 6 +- ...h => 0013-Optimized-getBiome-method.patch} | 0 ...=> 0014-Use-optimized-RecipeManager.patch} | 2 +- ...-Use-a-faster-random-implementation.patch} | 16 +- ...-API.patch => 0016-Player-Skull-API.patch} | 4 +- ...rk.patch => 0017-Reduce-sensor-work.patch} | 12 +- .../server/0018-Revert-Spark-Profiler.patch | 51 + patches/server/0019-Remove-Timings.patch | 1460 +++++++++++++++++ 31 files changed, 1598 insertions(+), 62 deletions(-) rename patches/api/{0006-Maven-publishing.patch => 0005-Maven-publishing.patch} (86%) rename patches/api/{0007-Player-Skull-API.patch => 0006-Player-Skull-API.patch} (89%) create mode 100644 patches/api/0007-Revert-Spark-Profiler.patch rename patches/{ => removed/1.19.3}/api/0003-Smooth-Teleports.patch (89%) rename patches/{ => removed/1.19.3}/api/0005-Add-Java19-Support-for-SIMD.patch (100%) rename patches/{ => removed/1.19.3}/server/0003-Use-our-logo-instead-of-Purpur-s.patch (100%) rename patches/{ => removed/1.19.3}/server/0005-Smooth-Teleports.patch (100%) rename patches/{ => removed/1.19.3}/server/0015-Use-Timings-v2-instead-of-spark.patch (100%) rename patches/{ => removed/1.19.3}/server/0018-Use-cached-pool-for-mob-spawning-executor.patch (100%) rename patches/{ => removed/1.19.3}/server/0019-Add-Java19-Support-for-SIMD.patch (100%) rename patches/server/{0004-Smarter-statistics-ticking.patch => 0003-Smarter-statistics-ticking.patch} (91%) rename patches/server/{0006-Fast-speed-check.patch => 0004-Fast-speed-check.patch} (90%) rename patches/server/{0007-Options-of-warnings.patch => 0005-Options-of-warnings.patch} (93%) rename patches/server/{0008-Add-an-option-for-tripwire-duping.patch => 0006-Add-an-option-for-tripwire-duping.patch} (100%) rename patches/server/{0009-Add-an-option-for-spigot-item-merging-mechanism.patch => 0007-Add-an-option-for-spigot-item-merging-mechanism.patch} (92%) rename patches/server/{0010-Add-global-eula-file-feature.patch => 0008-Add-global-eula-file-feature.patch} (82%) rename patches/server/{0011-Do-not-save-firework-entities-or-the-server-may-be-l.patch => 0009-Do-not-save-firework-entities-or-the-server-may-be-l.patch} (89%) rename patches/server/{0012-Disable-arrow-despawn-counter-by-default.patch => 0010-Disable-arrow-despawn-counter-by-default.patch} (91%) rename patches/server/{0013-Don-t-create-new-random-instance.patch => 0011-Don-t-create-new-random-instance.patch} (91%) rename patches/server/{0014-Skip-entity-move-if-no-movement.patch => 0012-Skip-entity-move-if-no-movement.patch} (89%) rename patches/server/{0016-Optimized-getBiome-method.patch => 0013-Optimized-getBiome-method.patch} (100%) rename patches/server/{0017-Use-optimized-RecipeManager.patch => 0014-Use-optimized-RecipeManager.patch} (97%) rename patches/server/{0020-Use-a-faster-random-implementation.patch => 0015-Use-a-faster-random-implementation.patch} (96%) rename patches/server/{0021-Player-Skull-API.patch => 0016-Player-Skull-API.patch} (92%) rename patches/server/{0022-Reduce-sensor-work.patch => 0017-Reduce-sensor-work.patch} (80%) create mode 100644 patches/server/0018-Revert-Spark-Profiler.patch create mode 100644 patches/server/0019-Remove-Timings.patch diff --git a/build.gradle.kts b/build.gradle.kts index a5686ff..37b8d09 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { java `maven-publish` id("com.github.johnrengelman.shadow") version "7.1.2" apply false - id("io.papermc.paperweight.patcher") version "1.3.9" + id("io.papermc.paperweight.patcher") version "1.3.11" } val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" diff --git a/gradle.properties b/gradle.properties index 07e7869..8aa04fd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ group = cc.keyimc.keyi -version = 1.19.2-R0.1-SNAPSHOT +version = 1.19.3-R0.1-SNAPSHOT -purpurCommit = 86f2da583b1d84372cbca9a7dcfff45c287853ad +purpurCommit = 78e9a806d3fb2e17bf85f5457e2004a2478ed747 org.gradle.caching = true org.gradle.parallel = true diff --git a/patches/api/0006-Maven-publishing.patch b/patches/api/0005-Maven-publishing.patch similarity index 86% rename from patches/api/0006-Maven-publishing.patch rename to patches/api/0005-Maven-publishing.patch index 80d08e0..df048eb 100644 --- a/patches/api/0006-Maven-publishing.patch +++ b/patches/api/0005-Maven-publishing.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Maven publishing diff --git a/build.gradle.kts b/build.gradle.kts -index 8e64ccdb928bc38cb703e60c8ec31339a6f6d894..d52ac51e072ac3c25ce426c2864584277f0c7fc8 100644 +index 051b2db3548d1b24f591f05eece0c8241475e9bf..85e30cd20f0f8534724ce4e309e28ef0031f683c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -153,3 +153,24 @@ tasks.check { +@@ -145,3 +145,24 @@ tasks.check { dependsOn(scanJar) } // Paper end diff --git a/patches/api/0007-Player-Skull-API.patch b/patches/api/0006-Player-Skull-API.patch similarity index 89% rename from patches/api/0007-Player-Skull-API.patch rename to patches/api/0006-Player-Skull-API.patch index 348e8cb..169a309 100644 --- a/patches/api/0007-Player-Skull-API.patch +++ b/patches/api/0006-Player-Skull-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Player Skull API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index d54ba266d4dc772d844b1fffed0092a2d92e0eb1..ba8ac0aaa321d389b2186ad5d7c7759f7956723f 100644 +index d13f8f7f5afb772514804ef78e2c704964c3cbd8..52dc40bc7cea12e657885b011a002cb89db00f33 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -3,6 +3,9 @@ package org.bukkit.entity; @@ -18,7 +18,7 @@ index d54ba266d4dc772d844b1fffed0092a2d92e0eb1..ba8ac0aaa321d389b2186ad5d7c7759f import com.destroystokyo.paper.ClientOption; // Paper import com.destroystokyo.paper.Title; // Paper import net.kyori.adventure.text.Component; -@@ -3073,4 +3076,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -3071,4 +3074,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ void sendDeathScreen(@NotNull Component message, @Nullable Entity killer); // Purpur end diff --git a/patches/api/0007-Revert-Spark-Profiler.patch b/patches/api/0007-Revert-Spark-Profiler.patch new file mode 100644 index 0000000..942e716 --- /dev/null +++ b/patches/api/0007-Revert-Spark-Profiler.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: nostalgic853 +Date: Fri, 9 Dec 2022 23:13:43 +0800 +Subject: [PATCH] Revert "Spark Profiler" + +This reverts commit 2f3f630834d34ee625be79fac6bc429d0e10d929. + +diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +index 2843545c6281da1f47e24431023c56e9592cef16..08f5892f175b898e3aa5cfc7de6639b818330927 100644 +--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java ++++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +@@ -167,12 +167,6 @@ public final class SimplePluginManager implements PluginManager { + server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper + continue; + } +- // Purpur start +- if (!Boolean.getBoolean("Purpur.IReallyDontWantSpark") && plugins.containsKey(description.getName()) && description.getName().equalsIgnoreCase("spark")) { +- server.getLogger().log(Level.INFO, "Purpur: Using user-provided spark plugin instead of our own."); +- continue; +- } +- // Purpur end + + File replacedFile = plugins.put(description.getName(), file); + if (replacedFile != null) { diff --git a/patches/api/0003-Smooth-Teleports.patch b/patches/removed/1.19.3/api/0003-Smooth-Teleports.patch similarity index 89% rename from patches/api/0003-Smooth-Teleports.patch rename to patches/removed/1.19.3/api/0003-Smooth-Teleports.patch index e673a84..8ee51b5 100644 --- a/patches/api/0003-Smooth-Teleports.patch +++ b/patches/removed/1.19.3/api/0003-Smooth-Teleports.patch @@ -9,10 +9,10 @@ Original license: MIT Original project: https://github.com/Cryptite/Slice diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 9c2dcca0b6e34a3083226360575f0956a077d767..5ed16b78c39de21eff18a4824f84457a7c70fb58 100644 +index 35bff85031b1e1b06af7d2bc1c76540d17ae3f3e..d13f8f7f5afb772514804ef78e2c704964c3cbd8 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2771,6 +2771,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2769,6 +2769,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM String getClientBrandName(); // Paper end diff --git a/patches/api/0005-Add-Java19-Support-for-SIMD.patch b/patches/removed/1.19.3/api/0005-Add-Java19-Support-for-SIMD.patch similarity index 100% rename from patches/api/0005-Add-Java19-Support-for-SIMD.patch rename to patches/removed/1.19.3/api/0005-Add-Java19-Support-for-SIMD.patch diff --git a/patches/server/0003-Use-our-logo-instead-of-Purpur-s.patch b/patches/removed/1.19.3/server/0003-Use-our-logo-instead-of-Purpur-s.patch similarity index 100% rename from patches/server/0003-Use-our-logo-instead-of-Purpur-s.patch rename to patches/removed/1.19.3/server/0003-Use-our-logo-instead-of-Purpur-s.patch diff --git a/patches/server/0005-Smooth-Teleports.patch b/patches/removed/1.19.3/server/0005-Smooth-Teleports.patch similarity index 100% rename from patches/server/0005-Smooth-Teleports.patch rename to patches/removed/1.19.3/server/0005-Smooth-Teleports.patch diff --git a/patches/server/0015-Use-Timings-v2-instead-of-spark.patch b/patches/removed/1.19.3/server/0015-Use-Timings-v2-instead-of-spark.patch similarity index 100% rename from patches/server/0015-Use-Timings-v2-instead-of-spark.patch rename to patches/removed/1.19.3/server/0015-Use-Timings-v2-instead-of-spark.patch diff --git a/patches/server/0018-Use-cached-pool-for-mob-spawning-executor.patch b/patches/removed/1.19.3/server/0018-Use-cached-pool-for-mob-spawning-executor.patch similarity index 100% rename from patches/server/0018-Use-cached-pool-for-mob-spawning-executor.patch rename to patches/removed/1.19.3/server/0018-Use-cached-pool-for-mob-spawning-executor.patch diff --git a/patches/server/0019-Add-Java19-Support-for-SIMD.patch b/patches/removed/1.19.3/server/0019-Add-Java19-Support-for-SIMD.patch similarity index 100% rename from patches/server/0019-Add-Java19-Support-for-SIMD.patch rename to patches/removed/1.19.3/server/0019-Add-Java19-Support-for-SIMD.patch diff --git a/patches/server/0001-Rebrand.patch b/patches/server/0001-Rebrand.patch index a3c7d1d..58035d2 100644 --- a/patches/server/0001-Rebrand.patch +++ b/patches/server/0001-Rebrand.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Rebrand diff --git a/build.gradle.kts b/build.gradle.kts -index 8ffc0d92ea29b95e5406ed81088ecf00e7679a97..96c012a57170fe1ec6954af7969b5c1371ea9ecf 100644 +index 7de4b51cb4afdcbdfb8d1dc32f56252d997e23a8..3ffa404efaac294d60c8430266f47dcbfb6d1592 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { @@ -14,10 +14,10 @@ index 8ffc0d92ea29b95e5406ed81088ecf00e7679a97..96c012a57170fe1ec6954af7969b5c13 dependencies { - implementation(project(":purpur-api")) // Purpur + implementation(project(":keyi-api")) // Purpur // KeYi - // Pufferfish start - implementation("io.papermc.paper:paper-mojangapi:1.19.2-R0.1-SNAPSHOT") { + implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") { exclude("io.papermc.paper", "paper-api") -@@ -78,13 +78,13 @@ tasks.jar { + } +@@ -60,13 +60,13 @@ tasks.jar { manifest { val git = Git(rootProject.layout.projectDirectory.path) val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim() @@ -28,7 +28,7 @@ index 8ffc0d92ea29b95e5406ed81088ecf00e7679a97..96c012a57170fe1ec6954af7969b5c13 attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", "Implementation-Title" to "CraftBukkit", -- "Implementation-Version" to "git-Purpur-$implementationVersion",// Purpur +- "Implementation-Version" to "git-Purpur-$implementationVersion", // Purpur + "Implementation-Version" to "git-KeYi-$gitBranch-$implementationVersion",// Purpur // KeYi "Implementation-Vendor" to date, // Paper "Specification-Title" to "Bukkit", @@ -166,10 +166,10 @@ index fba5dbdb7bcbb55400ef18342c9b54612972a718..005983d56b283e54e2cf450f1e9f985a private static int fetchDistanceFromSiteApi(int jenkinsBuild, @Nullable String siteApiVersion) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 2491785f5edd782b74189bef33eeffe13288f3da..3a67aaa39daf1fb86938f53e129aadfb686583b0 100644 +index 80d4167edd7c87240ce02ae122153976015d548a..120b798742b1a4524eefa4b5387a8ffc203e523c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -249,7 +249,7 @@ import javax.annotation.Nullable; // Paper +@@ -262,7 +262,7 @@ import javax.annotation.Nullable; // Paper import javax.annotation.Nonnull; // Paper public final class CraftServer implements Server { @@ -192,7 +192,7 @@ index fb87620c742ff7912f5e8ccd2a7930dd605576d9..d779212cbb719a1d923a24823135c5d3 if (stream != null) { diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index ccca392a45cb05abb55ddd5c6c36e6f9c7a5d171..f02a183fa2fd359456063b55c6c087e802c54f7b 100644 +index 76cbfb7e900bf2698776f54cfe498f4b42965221..cd60f79acdd2307bdae48a11d4f5ec3ff3fa225a 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -244,7 +244,7 @@ public class PurpurConfig { diff --git a/patches/server/0002-Config-and-command.patch b/patches/server/0002-Config-and-command.patch index 8c1bf90..b437025 100644 --- a/patches/server/0002-Config-and-command.patch +++ b/patches/server/0002-Config-and-command.patch @@ -240,12 +240,12 @@ index 0000000000000000000000000000000000000000..510eea6066fb0743a9c561eb577de9d9 + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index a029f51983bcfe49beab1359f282f0f957723ef2..ca0ddafe66dd5d02b1e96b1fc1c574490b68e6d4 100644 +index 5b44f7512f21dba3f3306c7f42fa2d78e600847a..8fe0a9c2989016821ff673838c0041b38aff8fb2 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -239,6 +239,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish - gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish +@@ -232,6 +232,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + // Paper end + // gg.pufferfish.pufferfish.PufferfishConfig.pufferfishFile = (java.io.File) options.valueOf("pufferfish-settings"); // Purpur + // KeYi start - init config + try { @@ -261,7 +261,7 @@ index a029f51983bcfe49beab1359f282f0f957723ef2..ca0ddafe66dd5d02b1e96b1fc1c57449 this.setFlightAllowed(dedicatedserverproperties.allowFlight); this.setMotd(dedicatedserverproperties.motd); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 8a4c8701122edf2f29edbe97e4fa199da2744e9e..ebf774da1f2614c0ecb00cf9260ba5a5ca676cb2 100644 +index 72810905cc50af204161a02872d599af4aba8dbb..175d75a929d219f24c78cabe1558b4ebd22e1235 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -180,6 +180,14 @@ public class Main { diff --git a/patches/server/0004-Smarter-statistics-ticking.patch b/patches/server/0003-Smarter-statistics-ticking.patch similarity index 91% rename from patches/server/0004-Smarter-statistics-ticking.patch rename to patches/server/0003-Smarter-statistics-ticking.patch index 68d3ce9..2cc7de3 100644 --- a/patches/server/0004-Smarter-statistics-ticking.patch +++ b/patches/server/0003-Smarter-statistics-ticking.patch @@ -10,13 +10,13 @@ Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia 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 1b7e38538881ba00ffdbe9226952627151532c5c..119e26e32654c834ff1158836ce56ba8985c09e8 100644 +index 5a482f4c2a86d3f93fbbe8fc8fd29b07ebd50dc8..0b50301046234551c51b5ea9add450b6310ca73a 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -315,19 +315,21 @@ public abstract class Player extends LivingEntity { +@@ -308,19 +308,21 @@ public abstract class Player extends LivingEntity { + this.moveCloak(); if (!this.level.isClientSide) { this.foodData.tick(this); - this.wardenSpawnTracker.tick(); - this.awardStat(Stats.PLAY_TIME); - this.awardStat(Stats.TOTAL_WORLD_TIME); - if (this.isAlive()) { diff --git a/patches/server/0006-Fast-speed-check.patch b/patches/server/0004-Fast-speed-check.patch similarity index 90% rename from patches/server/0006-Fast-speed-check.patch rename to patches/server/0004-Fast-speed-check.patch index 9172842..1eee077 100644 --- a/patches/server/0006-Fast-speed-check.patch +++ b/patches/server/0004-Fast-speed-check.patch @@ -14,10 +14,10 @@ doing questionable/buggy ones, and claiming breathtaking performance improvement any of those Spigot forks! diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index dd13fc7cbf82948b1474ea33411e64b465608672..d0b001ec4265dda8d130122c2e946ea07f9aa3ac 100644 +index 64b91d72fca05f2e74bcaf83bccf061a25a0c868..b0bb07c57e6219a21003bfce72b6909680ac78e5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1196,7 +1196,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1163,7 +1163,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } this.tryCheckInsideBlocks(); diff --git a/patches/server/0007-Options-of-warnings.patch b/patches/server/0005-Options-of-warnings.patch similarity index 93% rename from patches/server/0007-Options-of-warnings.patch rename to patches/server/0005-Options-of-warnings.patch index 680aa9c..cc8e6f7 100644 --- a/patches/server/0007-Options-of-warnings.patch +++ b/patches/server/0005-Options-of-warnings.patch @@ -30,10 +30,10 @@ index bc9403d002ef24e71be67a962d099f5d73db9540..5582c15a37fbbf74d2039ba15d67684f } \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index a9c4f1192f53fea55b2f5edc8a91b6911489e2d3..5420915b21bbd17eeaba2ba45e08399a3abe6952 100644 +index 8fe0a9c2989016821ff673838c0041b38aff8fb2..c2dab0da201010395b9367c8812115b34176fa36 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -185,7 +185,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -180,7 +180,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } // Paper start - detect running as root @@ -42,7 +42,7 @@ index a9c4f1192f53fea55b2f5edc8a91b6911489e2d3..5420915b21bbd17eeaba2ba45e08399a DedicatedServer.LOGGER.warn("****************************"); DedicatedServer.LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED."); DedicatedServer.LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS."); -@@ -326,10 +326,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -319,10 +319,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface // CraftBukkit end if (!this.usesAuthentication()) { @@ -61,7 +61,7 @@ index a9c4f1192f53fea55b2f5edc8a91b6911489e2d3..5420915b21bbd17eeaba2ba45e08399a DedicatedServer.LOGGER.warn("Whilst this makes it possible to use BungeeCord or Velocity, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose."); // Purpur DedicatedServer.LOGGER.warn("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information."); } else { -@@ -337,7 +342,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -330,7 +335,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.warn("You will not be offered any support as long as the server allows offline-mode players to join."); // Purpur } // Spigot end diff --git a/patches/server/0008-Add-an-option-for-tripwire-duping.patch b/patches/server/0006-Add-an-option-for-tripwire-duping.patch similarity index 100% rename from patches/server/0008-Add-an-option-for-tripwire-duping.patch rename to patches/server/0006-Add-an-option-for-tripwire-duping.patch diff --git a/patches/server/0009-Add-an-option-for-spigot-item-merging-mechanism.patch b/patches/server/0007-Add-an-option-for-spigot-item-merging-mechanism.patch similarity index 92% rename from patches/server/0009-Add-an-option-for-spigot-item-merging-mechanism.patch rename to patches/server/0007-Add-an-option-for-spigot-item-merging-mechanism.patch index 52cf1ed..f8df3ad 100644 --- a/patches/server/0009-Add-an-option-for-spigot-item-merging-mechanism.patch +++ b/patches/server/0007-Add-an-option-for-spigot-item-merging-mechanism.patch @@ -21,10 +21,10 @@ index 8884a2471b4b7c5cabf1c0c767710ba69c7ae4ec..4f08f2e40f5bc3bc5a87bf3a34945afd } \ No newline at end of file diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index d7e102024b495067335fe008ec1649708f3a4016..f1aed20abb804c65b9c490e14f32f4074a32e893 100644 +index ee5ec376cf7495ed99ee822a7b26978c3c107098..a85cef2b26cf876025c9436606eee24a3354f4da 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -296,7 +296,7 @@ public class ItemEntity extends Entity { +@@ -288,7 +288,7 @@ public class ItemEntity extends Entity { ItemStack itemstack1 = other.getItem(); if (Objects.equals(this.getOwner(), other.getOwner()) && ItemEntity.areMergable(itemstack, itemstack1)) { diff --git a/patches/server/0010-Add-global-eula-file-feature.patch b/patches/server/0008-Add-global-eula-file-feature.patch similarity index 82% rename from patches/server/0010-Add-global-eula-file-feature.patch rename to patches/server/0008-Add-global-eula-file-feature.patch index df974b2..c27ef32 100644 --- a/patches/server/0010-Add-global-eula-file-feature.patch +++ b/patches/server/0008-Add-global-eula-file-feature.patch @@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia diff --git a/src/main/java/net/minecraft/server/Eula.java b/src/main/java/net/minecraft/server/Eula.java -index 920a0e6540bc8b8ce34dfaf57d58c200013b7b2c..94f05d32304f8a8c2aa294318617851adc55988d 100644 +index 5528a4b7a67e0c257966c587437006004a2e1292..032e45e0addd89ad8b028803ea6d2135ffed5c05 100644 --- a/src/main/java/net/minecraft/server/Eula.java +++ b/src/main/java/net/minecraft/server/Eula.java -@@ -16,12 +16,26 @@ public class Eula { +@@ -16,10 +16,24 @@ public class Eula { public Eula(Path eulaFile) { this.file = eulaFile; @@ -35,8 +35,5 @@ index 920a0e6540bc8b8ce34dfaf57d58c200013b7b2c..94f05d32304f8a8c2aa294318617851a + + private boolean readFile(java.nio.file.Path path) { try { -- InputStream inputStream = Files.newInputStream(this.file); -+ InputStream inputStream = Files.newInputStream(path); - boolean var3; - try { + try (InputStream inputStream = Files.newInputStream(this.file)) { diff --git a/patches/server/0011-Do-not-save-firework-entities-or-the-server-may-be-l.patch b/patches/server/0009-Do-not-save-firework-entities-or-the-server-may-be-l.patch similarity index 89% rename from patches/server/0011-Do-not-save-firework-entities-or-the-server-may-be-l.patch rename to patches/server/0009-Do-not-save-firework-entities-or-the-server-may-be-l.patch index ddfaa54..d73401a 100644 --- a/patches/server/0011-Do-not-save-firework-entities-or-the-server-may-be-l.patch +++ b/patches/server/0009-Do-not-save-firework-entities-or-the-server-may-be-l.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Do not save firework entities or the server may be laggy diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index 61252ef8a79bac0ea2d3d231ec6b12166f39d072..ada4792000be638b19425e87e582ad257b147dd2 100644 +index 5406925cd66f46ab8744123c670d72cea7bfc3a1..0b664dfef68b1e3905c9d8451602abf9cd9eafe6 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -358,4 +358,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { diff --git a/patches/server/0012-Disable-arrow-despawn-counter-by-default.patch b/patches/server/0010-Disable-arrow-despawn-counter-by-default.patch similarity index 91% rename from patches/server/0012-Disable-arrow-despawn-counter-by-default.patch rename to patches/server/0010-Disable-arrow-despawn-counter-by-default.patch index 8fbc8ee..a04dbef 100644 --- a/patches/server/0012-Disable-arrow-despawn-counter-by-default.patch +++ b/patches/server/0010-Disable-arrow-despawn-counter-by-default.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Disable arrow despawn counter by default diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index bb352ed86e4047e38ad27900f72fc0ddb741bf71..2cc8eeedfd5729fd324b10cb4b2a6298dad39e9d 100644 +index 856024f31ca1eeab6e4d4ee7f547509bc9581bf8..d73914f406012af602232ca47e7ed0e627b564c6 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -116,7 +116,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0013-Don-t-create-new-random-instance.patch b/patches/server/0011-Don-t-create-new-random-instance.patch similarity index 91% rename from patches/server/0013-Don-t-create-new-random-instance.patch rename to patches/server/0011-Don-t-create-new-random-instance.patch index 9da4772..ad600d4 100644 --- a/patches/server/0013-Don-t-create-new-random-instance.patch +++ b/patches/server/0011-Don-t-create-new-random-instance.patch @@ -7,10 +7,10 @@ Original code by PatinaMC, licensed under GNU General Public License v3.0 You can find the original code on https://github.com/PatinaMC/Patina diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 2162082984f343b31a3800811a1bb8e0b1dc6e41..7210ec5ac726b615b0373dc551c915f6b1bf5848 100644 +index 7f2a811505c2aeaad6e1a91a0719613a6694f77a..6890e3598d769d6dbfb5b665153b17cb5493a84a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -387,7 +387,7 @@ public class ServerPlayer extends Player { +@@ -398,7 +398,7 @@ public class ServerPlayer extends Player { long l = k * k; int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l; int j1 = this.getCoprime(i1); @@ -19,7 +19,7 @@ index 2162082984f343b31a3800811a1bb8e0b1dc6e41..7210ec5ac726b615b0373dc551c915f6 for (int l1 = 0; l1 < i1; ++l1) { int i2 = (k1 + j1 * l1) % i1; -@@ -424,7 +424,7 @@ public class ServerPlayer extends Player { +@@ -435,7 +435,7 @@ public class ServerPlayer extends Player { long l = k * k; int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l; int j1 = this.getCoprime(i1); diff --git a/patches/server/0014-Skip-entity-move-if-no-movement.patch b/patches/server/0012-Skip-entity-move-if-no-movement.patch similarity index 89% rename from patches/server/0014-Skip-entity-move-if-no-movement.patch rename to patches/server/0012-Skip-entity-move-if-no-movement.patch index ccd33bc..0dce136 100644 --- a/patches/server/0014-Skip-entity-move-if-no-movement.patch +++ b/patches/server/0012-Skip-entity-move-if-no-movement.patch @@ -9,7 +9,7 @@ Original code by RelativityMC, licensed under MIT You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d0b001ec4265dda8d130122c2e946ea07f9aa3ac..9a9d2e4cf955da26edc3b20d567294b2b2775ac4 100644 +index b0bb07c57e6219a21003bfce72b6909680ac78e5..6f9c8bfea4ef60aec040064ce976bb1f03770d04 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -399,6 +399,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -20,7 +20,7 @@ index d0b001ec4265dda8d130122c2e946ea07f9aa3ac..9a9d2e4cf955da26edc3b20d567294b2 public void setOrigin(@javax.annotation.Nonnull Location location) { this.origin = location.toVector(); -@@ -1036,6 +1037,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1003,6 +1004,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { // Paper end - detailed watchdog information public void move(MoverType movementType, Vec3 movement) { @@ -34,7 +34,7 @@ index d0b001ec4265dda8d130122c2e946ea07f9aa3ac..9a9d2e4cf955da26edc3b20d567294b2 // Paper start - detailed watchdog information io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main"); synchronized (this.posLock) { -@@ -3797,6 +3805,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3804,6 +3812,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public final void setBoundingBox(AABB boundingBox) { diff --git a/patches/server/0016-Optimized-getBiome-method.patch b/patches/server/0013-Optimized-getBiome-method.patch similarity index 100% rename from patches/server/0016-Optimized-getBiome-method.patch rename to patches/server/0013-Optimized-getBiome-method.patch diff --git a/patches/server/0017-Use-optimized-RecipeManager.patch b/patches/server/0014-Use-optimized-RecipeManager.patch similarity index 97% rename from patches/server/0017-Use-optimized-RecipeManager.patch rename to patches/server/0014-Use-optimized-RecipeManager.patch index 328a767..6cb90cb 100644 --- a/patches/server/0017-Use-optimized-RecipeManager.patch +++ b/patches/server/0014-Use-optimized-RecipeManager.patch @@ -11,7 +11,7 @@ This is a fully vanilla optimization. Improves: [Blast]Furnace/Campfire/Smoker/S This was mostly made for the auto crafting table, since the performance boost is much more visible while using that mod diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index 4872f70977e73c889fe6e2339d00ebc64459613d..7f6bd5fb335ea33c52d510461a1f17371c36576a 100644 +index 2f712bfc1f717ba410bf34669d7b0a919ca218cc..fa7f4c3e14aa4ec11187f7c0f96cb4504ee38547 100644 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java @@ -11,14 +11,7 @@ import com.google.gson.JsonParseException; diff --git a/patches/server/0020-Use-a-faster-random-implementation.patch b/patches/server/0015-Use-a-faster-random-implementation.patch similarity index 96% rename from patches/server/0020-Use-a-faster-random-implementation.patch rename to patches/server/0015-Use-a-faster-random-implementation.patch index 39f330f..856694a 100644 --- a/patches/server/0020-Use-a-faster-random-implementation.patch +++ b/patches/server/0015-Use-a-faster-random-implementation.patch @@ -424,7 +424,7 @@ index e5ea9f27a1936ed9e329e74317c91c5df89b9fbd..89a41d396162a1c2eb2df5192b0d888b private long lastFill = -1; private long nextRefill = -1; 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 e0e4a924e926b086699998095a1abddd01d8c002..f55584f7255012599fdce018b85e2e21e4660849 100644 +index 09e357833f9bbe26da7fa7142875daf2733d6420..2850b4fac2bf28b751cd6412e2effb99c60a3d74 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -53,6 +53,10 @@ import net.minecraft.world.level.material.Fluids; @@ -438,9 +438,9 @@ index e0e4a924e926b086699998095a1abddd01d8c002..f55584f7255012599fdce018b85e2e21 public class LevelChunk extends ChunkAccess { -@@ -932,7 +936,7 @@ public class LevelChunk extends ChunkAccess { +@@ -919,7 +923,7 @@ public class LevelChunk extends ChunkAccess { if (this.needsDecoration) { - try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper + //try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper // Purpur this.needsDecoration = false; - java.util.Random random = new java.util.Random(); + Random random = new FastRandom(); @@ -469,10 +469,10 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..ef8909c9c13c8f46ec6d452f0d14c9a1 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 41fafd4a1583e748d763439e8838739ec1ff8e1d..48c35afdbb8b08dbc1279bc57ea44bccb65b2a8a 100644 +index 069bb67d1f79e63dce85cba347a1fd67a4781043..840657e9fa7adaa20753b54d86a68d83e5b0eaf1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -135,6 +135,7 @@ import org.bukkit.util.Consumer; +@@ -134,6 +134,7 @@ import org.bukkit.util.Consumer; import org.bukkit.util.RayTraceResult; import org.bukkit.util.StructureSearchResult; import org.bukkit.util.Vector; @@ -480,7 +480,7 @@ index 41fafd4a1583e748d763439e8838739ec1ff8e1d..48c35afdbb8b08dbc1279bc57ea44bcc public class CraftWorld extends CraftRegionAccessor implements World { public static final int CUSTOM_DIMENSION_OFFSET = 10; -@@ -227,7 +228,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -226,7 +227,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { } // Paper end @@ -507,10 +507,10 @@ index d1c7ab67cba881d96b7a5e9220130d86d0514304..309d1ce15aace9da4a84819e8511af2c public CraftFirework(CraftServer server, FireworkRocketEntity entity) { diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java -index 23b1725679d195380a902a3b03c6b6ad3aaede19..d554bd8e2fbaab8ee4a770563396544d5f447319 100644 +index a9673a804d597599c35c83f4f245510c83005328..08d47eee550e2e9ddfb4dc0ce12945401b16c23c 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java -@@ -40,13 +40,14 @@ import org.bukkit.craftbukkit.util.RandomSourceWrapper; +@@ -42,13 +42,14 @@ import org.bukkit.craftbukkit.util.RandomSourceWrapper; import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator.BiomeGrid; import org.bukkit.generator.ChunkGenerator.ChunkData; diff --git a/patches/server/0021-Player-Skull-API.patch b/patches/server/0016-Player-Skull-API.patch similarity index 92% rename from patches/server/0021-Player-Skull-API.patch rename to patches/server/0016-Player-Skull-API.patch index f9bcc85..e273bc7 100644 --- a/patches/server/0021-Player-Skull-API.patch +++ b/patches/server/0016-Player-Skull-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Player Skull API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 965dabe484bf6276497389656e12d0363fb6513f..77c877118517717a6abf386d104b2c81094ae52a 100644 +index 82697576db752e3dad908e389035ec66c728f0ec..d41d91914b8e7b29b7f92692faa9f7a5a5cbd080 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -26,6 +26,9 @@ import java.util.Optional; @@ -18,7 +18,7 @@ index 965dabe484bf6276497389656e12d0363fb6513f..77c877118517717a6abf386d104b2c81 import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nullable; -@@ -144,6 +147,7 @@ import org.bukkit.event.player.PlayerUnregisterChannelEvent; +@@ -146,6 +149,7 @@ import org.bukkit.event.player.PlayerUnregisterChannelEvent; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.InventoryView.Property; import org.bukkit.inventory.ItemStack; diff --git a/patches/server/0022-Reduce-sensor-work.patch b/patches/server/0017-Reduce-sensor-work.patch similarity index 80% rename from patches/server/0022-Reduce-sensor-work.patch rename to patches/server/0017-Reduce-sensor-work.patch index ffa3065..085bcce 100644 --- a/patches/server/0022-Reduce-sensor-work.patch +++ b/patches/server/0017-Reduce-sensor-work.patch @@ -10,10 +10,10 @@ this patch is focused around the sensors used for ai delete the line of sight cache less often and use a faster nearby comparison diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f23829690d2be20af50256e4d985e3e342415d54..995fc228430ac6c8af8654aa1137c7f66668f622 100644 +index ee87227269b36ff758dceb8dcf20b9367470d6df..01168bb3727399cac73fbf8aa9ae2316a702586d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1026,20 +1026,22 @@ public abstract class LivingEntity extends Entity { +@@ -1027,23 +1027,25 @@ public abstract class LivingEntity extends Entity { } if (entity != null) { @@ -35,16 +35,20 @@ index f23829690d2be20af50256e4d985e3e342415d54..995fc228430ac6c8af8654aa1137c7f6 + else if (entitytypes == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) { d0 *= entity.level.purpurConfig.creeperHeadVisibilityPercent; } +- else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && itemstack.is(Items.PIGLIN_HEAD)) { ++ else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD)) { + d0 *= entity.level.purpurConfig.piglinHeadVisibilityPercent; + } // Purpur end + // petal end // Purpur start if (entity instanceof LivingEntity entityliving) { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index bc18c166ca776b0ef6e816eb034e410c391258b6..e68533ff29c882e955c150130e3260584cc250b0 100644 +index db23506c44de328c74eb509caf6cc4d8d91cbc52..caf2fc594bc5143e8ead8c574963224f63b3bc7a 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -884,10 +884,10 @@ public abstract class Mob extends LivingEntity { +@@ -900,10 +900,10 @@ public abstract class Mob extends LivingEntity { return; } // Paper end diff --git a/patches/server/0018-Revert-Spark-Profiler.patch b/patches/server/0018-Revert-Spark-Profiler.patch new file mode 100644 index 0000000..97285fe --- /dev/null +++ b/patches/server/0018-Revert-Spark-Profiler.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: nostalgic853 +Date: Fri, 9 Dec 2022 23:09:09 +0800 +Subject: [PATCH] Revert "Spark Profiler" + +This reverts commit 00657e75cfec6d86bbdcb1126aabcf7177bec31a. + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 120b798742b1a4524eefa4b5387a8ffc203e523c..5e56cc967f09fc29f1fa4976765a8a837e3087cf 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -448,38 +448,7 @@ public final class CraftServer implements Server { + if (!pluginFolder.exists()) { + pluginFolder.mkdirs(); + } +- // Purpur start +- List extraJars = this.extraPluginJars(); +- if (!Boolean.getBoolean("Purpur.IReallyDontWantSpark")) { +- try { +- File file = new File("cache", "spark.jar"); +- file.getParentFile().mkdirs(); +- +- boolean shouldDownload = true; +- if (file.exists()) { +- String fileSha1 = String.format("%040x", new java.math.BigInteger(1, java.security.MessageDigest.getInstance("SHA-1").digest(java.nio.file.Files.readAllBytes(file.toPath())))); +- String sparkSha1; +- try (java.io.BufferedReader reader = new java.io.BufferedReader(new InputStreamReader(new java.net.URL("https://sparkapi.lucko.me/download/bukkit/sha1").openStream()))) { +- sparkSha1 = reader.lines().collect(Collectors.joining("")); +- } +- +- if (fileSha1.equals(sparkSha1)) { +- shouldDownload = false; +- } +- } +- +- if (shouldDownload) { +- java.nio.file.Files.copy(new java.net.URL("https://sparkapi.lucko.me/download/bukkit").openStream(), file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); +- } +- +- extraJars.add(file); +- } catch (Exception e) { +- getLogger().severe("Purpur: Failed to download and install spark plugin"); +- e.printStackTrace(); +- } +- } +- Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder, extraJars); +- // Purpur end ++ Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder, this.extraPluginJars()); + // Paper end + for (Plugin plugin : plugins) { + try { diff --git a/patches/server/0019-Remove-Timings.patch b/patches/server/0019-Remove-Timings.patch new file mode 100644 index 0000000..abd89f3 --- /dev/null +++ b/patches/server/0019-Remove-Timings.patch @@ -0,0 +1,1460 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: nostalgic853 +Date: Fri, 9 Dec 2022 23:13:01 +0800 +Subject: [PATCH] Remove Timings + + +diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java +index 830d863cd9665d58875bfa5ca2bcd22f89ab2d49..e5d9c6f2cbe11c2ded6d8ad111fa6a8b2086dfba 100644 +--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java ++++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java +@@ -915,9 +915,9 @@ public final class ChunkHolderManager { + } + + public boolean processTicketUpdates() { +- //co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager // Purpur ++ co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager + return this.processTicketUpdates(true, true, null); +- //} finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager // Purpur ++ } finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager + } + + private static final ThreadLocal> CURRENT_TICKET_UPDATE_SCHEDULING = new ThreadLocal<>(); +diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java +index e42eb93fd9f6f51ff5bb4b14a2304d4ffcdd8441..8013dd333e27aa5fd0beb431fa32491eec9f5246 100644 +--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java ++++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java +@@ -1750,7 +1750,7 @@ public final class NewChunkHolder { + boolean canSavePOI = !(chunk instanceof LevelChunk levelChunk && levelChunk.mustNotSave) && (poi != null && poi.isDirty()); + boolean canSaveEntities = entities != null; + +- //try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper // Purpur ++ try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper + if (canSaveChunk) { + canSaveChunk = this.saveChunk(chunk, unloading); + } +@@ -1764,7 +1764,7 @@ public final class NewChunkHolder { + this.lastEntityUnload = null; + } + } +- //} // Purpur ++ } + + return executedUnloadTask | canSaveChunk | canSaveEntities | canSavePOI ? new SaveStat(executedUnloadTask || canSaveChunk, canSaveEntities, canSavePOI): null; + } +diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +index 6d6be46b30e518f9b9483100583ef318b30ee3f7..63ec2ebb71aa0e0dbb64bbce7cd3c9494e9ce2e7 100644 +--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java ++++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +@@ -64,7 +64,6 @@ public class GlobalConfiguration extends ConfigurationPart { + + @Override + public void postProcess() { +- // Purpur - diff on change + MinecraftTimings.processConfig(this); + } + } +diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +index 767623a35dda71d77c65602e10ef2b3f0ae743f1..27d4aa45e585842c04491839826d405d6f447f0e 100644 +--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java ++++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +@@ -47,9 +47,8 @@ public class PacketUtils { + if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 + if (listener.getConnection().isConnected()) { + co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings +- //try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings // Purpur ++ try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings + packet.handle(listener); +- /* // Purpur + } catch (Exception exception) { + net.minecraft.network.Connection networkmanager = listener.getConnection(); + String playerIP = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : ""; // Paper +@@ -61,7 +60,7 @@ public class PacketUtils { + net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error"); + networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error))); + networkmanager.setReadOnly(); +- } */ // Purpur ++ } + } else { + PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet); + } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index b915e6a13a518f05d109c707142efa3946892f0c..029f4bf955e690621e3862e078f7474b6c2fb750 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -337,13 +337,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { // Purpur ++ this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; ++ this.profiler = this.metricsRecorder.getProfiler(); ++ this.onMetricsRecordingStopped = (methodprofilerresults) -> { + this.stopRecordingMetrics(); +- };*/ // Purpur +- //this.onMetricsRecordingFinished = (path) -> { // Purpur +- //}; // Purpur ++ }; ++ this.onMetricsRecordingFinished = (path) -> { ++ }; + this.status = new ServerStatus(); + this.random = RandomSource.create(); + this.port = -1; +@@ -935,9 +935,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + return !this.canOversleep(); + }); +- //isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); // Purpur ++ isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); + // Paper end + new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper + +@@ -1447,7 +1447,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; + try { + this.isSaving = true; +@@ -1462,20 +1462,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur + Iterator iterator = this.getAllLevels().iterator(); // Paper - move down + while (iterator.hasNext()) { + ServerLevel worldserver = (ServerLevel) iterator.next(); +@@ -1544,28 +1543,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur + net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper + +- /*this.profiler.push(() -> { // Purpur ++ this.profiler.push(() -> { + return worldserver + " " + worldserver.dimension().location(); +- });*/ // Purpur ++ }); + /* Drop global time updates + if (this.tickCount % 20 == 0) { +- //this.profiler.push("timeSync"); // Purpur ++ this.profiler.push("timeSync"); + this.playerList.broadcastAll(new PacketPlayOutUpdateTime(worldserver.getGameTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)), worldserver.dimension()); +- //this.profiler.pop(); // Purpur ++ this.profiler.pop(); + } + // CraftBukkit end */ + +- //this.profiler.push("tick"); // Purpur ++ this.profiler.push("tick"); + + try { +- //worldserver.timings.doTick.startTiming(); // Spigot // Purpur ++ worldserver.timings.doTick.startTiming(); // Spigot + worldserver.tick(shouldKeepTicking); + // Paper start + for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) { + regionManager.recalculateRegions(); + } + // Paper end +- //worldserver.timings.doTick.stopTiming(); // Spigot // Purpur ++ worldserver.timings.doTick.stopTiming(); // Spigot + } catch (Throwable throwable) { + // Spigot Start + CrashReport crashreport; +@@ -1581,33 +1580,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + this.executeBlocking(() -> { + this.saveDebugReport(path.resolve("server")); +@@ -2511,40 +2509,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop resultConsumer, Consumer dumpConsumer) { +- /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur ++ this.onMetricsRecordingStopped = (methodprofilerresults) -> { + this.stopRecordingMetrics(); + resultConsumer.accept(methodprofilerresults); + }; + this.onMetricsRecordingFinished = dumpConsumer; +- this.willStartRecordingMetrics = true;*/ // Purpur ++ this.willStartRecordingMetrics = true; + } + + public void stopRecordingMetrics() { +- //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur ++ this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; + } + + public void finishRecordingMetrics() { +- //this.metricsRecorder.end(); // Purpur ++ this.metricsRecorder.end(); + } + + public void cancelRecordingMetrics() { +- //this.metricsRecorder.cancel(); // Purpur +- //this.profiler = this.metricsRecorder.getProfiler(); // Purpur ++ this.metricsRecorder.cancel(); ++ this.profiler = this.metricsRecorder.getProfiler(); + } + + public Path getWorldPath(LevelResource worldSavePath) { +@@ -2593,15 +2591,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = Lists.newArrayList(); + List list1 = this.level.players(); + ObjectIterator objectiterator = this.entityMap.values().iterator(); +- //level.timings.tracker1.startTiming(); // Paper // Purpur ++ level.timings.tracker1.startTiming(); // Paper + + ChunkMap.TrackedEntity playerchunkmap_entitytracker; + +@@ -1307,17 +1307,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + playerchunkmap_entitytracker.serverEntity.sendChanges(); + } + } +- //level.timings.tracker1.stopTiming(); // Paper // Purpur ++ level.timings.tracker1.stopTiming(); // Paper + + if (!list.isEmpty()) { + objectiterator = this.entityMap.values().iterator(); + +- //level.timings.tracker2.startTiming(); // Paper // Purpur ++ level.timings.tracker2.startTiming(); // Paper + while (objectiterator.hasNext()) { + playerchunkmap_entitytracker = (ChunkMap.TrackedEntity) objectiterator.next(); + playerchunkmap_entitytracker.updatePlayers(list); + } +- //level.timings.tracker2.stopTiming(); // Paper // Purpur ++ level.timings.tracker2.stopTiming(); // Paper + } + + } +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index 105cdab3a1c912299dbcfb670ace810b9202731c..ca84eddbdb1e198b899750e5f6b3eafd25ce970f 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -428,16 +428,16 @@ public class ServerChunkCache extends ChunkSource { + return ifLoaded; + } + // Paper end +- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur ++ ProfilerFiller gameprofilerfiller = this.level.getProfiler(); + +- //gameprofilerfiller.incrementCounter("getChunk"); // Purpur ++ gameprofilerfiller.incrementCounter("getChunk"); + long k = ChunkPos.asLong(x, z); + + ChunkAccess ichunkaccess; + + // Paper - rewrite chunk system - there are no correct callbacks to remove items from cache in the new chunk system + +- //gameprofilerfiller.incrementCounter("getChunkCacheMiss"); // Purpur ++ gameprofilerfiller.incrementCounter("getChunkCacheMiss"); + CompletableFuture> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create, true); // Paper + ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor; + +@@ -447,10 +447,10 @@ public class ServerChunkCache extends ChunkSource { + io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.pushChunkWait(this.level, x1, z1); // Paper - rewrite chunk system + // Paper end + com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - sync load info +- //this.level.timings.syncChunkLoad.startTiming(); // Paper // Purpur ++ this.level.timings.syncChunkLoad.startTiming(); // Paper + chunkproviderserver_b.managedBlock(completablefuture::isDone); + io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system +- //this.level.timings.syncChunkLoad.stopTiming(); // Paper // Purpur ++ this.level.timings.syncChunkLoad.stopTiming(); // Paper + } // Paper + ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { + return ichunkaccess1; +@@ -598,17 +598,17 @@ public class ServerChunkCache extends ChunkSource { + + public void save(boolean flush) { + this.runDistanceManagerUpdates(); +- //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur ++ try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings + this.chunkMap.saveAllChunks(flush); +- //} // Paper - Timings // Purpur ++ } // Paper - Timings + } + + // Paper start - duplicate save, but call incremental + public void saveIncrementally() { + this.runDistanceManagerUpdates(); +- //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur ++ try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings + this.chunkMap.saveIncrementally(); +- //} // Paper - Timings // Purpur ++ } // Paper - Timings + } + // Paper end + +@@ -625,36 +625,36 @@ public class ServerChunkCache extends ChunkSource { + // CraftBukkit start - modelled on below + public void purgeUnload() { + if (true) return; // Paper - tickets will be removed later, this behavior isn't really well accounted for by the chunk system +- //this.level.getProfiler().push("purge"); // Purpur ++ this.level.getProfiler().push("purge"); + this.distanceManager.purgeStaleTickets(); + this.runDistanceManagerUpdates(); +- //this.level.getProfiler().popPush("unload"); // Purpur ++ this.level.getProfiler().popPush("unload"); + this.chunkMap.tick(() -> true); +- //this.level.getProfiler().pop(); // Purpur ++ this.level.getProfiler().pop(); + this.clearCache(); + } + // CraftBukkit end + + @Override + public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { +- //this.level.getProfiler().push("purge"); // Purpur +- //this.level.timings.doChunkMap.startTiming(); // Spigot // Purpur ++ this.level.getProfiler().push("purge"); ++ this.level.timings.doChunkMap.startTiming(); // Spigot + this.distanceManager.purgeStaleTickets(); + this.runDistanceManagerUpdates(); +- //this.level.timings.doChunkMap.stopTiming(); // Spigot // Purpur +- //this.level.getProfiler().popPush("chunks"); // Purpur ++ this.level.timings.doChunkMap.stopTiming(); // Spigot ++ this.level.getProfiler().popPush("chunks"); + if (tickChunks) { +- //this.level.timings.chunks.startTiming(); // Paper - timings // Purpur ++ this.level.timings.chunks.startTiming(); // Paper - timings + this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes + this.tickChunks(); +- //this.level.timings.chunks.stopTiming(); // Paper - timings // Purpur ++ this.level.timings.chunks.stopTiming(); // Paper - timings + } + +- //this.level.timings.doChunkUnload.startTiming(); // Spigot // Purpur +- //this.level.getProfiler().popPush("unload"); // Purpur ++ this.level.timings.doChunkUnload.startTiming(); // Spigot ++ this.level.getProfiler().popPush("unload"); + this.chunkMap.tick(shouldKeepTicking); +- //this.level.timings.doChunkUnload.stopTiming(); // Spigot // Purpur +- //this.level.getProfiler().pop(); // Purpur ++ this.level.timings.doChunkUnload.stopTiming(); // Spigot ++ this.level.getProfiler().pop(); + this.clearCache(); + } + +@@ -700,14 +700,14 @@ public class ServerChunkCache extends ChunkSource { + } + // Paper end - optimize isOutisdeRange + LevelData worlddata = this.level.getLevelData(); +- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur ++ ProfilerFiller gameprofilerfiller = this.level.getProfiler(); + +- //gameprofilerfiller.push("pollingChunks"); // Purpur ++ gameprofilerfiller.push("pollingChunks"); + int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); + boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit + +- //gameprofilerfiller.push("naturalSpawnCount"); // Purpur +- //this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur ++ gameprofilerfiller.push("naturalSpawnCount"); ++ this.level.timings.countNaturalMobs.startTiming(); // Paper - timings + int l = this.distanceManager.getNaturalSpawnChunkCount(); + // Paper start - per player mob spawning + NaturalSpawner.SpawnState spawnercreature_d; // moved down +@@ -721,16 +721,16 @@ public class ServerChunkCache extends ChunkSource { + spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, this.chunkMap.playerMobDistanceMap == null ? new LocalMobCapCalculator(this.chunkMap) : null, false); + } + // Paper end +- //this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur ++ this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings + + this.lastSpawnState = spawnercreature_d; +- //gameprofilerfiller.popPush("filteringLoadedChunks"); // Purpur ++ gameprofilerfiller.popPush("filteringLoadedChunks"); + // Paper - moved down +- //this.level.timings.chunkTicks.startTiming(); // Paper // Purpur ++ this.level.timings.chunkTicks.startTiming(); // Paper + + // Paper - moved down + +- //gameprofilerfiller.popPush("spawnAndTick"); // Purpur ++ gameprofilerfiller.popPush("spawnAndTick"); + boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit + + // Paper - only shuffle if per-player mob spawning is disabled +@@ -780,17 +780,17 @@ public class ServerChunkCache extends ChunkSource { + } + } + // Paper end - optimise chunk tick iteration +- //this.level.timings.chunkTicks.stopTiming(); // Paper // Purpur +- //gameprofilerfiller.popPush("customSpawners"); // Purpur ++ this.level.timings.chunkTicks.stopTiming(); // Paper ++ gameprofilerfiller.popPush("customSpawners"); + if (flag2) { +- //try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings // Purpur ++ try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings + this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); +- //} // Paper - timings // Purpur ++ } // Paper - timings + } +- //gameprofilerfiller.pop(); // Purpur ++ gameprofilerfiller.pop(); + // Paper start - use set of chunks requiring updates, rather than iterating every single one loaded +- //gameprofilerfiller.popPush("broadcast"); // Purpur +- //this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur ++ gameprofilerfiller.popPush("broadcast"); ++ this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing + if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) { + ReferenceOpenHashSet copy = this.chunkMap.needsChangeBroadcasting.clone(); + this.chunkMap.needsChangeBroadcasting.clear(); +@@ -802,8 +802,8 @@ public class ServerChunkCache extends ChunkSource { + } + } + } +- //this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing // Purpur +- //gameprofilerfiller.pop(); // Purpur ++ this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing ++ gameprofilerfiller.pop(); + // Paper end - use set of chunks requiring updates, rather than iterating every single one loaded + // Paper start - controlled flush for entity tracker packets + List disabledFlushes = new java.util.ArrayList<>(this.level.players.size()); +@@ -994,7 +994,7 @@ public class ServerChunkCache extends ChunkSource { + + @Override + protected void doRunTask(Runnable task) { +- //ServerChunkCache.this.level.getProfiler().incrementCounter("runTask"); // Purpur ++ ServerChunkCache.this.level.getProfiler().incrementCounter("runTask"); + super.doRunTask(task); + } + +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index e21559ebc4d5ffcf10fc50f5bcc31ccff3b8394f..8fd3511d484cfd2b56238530aea95c84effcd1f1 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -656,12 +656,12 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + } + // Paper end - optimise checkDespawn +- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur ++ ProfilerFiller gameprofilerfiller = this.getProfiler(); + + this.handlingTick = true; +- //gameprofilerfiller.push("world border"); // Purpur ++ gameprofilerfiller.push("world border"); + this.getWorldBorder().tick(); +- //gameprofilerfiller.popPush("weather"); // Purpur ++ gameprofilerfiller.popPush("weather"); + this.advanceWeatherCycle(); + int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + long j; +@@ -688,32 +688,32 @@ public class ServerLevel extends Level implements WorldGenLevel { + + this.updateSkyBrightness(); + this.tickTime(); +- //gameprofilerfiller.popPush("tickPending"); // Purpur +- //timings.scheduledBlocks.startTiming(); // Paper // Purpur ++ gameprofilerfiller.popPush("tickPending"); ++ timings.scheduledBlocks.startTiming(); // Paper + if (!this.isDebug()) { + j = this.getGameTime(); +- //gameprofilerfiller.push("blockTicks"); // Purpur ++ gameprofilerfiller.push("blockTicks"); + this.blockTicks.tick(j, 65536, this::tickBlock); +- //gameprofilerfiller.popPush("fluidTicks"); // Purpur ++ gameprofilerfiller.popPush("fluidTicks"); + this.fluidTicks.tick(j, 65536, this::tickFluid); +- //gameprofilerfiller.pop(); // Purpur ++ gameprofilerfiller.pop(); + } +- //timings.scheduledBlocks.stopTiming(); // Paper // Purpur ++ timings.scheduledBlocks.stopTiming(); // Paper + +- //gameprofilerfiller.popPush("raid"); // Purpur +- //this.timings.raids.startTiming(); // Paper - timings // Purpur ++ gameprofilerfiller.popPush("raid"); ++ this.timings.raids.startTiming(); // Paper - timings + this.raids.tick(); +- //this.timings.raids.stopTiming(); // Paper - timings // Purpur +- //gameprofilerfiller.popPush("chunkSource"); // Purpur +- //this.timings.chunkProviderTick.startTiming(); // Paper - timings // Purpur ++ this.timings.raids.stopTiming(); // Paper - timings ++ gameprofilerfiller.popPush("chunkSource"); ++ this.timings.chunkProviderTick.startTiming(); // Paper - timings + this.getChunkSource().tick(shouldKeepTicking, true); +- //this.timings.chunkProviderTick.stopTiming(); // Paper - timings // Purpur +- //gameprofilerfiller.popPush("blockEvents"); // Purpur +- //timings.doSounds.startTiming(); // Spigot // Purpur ++ this.timings.chunkProviderTick.stopTiming(); // Paper - timings ++ gameprofilerfiller.popPush("blockEvents"); ++ timings.doSounds.startTiming(); // Spigot + this.runBlockEvents(); +- //timings.doSounds.stopTiming(); // Spigot // Purpur ++ timings.doSounds.stopTiming(); // Spigot + this.handlingTick = false; +- //gameprofilerfiller.pop(); // Purpur ++ gameprofilerfiller.pop(); + boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players + + if (flag) { +@@ -721,24 +721,24 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + + if (flag || this.emptyTime++ < 300) { +- //gameprofilerfiller.push("entities"); // Purpur +- //timings.tickEntities.startTiming(); // Spigot // Purpur ++ gameprofilerfiller.push("entities"); ++ timings.tickEntities.startTiming(); // Spigot + if (this.dragonFight != null) { +- //gameprofilerfiller.push("dragonFight"); // Purpur ++ gameprofilerfiller.push("dragonFight"); + this.dragonFight.tick(); +- //gameprofilerfiller.pop(); // Purpur ++ gameprofilerfiller.pop(); + } + + org.spigotmc.ActivationRange.activateEntities(this); // Spigot +- //timings.entityTick.startTiming(); // Spigot // Purpur ++ timings.entityTick.startTiming(); // Spigot + this.entityTickList.forEach((entity) -> { + if (!entity.isRemoved()) { + if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed + entity.discard(); + } else { +- //gameprofilerfiller.push("checkDespawn"); // Purpur ++ gameprofilerfiller.push("checkDespawn"); + entity.checkDespawn(); +- //gameprofilerfiller.pop(); // Purpur ++ gameprofilerfiller.pop(); + if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list + Entity entity1 = entity.getVehicle(); + +@@ -750,21 +750,22 @@ public class ServerLevel extends Level implements WorldGenLevel { + entity.stopRiding(); + } + +- //gameprofilerfiller.push("tick"); // Purpur ++ gameprofilerfiller.push("tick"); + this.guardEntityTick(this::tickNonPassenger, entity); +- //gameprofilerfiller.pop(); // Purpur ++ gameprofilerfiller.pop(); + } + } + } + }); +- //timings.entityTick.stopTiming(); // Spigot // Purpur +- //timings.tickEntities.stopTiming(); // Spigot // Purpur +- //gameprofilerfiller.pop(); // Purpur ++ timings.entityTick.stopTiming(); // Spigot ++ timings.tickEntities.stopTiming(); // Spigot ++ gameprofilerfiller.pop(); + this.tickBlockEntities(); + } + +- //gameprofilerfiller.push("entityManagement"); // Purpur ++ gameprofilerfiller.push("entityManagement"); + //this.entityManager.tick(); // Paper - rewrite chunk system ++ gameprofilerfiller.pop(); + } + + @Override +@@ -844,9 +845,9 @@ public class ServerLevel extends Level implements WorldGenLevel { + boolean flag = this.isRaining(); + int j = chunkcoordintpair.getMinBlockX(); + int k = chunkcoordintpair.getMinBlockZ(); +- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur ++ ProfilerFiller gameprofilerfiller = this.getProfiler(); + +- //gameprofilerfiller.push("thunder"); // Purpur ++ gameprofilerfiller.push("thunder"); + final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change + + if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder +@@ -884,7 +885,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + } + +- //gameprofilerfiller.popPush("iceandsnow"); // Purpur ++ gameprofilerfiller.popPush("iceandsnow"); + int l; + + if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow +@@ -936,8 +937,8 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + + // Paper start - optimise random block ticking +- //gameprofilerfiller.popPush("randomTick"); // Purpur +- //timings.chunkTicksBlocks.startTiming(); // Paper // Purpur ++ gameprofilerfiller.popPush("randomTick"); ++ timings.chunkTicksBlocks.startTiming(); // Paper + if (randomTickSpeed > 0) { + LevelChunkSection[] sections = chunk.getSections(); + int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this); +@@ -971,8 +972,8 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + } + // Paper end - optimise random block ticking +- //timings.chunkTicksBlocks.stopTiming(); // Paper // Purpur +- //gameprofilerfiller.pop(); // Purpur ++ timings.chunkTicksBlocks.stopTiming(); // Paper ++ gameprofilerfiller.pop(); + } + + public Optional findLightningRod(BlockPos pos) { +@@ -1264,24 +1265,24 @@ public class ServerLevel extends Level implements WorldGenLevel { + // Spigot end + // Paper start- timings + final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); +- //timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper // Purpur +- //try { // Purpur ++ timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper ++ try { + // Paper end - timings + entity.setOldPosAndRot(); +- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur ++ ProfilerFiller gameprofilerfiller = this.getProfiler(); + + ++entity.tickCount; +- /*this.getProfiler().push(() -> { // Purpur ++ this.getProfiler().push(() -> { + return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); +- });*/ // Purpur +- //gameprofilerfiller.incrementCounter("tickNonPassenger"); // Purpur ++ }); ++ gameprofilerfiller.incrementCounter("tickNonPassenger"); + if (isActive) { // Paper - EAR 2 + TimingHistory.activatedEntityTicks++; + entity.tick(); + entity.postTick(); // CraftBukkit + } else { entity.inactiveTick(); } // Paper - EAR 2 +- //this.getProfiler().pop(); // Purpur +- //} finally { timer.stopTiming(); } // Paper - timings // Purpur ++ this.getProfiler().pop(); ++ } finally { timer.stopTiming(); } // Paper - timings + Iterator iterator = entity.getPassengers().iterator(); + + while (iterator.hasNext()) { +@@ -1304,17 +1305,17 @@ public class ServerLevel extends Level implements WorldGenLevel { + if (passenger instanceof Player || this.entityTickList.contains(passenger)) { + // Paper - EAR 2 + final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger); +- //co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper // Purpur +- //try { // Purpur ++ co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper ++ try { + // Paper end + passenger.setOldPosAndRot(); + ++passenger.tickCount; +- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur ++ ProfilerFiller gameprofilerfiller = this.getProfiler(); + +- /*gameprofilerfiller.push(() -> { // Purpur ++ gameprofilerfiller.push(() -> { + return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); +- });*/ // Purpur +- //gameprofilerfiller.incrementCounter("tickPassenger"); // Purpur ++ }); ++ gameprofilerfiller.incrementCounter("tickPassenger"); + // Paper start - EAR 2 + if (isActive) { + passenger.rideTick(); +@@ -1326,7 +1327,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + vehicle.positionRider(passenger); + } + // Paper end - EAR 2 +- //gameprofilerfiller.pop(); // Purpur ++ gameprofilerfiller.pop(); + Iterator iterator = passenger.getPassengers().iterator(); + + while (iterator.hasNext()) { +@@ -1335,7 +1336,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + this.tickPassenger(passenger, entity2); + } + +- //} finally { timer.stopTiming(); }// Paper - EAR2 timings // Purpur ++ } finally { timer.stopTiming(); }// Paper - EAR2 timings + } + } else { + passenger.stopRiding(); +@@ -1355,14 +1356,14 @@ public class ServerLevel extends Level implements WorldGenLevel { + org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); + } + +- //try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) { // Purpur ++ try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) { + if (doFull) { + this.saveLevelData(); + } + +- //this.timings.worldSaveChunks.startTiming(); // Paper // Purpur ++ this.timings.worldSaveChunks.startTiming(); // Paper + if (!this.noSave()) chunkproviderserver.saveIncrementally(); +- //this.timings.worldSaveChunks.stopTiming(); // Paper // Purpur ++ this.timings.worldSaveChunks.stopTiming(); // Paper + + // Copied from save() + // CraftBukkit start - moved from MinecraftServer.saveChunks +@@ -1374,7 +1375,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData()); + } + // CraftBukkit end +- //} // Purpur ++ } + } + // Paper end + +@@ -1388,7 +1389,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + + if (!savingDisabled) { + org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit +- //try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper // Purpur // Purpur ++ try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper + if (progressListener != null) { + progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); + } +@@ -1398,11 +1399,11 @@ public class ServerLevel extends Level implements WorldGenLevel { + progressListener.progressStage(Component.translatable("menu.savingChunks")); + } + +- //timings.worldSaveChunks.startTiming(); // Paper // Purpur ++ timings.worldSaveChunks.startTiming(); // Paper + if (!close) chunkproviderserver.save(flush); // Paper - rewrite chunk system + if (close) chunkproviderserver.close(true); // Paper - rewrite chunk system +- //timings.worldSaveChunks.stopTiming(); // Paper // Purpur +- //}// Paper // Purpur ++ timings.worldSaveChunks.stopTiming(); // Paper ++ }// Paper + // Paper - rewrite chunk system - entity saving moved into ChunkHolder + + } else if (close) { chunkproviderserver.close(false); } // Paper - rewrite chunk system +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index e69348724dc1b98a91f93af18dde6e6231068b61..45bdc5afa8b51ef381ac3c41c57cf0ad271658d0 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2586,7 +2586,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + } + } + // Paper End +- //co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper // Purpur ++ co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper + if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot + this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); + +@@ -2596,7 +2596,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + this.cserver.getPluginManager().callEvent(event); + + if (event.isCancelled()) { +- //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur ++ co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper + return; + } + +@@ -2609,7 +2609,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + return; + } finally { +- //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur ++ co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper + } + } + // CraftBukkit end +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 9cfe4f2ab57f6d17a64eda2c48fb59ab7aa14367..23cea7dd67dd1890a8fd34c294d140b30e89f59c 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1297,7 +1297,7 @@ public abstract class PlayerList { + + public void saveAll(int interval) { + io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main +- //MinecraftTimings.savePlayers.startTiming(); // Paper // Purpur ++ MinecraftTimings.savePlayers.startTiming(); // Paper + int numSaved = 0; + long now = MinecraftServer.currentTick; + for (int i = 0; i < this.players.size(); ++i) { +@@ -1308,7 +1308,7 @@ public abstract class PlayerList { + } + // Paper end + } +- //MinecraftTimings.savePlayers.stopTiming(); // Paper // Purpur ++ MinecraftTimings.savePlayers.stopTiming(); // Paper + return null; }); // Paper - ensure main + } + +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 651c156dc8a5aad04d461add02e22147af657d07..57ef7fbba3028c28231abf7b7ae78aa019323536 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 + this.status = Behavior.Status.RUNNING; + int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration); + this.endTimestamp = time + (long)i; +- //this.timing.startTiming(); // Paper - behavior timings // Purpur ++ this.timing.startTiming(); // Paper - behavior timings + this.start(world, entity, time); +- //this.timing.stopTiming(); // Paper - behavior timings // Purpur ++ this.timing.stopTiming(); // Paper - behavior timings + return true; + } else { + return false; +@@ -72,13 +72,13 @@ public abstract class Behavior implements BehaviorContro + + @Override + public final void tickOrStop(ServerLevel world, E entity, long time) { +- //this.timing.startTiming(); // Paper - behavior timings // Purpur ++ this.timing.startTiming(); // Paper - behavior timings + if (!this.timedOut(time) && this.canStillUse(world, entity, time)) { + this.tick(world, entity, time); + } else { + this.doStop(world, entity, time); + } +- //this.timing.stopTiming(); // Paper - behavior timings // Purpur ++ this.timing.stopTiming(); // Paper - behavior 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 7094701d213c73ba47ace806962244c10fdf4dda..fcdb9bde8e1605e30dde3e580491522d4b62cdc0 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 { + 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); +- //this.timing.startTiming(); // Purpur ++ this.timing.startTiming(); + // Paper end + this.doTick(world, entity); +- //this.timing.stopTiming(); // Paper - sensor timings // Purpur ++ this.timing.stopTiming(); // Paper - sensor timings + } + + } +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 3778ad438b3a5f6cdbc465c7356bf9e11340753e..730a6e8bac4436a62c4ef5a122f55fc92432ae6a 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -608,9 +608,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + BlockState iblockdata2 = this.getBlockState(pos); + + if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock(this, pos) != iblockdata1.getLightBlock(this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) { +- //this.getProfiler().push("queueCheckLight"); // Purpur ++ this.getProfiler().push("queueCheckLight"); + this.getChunkSource().getLightEngine().checkBlock(pos); +- //this.getProfiler().pop(); // Purpur ++ this.getProfiler().pop(); + } + + /* +@@ -909,18 +909,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + } + + protected void tickBlockEntities() { +- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur ++ ProfilerFiller gameprofilerfiller = this.getProfiler(); + +- //gameprofilerfiller.push("blockEntities"); // Purpur +- //timings.tileEntityPending.startTiming(); // Spigot // Purpur ++ gameprofilerfiller.push("blockEntities"); ++ timings.tileEntityPending.startTiming(); // Spigot + this.tickingBlockEntities = true; + if (!this.pendingBlockEntityTickers.isEmpty()) { + this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); + this.pendingBlockEntityTickers.clear(); + } +- //timings.tileEntityPending.stopTiming(); // Spigot // Purpur ++ timings.tileEntityPending.stopTiming(); // Spigot + +- //timings.tileEntityTick.startTiming(); // Spigot // Purpur ++ timings.tileEntityTick.startTiming(); // Spigot + // Spigot start + // Iterator iterator = this.blockEntityTickers.iterator(); + int tilesThisCycle = 0; +@@ -953,10 +953,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + } + this.blockEntityTickers.removeAll(toRemove); + +- //timings.tileEntityTick.stopTiming(); // Spigot // Purpur ++ timings.tileEntityTick.stopTiming(); // Spigot + this.tickingBlockEntities = false; + co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper +- //gameprofilerfiller.pop(); // Purpur ++ gameprofilerfiller.pop(); + spigotConfig.currentPrimedTnt = 0; // Spigot + } + +@@ -1149,7 +1149,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + + @Override + public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { +- //this.getProfiler().incrementCounter("getEntities"); // Purpur ++ this.getProfiler().incrementCounter("getEntities"); + List list = Lists.newArrayList(); + ((ServerLevel)this).getEntityLookup().getEntities(except, box, list, predicate); // Paper - optimise this call + return list; +@@ -1168,7 +1168,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + } + + public void getEntities(EntityTypeTest filter, AABB box, Predicate predicate, List result, int limit) { +- //this.getProfiler().incrementCounter("getEntities"); // Purpur ++ this.getProfiler().incrementCounter("getEntities"); + // Paper start - optimise this call + //TODO use limit + if (filter instanceof net.minecraft.world.entity.EntityType entityTypeTest) { +@@ -1497,7 +1497,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + } + + public ProfilerFiller getProfiler() { +- // Purpur - diff on change + return (ProfilerFiller) this.profiler.get(); + } + +diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +index decf30b590658a627d47cb688531ec1cc24ba001..01b21f520ef1c834b9bafc3de85c1fa4fcf539d6 100644 +--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java ++++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +@@ -132,8 +132,8 @@ public final class NaturalSpawner { + } + + public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn) { +- //world.getProfiler().push("spawner"); // Purpur +- //world.timings.mobSpawn.startTiming(); // Spigot // Purpur ++ world.getProfiler().push("spawner"); ++ world.timings.mobSpawn.startTiming(); // Spigot + MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES; + int i = aenumcreaturetype.length; + +@@ -188,8 +188,8 @@ public final class NaturalSpawner { + } + } + +- //world.timings.mobSpawn.stopTiming(); // Spigot // Purpur +- //world.getProfiler().pop(); // Purpur ++ world.timings.mobSpawn.stopTiming(); // Spigot ++ world.getProfiler().pop(); + } + + // Paper start +@@ -260,7 +260,7 @@ public final class NaturalSpawner { + blockposition_mutableblockposition.set(l, i, i1); + double d0 = (double) l + 0.5D; + double d1 = (double) i1 + 0.5D; +- Player entityhuman = (chunk instanceof LevelChunk) ? ((LevelChunk)chunk).findNearestPlayer(d0, i, d1, 576.0D, world.purpurConfig.mobSpawningIgnoreCreativePlayers ? net.minecraft.world.entity.EntitySelector.NO_CREATIVE_OR_SPECTATOR : net.minecraft.world.entity.EntitySelector.NO_SPECTATORS) : world.getNearestPlayer(d0, (double) i, d1, -1.0D, world.purpurConfig.mobSpawningIgnoreCreativePlayers); // Paper - use chunk's player cache to optimize search in range // Purpur ++ Player entityhuman = (chunk instanceof LevelChunk) ? ((LevelChunk)chunk).findNearestPlayer(d0, i, d1, 576.0D, net.minecraft.world.entity.EntitySelector.NO_SPECTATORS) : world.getNearestPlayer(d0, (double) i, d1, -1.0D, false); // Paper - use chunk's player cache to optimize search in range + + if (entityhuman != null) { + double d2 = entityhuman.distanceToSqr(d0, (double) i, d1); +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 2850b4fac2bf28b751cd6412e2effb99c60a3d74..28e4b302284f955a73e75d0f4276d55fb51826f5 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -53,10 +53,6 @@ import net.minecraft.world.level.material.Fluids; + import net.minecraft.world.ticks.LevelChunkTicks; + import net.minecraft.world.ticks.TickContainerAccess; + import org.slf4j.Logger; +-// KeYi start +-import cc.keyimc.keyi.utils.FastRandom; +-import java.util.Random; // KeYi +-// KeYi end + + public class LevelChunk extends ChunkAccess { + +@@ -921,9 +917,9 @@ public class LevelChunk extends ChunkAccess { + this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system + + if (this.needsDecoration) { +- //try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper // Purpur ++ try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper + this.needsDecoration = false; +- Random random = new FastRandom(); ++ java.util.Random random = new java.util.Random(); + random.setSeed(this.level.getSeed()); + long xRand = random.nextLong() / 2L * 2L + 1L; + long zRand = random.nextLong() / 2L * 2L + 1L; +@@ -941,7 +937,7 @@ public class LevelChunk extends ChunkAccess { + } + } + server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk)); +- //} // Paper // Purpur ++ } // Paper + } + } + } +@@ -1298,10 +1294,10 @@ public class LevelChunk extends ChunkAccess { + + if (LevelChunk.this.isTicking(blockposition)) { + try { +- //ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); // Purpur ++ ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); + +- //gameprofilerfiller.push(this::getType); // Purpur +- //this.blockEntity.tickTimer.startTiming(); // Spigot // Purpur ++ gameprofilerfiller.push(this::getType); ++ this.blockEntity.tickTimer.startTiming(); // Spigot + BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); + + if (this.blockEntity.getType().isValid(iblockdata)) { +@@ -1312,7 +1308,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}); + } + +- //gameprofilerfiller.pop(); // Purpur ++ gameprofilerfiller.pop(); + } catch (Throwable throwable) { + if (throwable instanceof ThreadDeath) throw throwable; // Paper + // Paper start - Prevent tile entity and entity crashes +@@ -1323,7 +1319,7 @@ public class LevelChunk extends ChunkAccess { + // Paper end + // Spigot start + } finally { +- //this.blockEntity.tickTimer.stopTiming(); // Purpur ++ this.blockEntity.tickTimer.stopTiming(); + // Spigot end + } + } +diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +index 5402098dce0d64d3dceea51f248d7d366850a74f..d1526ed7197b883e1d1f07baf285bf5eef4d20d5 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java ++++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +@@ -516,10 +516,10 @@ public class CraftScheduler implements BukkitScheduler { + this.runners.remove(task.getTaskId()); + } + } +- //MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper // Purpur ++ MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper + this.pending.addAll(temp); + temp.clear(); +- //MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper // Purpur ++ MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper + //this.debugHead = this.debugHead.getNextHead(currentTick); // Paper + } + +@@ -563,7 +563,7 @@ public class CraftScheduler implements BukkitScheduler { + } + + void parsePending() { // Paper +- //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper // Purpur ++ if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper + CraftTask head = this.head; + CraftTask task = head.getNext(); + CraftTask lastTask = head; +@@ -582,7 +582,7 @@ public class CraftScheduler implements BukkitScheduler { + task.setNext(null); + } + this.head = lastTask; +- //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper // Purpur ++ if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper + } + + private boolean isReady(final int currentTick) { +diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +index 4f1cf281c4bf68c37982d390da8779dea78dab18..3f45bab0e9f7b3697e6d9d1092a1e6e579f7066f 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java ++++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +@@ -96,13 +96,13 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot + + @Override + public void run() { +- //try (Timing ignored = timings.startTiming()) { // Paper // Purpur ++ try (Timing ignored = timings.startTiming()) { // Paper + if (this.rTask != null) { + this.rTask.run(); + } else { + this.cTask.accept(this); + } +- //} // Paper // Purpur ++ } // Paper + } + + long getCreatedAt() { +diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java +index a6e9e503a496c18e2501b03ec84f4600c134a50c..138407c2d4b0bc55ddb9aac5d2aa3edadda090fb 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java ++++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java +@@ -115,7 +115,7 @@ public final class CraftScoreboardManager implements ScoreboardManager { + public void getScoreboardScores(ObjectiveCriteria criteria, String name, Consumer consumer) { + // Paper start - add timings for scoreboard search + // plugins leaking scoreboards will make this very expensive, let server owners debug it easily +- //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync(); // Purpur ++ co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync(); + try { + // Paper end - add timings for scoreboard search + for (CraftScoreboard scoreboard : this.scoreboards) { +@@ -123,7 +123,7 @@ public final class CraftScoreboardManager implements ScoreboardManager { + board.forAllObjectives(criteria, name, (score) -> consumer.accept(score)); + } + } finally { // Paper start - add timings for scoreboard search +- //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync(); // Purpur ++ co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync(); + } + // Paper end - add timings for scoreboard search + } +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index 43d962f634c25da159c4935a3c5c8994a3a4930e..3783186d0c3f2f7b241d38f8ee011e8a5c172980 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -166,7 +166,7 @@ public class ActivationRange + */ + public static void activateEntities(Level world) + { +- //MinecraftTimings.entityActivationCheckTimer.startTiming(); // Purpur ++ MinecraftTimings.entityActivationCheckTimer.startTiming(); + final int miscActivationRange = world.spigotConfig.miscActivationRange; + final int raiderActivationRange = world.spigotConfig.raiderActivationRange; + final int animalActivationRange = world.spigotConfig.animalActivationRange; +@@ -221,7 +221,7 @@ public class ActivationRange + } + // Paper end + } +- //MinecraftTimings.entityActivationCheckTimer.stopTiming(); // Purpur ++ MinecraftTimings.entityActivationCheckTimer.stopTiming(); + } + + /**