From ede863d773e355cb3cd95c7894291779fb24e1ed Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Wed, 4 Jan 2023 19:08:05 -0500 Subject: [PATCH] Purpur: Remove Timings & Profiler --- patches/api/0007-Purpur-Remove-Timings.patch | 154 ++ ... 0008-KTP-Optimize-Spigot-event-bus.patch} | 0 ...09-KeYi-Add-Java19-Support-for-SIMD.patch} | 0 ...patch => 0010-KeYi-Player-Skull-API.patch} | 0 .../server/0027-Purpur-Remove-Timings.patch | 954 +++++++++ .../0028-Purpur-Remove-Mojang-Profiler.patch | 1859 +++++++++++++++++ ...firework-entities-or-the-server-may.patch} | 0 ...-Use-a-faster-random-implementation.patch} | 4 +- ...patch => 0031-KeYi-Player-Skull-API.patch} | 0 ...pet-Fixes-Optimized-getBiome-method.patch} | 0 ...t-Fixes-Use-optimized-RecipeManager.patch} | 0 ...na-Don-t-create-new-random-instance.patch} | 2 +- ...-Yatopia-Smarter-statistics-ticking.patch} | 0 ...atch => 0036-Mirai-Fast-speed-check.patch} | 2 +- ...VMP-Skip-entity-move-if-no-movement.patch} | 2 +- ...ch => 0038-Petal-Reduce-sensor-work.patch} | 8 +- ... 0039-Hearse-Async-entity-traveling.patch} | 26 +- ...atch => 0040-Hearse-Async-entity-ai.patch} | 71 +- ...ch => 0041-Hearse-Pathfinding-Fixes.patch} | 2 +- 19 files changed, 3027 insertions(+), 57 deletions(-) create mode 100644 patches/api/0007-Purpur-Remove-Timings.patch rename patches/api/{0007-KTP-Optimize-Spigot-event-bus.patch => 0008-KTP-Optimize-Spigot-event-bus.patch} (100%) rename patches/api/{0008-KeYi-Add-Java19-Support-for-SIMD.patch => 0009-KeYi-Add-Java19-Support-for-SIMD.patch} (100%) rename patches/api/{0009-KeYi-Player-Skull-API.patch => 0010-KeYi-Player-Skull-API.patch} (100%) create mode 100644 patches/server/0027-Purpur-Remove-Timings.patch create mode 100644 patches/server/0028-Purpur-Remove-Mojang-Profiler.patch rename patches/server/{0027-KeYi-Do-not-save-firework-entities-or-the-server-may.patch => 0029-KeYi-Do-not-save-firework-entities-or-the-server-may.patch} (100%) rename patches/server/{0028-KeYi-Use-a-faster-random-implementation.patch => 0030-KeYi-Use-a-faster-random-implementation.patch} (98%) rename patches/server/{0029-KeYi-Player-Skull-API.patch => 0031-KeYi-Player-Skull-API.patch} (100%) rename patches/server/{0030-Carpet-Fixes-Optimized-getBiome-method.patch => 0032-Carpet-Fixes-Optimized-getBiome-method.patch} (100%) rename patches/server/{0031-Carpet-Fixes-Use-optimized-RecipeManager.patch => 0033-Carpet-Fixes-Use-optimized-RecipeManager.patch} (100%) rename patches/server/{0032-Patina-Don-t-create-new-random-instance.patch => 0034-Patina-Don-t-create-new-random-instance.patch} (96%) rename patches/server/{0033-Yatopia-Smarter-statistics-ticking.patch => 0035-Yatopia-Smarter-statistics-ticking.patch} (100%) rename patches/server/{0034-Mirai-Fast-speed-check.patch => 0036-Mirai-Fast-speed-check.patch} (94%) rename patches/server/{0035-VMP-Skip-entity-move-if-no-movement.patch => 0037-VMP-Skip-entity-move-if-no-movement.patch} (95%) rename patches/server/{0036-Petal-Reduce-sensor-work.patch => 0038-Petal-Reduce-sensor-work.patch} (79%) rename patches/server/{0037-Hearse-Async-entity-traveling.patch => 0039-Hearse-Async-entity-traveling.patch} (97%) rename patches/server/{0038-Hearse-Async-entity-ai.patch => 0040-Hearse-Async-entity-ai.patch} (93%) rename patches/server/{0039-Hearse-Pathfinding-Fixes.patch => 0041-Hearse-Pathfinding-Fixes.patch} (99%) diff --git a/patches/api/0007-Purpur-Remove-Timings.patch b/patches/api/0007-Purpur-Remove-Timings.patch new file mode 100644 index 00000000..112d27ac --- /dev/null +++ b/patches/api/0007-Purpur-Remove-Timings.patch @@ -0,0 +1,154 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 1 Jul 2022 04:03:26 -0500 +Subject: [PATCH] Purpur: Remove Timings + +Original license: MIT +Original project: https://github.com/PurpurMC/Purpur + +diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java +index 34e43e56ccc663e05b9cae36643e8df5eee5cb17..2c15b67149d014fdce2dd74a550013d83b6e44c8 100644 +--- a/src/main/java/co/aikar/timings/TimedEventExecutor.java ++++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java +@@ -76,9 +76,9 @@ public class TimedEventExecutor implements EventExecutor { + executor.execute(listener, event); + return; + } +- try (Timing ignored = timings.startTiming()){ ++ //try (Timing ignored = timings.startTiming()){ // Purpur + executor.execute(listener, event); +- } ++ //} // Purpur + } + + @Override +diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java +index a21e5ead5024fd0058c5e3302d8201dd249d32bc..505908e987a032a801ae03d7fb020dfb662bf81b 100644 +--- a/src/main/java/co/aikar/timings/Timing.java ++++ b/src/main/java/co/aikar/timings/Timing.java +@@ -36,6 +36,7 @@ public interface Timing extends AutoCloseable { + * @return Timing + */ + @NotNull ++ @io.papermc.paper.annotation.DoNotUse // Purpur + Timing startTiming(); + + /** +@@ -43,6 +44,7 @@ public interface Timing extends AutoCloseable { + * + * Will automatically be called when this Timing is used with try-with-resources + */ ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void stopTiming(); + + /** +@@ -53,6 +55,7 @@ public interface Timing extends AutoCloseable { + * @return Timing + */ + @NotNull ++ @io.papermc.paper.annotation.DoNotUse // Purpur + Timing startTimingIfSync(); + + /** +@@ -62,12 +65,14 @@ public interface Timing extends AutoCloseable { + * + * But only if we are on the primary thread. + */ ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void stopTimingIfSync(); + + /** + * @deprecated Doesn't do anything - Removed + */ + @Deprecated ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void abort(); + + /** +@@ -79,5 +84,6 @@ public interface Timing extends AutoCloseable { + TimingHandler getTimingHandler(); + + @Override ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void close(); + } +diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java +index dd72a34eaa4bedd9ea0b92eaa79091b00eb4dd09..759e9cbcedb50894821dcb6dcc602af4f0c3453e 100644 +--- a/src/main/java/co/aikar/timings/Timings.java ++++ b/src/main/java/co/aikar/timings/Timings.java +@@ -114,7 +114,7 @@ public final class Timings { + @NotNull + public static Timing ofStart(@NotNull Plugin plugin, @NotNull String name, @Nullable Timing groupHandler) { + Timing timing = of(plugin, name, groupHandler); +- timing.startTiming(); ++ //timing.startTiming(); // Purpur + return timing; + } + +diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java +index 3132dc98d26c54c5e46162e53aaed195d7335c8d..b461b5c50f97f11cb9ef68abc520271bb72440fa 100644 +--- a/src/main/java/co/aikar/timings/TimingsCommand.java ++++ b/src/main/java/co/aikar/timings/TimingsCommand.java +@@ -44,7 +44,7 @@ public class TimingsCommand extends BukkitCommand { + public TimingsCommand(@NotNull String name) { + super(name); + this.description = "Manages Spigot Timings data to see performance of the server."; +- this.usageMessage = "/timings "; ++ this.usageMessage = "/timings";// "; // Purpur + this.setPermission("bukkit.command.timings"); + } + +@@ -53,6 +53,13 @@ public class TimingsCommand extends BukkitCommand { + if (!testPermission(sender)) { + return true; + } ++ if (true) { ++ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage(); ++ sender.sendMessage(mm.deserialize("Purpur has removed timings to save your performance. Please use /spark instead")); ++ sender.sendMessage(mm.deserialize("For more information, view its documentation at")); ++ sender.sendMessage(mm.deserialize("https://spark.lucko.me/docs/Command-Usage")); ++ return true; ++ } + if (args.length < 1) { + sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED)); + return true; +@@ -111,7 +118,7 @@ public class TimingsCommand extends BukkitCommand { + Preconditions.checkNotNull(args, "Arguments cannot be null"); + Preconditions.checkNotNull(alias, "Alias cannot be null"); + +- if (args.length == 1) { ++ if (false && args.length == 1) { // Purpur + return StringUtil.copyPartialMatches(args[0], TIMINGS_SUBCOMMANDS, + new ArrayList(TIMINGS_SUBCOMMANDS.size())); + } +diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java +index b8623575b1c1b565560c2dd6438190716845a652..a9ffc32583ff701d8d163c1b41e0b06f764e2043 100644 +--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java ++++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java +@@ -150,10 +150,10 @@ public class SimpleCommandMap implements CommandMap { + // Paper end + + try { +- try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources ++ //try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources // Purpur + // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) + target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length)); +- } // target.timings.stopTiming(); // Spigot // Paper ++ //} // target.timings.stopTiming(); // Spigot // Paper // Purpur + } catch (CommandException ex) { + server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper + //target.timings.stopTiming(); // Spigot // Paper +diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java +index 123647bb10fc89508437d7a0bd3fd31d58ee7c82..ce209668dd7f11b284bd7f5688191a0b3ae86a09 100644 +--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java ++++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java +@@ -61,7 +61,7 @@ public final class CustomTimingsHandler { + handler = timing; + } + +- public void startTiming() { handler.startTiming(); } +- public void stopTiming() { handler.stopTiming(); } ++ public void startTiming() { /*handler.startTiming();*/ } // Purpur ++ public void stopTiming() { /*handler.stopTiming();*/ } // Purpur + + } diff --git a/patches/api/0007-KTP-Optimize-Spigot-event-bus.patch b/patches/api/0008-KTP-Optimize-Spigot-event-bus.patch similarity index 100% rename from patches/api/0007-KTP-Optimize-Spigot-event-bus.patch rename to patches/api/0008-KTP-Optimize-Spigot-event-bus.patch diff --git a/patches/api/0008-KeYi-Add-Java19-Support-for-SIMD.patch b/patches/api/0009-KeYi-Add-Java19-Support-for-SIMD.patch similarity index 100% rename from patches/api/0008-KeYi-Add-Java19-Support-for-SIMD.patch rename to patches/api/0009-KeYi-Add-Java19-Support-for-SIMD.patch diff --git a/patches/api/0009-KeYi-Player-Skull-API.patch b/patches/api/0010-KeYi-Player-Skull-API.patch similarity index 100% rename from patches/api/0009-KeYi-Player-Skull-API.patch rename to patches/api/0010-KeYi-Player-Skull-API.patch diff --git a/patches/server/0027-Purpur-Remove-Timings.patch b/patches/server/0027-Purpur-Remove-Timings.patch new file mode 100644 index 00000000..8452aa2f --- /dev/null +++ b/patches/server/0027-Purpur-Remove-Timings.patch @@ -0,0 +1,954 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 1 Jul 2022 04:03:37 -0500 +Subject: [PATCH] Purpur: Remove Timings + +Original license: MIT +Original project: https://github.com/PurpurMC/Purpur + +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 e5d9c6f2cbe11c2ded6d8ad111fa6a8b2086dfba..830d863cd9665d58875bfa5ca2bcd22f89ab2d49 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 ++ //co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager // Purpur + return this.processTicketUpdates(true, true, null); +- } finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager ++ //} finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager // Purpur + } + + 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 8013dd333e27aa5fd0beb431fa32491eec9f5246..e42eb93fd9f6f51ff5bb4b14a2304d4ffcdd8441 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 ++ //try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper // Purpur + 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 01bdf134fc21220ab7ecca51f2dcd51c0b466bba..6bf14183a3fcd2b3d166752ce33240d2ff1ffa7c 100644 +--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java ++++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +@@ -67,14 +67,14 @@ public class GlobalConfiguration extends ConfigurationPart { + + @Override + public void postProcess() { +- // Pufferfish start ++ /*// Pufferfish start // Purpur + if (enabled && !reallyEnabled) { + Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] To improve performance, timings have been disabled by default"); + Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] You can still use timings by using /timings on, but they will not start on server startup unless you set timings.really-enabled to true in paper.yml"); + Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] If you would like to disable this message, either set timings.really-enabled to true or timings.enabled to false."); + } + enabled = reallyEnabled; +- // Pufferfish end ++ */// Pufferfish end // Purpur + 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 27d4aa45e585842c04491839826d405d6f447f0e..767623a35dda71d77c65602e10ef2b3f0ae743f1 100644 +--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java ++++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +@@ -47,8 +47,9 @@ 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 ++ //try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings // Purpur + 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 +@@ -60,7 +61,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 75daffc4eaa831708f1ccfa5370ddf1871998033..a0e94d7a3ae1b6d28811324d24dff7ac5c6d4c16 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1393,15 +1393,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + return !this.canOversleep(); + }); +- isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); ++ //isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); // Purpur + // Paper end + new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper + +@@ -1453,9 +1453,9 @@ 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 ++ //level.timings.tracker1.startTiming(); // Paper // Purpur + + 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 ++ //level.timings.tracker1.stopTiming(); // Paper // Purpur + + if (!list.isEmpty()) { + objectiterator = this.entityMap.values().iterator(); + +- level.timings.tracker2.startTiming(); // Paper ++ //level.timings.tracker2.startTiming(); // Paper // Purpur + while (objectiterator.hasNext()) { + playerchunkmap_entitytracker = (ChunkMap.TrackedEntity) objectiterator.next(); + playerchunkmap_entitytracker.updatePlayers(list); + } +- level.timings.tracker2.stopTiming(); // Paper ++ //level.timings.tracker2.stopTiming(); // Paper // Purpur + } + + } +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index c6f5d6756fa0e068a462d9c0ded12e0771abba37..2c23321c826d929981df51f2cc60cdcdb649a43f 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -450,10 +450,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 ++ //this.level.timings.syncChunkLoad.startTiming(); // Paper // Purpur + 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 ++ //this.level.timings.syncChunkLoad.stopTiming(); // Paper // Purpur + } // Paper + ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { + return ichunkaccess1; +@@ -601,17 +601,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 ++ //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur + this.chunkMap.saveAllChunks(flush); +- } // Paper - Timings ++ //} // Paper - Timings // Purpur + } + + // Paper start - duplicate save, but call incremental + public void saveIncrementally() { + this.runDistanceManagerUpdates(); +- try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings ++ //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur + this.chunkMap.saveIncrementally(); +- } // Paper - Timings ++ //} // Paper - Timings // Purpur + } + // Paper end + +@@ -641,22 +641,22 @@ public class ServerChunkCache extends ChunkSource { + @Override + public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { + this.level.getProfiler().push("purge"); +- this.level.timings.doChunkMap.startTiming(); // Spigot ++ //this.level.timings.doChunkMap.startTiming(); // Spigot // Purpur + this.distanceManager.purgeStaleTickets(); + this.runDistanceManagerUpdates(); +- this.level.timings.doChunkMap.stopTiming(); // Spigot ++ //this.level.timings.doChunkMap.stopTiming(); // Spigot // Purpur + this.level.getProfiler().popPush("chunks"); + if (tickChunks) { +- this.level.timings.chunks.startTiming(); // Paper - timings ++ //this.level.timings.chunks.startTiming(); // Paper - timings // Purpur + this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes + this.tickChunks(); +- this.level.timings.chunks.stopTiming(); // Paper - timings ++ //this.level.timings.chunks.stopTiming(); // Paper - timings // Purpur + } + +- this.level.timings.doChunkUnload.startTiming(); // Spigot ++ //this.level.timings.doChunkUnload.startTiming(); // Spigot // Purpur + this.level.getProfiler().popPush("unload"); + this.chunkMap.tick(shouldKeepTicking); +- this.level.timings.doChunkUnload.stopTiming(); // Spigot ++ //this.level.timings.doChunkUnload.stopTiming(); // Spigot // Purpur + this.level.getProfiler().pop(); + this.clearCache(); + } +@@ -711,7 +711,7 @@ public class ServerChunkCache extends ChunkSource { + 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"); +- this.level.timings.countNaturalMobs.startTiming(); // Paper - timings ++ //this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur + int l = this.distanceManager.getNaturalSpawnChunkCount(); + // Paper start - per player mob spawning + NaturalSpawner.SpawnState spawnercreature_d; // moved down +@@ -732,12 +732,12 @@ public class ServerChunkCache extends ChunkSource { + // Pufferfish end + } + // Paper end +- this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings ++ //this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur + + //this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously + gameprofilerfiller.popPush("filteringLoadedChunks"); + // Paper - moved down +- this.level.timings.chunkTicks.startTiming(); // Paper ++ //this.level.timings.chunkTicks.startTiming(); // Paper // Purpur + + // Paper - moved down + +@@ -791,17 +791,17 @@ public class ServerChunkCache extends ChunkSource { + } + } + // Paper end - optimise chunk tick iteration +- this.level.timings.chunkTicks.stopTiming(); // Paper ++ //this.level.timings.chunkTicks.stopTiming(); // Paper // Purpur + gameprofilerfiller.popPush("customSpawners"); + if (flag2) { +- try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings ++ //try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings // Purpur + this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); +- } // Paper - timings ++ //} // Paper - timings // Purpur + } + gameprofilerfiller.pop(); + // Paper start - use set of chunks requiring updates, rather than iterating every single one loaded + gameprofilerfiller.popPush("broadcast"); +- this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing ++ //this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur + if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) { + ReferenceOpenHashSet copy = this.chunkMap.needsChangeBroadcasting.clone(); + this.chunkMap.needsChangeBroadcasting.clear(); +@@ -813,7 +813,7 @@ public class ServerChunkCache extends ChunkSource { + } + } + } +- this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing ++ //this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing // Purpur + 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 +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index 53198ebfa30273c5ddc1bb4324f5174ff99f688d..deef2fafed137d90cbd14a71d3e7bb1210348af9 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -666,7 +666,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + this.updateSkyBrightness(); + this.tickTime(); + gameprofilerfiller.popPush("tickPending"); +- timings.scheduledBlocks.startTiming(); // Paper ++ //timings.scheduledBlocks.startTiming(); // Paper // Purpur + if (!this.isDebug()) { + j = this.getGameTime(); + gameprofilerfiller.push("blockTicks"); +@@ -675,20 +675,20 @@ public class ServerLevel extends Level implements WorldGenLevel { + this.fluidTicks.tick(j, 65536, this::tickFluid); + gameprofilerfiller.pop(); + } +- timings.scheduledBlocks.stopTiming(); // Paper ++ //timings.scheduledBlocks.stopTiming(); // Paper // Purpur + + gameprofilerfiller.popPush("raid"); +- this.timings.raids.startTiming(); // Paper - timings ++ //this.timings.raids.startTiming(); // Paper - timings // Purpur + this.raids.tick(); +- this.timings.raids.stopTiming(); // Paper - timings ++ //this.timings.raids.stopTiming(); // Paper - timings // Purpur + gameprofilerfiller.popPush("chunkSource"); +- this.timings.chunkProviderTick.startTiming(); // Paper - timings ++ //this.timings.chunkProviderTick.startTiming(); // Paper - timings // Purpur + this.getChunkSource().tick(shouldKeepTicking, true); +- this.timings.chunkProviderTick.stopTiming(); // Paper - timings ++ //this.timings.chunkProviderTick.stopTiming(); // Paper - timings // Purpur + gameprofilerfiller.popPush("blockEvents"); +- timings.doSounds.startTiming(); // Spigot ++ //timings.doSounds.startTiming(); // Spigot // Purpur + this.runBlockEvents(); +- timings.doSounds.stopTiming(); // Spigot ++ //timings.doSounds.stopTiming(); // Spigot // Purpur + this.handlingTick = false; + gameprofilerfiller.pop(); + boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players +@@ -699,7 +699,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + + if (flag || this.emptyTime++ < 300) { + gameprofilerfiller.push("entities"); +- timings.tickEntities.startTiming(); // Spigot ++ //timings.tickEntities.startTiming(); // Spigot // Purpur + if (this.dragonFight != null) { + gameprofilerfiller.push("dragonFight"); + this.dragonFight.tick(); +@@ -707,7 +707,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + + org.spigotmc.ActivationRange.activateEntities(this); // Spigot +- timings.entityTick.startTiming(); // Spigot ++ //timings.entityTick.startTiming(); // Spigot // Purpur + this.entityTickList.forEach((entity) -> { + entity.activatedPriorityReset = false; // Pufferfish - DAB + if (!entity.isRemoved()) { +@@ -748,8 +748,8 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + } + }); +- timings.entityTick.stopTiming(); // Spigot +- timings.tickEntities.stopTiming(); // Spigot ++ //timings.entityTick.stopTiming(); // Spigot // Purpur ++ //timings.tickEntities.stopTiming(); // Spigot // Purpur + gameprofilerfiller.pop(); + this.tickBlockEntities(); + } +@@ -902,7 +902,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + + // Paper start - optimise random block ticking + gameprofilerfiller.popPush("randomTick"); +- timings.chunkTicksBlocks.startTiming(); // Paper ++ //timings.chunkTicksBlocks.startTiming(); // Paper // Purpur + if (randomTickSpeed > 0) { + LevelChunkSection[] sections = chunk.getSections(); + int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this); +@@ -936,7 +936,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + } + // Paper end - optimise random block ticking +- timings.chunkTicksBlocks.stopTiming(); // Paper ++ //timings.chunkTicksBlocks.stopTiming(); // Paper // Purpur + gameprofilerfiller.pop(); + } + +@@ -1211,8 +1211,8 @@ 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 +- try { ++ //timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper // Purpur ++ //try { // Purpur + // Paper end - timings + entity.setOldPosAndRot(); + ProfilerFiller gameprofilerfiller = this.getProfiler(); +@@ -1228,7 +1228,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + entity.postTick(); // CraftBukkit + } else { entity.inactiveTick(); } // Paper - EAR 2 + this.getProfiler().pop(); +- } finally { timer.stopTiming(); } // Paper - timings ++ //} finally { timer.stopTiming(); } // Paper - timings // Purpur + Iterator iterator = entity.getPassengers().iterator(); + + while (iterator.hasNext()) { +@@ -1251,8 +1251,8 @@ 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 +- try { ++ //co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper // Purpur ++ //try { // Purpur + // Paper end + passenger.setOldPosAndRot(); + ++passenger.tickCount; +@@ -1282,7 +1282,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + this.tickPassenger(passenger, entity2); + } + +- } finally { timer.stopTiming(); }// Paper - EAR2 timings ++ //} finally { timer.stopTiming(); }// Paper - EAR2 timings // Purpur + } + } else { + passenger.stopRiding(); +@@ -1302,14 +1302,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()) { ++ //try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) { // Purpur + if (doFull) { + this.saveLevelData(); + } + +- this.timings.worldSaveChunks.startTiming(); // Paper ++ //this.timings.worldSaveChunks.startTiming(); // Paper // Purpur + if (!this.noSave()) chunkproviderserver.saveIncrementally(); +- this.timings.worldSaveChunks.stopTiming(); // Paper ++ //this.timings.worldSaveChunks.stopTiming(); // Paper // Purpur + + // Copied from save() + // CraftBukkit start - moved from MinecraftServer.saveChunks +@@ -1321,7 +1321,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 + +@@ -1335,7 +1335,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 ++ //try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper // Purpur // Purpur + if (progressListener != null) { + progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); + } +@@ -1345,11 +1345,11 @@ public class ServerLevel extends Level implements WorldGenLevel { + progressListener.progressStage(Component.translatable("menu.savingChunks")); + } + +- timings.worldSaveChunks.startTiming(); // Paper ++ //timings.worldSaveChunks.startTiming(); // Paper // Purpur + if (!close) chunkproviderserver.save(flush); // Paper - rewrite chunk system + if (close) chunkproviderserver.close(true); // Paper - rewrite chunk system +- timings.worldSaveChunks.stopTiming(); // Paper +- }// Paper ++ //timings.worldSaveChunks.stopTiming(); // Paper // Purpur ++ //}// Paper // Purpur + // 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 3dbe70385d4d22c5a9cea3c471519db8bcd301e7..394485dbab52447a4a8613ec8d08b05d42a67920 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2520,7 +2520,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + } + } + // Paper End +- co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper ++ //co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper // Purpur + if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot + this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); + +@@ -2530,7 +2530,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + this.cserver.getPluginManager().callEvent(event); + + if (event.isCancelled()) { +- co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper ++ //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur + return; + } + +@@ -2543,7 +2543,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 ++ //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur + } + } + // 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 55418d3e366bca06b917ed977cb4f2b99a6c7250..55cfc41b506d6bde8c7fec890078b8331035fe05 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1197,7 +1197,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 ++ //MinecraftTimings.savePlayers.startTiming(); // Paper // Purpur + int numSaved = 0; + long now = MinecraftServer.currentTick; + for (int i = 0; i < this.players.size(); ++i) { +@@ -1208,7 +1208,7 @@ public abstract class PlayerList { + } + // Paper end + } +- MinecraftTimings.savePlayers.stopTiming(); // Paper ++ //MinecraftTimings.savePlayers.stopTiming(); // Paper // Purpur + 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 57ef7fbba3028c28231abf7b7ae78aa019323536..651c156dc8a5aad04d461add02e22147af657d07 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 ++ //this.timing.startTiming(); // Paper - behavior timings // Purpur + this.start(world, entity, time); +- this.timing.stopTiming(); // Paper - behavior timings ++ //this.timing.stopTiming(); // Paper - behavior timings // Purpur + 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 ++ //this.timing.startTiming(); // Paper - behavior timings // Purpur + 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 ++ //this.timing.stopTiming(); // Paper - behavior timings // Purpur + + } + +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java +index fcdb9bde8e1605e30dde3e580491522d4b62cdc0..7094701d213c73ba47ace806962244c10fdf4dda 100644 +--- 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(); ++ //this.timing.startTiming(); // Purpur + // Paper end + this.doTick(world, entity); +- this.timing.stopTiming(); // Paper - sensor timings ++ //this.timing.stopTiming(); // Paper - sensor timings // Purpur + } + + } +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 62aff29485f124880739e7d2b5fb0d8a9d957741..e61e52a34bb237bf7b1e28ba8087d1b2cd5f2f89 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -968,15 +968,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + ProfilerFiller gameprofilerfiller = this.getProfiler(); + + gameprofilerfiller.push("blockEntities"); +- timings.tileEntityPending.startTiming(); // Spigot ++ //timings.tileEntityPending.startTiming(); // Spigot // Purpur + this.tickingBlockEntities = true; + if (!this.pendingBlockEntityTickers.isEmpty()) { + this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); + this.pendingBlockEntityTickers.clear(); + } +- timings.tileEntityPending.stopTiming(); // Spigot ++ //timings.tileEntityPending.stopTiming(); // Spigot // Purpur + +- timings.tileEntityTick.startTiming(); // Spigot ++ //timings.tileEntityTick.startTiming(); // Spigot // Purpur + // Spigot start + // Iterator iterator = this.blockEntityTickers.iterator(); + int tilesThisCycle = 0; +@@ -1009,7 +1009,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + } + this.blockEntityTickers.removeAll(toRemove); + +- timings.tileEntityTick.stopTiming(); // Spigot ++ //timings.tileEntityTick.stopTiming(); // Spigot // Purpur + this.tickingBlockEntities = false; + co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper + gameprofilerfiller.pop(); +diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +index 5521418fa307b3eeb4f02a10c39f05b360d1d06e..31cab107a606409af5c1fe56cd0956d707637cc0 100644 +--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java ++++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +@@ -133,7 +133,7 @@ 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"); +- world.timings.mobSpawn.startTiming(); // Spigot ++ //world.timings.mobSpawn.startTiming(); // Spigot // Purpur + MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES; + int i = aenumcreaturetype.length; + +@@ -188,7 +188,7 @@ public final class NaturalSpawner { + } + } + +- world.timings.mobSpawn.stopTiming(); // Spigot ++ //world.timings.mobSpawn.stopTiming(); // Spigot // Purpur + world.getProfiler().pop(); + } + +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 de7a5f3812a017131fd1b32fbeff10e325b1cd2e..f64225897d659127dd87293b26b58653cefda0c3 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -930,7 +930,7 @@ 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 ++ //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.setSeed(this.level.getSeed()); +@@ -950,7 +950,7 @@ public class LevelChunk extends ChunkAccess { + } + } + server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk)); +- } // Paper ++ //} // Paper // Purpur + } + } + } +@@ -1310,7 +1310,7 @@ public class LevelChunk extends ChunkAccess { + ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); + + gameprofilerfiller.push(this::getType); +- this.blockEntity.tickTimer.startTiming(); // Spigot ++ //this.blockEntity.tickTimer.startTiming(); // Spigot // Purpur + BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); + + if (this.blockEntity.getType().isValid(iblockdata)) { +@@ -1332,7 +1332,7 @@ public class LevelChunk extends ChunkAccess { + // Paper end + // Spigot start + } finally { +- this.blockEntity.tickTimer.stopTiming(); ++ //this.blockEntity.tickTimer.stopTiming(); // Purpur + // 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 38920d680d9b0d81013dcf16ce3dd7271eeafe4c..4f01386675b4faf94589b4ae5f65a93737ab3240 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 ++ //MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper // Purpur + this.pending.addAll(temp); + temp.clear(); +- MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper ++ //MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper // Purpur + //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 ++ //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper // Purpur + 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 ++ //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper // Purpur + } + + 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 3f45bab0e9f7b3697e6d9d1092a1e6e579f7066f..4f1cf281c4bf68c37982d390da8779dea78dab18 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 ++ //try (Timing ignored = timings.startTiming()) { // Paper // Purpur + if (this.rTask != null) { + this.rTask.run(); + } else { + this.cTask.accept(this); + } +- } // Paper ++ //} // Paper // Purpur + } + + 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 138407c2d4b0bc55ddb9aac5d2aa3edadda090fb..a6e9e503a496c18e2501b03ec84f4600c134a50c 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(); ++ //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync(); // Purpur + 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(); ++ //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync(); // Purpur + } + // 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 b87756d9a7b04ea2613208984b2583eca3f32af6..99e104a9eb86f60290a70c0b2203f9f96e3b8cbc 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -169,7 +169,7 @@ public class ActivationRange + */ + public static void activateEntities(Level world) + { +- MinecraftTimings.entityActivationCheckTimer.startTiming(); ++ //MinecraftTimings.entityActivationCheckTimer.startTiming(); // Purpur + final int miscActivationRange = world.spigotConfig.miscActivationRange; + final int raiderActivationRange = world.spigotConfig.raiderActivationRange; + final int animalActivationRange = world.spigotConfig.animalActivationRange; +@@ -242,7 +242,7 @@ public class ActivationRange + } + // Paper end + } +- MinecraftTimings.entityActivationCheckTimer.stopTiming(); ++ //MinecraftTimings.entityActivationCheckTimer.stopTiming(); // Purpur + } + + /** diff --git a/patches/server/0028-Purpur-Remove-Mojang-Profiler.patch b/patches/server/0028-Purpur-Remove-Mojang-Profiler.patch new file mode 100644 index 00000000..5fd50ad5 --- /dev/null +++ b/patches/server/0028-Purpur-Remove-Mojang-Profiler.patch @@ -0,0 +1,1859 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sat, 16 Jul 2022 21:37:10 -0500 +Subject: [PATCH] Purpur: Remove Mojang Profiler + +Original license: MIT +Original project: https://github.com/PurpurMC/Purpur + +diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java +index 31e44f59bd34ae79dd1147263e446e6d6e9f8c66..b516177c3a10abd30d099823717339456ad517fc 100644 +--- a/src/main/java/net/minecraft/commands/Commands.java ++++ b/src/main/java/net/minecraft/commands/Commands.java +@@ -144,7 +144,7 @@ public class Commands { + CloneCommands.register(this.dispatcher, commandRegistryAccess); + DataCommands.register(this.dispatcher); + DataPackCommand.register(this.dispatcher); +- DebugCommand.register(this.dispatcher); ++ //DebugCommand.register(this.dispatcher); // Purpur + DefaultGameModeCommands.register(this.dispatcher); + DifficultyCommand.register(this.dispatcher); + EffectCommands.register(this.dispatcher, commandRegistryAccess); +@@ -304,9 +304,9 @@ public class Commands { + public int performCommand(ParseResults parseresults, String s, String label) { // CraftBukkit + CommandSourceStack commandlistenerwrapper = (CommandSourceStack) parseresults.getContext().getSource(); + +- commandlistenerwrapper.getServer().getProfiler().push(() -> { ++ /*commandlistenerwrapper.getServer().getProfiler().push(() -> { // Purpur + return "/" + s; +- }); ++ });*/ // Purpur + + byte b0; + +@@ -369,7 +369,7 @@ public class Commands { + b0 = 0; + } + } finally { +- commandlistenerwrapper.getServer().getProfiler().pop(); ++ //commandlistenerwrapper.getServer().getProfiler().pop(); // Purpur + } + + return b0; +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index a0e94d7a3ae1b6d28811324d24dff7ac5c6d4c16..3b7e4b724e86518ea57f5ed5ef0b8b3741d10f6f 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 { ++ //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur ++ //this.profiler = this.metricsRecorder.getProfiler(); // Purpur ++ /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur + this.stopRecordingMetrics(); +- }; +- this.onMetricsRecordingFinished = (path) -> { +- }; ++ };*/ // Purpur ++ //this.onMetricsRecordingFinished = (path) -> { // Purpur ++ //}; // Purpur + this.status = new ServerStatus(); + this.random = RandomSource.create(); + this.port = -1; +@@ -935,9 +935,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; + try { + this.isSaving = true; +@@ -1449,7 +1449,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper + net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper + +- this.profiler.push(() -> { ++ /*this.profiler.push(() -> { // Purpur + return worldserver + " " + worldserver.dimension().location(); +- }); ++ });*/ // Purpur + /* Drop global time updates + if (this.tickCount % 20 == 0) { +- this.profiler.push("timeSync"); ++ //this.profiler.push("timeSync"); // Purpur + this.playerList.broadcastAll(new PacketPlayOutUpdateTime(worldserver.getGameTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)), worldserver.dimension()); +- this.profiler.pop(); ++ //this.profiler.pop(); // Purpur + } + // CraftBukkit end */ + +- this.profiler.push("tick"); ++ //this.profiler.push("tick"); // Purpur + + try { + //worldserver.timings.doTick.startTiming(); // Spigot // Purpur +@@ -1566,17 +1566,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + this.executeBlocking(() -> { + this.saveDebugReport(path.resolve("server")); +@@ -2501,40 +2501,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop resultConsumer, Consumer dumpConsumer) { +- this.onMetricsRecordingStopped = (methodprofilerresults) -> { ++ /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur + this.stopRecordingMetrics(); + resultConsumer.accept(methodprofilerresults); + }; + this.onMetricsRecordingFinished = dumpConsumer; +- this.willStartRecordingMetrics = true; ++ this.willStartRecordingMetrics = true;*/ // Purpur + } + + public void stopRecordingMetrics() { +- this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; ++ //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur + } + + public void finishRecordingMetrics() { +- this.metricsRecorder.end(); ++ //this.metricsRecorder.end(); // Purpur + } + + public void cancelRecordingMetrics() { +- this.metricsRecorder.cancel(); +- this.profiler = this.metricsRecorder.getProfiler(); ++ //this.metricsRecorder.cancel(); // Purpur ++ //this.profiler = this.metricsRecorder.getProfiler(); // Purpur + } + + public Path getWorldPath(LevelResource worldSavePath) { +@@ -2583,15 +2583,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop functions, ResourceLocation label) { +- ProfilerFiller gameprofilerfiller = this.server.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = this.server.getProfiler(); // Purpur + + Objects.requireNonNull(label); +- gameprofilerfiller.push(label::toString); ++ //gameprofilerfiller.push(label::toString); // Purpur + Iterator iterator = functions.iterator(); + + while (iterator.hasNext()) { +@@ -69,7 +69,7 @@ public class ServerFunctionManager { + this.execute(customfunction, this.getGameLoopSender()); + } + +- this.server.getProfiler().pop(); ++ //this.server.getProfiler().pop(); // Purpur + } + + public int execute(CommandFunction function, CommandSourceStack source) { +@@ -177,10 +177,10 @@ public class ServerFunctionManager { + + try { + ServerFunctionManager.QueuedCommand customfunctiondata_b = (ServerFunctionManager.QueuedCommand) this.commandQueue.removeFirst(); +- ProfilerFiller gameprofilerfiller = ServerFunctionManager.this.server.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = ServerFunctionManager.this.server.getProfiler(); // Purpur + + Objects.requireNonNull(customfunctiondata_b); +- gameprofilerfiller.push(customfunctiondata_b::toString); ++ //gameprofilerfiller.push(customfunctiondata_b::toString); // Purpur + this.depth = customfunctiondata_b.depth; + customfunctiondata_b.execute(ServerFunctionManager.this, this.commandQueue, i, this.tracer); + if (!this.nestedCalls.isEmpty()) { +@@ -192,7 +192,7 @@ public class ServerFunctionManager { + this.nestedCalls.clear(); + } + } finally { +- ServerFunctionManager.this.server.getProfiler().pop(); ++ //ServerFunctionManager.this.server.getProfiler().pop(); // Purpur + } + + ++j; +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index eb4f2c5c9453f59abbc7c9b9629ab0d43a4c5da6..beb7c22cb63021f26c06f91050361e1b25fcc72d 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -618,20 +618,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + } + + protected void tick(BooleanSupplier shouldKeepTicking) { +- ProfilerFiller gameprofilerfiller = this.level.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur + + //try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper // Purpur +- gameprofilerfiller.push("poi"); ++ //gameprofilerfiller.push("poi"); // Purpur + this.poiManager.tick(shouldKeepTicking); + //} // Paper // Purpur +- gameprofilerfiller.popPush("chunk_unload"); ++ //gameprofilerfiller.popPush("chunk_unload"); // Purpur + if (!this.level.noSave()) { + //try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper // Purpur + this.processUnloads(shouldKeepTicking); + //} // Paper // Purpur + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + public boolean hasWork() { +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index 2c23321c826d929981df51f2cc60cdcdb649a43f..0ae45cf5a084fd412305e8b2f5dabe608b4eb1c1 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -431,16 +431,16 @@ public class ServerChunkCache extends ChunkSource { + return ifLoaded; + } + // Paper end +- ProfilerFiller gameprofilerfiller = this.level.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur + +- gameprofilerfiller.incrementCounter("getChunk"); ++ //gameprofilerfiller.incrementCounter("getChunk"); // Purpur + 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"); ++ //gameprofilerfiller.incrementCounter("getChunkCacheMiss"); // Purpur + CompletableFuture> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create, true); // Paper + ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor; + +@@ -628,24 +628,24 @@ 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"); ++ //this.level.getProfiler().push("purge"); // Purpur + this.distanceManager.purgeStaleTickets(); + this.runDistanceManagerUpdates(); +- this.level.getProfiler().popPush("unload"); ++ //this.level.getProfiler().popPush("unload"); // Purpur + this.chunkMap.tick(() -> true); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + this.clearCache(); + } + // CraftBukkit end + + @Override + public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { +- this.level.getProfiler().push("purge"); ++ //this.level.getProfiler().push("purge"); // Purpur + //this.level.timings.doChunkMap.startTiming(); // Spigot // Purpur + this.distanceManager.purgeStaleTickets(); + this.runDistanceManagerUpdates(); + //this.level.timings.doChunkMap.stopTiming(); // Spigot // Purpur +- this.level.getProfiler().popPush("chunks"); ++ //this.level.getProfiler().popPush("chunks"); // Purpur + if (tickChunks) { + //this.level.timings.chunks.startTiming(); // Paper - timings // Purpur + this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes +@@ -654,10 +654,10 @@ public class ServerChunkCache extends ChunkSource { + } + + //this.level.timings.doChunkUnload.startTiming(); // Spigot // Purpur +- this.level.getProfiler().popPush("unload"); ++ //this.level.getProfiler().popPush("unload"); // Purpur + this.chunkMap.tick(shouldKeepTicking); + //this.level.timings.doChunkUnload.stopTiming(); // Spigot // Purpur +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + this.clearCache(); + } + +@@ -703,14 +703,14 @@ public class ServerChunkCache extends ChunkSource { + } + // Paper end - optimize isOutisdeRange + LevelData worlddata = this.level.getLevelData(); +- ProfilerFiller gameprofilerfiller = this.level.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur + +- gameprofilerfiller.push("pollingChunks"); ++ //gameprofilerfiller.push("pollingChunks"); // Purpur + this.level.resetIceAndSnowTick(); // Pufferfish - reset ice & snow tick random + 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"); ++ //gameprofilerfiller.push("naturalSpawnCount"); // Purpur + //this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur + int l = this.distanceManager.getNaturalSpawnChunkCount(); + // Paper start - per player mob spawning +@@ -735,13 +735,13 @@ public class ServerChunkCache extends ChunkSource { + //this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur + + //this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously +- gameprofilerfiller.popPush("filteringLoadedChunks"); ++ //gameprofilerfiller.popPush("filteringLoadedChunks"); // Purpur + // Paper - moved down + //this.level.timings.chunkTicks.startTiming(); // Paper // Purpur + + // Paper - moved down + +- gameprofilerfiller.popPush("spawnAndTick"); ++ //gameprofilerfiller.popPush("spawnAndTick"); // Purpur + boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit + + // Paper - only shuffle if per-player mob spawning is disabled +@@ -792,15 +792,15 @@ public class ServerChunkCache extends ChunkSource { + } + // Paper end - optimise chunk tick iteration + //this.level.timings.chunkTicks.stopTiming(); // Paper // Purpur +- gameprofilerfiller.popPush("customSpawners"); ++ //gameprofilerfiller.popPush("customSpawners"); // Purpur + if (flag2) { + //try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings // Purpur + this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); + //} // Paper - timings // Purpur + } +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + // Paper start - use set of chunks requiring updates, rather than iterating every single one loaded +- gameprofilerfiller.popPush("broadcast"); ++ //gameprofilerfiller.popPush("broadcast"); // Purpur + //this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur + if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) { + ReferenceOpenHashSet copy = this.chunkMap.needsChangeBroadcasting.clone(); +@@ -814,7 +814,7 @@ public class ServerChunkCache extends ChunkSource { + } + } + //this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing // Purpur +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + // 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()); +@@ -1029,7 +1029,7 @@ public class ServerChunkCache extends ChunkSource { + + @Override + protected void doRunTask(Runnable task) { +- ServerChunkCache.this.level.getProfiler().incrementCounter("runTask"); ++ //ServerChunkCache.this.level.getProfiler().incrementCounter("runTask"); // Purpur + 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 deef2fafed137d90cbd14a71d3e7bb1210348af9..03b8ef3409fd5f7a4d4b06e13cf8eb22b3bbf8a1 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -633,12 +633,12 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + } + // Paper end - optimise checkDespawn +- ProfilerFiller gameprofilerfiller = this.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur + + this.handlingTick = true; +- gameprofilerfiller.push("world border"); ++ //gameprofilerfiller.push("world border"); // Purpur + this.getWorldBorder().tick(); +- gameprofilerfiller.popPush("weather"); ++ //gameprofilerfiller.popPush("weather"); // Purpur + this.advanceWeatherCycle(); + int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + long j; +@@ -665,32 +665,32 @@ public class ServerLevel extends Level implements WorldGenLevel { + + this.updateSkyBrightness(); + this.tickTime(); +- gameprofilerfiller.popPush("tickPending"); ++ //gameprofilerfiller.popPush("tickPending"); // Purpur + //timings.scheduledBlocks.startTiming(); // Paper // Purpur + if (!this.isDebug()) { + j = this.getGameTime(); +- gameprofilerfiller.push("blockTicks"); ++ //gameprofilerfiller.push("blockTicks"); // Purpur + this.blockTicks.tick(j, 65536, this::tickBlock); +- gameprofilerfiller.popPush("fluidTicks"); ++ //gameprofilerfiller.popPush("fluidTicks"); // Purpur + this.fluidTicks.tick(j, 65536, this::tickFluid); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + //timings.scheduledBlocks.stopTiming(); // Paper // Purpur + +- gameprofilerfiller.popPush("raid"); ++ //gameprofilerfiller.popPush("raid"); // Purpur + //this.timings.raids.startTiming(); // Paper - timings // Purpur + this.raids.tick(); + //this.timings.raids.stopTiming(); // Paper - timings // Purpur +- gameprofilerfiller.popPush("chunkSource"); ++ //gameprofilerfiller.popPush("chunkSource"); // Purpur + //this.timings.chunkProviderTick.startTiming(); // Paper - timings // Purpur + this.getChunkSource().tick(shouldKeepTicking, true); + //this.timings.chunkProviderTick.stopTiming(); // Paper - timings // Purpur +- gameprofilerfiller.popPush("blockEvents"); ++ //gameprofilerfiller.popPush("blockEvents"); // Purpur + //timings.doSounds.startTiming(); // Spigot // Purpur + this.runBlockEvents(); + //timings.doSounds.stopTiming(); // Spigot // Purpur + this.handlingTick = false; +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players + + if (flag) { +@@ -698,12 +698,12 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + + if (flag || this.emptyTime++ < 300) { +- gameprofilerfiller.push("entities"); ++ //gameprofilerfiller.push("entities"); // Purpur + //timings.tickEntities.startTiming(); // Spigot // Purpur + if (this.dragonFight != null) { +- gameprofilerfiller.push("dragonFight"); ++ //gameprofilerfiller.push("dragonFight"); // Purpur + this.dragonFight.tick(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + org.spigotmc.ActivationRange.activateEntities(this); // Spigot +@@ -714,9 +714,9 @@ public class ServerLevel extends Level implements WorldGenLevel { + if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed + entity.discard(); + } else { +- gameprofilerfiller.push("checkDespawn"); ++ //gameprofilerfiller.push("checkDespawn"); // Purpur + entity.checkDespawn(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list + Entity entity1 = entity.getVehicle(); + +@@ -728,7 +728,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + entity.stopRiding(); + } + +- gameprofilerfiller.push("tick"); ++ //gameprofilerfiller.push("tick"); // Purpur + // Pufferfish start - copied from this.guardEntityTick + try { + this.tickNonPassenger(entity); // Pufferfish - changed +@@ -743,20 +743,19 @@ public class ServerLevel extends Level implements WorldGenLevel { + // Paper end + } + // Pufferfish end +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + } + } + }); + //timings.entityTick.stopTiming(); // Spigot // Purpur + //timings.tickEntities.stopTiming(); // Spigot // Purpur +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + this.tickBlockEntities(); + } + +- gameprofilerfiller.push("entityManagement"); ++ //gameprofilerfiller.push("entityManagement"); // Purpur + //this.entityManager.tick(); // Paper - rewrite chunk system +- gameprofilerfiller.pop(); + } + + @Override +@@ -817,9 +816,9 @@ public class ServerLevel extends Level implements WorldGenLevel { + boolean flag = this.isRaining(); + int j = chunkcoordintpair.getMinBlockX(); + int k = chunkcoordintpair.getMinBlockZ(); +- ProfilerFiller gameprofilerfiller = this.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur + +- gameprofilerfiller.push("thunder"); ++ //gameprofilerfiller.push("thunder"); // Purpur + 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 &&*/ chunk.shouldDoLightning(this.random)) { // Spigot // Paper - disable thunder // Pufferfish - replace random with shouldDoLightning +@@ -849,7 +848,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + } + +- gameprofilerfiller.popPush("iceandsnow"); ++ //gameprofilerfiller.popPush("iceandsnow"); // Purpur + int l; + + if (!this.paperConfig().environment.disableIceAndSnow && (this.currentIceAndSnowTick++ & 15) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking // Pufferfish - optimize further random ticking +@@ -901,7 +900,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + + // Paper start - optimise random block ticking +- gameprofilerfiller.popPush("randomTick"); ++ //gameprofilerfiller.popPush("randomTick"); // Purpur + //timings.chunkTicksBlocks.startTiming(); // Paper // Purpur + if (randomTickSpeed > 0) { + LevelChunkSection[] sections = chunk.getSections(); +@@ -937,7 +936,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + // Paper end - optimise random block ticking + //timings.chunkTicksBlocks.stopTiming(); // Paper // Purpur +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + public Optional findLightningRod(BlockPos pos) { +@@ -1215,19 +1214,19 @@ public class ServerLevel extends Level implements WorldGenLevel { + //try { // Purpur + // Paper end - timings + entity.setOldPosAndRot(); +- ProfilerFiller gameprofilerfiller = this.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur + + ++entity.tickCount; +- this.getProfiler().push(() -> { ++ /*this.getProfiler().push(() -> { // Purpur + return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); +- }); +- gameprofilerfiller.incrementCounter("tickNonPassenger"); ++ });*/ // Purpur ++ //gameprofilerfiller.incrementCounter("tickNonPassenger"); // Purpur + if (isActive) { // Paper - EAR 2 + TimingHistory.activatedEntityTicks++; + entity.tick(); + entity.postTick(); // CraftBukkit + } else { entity.inactiveTick(); } // Paper - EAR 2 +- this.getProfiler().pop(); ++ //this.getProfiler().pop(); // Purpur + //} finally { timer.stopTiming(); } // Paper - timings // Purpur + Iterator iterator = entity.getPassengers().iterator(); + +@@ -1256,12 +1255,12 @@ public class ServerLevel extends Level implements WorldGenLevel { + // Paper end + passenger.setOldPosAndRot(); + ++passenger.tickCount; +- ProfilerFiller gameprofilerfiller = this.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur + +- gameprofilerfiller.push(() -> { ++ /*gameprofilerfiller.push(() -> { // Purpur + return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); +- }); +- gameprofilerfiller.incrementCounter("tickPassenger"); ++ });*/ // Purpur ++ //gameprofilerfiller.incrementCounter("tickPassenger"); // Purpur + // Paper start - EAR 2 + if (isActive) { + passenger.rideTick(); +@@ -1273,7 +1272,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + vehicle.positionRider(passenger); + } + // Paper end - EAR 2 +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + Iterator iterator = passenger.getPassengers().iterator(); + + while (iterator.hasNext()) { +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index d46f33d9bc99484297270f88e68c1519922cb7db..36cbcf3ca6412d98c9f7a002c5935bb99419fcca 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -1159,7 +1159,7 @@ public class ServerPlayer extends Player { + PortalInfo shapedetectorshape = this.findDimensionEntryPoint(worldserver); + + if (shapedetectorshape != null) { +- worldserver1.getProfiler().push("moving"); ++ //worldserver1.getProfiler().push("moving"); // Purpur + worldserver = shapedetectorshape.world; // CraftBukkit + if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event + if (resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit +@@ -1182,8 +1182,8 @@ public class ServerPlayer extends Player { + worldserver = ((CraftWorld) exit.getWorld()).getHandle(); + // CraftBukkit end + +- worldserver1.getProfiler().pop(); +- worldserver1.getProfiler().push("placing"); ++ //worldserver1.getProfiler().pop(); // Purpur ++ //worldserver1.getProfiler().push("placing"); // Purpur + if (true) { // CraftBukkit + this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds + +@@ -1201,7 +1201,7 @@ public class ServerPlayer extends Player { + this.connection.teleport(exit); // CraftBukkit - use internal teleport without event + this.connection.resetPosition(); + worldserver.addDuringPortalTeleport(this); +- worldserver1.getProfiler().pop(); ++ //worldserver1.getProfiler().pop(); // Purpur + this.triggerDimensionChangeTriggers(worldserver1); + this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); + playerlist.sendLevelInfo(this, worldserver); +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 394485dbab52447a4a8613ec8d08b05d42a67920..93a55392a2d4eaae6689b10c1abcd2e8abf5b16f 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -392,7 +392,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + this.aboveGroundVehicleTickCount = 0; + } + +- this.server.getProfiler().push("keepAlive"); ++ //this.server.getProfiler().push("keepAlive"); // Purpur + // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // This should effectively place the keepalive handling back to "as it was" before 1.12.2 + long currentTime = Util.getMillis(); +@@ -428,7 +428,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + } + // Paper end + +- this.server.getProfiler().pop(); ++ //this.server.getProfiler().pop(); // Purpur + // CraftBukkit start + for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ; + if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable +diff --git a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +index 9ddbfcf80d9a381dace78a62880f85a4d767e0eb..7383c7d3820dce06108eaafd236a7c6c06a10a42 100644 +--- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java ++++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +@@ -9,11 +9,11 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener + @Override + default CompletableFuture reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) { + return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> { +- applyProfiler.startTick(); +- applyProfiler.push("listener"); ++ //applyProfiler.startTick(); // Purpur ++ //applyProfiler.push("listener"); // Purpur + this.onResourceManagerReload(manager); +- applyProfiler.pop(); +- applyProfiler.endTick(); ++ //applyProfiler.pop(); // Purpur ++ //applyProfiler.endTick(); // Purpur + }, applyExecutor); + } + +diff --git a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java +index 6d96da16f25e2359e053c45270310886e168f828..de024b88e7328c25748f59288fb7ff575fce1fdc 100644 +--- a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java ++++ b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java +@@ -55,7 +55,7 @@ public class ActiveProfiler implements ProfileCollector { + this.started = true; + this.path = ""; + this.paths.clear(); +- this.push("root"); ++ //this.push("root"); // Purpur + } + } + +@@ -64,7 +64,7 @@ public class ActiveProfiler implements ProfileCollector { + if (!this.started) { + LOGGER.error("Profiler tick already ended - missing startTick()?"); + } else { +- this.pop(); ++ //this.pop(); // Purpur + this.started = false; + if (!this.path.isEmpty()) { + LOGGER.error("Profiler tick ended before path was fully popped (remainder: '{}'). Mismatched push/pop?", LogUtils.defer(() -> { +@@ -93,7 +93,7 @@ public class ActiveProfiler implements ProfileCollector { + + @Override + public void push(Supplier locationGetter) { +- this.push(locationGetter.get()); ++ //this.push(locationGetter.get()); // Purpur + } + + @Override +@@ -132,14 +132,14 @@ public class ActiveProfiler implements ProfileCollector { + + @Override + public void popPush(String location) { +- this.pop(); +- this.push(location); ++ //this.pop(); // Purpur ++ //this.push(location); // Purpur + } + + @Override + public void popPush(Supplier locationGetter) { +- this.pop(); +- this.push(locationGetter); ++ //this.pop(); // Purpur ++ //this.push(locationGetter); // Purpur + } + + private ActiveProfiler.PathEntry getCurrentEntry() { +diff --git a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java +index 5725c6593480fada65facc29664a00a8cc073512..ccb1f998ae3122d1856d77149ff7e7dffeedc71a 100644 +--- a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java ++++ b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java +@@ -6,32 +6,44 @@ import net.minecraft.util.profiling.metrics.MetricCategory; + public interface ProfilerFiller { + String ROOT = "root"; + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void startTick(); + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void endTick(); + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void push(String location); + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void push(Supplier locationGetter); + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void pop(); + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void popPush(String location); + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void popPush(Supplier locationGetter); + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void markForCharting(MetricCategory type); + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + default void incrementCounter(String marker) { +- this.incrementCounter(marker, 1); ++ //this.incrementCounter(marker, 1); // Purpur + } + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void incrementCounter(String marker, int i); + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + default void incrementCounter(Supplier markerGetter) { +- this.incrementCounter(markerGetter, 1); ++ //this.incrementCounter(markerGetter, 1); // Purpur + } + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + void incrementCounter(Supplier markerGetter, int i); + + static ProfilerFiller tee(final ProfilerFiller a, final ProfilerFiller b) { +@@ -41,62 +53,62 @@ public interface ProfilerFiller { + return b == InactiveProfiler.INSTANCE ? a : new ProfilerFiller() { + @Override + public void startTick() { +- a.startTick(); +- b.startTick(); ++ //a.startTick(); // Purpur ++ //b.startTick(); // Purpur + } + + @Override + public void endTick() { +- a.endTick(); +- b.endTick(); ++ //a.endTick(); // Purpur ++ //b.endTick(); // Purpur + } + + @Override + public void push(String location) { +- a.push(location); +- b.push(location); ++ //a.push(location); // Purpur ++ //b.push(location); // Purpur + } + + @Override + public void push(Supplier locationGetter) { +- a.push(locationGetter); +- b.push(locationGetter); ++ //a.push(locationGetter); // Purpur ++ //b.push(locationGetter); // Purpur + } + + @Override + public void markForCharting(MetricCategory type) { +- a.markForCharting(type); +- b.markForCharting(type); ++ //a.markForCharting(type); // Purpur ++ //b.markForCharting(type); // Purpur + } + + @Override + public void pop() { +- a.pop(); +- b.pop(); ++ //a.pop(); // Purpur ++ //b.pop(); // Purpur + } + + @Override + public void popPush(String location) { +- a.popPush(location); +- b.popPush(location); ++ //a.popPush(location); // Purpur ++ //b.popPush(location); // Purpur + } + + @Override + public void popPush(Supplier locationGetter) { +- a.popPush(locationGetter); +- b.popPush(locationGetter); ++ //a.popPush(locationGetter); // Purpur ++ //b.popPush(locationGetter); // Purpur + } + + @Override + public void incrementCounter(String marker, int i) { +- a.incrementCounter(marker, i); +- b.incrementCounter(marker, i); ++ //a.incrementCounter(marker, i); // Purpur ++ //b.incrementCounter(marker, i); // Purpur + } + + @Override + public void incrementCounter(Supplier markerGetter, int i) { +- a.incrementCounter(markerGetter, i); +- b.incrementCounter(markerGetter, i); ++ //a.incrementCounter(markerGetter, i); // Purpur ++ //b.incrementCounter(markerGetter, i); // Purpur + } + }; + } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 3961f66a23508089df8c4ee7455e170cb870e9d0..6e38669e60a1f4d69ea677901b36baf84327487f 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -822,7 +822,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + return; + } + // Pufferfish end - entity TTL +- this.level.getProfiler().push("entityBaseTick"); ++ //this.level.getProfiler().push("entityBaseTick"); // Purpur + if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Update last hurt when ticking + this.feetBlockState = null; + if (this.isPassenger() && this.getVehicle().isRemoved()) { +@@ -883,7 +883,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + } + + this.firstTick = false; +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } + + public void setSharedFlagOnFire(boolean onFire) { +@@ -1057,7 +1057,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + } + } + +- this.level.getProfiler().push("move"); ++ //this.level.getProfiler().push("move"); // Purpur + if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) { + movement = movement.multiply(this.stuckSpeedMultiplier); + this.stuckSpeedMultiplier = Vec3.ZERO; +@@ -1066,7 +1066,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + // Paper start - ignore movement changes while inactive. + if (isTemporarilyActive && !(this instanceof ItemEntity || this instanceof net.minecraft.world.entity.vehicle.AbstractMinecart) && movement == getDeltaMovement() && movementType == MoverType.SELF) { + setDeltaMovement(Vec3.ZERO); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + return; + } + // Paper end +@@ -1087,8 +1087,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z); + } + +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("rest"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("rest"); // Purpur + boolean flag = !Mth.equal(movement.x, vec3d1.x); + boolean flag1 = !Mth.equal(movement.z, vec3d1.z); + +@@ -1107,7 +1107,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + + this.checkFallDamage(vec3d1.y, this.onGround, iblockdata, blockposition); + if (this.isRemoved()) { +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } else { + if (this.horizontalCollision) { + Vec3 vec3d2 = this.getDeltaMovement(); +@@ -1248,7 +1248,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + this.setRemainingFireTicks(-this.getFireImmuneTicks()); + } + +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } + } + // Paper start - detailed watchdog information +@@ -2928,7 +2928,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + ServerLevel worldserver1 = minecraftserver.getLevel(resourcekey); + + if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit +- this.level.getProfiler().push("portal"); ++ //this.level.getProfiler().push("portal"); // Purpur + this.portalTime = i; + // Paper start + io.papermc.paper.event.entity.EntityPortalReadyEvent event = new io.papermc.paper.event.entity.EntityPortalReadyEvent(this.getBukkitEntity(), worldserver1 == null ? null : worldserver1.getWorld(), org.bukkit.PortalType.NETHER); +@@ -2946,7 +2946,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + } + } // Paper + // CraftBukkit end +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } + + this.isInsidePortal = false; +@@ -3411,14 +3411,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + } + // Paper end + if (this.level instanceof ServerLevel && !this.isRemoved()) { +- this.level.getProfiler().push("changeDimension"); ++ //this.level.getProfiler().push("changeDimension"); // Purpur + // CraftBukkit start + // this.decouple(); + if (worldserver == null) { + return null; + } + // CraftBukkit end +- this.level.getProfiler().push("reposition"); ++ //this.level.getProfiler().push("reposition"); // Purpur + PortalInfo shapedetectorshape = (location == null) ? this.findDimensionEntryPoint(worldserver) : new PortalInfo(new Vec3(location.x(), location.y(), location.z()), Vec3.ZERO, this.yRot, this.xRot, worldserver, null); // CraftBukkit + + if (shapedetectorshape == null) { +@@ -3452,7 +3452,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + this.unRide(); + // CraftBukkit end + +- this.level.getProfiler().popPush("reloading"); ++ //this.level.getProfiler().popPush("reloading"); // Purpur + // Paper start - Change lead drop timing to prevent dupe + if (this instanceof Mob) { + ((Mob) this).dropLeash(true, true); // Paper drop lead +@@ -3475,10 +3475,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + } + + this.removeAfterChangingDimensions(); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + ((ServerLevel) this.level).resetEmptyTime(); + worldserver.resetEmptyTime(); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + return entity; + } + } else { +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 120c0804010fd5b38a5f806ca580962ff8b47339..93c32dd39693b37efaa05af0486e1bdd298661f3 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -392,7 +392,7 @@ public abstract class LivingEntity extends Entity { + } + + super.baseTick(); +- this.level.getProfiler().push("livingEntityBaseTick"); ++ //this.level.getProfiler().push("livingEntityBaseTick"); // Purpur + if (this.fireImmune() || this.level.isClientSide) { + this.clearFire(); + } +@@ -494,7 +494,7 @@ public abstract class LivingEntity extends Entity { + this.yHeadRotO = this.yHeadRot; + this.yRotO = this.getYRot(); + this.xRotO = this.getXRot(); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } + + public boolean canSpawnSoulSpeedParticle() { +@@ -3062,10 +3062,10 @@ public abstract class LivingEntity extends Entity { + } + + this.run += (f3 - this.run) * 0.3F; +- this.level.getProfiler().push("headTurn"); ++ //this.level.getProfiler().push("headTurn"); // Purpur + f2 = this.tickHeadTurn(f1, f2); +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("rangeChecks"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("rangeChecks"); // Purpur + + // Paper start - stop large pitch and yaw changes from crashing the server + this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; +@@ -3077,7 +3077,7 @@ public abstract class LivingEntity extends Entity { + this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; + // Paper end + +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + this.animStep += f2; + if (this.isFallFlying()) { + ++this.fallFlyTicks; +@@ -3374,19 +3374,19 @@ public abstract class LivingEntity extends Entity { + } + + this.setDeltaMovement(d4, d5, d6); +- this.level.getProfiler().push("ai"); ++ //this.level.getProfiler().push("ai"); // Purpur + if (this.isImmobile()) { + this.jumping = false; + this.xxa = 0.0F; + this.zza = 0.0F; + } else if (this.isEffectiveAi()) { +- this.level.getProfiler().push("newAi"); ++ //this.level.getProfiler().push("newAi"); // Purpur + this.serverAiStep(); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } + +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("jump"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("jump"); // Purpur + if (this.jumping && this.isAffectedByFluids()) { + double d7; + +@@ -3413,8 +3413,8 @@ public abstract class LivingEntity extends Entity { + this.noJumpDelay = 0; + } + +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("travel"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("travel"); // Purpur + this.xxa *= 0.98F; + this.zza *= 0.98F; + this.updateFallFlying(); +@@ -3423,8 +3423,8 @@ public abstract class LivingEntity extends Entity { + // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper + this.travel(new Vec3((double) this.xxa, (double) this.yya, (double) this.zza)); + // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("freezing"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("freezing"); // Purpur + boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES); + int i; + +@@ -3444,15 +3444,15 @@ public abstract class LivingEntity extends Entity { + this.hurt(DamageSource.FREEZE, (float) i); + } + +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("push"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("push"); // Purpur + if (this.autoSpinAttackTicks > 0) { + --this.autoSpinAttackTicks; + this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); + } + + this.pushEntities(); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + // Paper start + if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) { + if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { +diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java +index 94b45579dc371ee980565aed2f5dee78ebd44427..2db9ce11dc52b8fb737e3344265e2a40d07ffc26 100644 +--- a/src/main/java/net/minecraft/world/entity/Mob.java ++++ b/src/main/java/net/minecraft/world/entity/Mob.java +@@ -329,13 +329,13 @@ public abstract class Mob extends LivingEntity { + @Override + public void baseTick() { + super.baseTick(); +- this.level.getProfiler().push("mobBaseTick"); ++ //this.level.getProfiler().push("mobBaseTick"); // Purpur + if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) { + this.resetAmbientSoundTime(); + this.playAmbientSound(); + } + +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } + + @Override +@@ -640,7 +640,7 @@ public abstract class Mob extends LivingEntity { + @Override + public void aiStep() { + super.aiStep(); +- this.level.getProfiler().push("looting"); ++ //this.level.getProfiler().push("looting"); // Purpur + if (!this.level.isClientSide && this.canPickUpLoot() && this.isAlive() && !this.dead && this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + Vec3i baseblockposition = this.getPickupReach(); + List list = this.level.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ())); +@@ -660,7 +660,7 @@ public abstract class Mob extends LivingEntity { + } + } + +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } + + protected Vec3i getPickupReach() { +@@ -873,46 +873,46 @@ public abstract class Mob extends LivingEntity { + return; + } + // Paper end +- this.level.getProfiler().push("sensing"); ++ //this.level.getProfiler().push("sensing"); // Purpur + this.sensing.tick(); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + int i = this.level.getServer().getTickCount() + this.getId(); + + if (i % 2 != 0 && this.tickCount > 1) { +- this.level.getProfiler().push("targetSelector"); ++ //this.level.getProfiler().push("targetSelector"); // Purpur + if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.targetSelector.tickRunningGoals(false); +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("goalSelector"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("goalSelector"); // Purpur + if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.goalSelector.tickRunningGoals(false); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } else { +- this.level.getProfiler().push("targetSelector"); ++ //this.level.getProfiler().push("targetSelector"); // Purpur + if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.targetSelector.tick(); +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("goalSelector"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("goalSelector"); // Purpur + if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.goalSelector.tick(); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } + +- this.level.getProfiler().push("navigation"); ++ //this.level.getProfiler().push("navigation"); // Purpur + this.navigation.tick(); +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("mob tick"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("mob tick"); // Purpur + this.customServerAiStep(); +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("controls"); +- this.level.getProfiler().push("move"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("controls"); // Purpur ++ //this.level.getProfiler().push("move"); // Purpur + this.moveControl.tick(); +- this.level.getProfiler().popPush("look"); ++ //this.level.getProfiler().popPush("look"); // Purpur + this.lookControl.tick(); +- this.level.getProfiler().popPush("jump"); ++ //this.level.getProfiler().popPush("jump"); // Purpur + this.jumpControl.tick(); +- this.level.getProfiler().pop(); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().pop(); // Purpur + this.sendDebugPackets(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +index 1635818fc4b1788c0d397085239df6dd75b210ab..02978315bc2b828cc603ce7478408f3f82c249c2 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +@@ -105,8 +105,8 @@ public class GoalSelector { + } + + public void tick() { +- ProfilerFiller profilerFiller = this.profiler.get(); +- profilerFiller.push("goalCleanup"); ++ //ProfilerFiller profilerFiller = this.profiler.get(); // Purpur ++ //profilerFiller.push("goalCleanup"); // Purpur + + for(WrappedGoal wrappedGoal : this.availableGoals) { + if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { +@@ -123,8 +123,8 @@ public class GoalSelector { + } + } + +- profilerFiller.pop(); +- profilerFiller.push("goalUpdate"); ++ //profilerFiller.pop(); // Purpur ++ //profilerFiller.push("goalUpdate"); // Purpur + + for(WrappedGoal wrappedGoal2 : this.availableGoals) { + // Paper start +@@ -144,13 +144,13 @@ public class GoalSelector { + } + } + +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Purpur + this.tickRunningGoals(true); + } + + public void tickRunningGoals(boolean tickAll) { +- ProfilerFiller profilerFiller = this.profiler.get(); +- profilerFiller.push("goalTick"); ++ //ProfilerFiller profilerFiller = this.profiler.get(); // Purpur ++ //profilerFiller.push("goalTick"); // Purpur + + for(WrappedGoal wrappedGoal : this.availableGoals) { + if (wrappedGoal.isRunning() && (tickAll || wrappedGoal.requiresUpdateEveryTick())) { +@@ -158,7 +158,7 @@ public class GoalSelector { + } + } + +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Purpur + } + + public Set getAvailableGoals() { +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +index 97257b450e848f53fdb9b5b7affa57b03ea5f459..2f2d9bb31194618ef5bba39cd1cbe7c4919e82c5 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +@@ -171,12 +171,12 @@ public abstract class PathNavigation { + } + } + // Paper end +- this.level.getProfiler().push("pathfind"); ++ //this.level.getProfiler().push("pathfind"); // Purpur + BlockPos blockPos = useHeadPos ? this.mob.blockPosition().above() : this.mob.blockPosition(); + int i = (int)(followRange + (float)range); + PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i)); + Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + if (path != null && path.getTarget() != null) { + this.targetPos = path.getTarget(); + this.reachRange = distance; +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java +index 288c6627906d07c0d223eacd84ae4eb31a349998..9babe636176da3c40598eb5bdac0919a1704eaa0 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java +@@ -26,9 +26,9 @@ public class Sensing { + } else if (this.unseen.contains(i)) { + return false; + } else { +- this.mob.level.getProfiler().push("hasLineOfSight"); ++ //this.mob.level.getProfiler().push("hasLineOfSight"); // Purpur + boolean bl = this.mob.hasLineOfSight(entity); +- this.mob.level.getProfiler().pop(); ++ //this.mob.level.getProfiler().pop(); // Purpur + if (bl) { + this.seen.add(i); + } else { +diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +index c66a214dfbde7fd8e7a68efaa82ac260178f297f..fc94b19804bdb5eb6518378c61d8e047e16af2a8 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java ++++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +@@ -231,13 +231,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier { + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep() { +- this.level.getProfiler().push("allayBrain"); ++ //this.level.getProfiler().push("allayBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel) this.level, this); +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("allayActivityUpdate"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("allayActivityUpdate"); // Purpur + AllayAi.updateActivity(this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + super.customServerAiStep(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +index 02219f5ca614fefffa1ceb3c7036dfe1c90c8676..10eeef777154a91da4bb2c337079b080521e175a 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java ++++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +@@ -288,13 +288,13 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder optional = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS); + +diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +index d9104d996c854cce1ff167706c93747cd69c3969..cbd9c33f65bedf5ba9187d7707f9d206f433703d 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java ++++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +@@ -146,13 +146,13 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider + + @Override + protected void customServerAiStep() { +- this.level.getProfiler().push("camelBrain"); ++ //this.level.getProfiler().push("camelBrain"); // Purpur + Brain brain = (Brain) this.getBrain(); // Paper - decompile fix + brain.tick((ServerLevel)this.level, this); +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("camelActivityUpdate"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("camelActivityUpdate"); // Purpur + CamelAi.updateActivity(this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + super.customServerAiStep(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +index 0a051c7e7f5a172a9b906de04ef2a0419eda26eb..6d91017a8580f17c7203f0d8cb465ef3c94329c3 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java ++++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +@@ -180,13 +180,13 @@ public class Frog extends Animal implements VariantHolder { + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep() { +- this.level.getProfiler().push("frogBrain"); ++ //this.level.getProfiler().push("frogBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel)this.level, this); +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("frogActivityUpdate"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("frogActivityUpdate"); // Purpur + FrogAi.updateActivity(this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + super.customServerAiStep(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +index e591b0a09f5a8475b3ec9cd28bd5d5b69809ed73..a9fde4ac03db139997e8c60f75d003b783d5a1d9 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java ++++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +@@ -80,13 +80,13 @@ public class Tadpole extends AbstractFish { + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep() { +- this.level.getProfiler().push("tadpoleBrain"); ++ //this.level.getProfiler().push("tadpoleBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel) this.level, this); +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("tadpoleActivityUpdate"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("tadpoleActivityUpdate"); // Purpur + TadpoleAi.updateActivity(this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + super.customServerAiStep(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +index 0f365b9dbb160d90ddf5fcd40895305df48ce916..afb46f8a7d6a960529286c51aa3b21e0cb967e77 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java ++++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +@@ -191,13 +191,13 @@ public class Goat extends Animal { + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep() { +- this.level.getProfiler().push("goatBrain"); ++ //this.level.getProfiler().push("goatBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel) this.level, this); +- this.level.getProfiler().pop(); +- this.level.getProfiler().push("goatActivityUpdate"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("goatActivityUpdate"); // Purpur + GoatAi.updateActivity(this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + super.customServerAiStep(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java +index 5956a7759964f5e4939f062e93714fba64f53141..c03cbeb09d43b24e87d592de31d371b09dbf2982 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java +@@ -198,9 +198,9 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { + + @Override + protected void customServerAiStep() { +- this.level.getProfiler().push("zoglinBrain"); ++ //this.level.getProfiler().push("zoglinBrain"); // Purpur + this.getBrain().tick((ServerLevel)this.level, this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + this.updateActivity(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +index daa2224b021c966751eb39f269ffbfe6e7f3d426..effd71f6f741f7f0d0a3a512d4293a6ae620e3cc 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java ++++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +@@ -129,10 +129,10 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { + private int behaviorTick; // Pufferfish + @Override + protected void customServerAiStep() { +- this.level.getProfiler().push("hoglinBrain"); ++ //this.level.getProfiler().push("hoglinBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel)this.level, this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + HoglinAi.updateActivity(this); + if (this.isConverting()) { + ++this.timeInOverworld; +diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +index b401fb4f276ca81b4bb18426ee56abed8a9f7a7b..5349361f1b8af4434a9dd75e5401264a0604889a 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java ++++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +@@ -311,10 +311,10 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento + private int behaviorTick; // Pufferfish + @Override + protected void customServerAiStep() { +- this.level.getProfiler().push("piglinBrain"); ++ //this.level.getProfiler().push("piglinBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick((ServerLevel) this.level, this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + PiglinAi.updateActivity(this); + super.customServerAiStep(); + } +diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +index ac75c54e897565e340b66823caeed92ba1d1641a..06e5dc592a3dd23d52fd727a477c2262804054ef 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java ++++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +@@ -85,9 +85,9 @@ public class PiglinBrute extends AbstractPiglin { + + @Override + protected void customServerAiStep() { +- this.level.getProfiler().push("piglinBruteBrain"); ++ //this.level.getProfiler().push("piglinBruteBrain"); // Purpur + this.getBrain().tick((ServerLevel)this.level, this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + PiglinBruteAi.updateActivity(this); + PiglinBruteAi.maybePlayActivitySound(this); + super.customServerAiStep(); +diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +index 904826ea563bd2eb469f403df459def62cc1b5e6..c2a5d93fc2cb437d13f41735daceca00b6602a10 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java ++++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +@@ -275,10 +275,10 @@ public class Warden extends Monster implements VibrationListener.VibrationListen + protected void customServerAiStep() { + ServerLevel worldserver = (ServerLevel) this.level; + +- worldserver.getProfiler().push("wardenBrain"); ++ //worldserver.getProfiler().push("wardenBrain"); // Purpur + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + this.getBrain().tick(worldserver, this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + super.customServerAiStep(); + if ((this.tickCount + this.getId()) % 120 == 0) { + Warden.applyDarknessAround(worldserver, this.position(), this, 20); +diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java +index a39d038b5198c9244e2225e0fe383f3c96b49a08..2d222e383d48a1a32eebdb722d770b4fc6c0aca7 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java +@@ -292,7 +292,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + @Override + protected void customServerAiStep() { mobTick(false); } + protected void mobTick(boolean inactive) { +- this.level.getProfiler().push("villagerBrain"); ++ //this.level.getProfiler().push("villagerBrain"); // Purpur + // Purpur start + if (org.dreeam.leaf.LeafConfig.villagerLobotomizeEnabled) { + // treat as inactive if lobotomized +@@ -314,7 +314,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + restock(); + } + // Purpur end +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + if (this.assignProfessionWhenSpawned) { + this.assignProfessionWhenSpawned = false; + } +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java +index f16593a99ca4089151c2247f6028b823614c78e4..e71368734923c4dfed6cfad6571114b87d8fa6dc 100644 +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java +@@ -362,7 +362,7 @@ public class Explosion { + if (!iblockdata.isAir() && iblockdata.isDestroyable()) { // Paper + BlockPos blockposition1 = blockposition.immutable(); + +- this.level.getProfiler().push("explosion_blocks"); ++ //this.level.getProfiler().push("explosion_blocks"); // Purpur + if (block.dropFromExplosion(this)) { + Level world = this.level; + +@@ -384,7 +384,7 @@ public class Explosion { + + this.level.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 3); + block.wasExploded(this.level, blockposition, this); +- this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } + } + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index e61e52a34bb237bf7b1e28ba8087d1b2cd5f2f89..958e0ee29915bddde2cb8ebfd578448b83e2b149 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -664,9 +664,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"); ++ //this.getProfiler().push("queueCheckLight"); // Purpur + this.getChunkSource().getLightEngine().checkBlock(pos); +- this.getProfiler().pop(); ++ //this.getProfiler().pop(); // Purpur + } + + /* +@@ -965,9 +965,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + } + + protected void tickBlockEntities() { +- ProfilerFiller gameprofilerfiller = this.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur + +- gameprofilerfiller.push("blockEntities"); ++ //gameprofilerfiller.push("blockEntities"); // Purpur + //timings.tileEntityPending.startTiming(); // Spigot // Purpur + this.tickingBlockEntities = true; + if (!this.pendingBlockEntityTickers.isEmpty()) { +@@ -1012,7 +1012,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + //timings.tileEntityTick.stopTiming(); // Spigot // Purpur + this.tickingBlockEntities = false; + co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + spigotConfig.currentPrimedTnt = 0; // Spigot + } + +@@ -1205,7 +1205,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + + @Override + public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { +- this.getProfiler().incrementCounter("getEntities"); ++ //this.getProfiler().incrementCounter("getEntities"); // Purpur + List list = Lists.newArrayList(); + ((ServerLevel)this).getEntityLookup().getEntities(except, box, list, predicate); // Paper - optimise this call + return list; +@@ -1224,7 +1224,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"); ++ //this.getProfiler().incrementCounter("getEntities"); // Purpur + // Paper start - optimise this call + //TODO use limit + if (filter instanceof net.minecraft.world.entity.EntityType entityTypeTest) { +@@ -1553,7 +1553,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + } + + public ProfilerFiller getProfiler() { +- if (gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish ++ if (true || gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish // Purpur + 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 31cab107a606409af5c1fe56cd0956d707637cc0..fbb735915759ea59660daa809e23849a60fa5974 100644 +--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java ++++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +@@ -132,7 +132,7 @@ 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"); ++ //world.getProfiler().push("spawner"); // Purpur + //world.timings.mobSpawn.startTiming(); // Spigot // Purpur + MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES; + int i = aenumcreaturetype.length; +@@ -189,7 +189,7 @@ public final class NaturalSpawner { + } + + //world.timings.mobSpawn.stopTiming(); // Spigot // Purpur +- world.getProfiler().pop(); ++ //world.getProfiler().pop(); // Purpur + } + + // Paper start +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 f64225897d659127dd87293b26b58653cefda0c3..1fcdd47ee804db8d6649b603fd95c5273f40801d 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -1307,9 +1307,9 @@ public class LevelChunk extends ChunkAccess { + + if (LevelChunk.this.isTicking(blockposition)) { + try { +- ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); ++ //ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); // Purpur + +- gameprofilerfiller.push(this::getType); ++ //gameprofilerfiller.push(this::getType); // Purpur + //this.blockEntity.tickTimer.startTiming(); // Spigot // Purpur + BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); + +@@ -1321,7 +1321,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(); ++ //gameprofilerfiller.pop(); // Purpur + } catch (Throwable throwable) { + if (throwable instanceof ThreadDeath) throw throwable; // Paper + // Paper start - Prevent tile entity and entity crashes +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +index d23481453717f715124156b5d83f6448f720d049..a8af51a25b0f99c3a64d9150fdfcd6b818aa7581 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +@@ -53,8 +53,8 @@ public class PathFinder { + @Nullable + // Paper start - optimize collection + private Path findPath(ProfilerFiller profiler, Node startNode, List> positions, float followRange, int distance, float rangeMultiplier) { +- profiler.push("find_path"); +- profiler.markForCharting(MetricCategory.PATH_FINDING); ++ //profiler.push("find_path"); // Purpur ++ //profiler.markForCharting(MetricCategory.PATH_FINDING); // Purpur + // Set set = positions.keySet(); + startNode.g = 0.0F; + startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection +diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java +index 7f1ac2cb29eb84833c0895442d611dfa0504527e..5dea8414964e0d2d1fb15a6baa27227e9722bfc7 100644 +--- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java ++++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java +@@ -86,20 +86,20 @@ public class LevelTicks implements LevelTickAccess { + } + + public void tick(long time, int maxTicks, BiConsumer ticker) { +- ProfilerFiller profilerFiller = this.profiler.get(); +- profilerFiller.push("collect"); +- this.collectTicks(time, maxTicks, profilerFiller); +- profilerFiller.popPush("run"); +- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); ++ //ProfilerFiller profilerFiller = this.profiler.get(); // Purpur ++ //profilerFiller.push("collect"); // Purpur ++ this.collectTicks(time, maxTicks, null); // Purpur ++ //profilerFiller.popPush("run"); // Purpur ++ //profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); // Purpur + this.runCollectedTicks(ticker); +- profilerFiller.popPush("cleanup"); ++ //profilerFiller.popPush("cleanup"); // Purpur + this.cleanupAfterTick(); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Purpur + } + + private void collectTicks(long time, int maxTicks, ProfilerFiller profiler) { + this.sortContainersToTick(time); +- profiler.incrementCounter("containersToTick", this.containersToTick.size()); ++ //profiler.incrementCounter("containersToTick", this.containersToTick.size()); // Purpur + this.drainContainers(time, maxTicks); + this.rescheduleLeftoverContainers(); + } diff --git a/patches/server/0027-KeYi-Do-not-save-firework-entities-or-the-server-may.patch b/patches/server/0029-KeYi-Do-not-save-firework-entities-or-the-server-may.patch similarity index 100% rename from patches/server/0027-KeYi-Do-not-save-firework-entities-or-the-server-may.patch rename to patches/server/0029-KeYi-Do-not-save-firework-entities-or-the-server-may.patch diff --git a/patches/server/0028-KeYi-Use-a-faster-random-implementation.patch b/patches/server/0030-KeYi-Use-a-faster-random-implementation.patch similarity index 98% rename from patches/server/0028-KeYi-Use-a-faster-random-implementation.patch rename to patches/server/0030-KeYi-Use-a-faster-random-implementation.patch index d03a7833..80fe7ec2 100644 --- a/patches/server/0028-KeYi-Use-a-faster-random-implementation.patch +++ b/patches/server/0030-KeYi-Use-a-faster-random-implementation.patch @@ -426,7 +426,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 de7a5f3812a017131fd1b32fbeff10e325b1cd2e..ebe2c0b17fc6e21a5ced4f35b594d466f9f573f5 100644 +index 1fcdd47ee804db8d6649b603fd95c5273f40801d..2e922bb844bc147224a60ef2aae33a0125e6ca4a 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; @@ -442,7 +442,7 @@ index de7a5f3812a017131fd1b32fbeff10e325b1cd2e..ebe2c0b17fc6e21a5ced4f35b594d466 @@ -932,7 +936,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(); diff --git a/patches/server/0029-KeYi-Player-Skull-API.patch b/patches/server/0031-KeYi-Player-Skull-API.patch similarity index 100% rename from patches/server/0029-KeYi-Player-Skull-API.patch rename to patches/server/0031-KeYi-Player-Skull-API.patch diff --git a/patches/server/0030-Carpet-Fixes-Optimized-getBiome-method.patch b/patches/server/0032-Carpet-Fixes-Optimized-getBiome-method.patch similarity index 100% rename from patches/server/0030-Carpet-Fixes-Optimized-getBiome-method.patch rename to patches/server/0032-Carpet-Fixes-Optimized-getBiome-method.patch diff --git a/patches/server/0031-Carpet-Fixes-Use-optimized-RecipeManager.patch b/patches/server/0033-Carpet-Fixes-Use-optimized-RecipeManager.patch similarity index 100% rename from patches/server/0031-Carpet-Fixes-Use-optimized-RecipeManager.patch rename to patches/server/0033-Carpet-Fixes-Use-optimized-RecipeManager.patch diff --git a/patches/server/0032-Patina-Don-t-create-new-random-instance.patch b/patches/server/0034-Patina-Don-t-create-new-random-instance.patch similarity index 96% rename from patches/server/0032-Patina-Don-t-create-new-random-instance.patch rename to patches/server/0034-Patina-Don-t-create-new-random-instance.patch index 1e40716d..8dce1dea 100644 --- a/patches/server/0032-Patina-Don-t-create-new-random-instance.patch +++ b/patches/server/0034-Patina-Don-t-create-new-random-instance.patch @@ -10,7 +10,7 @@ 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 d46f33d9bc99484297270f88e68c1519922cb7db..46e5eaf8a6a4fef2c9b4d31665e8ec8589e6b31b 100644 +index 36cbcf3ca6412d98c9f7a002c5935bb99419fcca..b5aaddaf2ef9e7639cbdc682d06330945be3c432 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -393,7 +393,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0033-Yatopia-Smarter-statistics-ticking.patch b/patches/server/0035-Yatopia-Smarter-statistics-ticking.patch similarity index 100% rename from patches/server/0033-Yatopia-Smarter-statistics-ticking.patch rename to patches/server/0035-Yatopia-Smarter-statistics-ticking.patch diff --git a/patches/server/0034-Mirai-Fast-speed-check.patch b/patches/server/0036-Mirai-Fast-speed-check.patch similarity index 94% rename from patches/server/0034-Mirai-Fast-speed-check.patch rename to patches/server/0036-Mirai-Fast-speed-check.patch index bbf1b305..a9d93493 100644 --- a/patches/server/0034-Mirai-Fast-speed-check.patch +++ b/patches/server/0036-Mirai-Fast-speed-check.patch @@ -17,7 +17,7 @@ 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 3961f66a23508089df8c4ee7455e170cb870e9d0..fc6d90ec2e12cf5d12c6c0d9a45947218185ef3e 100644 +index 6e38669e60a1f4d69ea677901b36baf84327487f..8737203869179e84c6f05cf35bd98e76cd441db9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1194,7 +1194,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0035-VMP-Skip-entity-move-if-no-movement.patch b/patches/server/0037-VMP-Skip-entity-move-if-no-movement.patch similarity index 95% rename from patches/server/0035-VMP-Skip-entity-move-if-no-movement.patch rename to patches/server/0037-VMP-Skip-entity-move-if-no-movement.patch index 48448d89..f7a4e7f4 100644 --- a/patches/server/0035-VMP-Skip-entity-move-if-no-movement.patch +++ b/patches/server/0037-VMP-Skip-entity-move-if-no-movement.patch @@ -7,7 +7,7 @@ Original license: MIT Original project: https://github.com/RelativityMC/VMP-fabric diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index fc6d90ec2e12cf5d12c6c0d9a45947218185ef3e..853e96c3f2e4dd5572743154074b770ba9a23aa5 100644 +index 8737203869179e84c6f05cf35bd98e76cd441db9..75e374b262e2797b593e5f170014a6e0cd95e41e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -398,6 +398,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0036-Petal-Reduce-sensor-work.patch b/patches/server/0038-Petal-Reduce-sensor-work.patch similarity index 79% rename from patches/server/0036-Petal-Reduce-sensor-work.patch rename to patches/server/0038-Petal-Reduce-sensor-work.patch index 57cdc48c..86416131 100644 --- a/patches/server/0036-Petal-Reduce-sensor-work.patch +++ b/patches/server/0038-Petal-Reduce-sensor-work.patch @@ -10,7 +10,7 @@ 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/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 94b45579dc371ee980565aed2f5dee78ebd44427..48746d84f18cc8ee2f57785c65a5659ced454d39 100644 +index 2db9ce11dc52b8fb737e3344265e2a40d07ffc26..29fa9ad2223de668c15a5e5b433704b2c4765610 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -873,10 +873,10 @@ public abstract class Mob extends LivingEntity { @@ -18,11 +18,11 @@ index 94b45579dc371ee980565aed2f5dee78ebd44427..48746d84f18cc8ee2f57785c65a5659c } // Paper end + int i = this.level.getServer().getTickCount() + this.getId(); // petal - move up - this.level.getProfiler().push("sensing"); + //this.level.getProfiler().push("sensing"); // Purpur - this.sensing.tick(); + if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second - this.level.getProfiler().pop(); + //this.level.getProfiler().pop(); // Purpur - int i = this.level.getServer().getTickCount() + this.getId(); if (i % 2 != 0 && this.tickCount > 1) { - this.level.getProfiler().push("targetSelector"); + //this.level.getProfiler().push("targetSelector"); // Purpur diff --git a/patches/server/0037-Hearse-Async-entity-traveling.patch b/patches/server/0039-Hearse-Async-entity-traveling.patch similarity index 97% rename from patches/server/0037-Hearse-Async-entity-traveling.patch rename to patches/server/0039-Hearse-Async-entity-traveling.patch index a26c73ef..a3c8b97a 100644 --- a/patches/server/0037-Hearse-Async-entity-traveling.patch +++ b/patches/server/0039-Hearse-Async-entity-traveling.patch @@ -442,7 +442,7 @@ index e08f4e39db4ee3fed62e37364d17dcc5c5683504..22a5470862acfa470c9acd97c96fea29 + public static void reset() {} } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 75daffc4eaa831708f1ccfa5370ddf1871998033..6eea6430c6fe9174979bf390c008bdedc4c2a51b 100644 +index 3b7e4b724e86518ea57f5ed5ef0b8b3741d10f6f..74b525b14054dd5d921fdae4bf117f033538b2ea 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1,5 +1,7 @@ @@ -512,7 +512,7 @@ index 75daffc4eaa831708f1ccfa5370ddf1871998033..6eea6430c6fe9174979bf390c008bded + if (this.asyncExecutor.isSubmittingStarted()) { + this.asyncExecutor.stopSubmitting(); + } - co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper + //co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper // Purpur long i = Util.getNanos(); @@ -1406,6 +1419,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= 5000000000L) { this.lastServerStatus = i; @@ -1522,11 +1536,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - this.profiler.push(() -> { + /*this.profiler.push(() -> { // Purpur @@ -1557,7 +1570,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0) { - --this.autoSpinAttackTicks; - this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); - } ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("push"); // Purpur + this.removeFrost(); + this.tryAddFrost(); + if (!this.level.isClientSide && this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) { @@ -639,7 +641,7 @@ index 120c0804010fd5b38a5f806ca580962ff8b47339..2f2e67b922351ca10d32d807db6c92dc + } - this.pushEntities(); -- this.level.getProfiler().pop(); +- //this.level.getProfiler().pop(); // Purpur - // Paper start - if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) { - if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { diff --git a/patches/server/0038-Hearse-Async-entity-ai.patch b/patches/server/0040-Hearse-Async-entity-ai.patch similarity index 93% rename from patches/server/0038-Hearse-Async-entity-ai.patch rename to patches/server/0040-Hearse-Async-entity-ai.patch index 2d940299..c383a031 100644 --- a/patches/server/0038-Hearse-Async-entity-ai.patch +++ b/patches/server/0040-Hearse-Async-entity-ai.patch @@ -286,7 +286,7 @@ index f597d65d56964297eeeed6c7e77703764178fee0..b3bcafc8bafe1e4a1a2b690499b91e53 if (this.count == 0) { return; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index d939b1e3bc101e66bc1019cf49d8079665dadfcc..897c9a664806c43a4e7ff444ef69392b9b5cfab6 100644 +index beb7c22cb63021f26c06f91050361e1b25fcc72d..7c3716ff453f0705a67e5cd81776cf84de46ee2a 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -15,6 +15,7 @@ import com.mojang.logging.LogUtils; @@ -343,7 +343,7 @@ index d939b1e3bc101e66bc1019cf49d8079665dadfcc..897c9a664806c43a4e7ff444ef69392b this.chunkSaveCooldowns = new Long2LongOpenHashMap(); this.unloadQueue = Queues.newConcurrentLinkedQueue(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index c6f5d6756fa0e068a462d9c0ded12e0771abba37..788222965a82b21f669a7e7b10c50762968b67c0 100644 +index 0ae45cf5a084fd412305e8b2f5dabe608b4eb1c1..686852f5cb6303381c45a673a0daf79a2d3a9dfe 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -6,12 +6,7 @@ import com.mojang.datafixers.DataFixer; @@ -361,8 +361,8 @@ index c6f5d6756fa0e068a462d9c0ded12e0771abba37..788222965a82b21f669a7e7b10c50762 import java.util.concurrent.Executor; import java.util.function.BooleanSupplier; @@ -803,7 +798,7 @@ public class ServerChunkCache extends ChunkSource { - gameprofilerfiller.popPush("broadcast"); - this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing + //gameprofilerfiller.popPush("broadcast"); // Purpur + //this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) { - ReferenceOpenHashSet copy = this.chunkMap.needsChangeBroadcasting.clone(); + List copy = new ArrayList<>(this.chunkMap.needsChangeBroadcasting); @@ -421,7 +421,7 @@ index 50a9f33aa31e9273c7c52d4bb2b02f0f884f7ba5..6d94aa3c175345f701ec67175fad3fcd public int size() { return this.allInstances.size(); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 48746d84f18cc8ee2f57785c65a5659ced454d39..62e82f7e76bcf53da1caf709e5cf3088db840a32 100644 +index 29fa9ad2223de668c15a5e5b433704b2c4765610..a49247b9007d859928aab21ed05cfa86ad1a13cf 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -23,6 +23,7 @@ import net.minecraft.network.syncher.EntityDataAccessor; @@ -453,65 +453,66 @@ index 48746d84f18cc8ee2f57785c65a5659ced454d39..62e82f7e76bcf53da1caf709e5cf3088 } // Paper end -@@ -878,42 +881,32 @@ public abstract class Mob extends LivingEntity { +@@ -877,43 +880,32 @@ public abstract class Mob extends LivingEntity { + //this.level.getProfiler().push("sensing"); // Purpur if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second - this.level.getProfiler().pop(); - + //this.level.getProfiler().pop(); // Purpur +- - if (i % 2 != 0 && this.tickCount > 1) { -- this.level.getProfiler().push("targetSelector"); +- //this.level.getProfiler().push("targetSelector"); // Purpur - if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking - this.targetSelector.tickRunningGoals(false); -- this.level.getProfiler().pop(); -- this.level.getProfiler().push("goalSelector"); +- //this.level.getProfiler().pop(); // Purpur +- //this.level.getProfiler().push("goalSelector"); // Purpur - if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking - this.goalSelector.tickRunningGoals(false); -- this.level.getProfiler().pop(); +- //this.level.getProfiler().pop(); // Purpur - } else { -- this.level.getProfiler().push("targetSelector"); +- //this.level.getProfiler().push("targetSelector"); // Purpur - if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking - this.targetSelector.tick(); -- this.level.getProfiler().pop(); -- this.level.getProfiler().push("goalSelector"); +- //this.level.getProfiler().pop(); // Purpur +- //this.level.getProfiler().push("goalSelector"); // Purpur - if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking - this.goalSelector.tick(); -- this.level.getProfiler().pop(); +- //this.level.getProfiler().pop(); // Purpur - } - -- this.level.getProfiler().push("navigation"); +- //this.level.getProfiler().push("navigation"); // Purpur - this.navigation.tick(); -- this.level.getProfiler().pop(); -- this.level.getProfiler().push("mob tick"); +- //this.level.getProfiler().pop(); // Purpur +- //this.level.getProfiler().push("mob tick"); // Purpur - this.customServerAiStep(); -- this.level.getProfiler().pop(); -- this.level.getProfiler().push("controls"); -- this.level.getProfiler().push("move"); +- //this.level.getProfiler().pop(); // Purpur +- //this.level.getProfiler().push("controls"); // Purpur +- //this.level.getProfiler().push("move"); // Purpur - this.moveControl.tick(); -- this.level.getProfiler().popPush("look"); +- //this.level.getProfiler().popPush("look"); // Purpur - this.lookControl.tick(); -- this.level.getProfiler().popPush("jump"); +- //this.level.getProfiler().popPush("jump"); // Purpur - this.jumpControl.tick(); -- this.level.getProfiler().pop(); -- this.level.getProfiler().pop(); +- //this.level.getProfiler().pop(); // Purpur +- //this.level.getProfiler().pop(); // Purpur - this.sendDebugPackets(); + MinecraftServer.getServer().asyncExecutor.executeWithCallBack(() -> { + if (i % 2 != 0 && this.tickCount > 1) { -+ this.level.getProfiler().push("targetSelector"); ++ //this.level.getProfiler().push("targetSelector"); // Purpur + if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.targetSelector.tickRunningGoals(false); -+ this.level.getProfiler().pop(); -+ this.level.getProfiler().push("goalSelector"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("goalSelector"); // Purpur + if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.goalSelector.tickRunningGoals(false); -+ this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } else { -+ this.level.getProfiler().push("targetSelector"); ++ //this.level.getProfiler().push("targetSelector"); // Purpur + if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.targetSelector.tick(); -+ this.level.getProfiler().pop(); -+ this.level.getProfiler().push("goalSelector"); ++ //this.level.getProfiler().pop(); // Purpur ++ //this.level.getProfiler().push("goalSelector"); // Purpur + if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.goalSelector.tick(); -+ this.level.getProfiler().pop(); ++ //this.level.getProfiler().pop(); // Purpur + } + this.navigation.tick(); + this.customServerAiStep(); @@ -541,7 +542,7 @@ index 097007c1c25ba55d9916fc820dd1d1149d81f6f4..16eec12db529dd513e0971289a932665 GossipContainer.EntityGossips entityGossips = this.gossips.get(uuid); map.put(uuid, entityGossips.entries); diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index a39d038b5198c9244e2225e0fe383f3c96b49a08..948b3ae132dc291551a466a2c7569de3ba632c04 100644 +index 2d222e383d48a1a32eebdb722d770b4fc6c0aca7..eb5257fabef397566e784247922fb27e61f96313 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -274,16 +274,18 @@ public class Villager extends AbstractVillager implements ReputationEventHandler diff --git a/patches/server/0039-Hearse-Pathfinding-Fixes.patch b/patches/server/0041-Hearse-Pathfinding-Fixes.patch similarity index 99% rename from patches/server/0039-Hearse-Pathfinding-Fixes.patch rename to patches/server/0041-Hearse-Pathfinding-Fixes.patch index c4897fea..49454c2c 100644 --- a/patches/server/0039-Hearse-Pathfinding-Fixes.patch +++ b/patches/server/0041-Hearse-Pathfinding-Fixes.patch @@ -142,7 +142,7 @@ index a8a2594b8f5b3ebf6a1f918c7d822ad35b051b17..7de3c41e036ddb91d951cefbd2ea0939 public abstract Node getStart(); diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index d23481453717f715124156b5d83f6448f720d049..17073b714285857d7fc5c816f1ea57f9f528be22 100644 +index a8af51a25b0f99c3a64d9150fdfcd6b818aa7581..919f8c1aa52aa8c468427e850d1d4764a915320f 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java @@ -8,6 +8,8 @@ import java.util.List;