diff --git a/patches/dropped-server/0247-Remove-Mojang-Profiler.patch b/patches/dropped-server/0247-Remove-Mojang-Profiler.patch new file mode 100644 index 000000000..6bd55ce39 --- /dev/null +++ b/patches/dropped-server/0247-Remove-Mojang-Profiler.patch @@ -0,0 +1,2108 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sat, 16 Jul 2022 21:37:10 -0500 +Subject: [PATCH] Remove Mojang Profiler + + +diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java +index d8ee4422a13c7f09b84e9bbe8b57f0c139caac32..0ba926b6ff0bd54159765cc7f37d1753ded89dee 100644 +--- a/src/main/java/net/minecraft/commands/Commands.java ++++ b/src/main/java/net/minecraft/commands/Commands.java +@@ -169,7 +169,7 @@ public class Commands { + DamageCommand.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); +@@ -351,9 +351,9 @@ public class Commands { + // Paper end + CommandSourceStack commandlistenerwrapper = (CommandSourceStack) parseresults.getContext().getSource(); + +- Profiler.get().push(() -> { ++ /*Profiler.get().push(() -> { // Purpur + return "/" + s; +- }); ++ });*/ // Purpur + ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent + + try { +@@ -383,7 +383,7 @@ public class Commands { + Commands.LOGGER.error("'/{}' threw an exception", s, exception); + } + } finally { +- Profiler.get().pop(); ++ //Profiler.get().pop(); // Purpur + } + + } +diff --git a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java +index 9f5c3ec2eae9b30bdb8dbcb328d7f701cb7aeb9d..e7cc8105fff9cb952eabfd006e0a4e4638091019 100644 +--- a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java ++++ b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java +@@ -42,7 +42,7 @@ public class BuildContexts> { + ChainModifiers chainModifiers = flags; + List list = sources; + if (contextChain.getStage() != Stage.EXECUTE) { +- context.profiler().push(() -> "prepare " + this.commandInput); ++ //context.profiler().push(() -> "prepare " + this.commandInput); // Purpur + + try { + for (int i = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) { +@@ -86,7 +86,7 @@ public class BuildContexts> { + } + } + } finally { +- context.profiler().pop(); ++ //context.profiler().pop(); // Purpur + } + } + +diff --git a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java +index e9775b4506909bee65a74964f0d5391a0513de1d..684f7f202305c09b1037c5d38a52a5ea7f00751b 100644 +--- a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java ++++ b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java +@@ -23,7 +23,7 @@ public class ExecuteCommand> implements Unbo + + @Override + public void execute(T executionCommandSource, ExecutionContext executionContext, Frame frame) { +- executionContext.profiler().push(() -> "execute " + this.commandInput); ++ //executionContext.profiler().push(() -> "execute " + this.commandInput); // Purpur + + try { + executionContext.incrementCost(); +@@ -37,7 +37,7 @@ public class ExecuteCommand> implements Unbo + } catch (CommandSyntaxException var9) { + executionCommandSource.handleError(var9, this.modifiers.isForked(), executionContext.tracer()); + } finally { +- executionContext.profiler().pop(); ++ //executionContext.profiler().pop(); // Purpur + } + } + } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 2065f03b70bc77fffd8bac4fab6efc89d598f8b4..cb18ba70ea12785a95de90e4f9d1533ab755a576 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -431,12 +431,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { ++ //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur ++ /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur + this.stopRecordingMetrics(); +- }; +- this.onMetricsRecordingFinished = (path) -> { +- }; ++ };*/ // Purpur ++ //this.onMetricsRecordingFinished = (path) -> { // Purpur ++ //}; // Purpur + this.random = RandomSource.create(); + this.port = -1; + this.levels = Maps.newLinkedHashMap(); +@@ -1050,9 +1050,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + return false; +@@ -1365,7 +1365,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur + +- gameprofilerfiller.push(() -> { ++ /*gameprofilerfiller.push(() -> { // Purpur + String s = String.valueOf(worldserver); + + return s + " " + String.valueOf(worldserver.dimension().location()); +- }); ++ });*/ // Purpur + /* Drop global time updates + if (this.tickCount % 20 == 0) { +- gameprofilerfiller.push("timeSync"); ++ //gameprofilerfiller.push("timeSync"); // Purpur + this.synchronizeTime(worldserver); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + // CraftBukkit end */ + +- gameprofilerfiller.push("tick"); ++ //gameprofilerfiller.push("tick"); // Purpur + + try { + worldserver.tick(shouldKeepTicking); +@@ -1912,26 +1912,26 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + this.executeBlocking(() -> { + this.saveDebugReport(path.resolve("server")); +@@ -2927,37 +2927,38 @@ 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.metricsRecorder.cancel(); // Purpur + } + + public Path getWorldPath(LevelResource worldSavePath) { +@@ -3010,15 +3011,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> functions, ResourceLocation label) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + + Objects.requireNonNull(label); +- gameprofilerfiller.push(label::toString); ++ //gameprofilerfiller.push(label::toString); // Purpur + Iterator iterator = functions.iterator(); + + while (iterator.hasNext()) { +@@ -66,15 +66,15 @@ public class ServerFunctionManager { + this.execute(commandfunction, this.getGameLoopSender()); + } + +- Profiler.get().pop(); ++ //Profiler.get().pop(); // Purpur + } + + public void execute(CommandFunction function, CommandSourceStack source) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push(() -> { ++ /*gameprofilerfiller.push(() -> { // Purpur + return "function " + String.valueOf(function.id()); +- }); ++ });*/ // Purpur + + try { + InstantiatedFunction instantiatedfunction = function.instantiate((CompoundTag) null, this.getDispatcher()); +@@ -87,7 +87,7 @@ public class ServerFunctionManager { + } catch (Exception exception) { + ServerFunctionManager.LOGGER.warn("Failed to execute function {}", function.id(), exception); + } finally { +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + } +diff --git a/src/main/java/net/minecraft/server/commands/PerfCommand.java b/src/main/java/net/minecraft/server/commands/PerfCommand.java +index 8c587f829c5e8c6b6df3150024c4ae704988c47b..8ac4d5dbe7f8febf4226f26a6b035282dcdf1b0f 100644 +--- a/src/main/java/net/minecraft/server/commands/PerfCommand.java ++++ b/src/main/java/net/minecraft/server/commands/PerfCommand.java +@@ -42,6 +42,7 @@ public class PerfCommand { + } + + private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { ++ if (true) return removedMessage(source); // Purpur + MinecraftServer minecraftServer = source.getServer(); + if (minecraftServer.isRecordingMetrics()) { + throw ERROR_ALREADY_RUNNING.create(); +@@ -55,6 +56,7 @@ public class PerfCommand { + } + + private static int stopProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { ++ if (true) return removedMessage(source); // Purpur + MinecraftServer minecraftServer = source.getServer(); + if (!minecraftServer.isRecordingMetrics()) { + throw ERROR_NOT_RUNNING.create(); +@@ -64,6 +66,18 @@ public class PerfCommand { + } + } + ++ // Purpur start ++ private static int removedMessage(CommandSourceStack source) { ++ if (true) { ++ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage(); ++ source.getSender().sendMessage(mm.deserialize("Purpur has removed Mojang's Profiler to save your performance. Please use /spark instead")); ++ source.getSender().sendMessage(mm.deserialize("For more information, view its documentation at")); ++ source.getSender().sendMessage(mm.deserialize("https://spark.lucko.me/docs/Command-Usage")); ++ } ++ return 0; ++ } ++ // Purpur end ++ + private static void saveResults(CommandSourceStack source, Path tempProfilingDirectory, MinecraftServer server) { + String string = String.format( + Locale.ROOT, "%s-%s-%s", Util.getFilenameFormattedDateTime(), server.getWorldData().getLevelName(), SharedConstants.getCurrentVersion().getId() +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..e16f22dd82b4315da34af3c9a189d9d5fec0fd2f 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -406,16 +406,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + } + + protected void tick(BooleanSupplier shouldKeepTicking) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("poi"); ++ //gameprofilerfiller.push("poi"); // Purpur + this.poiManager.tick(shouldKeepTicking); +- gameprofilerfiller.popPush("chunk_unload"); ++ //gameprofilerfiller.popPush("chunk_unload"); // Purpur + if (!this.level.noSave()) { + this.processUnloads(shouldKeepTicking); + } + +- 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 3c711e1df57ac5b0f8795ebb12299d275792b1d4..bb168636cbf23b5b0c7232529e390f434546dc37 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -442,38 +442,38 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // CraftBukkit start - modelled on below + public void purgeUnload() { + if (true) return; // Paper - rewrite chunk system +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("purge"); ++ //gameprofilerfiller.push("purge"); // Purpur + this.distanceManager.purgeStaleTickets(); + this.runDistanceManagerUpdates(); +- gameprofilerfiller.popPush("unload"); ++ //gameprofilerfiller.popPush("unload"); // Purpur + this.chunkMap.tick(() -> true); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + this.clearCache(); + } + // CraftBukkit end + + @Override + public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("purge"); ++ //gameprofilerfiller.push("purge"); // Purpur + if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot + this.distanceManager.purgeStaleTickets(); + } + + this.runDistanceManagerUpdates(); +- gameprofilerfiller.popPush("chunks"); ++ //gameprofilerfiller.popPush("chunks"); // Purpur + if (tickChunks) { + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().tick(); // Paper - rewrite chunk system + this.tickChunks(); + this.chunkMap.tick(); + } + +- gameprofilerfiller.popPush("unload"); ++ //gameprofilerfiller.popPush("unload"); // Purpur + this.chunkMap.tick(shouldKeepTicking); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + this.clearCache(); + } + +@@ -483,34 +483,34 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + + this.lastInhabitedUpdate = i; + if (!this.level.isDebug()) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("pollingChunks"); ++ //gameprofilerfiller.push("pollingChunks"); // Purpur + if (this.level.tickRateManager().runsNormally()) { + List list = this.tickingChunks; + + try { +- gameprofilerfiller.push("filteringTickingChunks"); ++ //gameprofilerfiller.push("filteringTickingChunks"); // Purpur + this.collectTickingChunks(list); +- gameprofilerfiller.popPush("shuffleChunks"); ++ //gameprofilerfiller.popPush("shuffleChunks"); // Purpur + // Paper start - chunk tick iteration optimisation + this.shuffleRandom.setSeed(this.level.random.nextLong()); + if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled + // Paper end - chunk tick iteration optimisation +- this.tickChunks(gameprofilerfiller, j, list); +- gameprofilerfiller.pop(); ++ this.tickChunks(null, j, list); // Purpur ++ //gameprofilerfiller.pop(); // Purpur + } finally { + list.clear(); + } + } + +- this.broadcastChangedChunks(gameprofilerfiller); +- gameprofilerfiller.pop(); ++ this.broadcastChangedChunks(null); // Purpur ++ //gameprofilerfiller.pop(); // Purpur + } + } + +- private void broadcastChangedChunks(ProfilerFiller profiler) { +- profiler.push("broadcast"); ++ private void broadcastChangedChunks(ProfilerFiller profiler) { // Purpur ++ //profiler.push("broadcast"); // Purpur + Iterator iterator = this.chunkHoldersToBroadcast.iterator(); + + while (iterator.hasNext()) { +@@ -523,7 +523,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + + this.chunkHoldersToBroadcast.clear(); +- profiler.pop(); ++ //profiler.pop(); // Purpur + } + + private void collectTickingChunks(List chunks) { +@@ -550,7 +550,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + + private void tickChunks(ProfilerFiller profiler, long timeDelta, List chunks) { +- profiler.popPush("naturalSpawnCount"); ++ //profiler.popPush("naturalSpawnCount"); // Purpur + int j = this.distanceManager.getNaturalSpawnChunkCount(); + // Paper start - Optional per player mob spawns + final int naturalSpawnChunkCount = j; +@@ -577,7 +577,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper end - Optional per player mob spawns + + this.lastSpawnState = spawnercreature_d; +- profiler.popPush("spawnAndTick"); ++ //profiler.popPush("spawnAndTick"); // Purpur + boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit + int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); + List list1; +@@ -615,7 +615,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + } + +- profiler.popPush("customSpawners"); ++ //profiler.popPush("customSpawners"); // Purpur + if (flag) { + this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); + } +@@ -813,7 +813,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + + @Override + protected void doRunTask(Runnable task) { +- Profiler.get().incrementCounter("runTask"); ++ //Profiler.get().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 a8650040b69fe92f18606e5029ecd881961b39e7..4c11f0a23ee897691d8a8022baa134ef6f5e3d89 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -724,18 +724,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + + public void tick(BooleanSupplier shouldKeepTicking) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + + this.handlingTick = true; + TickRateManager tickratemanager = this.tickRateManager(); + boolean flag = tickratemanager.runsNormally(); + + if (flag) { +- gameprofilerfiller.push("world border"); ++ //gameprofilerfiller.push("world border"); // Purpur + this.getWorldBorder().tick(); +- gameprofilerfiller.popPush("weather"); ++ //gameprofilerfiller.popPush("weather"); // Purpur + this.advanceWeatherCycle(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); +@@ -766,30 +766,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + this.tickTime(); + } + +- gameprofilerfiller.push("tickPending"); ++ //gameprofilerfiller.push("tickPending"); // Purpur + if (!this.isDebug() && flag) { + j = this.getGameTime(); +- gameprofilerfiller.push("blockTicks"); ++ //gameprofilerfiller.push("blockTicks"); // Purpur + this.blockTicks.tick(j, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks +- gameprofilerfiller.popPush("fluidTicks"); ++ //gameprofilerfiller.popPush("fluidTicks"); // Purpur + this.fluidTicks.tick(j, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + +- gameprofilerfiller.popPush("raid"); ++ //gameprofilerfiller.popPush("raid"); // Purpur + if (flag) { + this.raids.tick(); + } + +- gameprofilerfiller.popPush("chunkSource"); ++ //gameprofilerfiller.popPush("chunkSource"); // Purpur + this.getChunkSource().tick(shouldKeepTicking, true); +- gameprofilerfiller.popPush("blockEvents"); ++ //gameprofilerfiller.popPush("blockEvents"); // Purpur + if (flag) { + this.runBlockEvents(); + } + + this.handlingTick = false; +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + boolean flag1 = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this + + if (flag1) { +@@ -797,20 +797,20 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + + if (flag1 || this.emptyTime++ < 300) { +- gameprofilerfiller.push("entities"); ++ //gameprofilerfiller.push("entities"); // Purpur + if (this.dragonFight != null && flag) { +- gameprofilerfiller.push("dragonFight"); ++ //gameprofilerfiller.push("dragonFight"); // Purpur + this.dragonFight.tick(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + org.spigotmc.ActivationRange.activateEntities(this); // Spigot + this.entityTickList.forEach((entity) -> { + if (!entity.isRemoved()) { + if (!tickratemanager.isEntityFrozen(entity)) { +- gameprofilerfiller.push("checkDespawn"); ++ //gameprofilerfiller.push("checkDespawn"); // Purpur + entity.checkDespawn(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + if (true) { // Paper - rewrite chunk system + Entity entity1 = entity.getVehicle(); + +@@ -822,20 +822,20 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + entity.stopRiding(); + } + +- gameprofilerfiller.push("tick"); ++ //gameprofilerfiller.push("tick"); // Purpur + this.guardEntityTick(this::tickNonPassenger, entity); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + } + } + }); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + this.tickBlockEntities(); + } + +- gameprofilerfiller.push("entityManagement"); ++ //gameprofilerfiller.push("entityManagement"); // Purpur + // Paper - rewrite chunk system +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + @Override +@@ -962,9 +962,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + boolean flag = this.isRaining(); + int j = chunkcoordintpair.getMinBlockX(); + int k = chunkcoordintpair.getMinBlockZ(); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("thunder"); ++ //gameprofilerfiller.push("thunder"); // Purpur + if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking + BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); + +@@ -1001,7 +1001,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + } + +- gameprofilerfiller.popPush("iceandsnow"); ++ //gameprofilerfiller.popPush("iceandsnow"); // Purpur + + if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow + for (int l = 0; l < randomTickSpeed; ++l) { +@@ -1011,12 +1011,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + } // Paper - Option to disable ice and snow + +- gameprofilerfiller.popPush("tickBlocks"); ++ //gameprofilerfiller.popPush("tickBlocks"); // Purpur + if (randomTickSpeed > 0) { + this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + @VisibleForTesting +@@ -1355,18 +1355,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + // Spigot end + final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); // Paper - EAR 2 + entity.setOldPosAndRot(); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + + ++entity.tickCount; +- gameprofilerfiller.push(() -> { ++ /*gameprofilerfiller.push(() -> { // Purpur + return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); +- }); +- gameprofilerfiller.incrementCounter("tickNonPassenger"); ++ });*/ // Purpur ++ //gameprofilerfiller.incrementCounter("tickNonPassenger"); // Purpur + if (isActive) { // Paper - EAR 2 + entity.tick(); + entity.postTick(); // CraftBukkit + } else { entity.inactiveTick(); } // Paper - EAR 2 +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + Iterator iterator = entity.getPassengers().iterator(); + + while (iterator.hasNext()) { +@@ -1389,12 +1389,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + if (passenger instanceof Player || this.entityTickList.contains(passenger)) { + passenger.setOldPosAndRot(); + ++passenger.tickCount; +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // 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(); +@@ -1406,7 +1406,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + 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 51229d600ea8a58e5c75bd97a1926f5cdf3704d4..0286b1bd461a5050cb78b9485bac84909ae91150 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -1669,15 +1669,15 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + this.unsetRemoved(); + */ + // CraftBukkit end +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("moving"); ++ //gameprofilerfiller.push("moving"); // Purpur + if (worldserver != null && resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit - empty to fall through to null to event + this.enteredNetherPosition = this.position(); + } + +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("placing"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("placing"); // Purpur + // CraftBukkit start + this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds + LevelData worlddata = worldserver.getLevelData(); +@@ -1695,7 +1695,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + this.connection.internalTeleport(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); // CraftBukkit - use internal teleport without event + this.connection.resetPosition(); + worldserver.addDuringTeleport(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + this.triggerDimensionChangeTriggers(worldserver1); + this.stopUsingItem(); + this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); +diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +index 7d276c191b391bca24948ddb36b8b7d0f1f03b03..49cb116fd55e6d5cd36b9773b39191e4ab06b7e0 100644 +--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +@@ -274,7 +274,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } + + protected void keepConnectionAlive() { +- Profiler.get().push("keepAlive"); ++ //Profiler.get().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(); +@@ -307,7 +307,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } + // Paper end - give clients a longer time to respond to pings as per pre 1.12.2 timings + +- Profiler.get().pop(); ++ //Profiler.get().pop(); // Purpur + } + + private boolean checkIfClosed(long time) { +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 d2d82e4f22bfeac8881b6815e4bef56c254fded9..abc92e09b7bb636612f04ace8232947c8d454e68 100644 +--- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java ++++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +@@ -12,10 +12,10 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener + PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor + ) { + return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("listener"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur ++ //profilerFiller.push("listener"); // Purpur + this.onResourceManagerReload(manager); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // 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 bce2dac613d29083dd5fbb68739304cc5a6d4d27..600a7036b503f60cc9c95f189f73c2dbf020e2e1 100644 +--- a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java ++++ b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java +@@ -55,7 +55,7 @@ public class ActiveProfiler implements ProfileCollector { + 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( +@@ -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 bc5c8879befe849ce81becf5e3fba6757b01cb70..ce81d6bd87f688a24003f2fbf6d5010ad6273917 100644 +--- a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java ++++ b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java +@@ -6,51 +6,68 @@ 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 + default void addZoneText(String label) { + } + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + default void addZoneValue(long value) { + } + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + default void setZoneColor(int color) { + } + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + default Zone zone(String name) { + this.push(name); + return new Zone(this); + } + ++ @io.papermc.paper.annotation.DoNotUse // Purpur + default Zone zone(Supplier nameSupplier) { + this.push(nameSupplier); + return new Zone(this); + } + ++ @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 num); + ++ @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 num); + + static ProfilerFiller combine(ProfilerFiller first, ProfilerFiller second) { +@@ -72,80 +89,80 @@ public interface ProfilerFiller { + + @Override + public void startTick() { +- this.first.startTick(); +- this.second.startTick(); ++ //this.first.startTick(); // Purpur ++ //this.second.startTick(); // Purpur + } + + @Override + public void endTick() { +- this.first.endTick(); +- this.second.endTick(); ++ //this.first.endTick(); // Purpur ++ //this.second.endTick(); // Purpur + } + + @Override + public void push(String location) { +- this.first.push(location); +- this.second.push(location); ++ //this.first.push(location); // Purpur ++ //this.second.push(location); // Purpur + } + + @Override + public void push(Supplier locationGetter) { +- this.first.push(locationGetter); +- this.second.push(locationGetter); ++ //this.first.push(locationGetter); // Purpur ++ //this.second.push(locationGetter); // Purpur + } + + @Override + public void markForCharting(MetricCategory type) { +- this.first.markForCharting(type); +- this.second.markForCharting(type); ++ //this.first.markForCharting(type); // Purpur ++ //this.second.markForCharting(type); // Purpur + } + + @Override + public void pop() { +- this.first.pop(); +- this.second.pop(); ++ //this.first.pop(); // Purpur ++ //this.second.pop(); // Purpur + } + + @Override + public void popPush(String location) { +- this.first.popPush(location); +- this.second.popPush(location); ++ //this.first.popPush(location); // Purpur ++ //this.second.popPush(location); // Purpur + } + + @Override + public void popPush(Supplier locationGetter) { +- this.first.popPush(locationGetter); +- this.second.popPush(locationGetter); ++ //this.first.popPush(locationGetter); // Purpur ++ //this.second.popPush(locationGetter); // Purpur + } + + @Override + public void incrementCounter(String marker, int num) { +- this.first.incrementCounter(marker, num); +- this.second.incrementCounter(marker, num); ++ //this.first.incrementCounter(marker, num); // Purpur ++ //this.second.incrementCounter(marker, num); // Purpur + } + + @Override + public void incrementCounter(Supplier markerGetter, int num) { +- this.first.incrementCounter(markerGetter, num); +- this.second.incrementCounter(markerGetter, num); ++ //this.first.incrementCounter(markerGetter, num); // Purpur ++ //this.second.incrementCounter(markerGetter, num); // Purpur + } + + @Override + public void addZoneText(String label) { +- this.first.addZoneText(label); +- this.second.addZoneText(label); ++ //this.first.addZoneText(label); // Purpur ++ //this.second.addZoneText(label); // Purpur + } + + @Override + public void addZoneValue(long value) { +- this.first.addZoneValue(value); +- this.second.addZoneValue(value); ++ //this.first.addZoneValue(value); // Purpur ++ //this.second.addZoneValue(value); // Purpur + } + + @Override + public void setZoneColor(int color) { +- this.first.setZoneColor(color); +- this.second.setZoneColor(color); ++ //this.first.setZoneColor(color); // Purpur ++ //this.second.setZoneColor(color); // Purpur + } + } + } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 520808a1238b28ec42f261b58b2b768cdb1d8277..1e740178898720cffff0a18255ebb9b46265f45f 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -946,9 +946,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + // CraftBukkit end + + public void baseTick() { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("entityBaseTick"); ++ //gameprofilerfiller.push("entityBaseTick"); // Purpur + if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups + this.inBlockState = null; + if (this.isPassenger() && this.getVehicle().isRemoved()) { +@@ -1017,7 +1017,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + public void setSharedFlagOnFire(boolean onFire) { +@@ -1243,9 +1243,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("move"); ++ //gameprofilerfiller.push("move"); // Purpur + if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) { + movement = movement.multiply(this.stuckSpeedMultiplier); + this.stuckSpeedMultiplier = Vec3.ZERO; +@@ -1254,7 +1254,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + // Paper start - ignore movement changes while inactive. + if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) { + setDeltaMovement(Vec3.ZERO); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + return; + } + // Paper end +@@ -1275,8 +1275,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z); + } + +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("rest"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("rest"); // Purpur + boolean flag = !Mth.equal(movement.x, vec3d1.x); + boolean flag1 = !Mth.equal(movement.z, vec3d1.z); + +@@ -1298,7 +1298,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + + if (this.isRemoved()) { +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } else { + if (this.horizontalCollision) { + Vec3 vec3d2 = this.getDeltaMovement(); +@@ -1347,7 +1347,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + float f = this.getBlockSpeedFactor(); + + this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f)); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + } + // Paper start - detailed watchdog information +@@ -3512,9 +3512,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.processPortalCooldown(); + if (this.portalProcess != null) { + if (this.portalProcess.processPortalTeleportation(worldserver, this, this.canUsePortal(false))) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("portal"); ++ //gameprofilerfiller.push("portal"); // Purpur + this.setPortalCooldown(); + TeleportTransition teleporttransition = this.portalProcess.getPortalDestination(worldserver, this); + +@@ -3526,7 +3526,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } else if (this.portalProcess.hasExpired()) { + this.portalProcess = null; + } +@@ -4079,12 +4079,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("teleportCrossDimension"); ++ //gameprofilerfiller.push("teleportCrossDimension"); // Purpur + entity = this.getType().create(world, EntitySpawnReason.DIMENSION_TRAVEL); + if (entity == null) { +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + return null; + } else { + // Paper start - Fix item duplication and teleport issues +@@ -4110,7 +4110,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + world.resetEmptyTime(); + teleportTarget.postTeleportTransition().onTransition(entity); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + return entity; + } + } +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index e2a5d66e4b945f69d9f2b538b95aa0b187749d8b..cd2fd85178acdfffc07b72bc0419a73e1d1bef64 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -457,9 +457,9 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + super.baseTick(); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("livingEntityBaseTick"); ++ //gameprofilerfiller.push("livingEntityBaseTick"); // Purpur + if (this.fireImmune() || this.level().isClientSide) { + this.clearFire(); + } +@@ -567,7 +567,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.yHeadRotO = this.yHeadRot; + this.yRotO = this.getYRot(); + this.xRotO = this.getXRot(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + @Override +@@ -3382,12 +3382,12 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + this.run += (f3 - this.run) * 0.3F; +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("headTurn"); ++ //gameprofilerfiller.push("headTurn"); // Purpur + f2 = this.tickHeadTurn(f1, f2); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("rangeChecks"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.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; +@@ -3399,7 +3399,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; + // Paper end + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + this.animStep += f2; + if (this.isFallFlying()) { + ++this.fallFlyTicks; +@@ -3629,21 +3629,21 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + this.setDeltaMovement(d0, d1, d2); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("ai"); ++ //gameprofilerfiller.push("ai"); // Purpur + if (this.isImmobile()) { + this.jumping = false; + this.xxa = 0.0F; + this.zza = 0.0F; + } else if (this.isEffectiveAi()) { +- gameprofilerfiller.push("newAi"); ++ //gameprofilerfiller.push("newAi"); // Purpur + this.serverAiStep(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("jump"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("jump"); // Purpur + if (this.jumping && this.isAffectedByFluids()) { + double d3; + +@@ -3670,8 +3670,8 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.noJumpDelay = 0; + } + +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("travel"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("travel"); // Purpur + this.xxa *= 0.98F; + this.zza *= 0.98F; + if (this.isFallFlying()) { +@@ -3704,8 +3704,8 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + this.calculateEntityAnimation(this instanceof FlyingAnimal); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("freezing"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("freezing"); // Purpur + if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API + int i = this.getTicksFrozen(); + +@@ -3726,15 +3726,15 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + } + +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("push"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("push"); // Purpur + if (this.autoSpinAttackTicks > 0) { + --this.autoSpinAttackTicks; + this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); + } + + this.pushEntities(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + // Paper start - Add EntityMoveEvent + // Purpur start + if (this.xo != this.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 7978e307e7bb7f80993c49dcc5ada319a907c648..ff9d23aef4658922692b43a859bd83632fe23612 100644 +--- a/src/main/java/net/minecraft/world/entity/Mob.java ++++ b/src/main/java/net/minecraft/world/entity/Mob.java +@@ -371,15 +371,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + @Override + public void baseTick() { + super.baseTick(); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("mobBaseTick"); ++ //gameprofilerfiller.push("mobBaseTick"); // Purpur + if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) { + this.resetAmbientSoundTime(); + this.playAmbientSound(); + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + incrementTicksSinceLastInteraction(); // Purpur + } + +@@ -698,9 +698,9 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + @Override + public void aiStep() { + super.aiStep(); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("looting"); ++ //gameprofilerfiller.push("looting"); // Purpur + Level world = this.level(); + + if (world instanceof ServerLevel worldserver) { +@@ -724,7 +724,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + } + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + protected Vec3i getPickupReach() { +@@ -946,44 +946,44 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + return; + } + // Paper end - Allow nerfed mobs to jump and float +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("sensing"); ++ //gameprofilerfiller.push("sensing"); // Purpur + this.sensing.tick(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + int i = this.tickCount + this.getId(); + + if (i % 2 != 0 && this.tickCount > 1) { +- gameprofilerfiller.push("targetSelector"); ++ //gameprofilerfiller.push("targetSelector"); // Purpur + this.targetSelector.tickRunningGoals(false); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("goalSelector"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("goalSelector"); // Purpur + this.goalSelector.tickRunningGoals(false); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } else { +- gameprofilerfiller.push("targetSelector"); ++ //gameprofilerfiller.push("targetSelector"); // Purpur + this.targetSelector.tick(); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("goalSelector"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("goalSelector"); // Purpur + this.goalSelector.tick(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + +- gameprofilerfiller.push("navigation"); ++ //gameprofilerfiller.push("navigation"); // Purpur + this.navigation.tick(); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("mob tick"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("mob tick"); // Purpur + this.customServerAiStep((ServerLevel) this.level()); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("controls"); +- gameprofilerfiller.push("move"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("controls"); // Purpur ++ //gameprofilerfiller.push("move"); // Purpur + this.moveControl.tick(); +- gameprofilerfiller.popPush("look"); ++ //gameprofilerfiller.popPush("look"); // Purpur + this.lookControl.tick(); +- gameprofilerfiller.popPush("jump"); ++ //gameprofilerfiller.popPush("jump"); // Purpur + this.jumpControl.tick(); +- gameprofilerfiller.pop(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.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 29ae74339a4831ccef3d01e8054931715ba192ad..74c5914bc51cff128d4b86853316e5e51e02b416 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 +@@ -82,8 +82,8 @@ public class GoalSelector { + } + + public void tick() { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("goalCleanup"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur ++ //profilerFiller.push("goalCleanup"); // Purpur + + for (WrappedGoal wrappedGoal : this.availableGoals) { + if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper - Perf: optimize goal types by removing streams +@@ -92,8 +92,8 @@ public class GoalSelector { + } + + this.lockedFlags.entrySet().removeIf(entry -> !entry.getValue().isRunning()); +- profilerFiller.pop(); +- profilerFiller.push("goalUpdate"); ++ //profilerFiller.pop(); // Purpur ++ //profilerFiller.push("goalUpdate"); // Purpur + + for (WrappedGoal wrappedGoal2 : this.availableGoals) { + // Paper start +@@ -113,13 +113,13 @@ public class GoalSelector { + } + } + +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Purpur + this.tickRunningGoals(true); + } + + public void tickRunningGoals(boolean tickAll) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("goalTick"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur ++ //profilerFiller.push("goalTick"); // Purpur + + for (WrappedGoal wrappedGoal : this.availableGoals) { + if (wrappedGoal.isRunning() && (tickAll || wrappedGoal.requiresUpdateEveryTick())) { +@@ -127,7 +127,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 48c0de870a5bbf647309e69361dfb10ab56c65ab..a5289b6c453c24cb7b8b3a301b72c3adf92c1d13 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 +@@ -188,13 +188,13 @@ public abstract class PathNavigation { + } + } + // Paper end - EntityPathfindEvent +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("pathfind"); ++ //ProfilerFiller profilerFiller = Profiler.get(); ++ //profilerFiller.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); +- profilerFiller.pop(); ++ //profilerFiller.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 116b1e251ffe68bae5c404d0823c2bc7c1afddf6..8f5a5db1a07fa6a95ecfacaab2f9de609202faf4 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 +@@ -28,10 +28,10 @@ public class Sensing { + } else if (this.unseen.contains(i)) { + return false; + } else { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("hasLineOfSight"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur ++ //profilerFiller.push("hasLineOfSight"); // Purpur + boolean bl = this.mob.hasLineOfSight(entity); +- profilerFiller.pop(); ++ //profilerFiller.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 5904b82b87bcdbe41367843885f7c1bd1272d1f1..f60961bd5fdf6d1417e458b92e311c1a0a62463d 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 +@@ -262,15 +262,15 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("allayBrain"); ++ //gameprofilerfiller.push("allayBrain"); // Purpur + //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Purpur - TODO: Pufferfish + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("allayActivityUpdate"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("allayActivityUpdate"); // Purpur + AllayAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + super.customServerAiStep(world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java +index 9ef53608f1608e88de7a7b3e96b43d8d2b4230ae..84516dcfc6cd0fe16c26538ccb86fb5c85b44ffa 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java ++++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java +@@ -163,14 +163,14 @@ public class Armadillo extends Animal { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("armadilloBrain"); ++ //gameprofilerfiller.push("armadilloBrain"); // Purpur + ((Brain) this.brain).tick(world, this); // CraftBukkit - decompile error +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("armadilloActivityUpdate"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("armadilloActivityUpdate"); // Purpur + ArmadilloAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { + this.forceDrops = true; // CraftBukkit + if (this.dropFromGiftLootTable(world, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) { +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 91768d49c3cbef0a135cfd0e60bdb4e84bf109b3..c80d74caa393a31e09f2776cdb3cb950ef99e2ef 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 +@@ -332,15 +332,15 @@ public class Axolotl extends Animal implements VariantHolder, B + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("axolotlBrain"); ++ //gameprofilerfiller.push("axolotlBrain"); // Purpur + //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Purpur - TODO: Pufferfish + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("axolotlActivityUpdate"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("axolotlActivityUpdate"); // Purpur + AxolotlAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + if (!this.isNoAi()) { + Optional 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 dbce71f45c008da883b6d244a06343d83ae25e7e..56d97225a909fd55f0d8aec992d5b6d42687c948 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 +@@ -154,16 +154,16 @@ public class Camel extends AbstractHorse { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("camelBrain"); ++ //gameprofilerfiller.push("camelBrain"); // Purpur + Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error + + behaviorcontroller.tick(world, this); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("camelActivityUpdate"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("camelActivityUpdate"); // Purpur + CamelAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + super.customServerAiStep(world); + } + +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 49915ec0ee5fb6e7d25b079e0410942d44aa1e33..501a12398c56fe0df4e76a3bbce0f98c6c5aa6cb 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 +@@ -240,14 +240,14 @@ public class Frog extends Animal implements VariantHolder> { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("frogBrain"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur ++ //profilerFiller.push("frogBrain"); // Purpur + //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Purpur - TODO: Pufferfish + this.getBrain().tick(world, this); +- profilerFiller.pop(); +- profilerFiller.push("frogActivityUpdate"); ++ //profilerFiller.pop(); // Purpur ++ //profilerFiller.push("frogActivityUpdate"); // Purpur + FrogAi.updateActivity(this); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Purpur + super.customServerAiStep(world); + } + +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 fb91677fb03b7bc1decdf181b7b15d971ffacdc2..071d14cc6697587ec14f02c69c78df364e7d8a8f 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 +@@ -122,15 +122,15 @@ public class Tadpole extends AbstractFish { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); + +- gameprofilerfiller.push("tadpoleBrain"); ++ //gameprofilerfiller.push("tadpoleBrain"); // Purpur + //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // // Purpur - TODO: Pufferfish + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("tadpoleActivityUpdate"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("tadpoleActivityUpdate"); // Purpur + TadpoleAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + super.customServerAiStep(world); + } + +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 7f196e8a8b5094375c9b13fe6e7311a3450dbb5f..51dcc3893b964e6d20a2b963d3105a2687b3c426 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 +@@ -226,15 +226,15 @@ public class Goat extends Animal { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("goatBrain"); ++ //gameprofilerfiller.push("goatBrain"); // Purpur + //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Purpur - TODO: Pufferfish + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("goatActivityUpdate"); ++ //gameprofilerfiller.pop(); // Purpur ++ //gameprofilerfiller.push("goatActivityUpdate"); // Purpur + GoatAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + super.customServerAiStep(world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +index 464a16df15d8759d66f94ad080d1ea28b3f6474c..3fb4f12095883ea4ec6e0d60e0600b9de6ed7be2 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java ++++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +@@ -495,13 +495,13 @@ public class Sniffer extends Animal { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("snifferBrain"); ++ //gameprofilerfiller.push("snifferBrain"); // Purpur + this.getBrain().tick(world, this); +- gameprofilerfiller.popPush("snifferActivityUpdate"); ++ //gameprofilerfiller.popPush("snifferActivityUpdate"); // Purpur + SnifferAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + super.customServerAiStep(world); + } + +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 cb20c018c11a0e707c2083cf964bd5303d216edd..f30ad422f19757664228f2064465fbcb22bb54f6 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java +@@ -281,11 +281,11 @@ public class Zoglin extends Monster implements HoglinBase { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("zoglinBrain"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur ++ //profilerFiller.push("zoglinBrain"); // Purpur + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Purpur + this.updateActivity(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java +index a16fd9c4679e874ad2d499f3c00c2ddfd780a7a5..0bc771e20a9bab139cd3fc03ff40baabf787b2f7 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java ++++ b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java +@@ -235,12 +235,12 @@ public class Breeze extends Monster { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("breezeBrain"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur ++ //profilerFiller.push("breezeBrain"); // Purpur + this.getBrain().tick(world, this); +- profilerFiller.popPush("breezeActivityUpdate"); ++ //profilerFiller.popPush("breezeActivityUpdate"); // Purpur + BreezeAi.updateActivity(this); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Purpur + super.customServerAiStep(world); + } + +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 7520ab7ec5902f083aefd68895a7d9c47bf4e418..7afde99f81ec222ecbffbdcdad3aa6404e8221e0 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 +@@ -196,11 +196,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("hoglinBrain"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur ++ //profilerFiller.push("hoglinBrain"); // Purpur + //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Purpur - TODO: Pufferfish + this.getBrain().tick(world, this); +- profilerFiller.pop(); ++ //profilerFiller.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 7d5ce66c6691b0911ed5afcb1d4186525f09a15e..b53e4a312ea0dbbd16e948e61c3f6b836d46f3b8 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 +@@ -339,12 +339,12 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("piglinBrain"); ++ //gameprofilerfiller.push("piglinBrain"); // Purpur + //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // // Purpur - TODO: Pufferfish + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + PiglinAi.updateActivity(this); + super.customServerAiStep(world); + } +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 bc3b0eb21200eae7e419b2571871b36fc1e07c0f..719179fb232a4f39a2c1642cc0e9593f4dea4bb8 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 +@@ -148,11 +148,11 @@ public class PiglinBrute extends AbstractPiglin { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("piglinBruteBrain"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur ++ //profilerFiller.push("piglinBruteBrain"); // Purpur + if (getRider() == null || this.isControllable()) // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Purpur + PiglinBruteAi.updateActivity(this); + PiglinBruteAi.maybePlayActivitySound(this); + super.customServerAiStep(world); +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 fcfea2cdd5df9fe505df3f7c866cd8d27ad9b249..692261880d05daa75fc53dde31d0f2b95dc52746 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 +@@ -303,9 +303,9 @@ public class Warden extends Monster implements VibrationSystem { + protected void customServerAiStep(ServerLevel world) { + ProfilerFiller gameprofilerfiller = Profiler.get(); + +- gameprofilerfiller.push("wardenBrain"); ++ //gameprofilerfiller.push("wardenBrain"); // Purpur + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + super.customServerAiStep(world); + if ((this.tickCount + this.getId()) % 120 == 0) { + Warden.applyDarknessAround(world, 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 c885b214f4d7d91627e98d8779aab8515f205636..b4ffad429ace965f16ebf47119c880b709b27f2e 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java +@@ -340,9 +340,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + } + protected void customServerAiStep(ServerLevel world, boolean inactive) { // Purpur - not final + // Paper end - EAR 2 +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("villagerBrain"); ++ //gameprofilerfiller.push("villagerBrain"); // Purpur + // Purpur start + if (this.level().purpurConfig.villagerLobotomizeEnabled) { + // treat as inactive if lobotomized +@@ -352,7 +352,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + } + // Purpur end + if (!inactive && (getRider() == null || !this.isControllable())) this.getBrain().tick(world, this); // Purpur +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + if (this.assignProfessionWhenSpawned) { + this.assignProfessionWhenSpawned = false; + } +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index c2aff2f03451b97f1ec6bd4ee987bb729177320a..7493262c2879af196e5585b15faad69ae42764e3 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -270,7 +270,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public final List getEntitiesOfClass(final Class entityClass, final AABB boundingBox, final Predicate predicate) { +- Profiler.get().incrementCounter("getEntities"); ++ //Profiler.get().incrementCounter("getEntities"); // Purpur + final List ret = new java.util.ArrayList<>(); + + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate); +@@ -280,7 +280,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public final List moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate predicate) { +- Profiler.get().incrementCounter("getEntities"); ++ //Profiler.get().incrementCounter("getEntities"); // Purpur + final List ret = new java.util.ArrayList<>(); + + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate); +@@ -1486,9 +1486,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + } + + protected void tickBlockEntities() { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + +- gameprofilerfiller.push("blockEntities"); ++ //gameprofilerfiller.push("blockEntities"); // Purpur + this.tickingBlockEntities = true; + if (!this.pendingBlockEntityTickers.isEmpty()) { + this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); +@@ -1526,7 +1526,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 + + this.tickingBlockEntities = false; +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + this.spigotConfig.currentPrimedTnt = 0; // Spigot + } + +@@ -1696,7 +1696,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { +- Profiler.get().incrementCounter("getEntities"); ++ //Profiler.get().incrementCounter("getEntities"); // Purpur + List list = Lists.newArrayList(); + + // Paper start - rewrite chunk system +@@ -1726,7 +1726,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + public void getEntities(final EntityTypeTest entityTypeTest, + final AABB boundingBox, final Predicate predicate, + final List into, final int maxCount) { +- Profiler.get().incrementCounter("getEntities"); ++ //Profiler.get().incrementCounter("getEntities"); // Purpur + + if (entityTypeTest instanceof net.minecraft.world.entity.EntityType byType) { + if (maxCount != Integer.MAX_VALUE) { +diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +index 5297798c2be1ba85569c2b92ed221956bf75477a..fa47d14e17d9e7d1b62de7990c875245c3a445a3 100644 +--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java ++++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +@@ -211,7 +211,7 @@ public final class NaturalSpawner { + } + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + // Paper start - Add mobcaps commands +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 4640baec5bed6c2d53cc0f8ca1d273cc115abe9b..15c83c6f5f56d6a27911d3bbd326cef1c21b1e58 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -407,11 +407,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + if (LightEngine.hasDifferentLightProperties(iblockdata1, iblockdata)) { + ProfilerFiller gameprofilerfiller = Profiler.get(); + +- gameprofilerfiller.push("updateSkyLightSources"); ++ //gameprofilerfiller.push("updateSkyLightSources"); // Purpur + // Paper - rewrite chunk system +- gameprofilerfiller.popPush("queueCheckLight"); ++ //gameprofilerfiller.popPush("queueCheckLight"); // Purpur + this.level.getChunkSource().getLightEngine().checkBlock(blockposition); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Purpur + } + + boolean flag3 = iblockdata1.hasBlockEntity(); +@@ -1058,9 +1058,9 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + + if (LevelChunk.this.isTicking(blockposition)) { + try { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); + +- gameprofilerfiller.push(this::getType); ++ //gameprofilerfiller.push(this::getType); + BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); + + if (this.blockEntity.getType().isValid(iblockdata)) { +@@ -1076,7 +1076,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + // Paper end - Remove the Block Entity if it's invalid + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); + } catch (Throwable throwable) { + if (throwable instanceof ThreadDeath) throw throwable; // Paper + // Paper start - Prevent block 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 cc7d94144e39f7dace7b569b4567def98396e8f9..91abbda59446d462979dddc4b380c6f24d0b4c92 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +@@ -58,9 +58,9 @@ public class PathFinder { + @Nullable + // Paper start - Perf: remove streams and optimize collection + private Path findPath(Node startNode, List> positions, float followRange, int distance, float rangeMultiplier) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("find_path"); +- profilerFiller.markForCharting(MetricCategory.PATH_FINDING); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur ++ //profilerFiller.push("find_path"); // Purpur ++ //profilerFiller.markForCharting(MetricCategory.PATH_FINDING); // Purpur + // Set set = positions.keySet(); + startNode.g = 0.0F; + startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection +@@ -128,7 +128,7 @@ public class PathFinder { + if (best == null || comparator.compare(path, best) < 0) + best = path; + } +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Purpur + return best; + // Paper end - Perf: remove streams and 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 778e6476c86d823dc8efe603a95e589e8b2ea9d9..452fb3442221fd66debfe1e1d6e85ee17951e556 100644 +--- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java ++++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java +@@ -79,20 +79,20 @@ public class LevelTicks implements LevelTickAccess { + } + + public void tick(long time, int maxTicks, BiConsumer ticker) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("collect"); +- this.collectTicks(time, maxTicks, profilerFiller); +- profilerFiller.popPush("run"); +- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); ++ //ProfilerFiller profilerFiller = 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(); + }