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 929835b74d539bb0af1bb99f23b50b79f457594e..7e0a05608a205ab81b3597dd3a9b5d4446d92fec 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java @@ -165,7 +165,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); @@ -346,9 +346,9 @@ public class Commands { // Paper end CommandSourceStack commandlistenerwrapper = (CommandSourceStack) parseresults.getContext().getSource(); - commandlistenerwrapper.getServer().getProfiler().push(() -> { + /*commandlistenerwrapper.getServer().getProfiler().push(() -> { // Purpur return "/" + s; - }); + });*/ // Purpur ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent try { @@ -378,7 +378,7 @@ public class Commands { Commands.LOGGER.error("'/{}' threw an exception", s, exception); } } finally { - commandlistenerwrapper.getServer().getProfiler().pop(); + //commandlistenerwrapper.getServer().getProfiler().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 73d6c71c6e38dcfff9f09fd2f54949edba80c373..96902343e202617413672ddb609e4b91713e5b94 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -422,13 +422,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.random = RandomSource.create(); this.port = -1; this.levels = Maps.newLinkedHashMap(); @@ -1036,9 +1036,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return false; } : this::haveTime); @@ -1338,7 +1338,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; try { this.isSaving = true; @@ -1655,7 +1655,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur - this.profiler.push(() -> { + /*this.profiler.push(() -> { // Purpur String s = String.valueOf(worldserver); return s + " " + String.valueOf(worldserver.dimension().location()); - }); + });*/ // Purpur /* Drop global time updates if (this.tickCount % 20 == 0) { - this.profiler.push("timeSync"); + //this.profiler.push("timeSync"); // Purpur this.synchronizeTime(worldserver); - 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 @@ -1846,17 +1846,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { this.executeBlocking(() -> { this.saveDebugReport(path.resolve("server")); @@ -2868,40 +2868,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) { @@ -2954,15 +2954,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()) { @@ -65,15 +65,15 @@ public class ServerFunctionManager { this.execute(commandfunction, this.getGameLoopSender()); } - this.server.getProfiler().pop(); + //this.server.getProfiler().pop(); // Purpur } public void execute(CommandFunction function, CommandSourceStack source) { - ProfilerFiller gameprofilerfiller = this.server.getProfiler(); + //ProfilerFiller gameprofilerfiller = this.server.getProfiler(); // Purpur - gameprofilerfiller.push(() -> { + /*gameprofilerfiller.push(() -> { // Purpur return "function " + String.valueOf(function.id()); - }); + });*/ // Purpur try { InstantiatedFunction instantiatedfunction = function.instantiate((CompoundTag) null, this.getDispatcher()); @@ -86,7 +86,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 4b2a66b68e96b85e78c12a12c410ffab3c14ab71..1883abec14e05f8eb2e865446b4d81091b1aa5e0 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -396,16 +396,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } protected void tick(BooleanSupplier shouldKeepTicking) { - ProfilerFiller gameprofilerfiller = this.level.getProfiler(); + //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // 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 793f16cb4049d121a6ef7ca4fcd9519dc8c0a7b0..ebe872c4643038f0c99b289d4d5afdbedd76c6ef 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -385,25 +385,26 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon public void purgeUnload() { if (true) return; // Paper - rewrite 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 if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot 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 ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().tick(); // Paper - rewrite chunk system @@ -413,10 +414,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } //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(); } @@ -427,10 +428,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon this.lastInhabitedUpdate = i; if (!this.level.isDebug()) { - ProfilerFiller gameprofilerfiller = this.level.getProfiler(); + //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur - gameprofilerfiller.push("pollingChunks"); - gameprofilerfiller.push("filteringLoadedChunks"); + //gameprofilerfiller.push("pollingChunks"); // Purpur + //gameprofilerfiller.push("filteringLoadedChunks"); // Purpur // Paper start - chunk tick iteration optimisations List list; { @@ -456,7 +457,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon // Paper - chunk tick iteration optimisations if (this.level.tickRateManager().runsNormally()) { - gameprofilerfiller.popPush("naturalSpawnCount"); + //gameprofilerfiller.popPush("naturalSpawnCount"); // Purpur //this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur int k = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - Optional per player mob spawns @@ -490,7 +491,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon // this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur // this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously - gameprofilerfiller.popPush("spawnAndTick"); + //gameprofilerfiller.popPush("spawnAndTick"); // Purpur boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.level.random); // Paper - per player mob spawns - do not need this when per-player is enabled @@ -530,7 +531,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } //this.level.timings.chunkTicks.stopTiming(); // Paper // Purpur - gameprofilerfiller.popPush("customSpawners"); + //gameprofilerfiller.popPush("customSpawners"); // Purpur if (flag) { //try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings // Purpur this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); @@ -538,7 +539,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } } - gameprofilerfiller.popPush("broadcast"); + //gameprofilerfiller.popPush("broadcast"); // Purpur // Paper start - chunk tick iteration optimisations //this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur { @@ -556,8 +557,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } //this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing // Purpur // Paper end - chunk tick iteration optimisations - gameprofilerfiller.pop(); - gameprofilerfiller.pop(); + //gameprofilerfiller.pop(); // Purpur + //gameprofilerfiller.pop(); // Purpur } // Pufferfish start - optimize mob spawning @@ -772,7 +773,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon @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 b6fd5b83cff5ea21221d029b8729932e25300d47..067b10134b087626e05596225744b905211e8b63 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -645,16 +645,16 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } public void tick(BooleanSupplier shouldKeepTicking) { - ProfilerFiller gameprofilerfiller = this.getProfiler(); + //ProfilerFiller gameprofilerfiller = this.getProfiler(); // 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(); } @@ -686,30 +686,30 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. this.tickTime(); } - gameprofilerfiller.popPush("tickPending"); + //gameprofilerfiller.popPush("tickPending"); // Purpur //this.timings.scheduledBlocks.startTiming(); // Paper // 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 } //this.timings.scheduledBlocks.stopTiming(); // Paper // Purpur - gameprofilerfiller.popPush("raid"); + //gameprofilerfiller.popPush("raid"); // Purpur if (flag) { // 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 if (flag) { // this.timings.doSounds.startTiming(); // Spigot // Purpur this.runBlockEvents(); @@ -717,7 +717,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } 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) { @@ -725,12 +725,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } if (flag1 || this.emptyTime++ < 300) { - gameprofilerfiller.push("entities"); + //gameprofilerfiller.push("entities"); // Purpur //this.timings.tickEntities.startTiming(); // Spigot // 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 @@ -741,9 +741,9 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed entity.discard(); } else if (!tickratemanager.isEntityFrozen(entity)) { - 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 - rewrite chunk system Entity entity1 = entity.getVehicle(); @@ -755,7 +755,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. entity.stopRiding(); } - gameprofilerfiller.push("tick"); + //gameprofilerfiller.push("tick"); // Purpur // Pufferfish start - copied from this.guardEntityTick try { this.tickNonPassenger(entity); // Pufferfish - changed @@ -770,20 +770,20 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } this.moonrise$midTickTasks(); // Paper - rewrite chunk system // Pufferfish end - gameprofilerfiller.pop(); + //gameprofilerfiller.pop(); // Purpur } } } }); //this.timings.entityTick.stopTiming(); // Spigot // Purpur //this.timings.tickEntities.stopTiming(); // Spigot // 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 @@ -916,8 +916,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. boolean flag = this.isRaining(); int j = chunkcoordintpair.getMinBlockX(); int k = chunkcoordintpair.getMinBlockZ(); - ProfilerFiller gameprofilerfiller = this.getProfiler(); - gameprofilerfiller.push("thunder"); + //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur + //gameprofilerfiller.push("thunder"); // Purpur 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 - Option to disable thunder // Pufferfish - replace random with shouldDoLightning BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); @@ -955,7 +955,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } } - 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) { @@ -965,14 +965,14 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. } } // Paper - Option to disable ice and snow - gameprofilerfiller.popPush("tickBlocks"); + //gameprofilerfiller.popPush("tickBlocks"); // Purpur //timings.chunkTicksBlocks.startTiming(); // Paper // Purpur if (randomTickSpeed > 0) { this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking } //timings.chunkTicksBlocks.stopTiming(); // Paper // Purpur - gameprofilerfiller.pop(); + //gameprofilerfiller.pop(); // Purpur } @VisibleForTesting @@ -1318,19 +1318,19 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. //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(); @@ -1359,12 +1359,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. // 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(); @@ -1376,7 +1376,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. 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 6f6b9dbfa8bf4d67a9157ec870a4f14a8002ac01..d8bff9a83c4c2ad1ec1e7d44aac23068f6dc930b 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1398,7 +1398,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple this.unsetRemoved(); */ // CraftBukkit end - worldserver1.getProfiler().push("moving"); + //worldserver1.getProfiler().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(); } @@ -1414,8 +1414,8 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple worldserver = ((CraftWorld) exit.getWorld()).getHandle(); // CraftBukkit end - worldserver1.getProfiler().pop(); - worldserver1.getProfiler().push("placing"); + //worldserver1.getProfiler().pop(); // Purpur + //worldserver1.getProfiler().push("placing"); // Purpur // CraftBukkit start this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds LevelData worlddata = worldserver.getLevelData(); @@ -1433,7 +1433,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple this.connection.teleport(exit); // CraftBukkit - use internal teleport without event this.connection.resetPosition(); worldserver.addDuringTeleport(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/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java index 87e904ef07cf04d7e59c8da418c5d0458902de2d..a9d54c80f682d826ad272731bd6477eed0fd44d5 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -267,7 +267,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } protected void keepConnectionAlive() { - 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(); @@ -300,7 +300,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 - this.server.getProfiler().pop(); + //this.server.getProfiler().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 f14113eef226e906c0d21641e74a27471254909d..0c25f3ed0a8a538edc7cadd3476100c9b3631f7a 100644 --- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java @@ -16,11 +16,11 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener 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 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 a715ecf4a8ac91d3e5e5c6269d89e54b2c1cd279..223c3665126c576eddb1a8f7c9f5bc60c6ff9818 100644 --- a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java +++ b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java @@ -6,32 +6,44 @@ import net.minecraft.util.profiling.metrics.MetricCategory; 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 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 tee(ProfilerFiller a, 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 num) { - a.incrementCounter(marker, num); - b.incrementCounter(marker, num); + //a.incrementCounter(marker, num); // Purpur + //b.incrementCounter(marker, num); // Purpur } @Override public void incrementCounter(Supplier markerGetter, int num) { - a.incrementCounter(markerGetter, num); - b.incrementCounter(markerGetter, num); + //a.incrementCounter(markerGetter, num); // Purpur + //b.incrementCounter(markerGetter, num); // Purpur } }; } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 7e7d13424ea1328ca37b1201a74ac0d4f933a8c3..95885f71825cbf1e46001d60f81dc88049ec6e22 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -889,7 +889,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // CraftBukkit end public void baseTick() { - 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 - Prevent entity loading causing async lookups this.inBlockState = null; if (this.isPassenger() && this.getVehicle().isRemoved()) { @@ -954,7 +954,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess Leashable.tickLeash((Entity & Leashable) this); // CraftBukkit - decompile error } - this.level().getProfiler().pop(); + //this.level().getProfiler().pop(); // Purpur } public void setSharedFlagOnFire(boolean onFire) { @@ -1169,7 +1169,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } - 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; @@ -1178,7 +1178,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // Paper start - ignore movement changes while inactive. if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && movementType == MoverType.SELF) { setDeltaMovement(Vec3.ZERO); - this.level.getProfiler().pop(); + //this.level.getProfiler().pop(); // Purpur return; } // Paper end @@ -1199,8 +1199,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess 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); @@ -1219,7 +1219,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess 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(); @@ -1322,7 +1322,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.setRemainingFireTicks(-this.getFireImmuneTicks()); } - this.level().getProfiler().pop(); + //this.level().getProfiler().pop(); // Purpur } } // Paper start - detailed watchdog information @@ -3314,7 +3314,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.processPortalCooldown(); if (this.portalProcess != null) { if (this.portalProcess.processPortalTeleportation(worldserver, this, this.canUsePortal(false))) { - worldserver.getProfiler().push("portal"); + //worldserver.getProfiler().push("portal"); // Purpur this.setPortalCooldown(); DimensionTransition dimensiontransition = this.portalProcess.getPortalDestination(worldserver, this); @@ -3326,7 +3326,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } - worldserver.getProfiler().pop(); + //worldserver.getProfiler().pop(); // Purpur } else if (this.portalProcess.hasExpired()) { this.portalProcess = null; } @@ -3829,7 +3829,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } - worldserver.getProfiler().push("changeDimension"); + //worldserver.getProfiler().push("changeDimension"); // Purpur Entity entity2 = worldserver1.dimension() == worldserver.dimension() ? this : this.getType().create(worldserver1); if (entity2 != null) { @@ -3865,7 +3865,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess teleportTarget.postDimensionTransition().onTransition(entity2); } - worldserver.getProfiler().pop(); + //worldserver.getProfiler().pop(); // Purpur return entity2; } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java index 409d5c775b3187f2d3b58879e3c945d16a690299..7e00f1f875c7761cfbc1964a3d76da08c36c60f1 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -444,7 +444,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } super.baseTick(); - this.level().getProfiler().push("livingEntityBaseTick"); + //this.level().getProfiler().push("livingEntityBaseTick"); // Purpur if (this.fireImmune() || this.level().isClientSide) { this.clearFire(); } @@ -550,7 +550,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.yHeadRotO = this.yHeadRot; this.yRotO = this.getYRot(); this.xRotO = this.getXRot(); - this.level().getProfiler().pop(); + //this.level().getProfiler().pop(); // Purpur } @Override @@ -3298,10 +3298,10 @@ public abstract class LivingEntity extends Entity implements Attackable { } 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; @@ -3313,7 +3313,7 @@ public abstract class LivingEntity extends Entity implements Attackable { 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; @@ -3553,19 +3553,19 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.setDeltaMovement(d0, d1, d2); - 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 d3; @@ -3592,8 +3592,8 @@ public abstract class LivingEntity extends Entity implements Attackable { 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(); @@ -3618,8 +3618,8 @@ public abstract class LivingEntity extends Entity implements Attackable { this.travel(vec3d1); } - this.level().getProfiler().pop(); - this.level().getProfiler().push("freezing"); + //this.level().getProfiler().pop(); // Purpur + //this.level().getProfiler().push("freezing"); // Purpur if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API int i = this.getTicksFrozen(); @@ -3636,15 +3636,15 @@ public abstract class LivingEntity extends Entity implements Attackable { this.hurt(this.damageSources().freeze(), 1.0F); } - 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 - 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 518968c03e4e7ae99c2e40f6164c89ad27bad697..4b4bdaf8c43e15ba953c160a003a719aaf730318 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -370,13 +370,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @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 incrementTicksSinceLastInteraction(); // Purpur } @@ -706,7 +706,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @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().purpurConfig.entitiesPickUpLootBypassMobGriefing || 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())); @@ -726,7 +726,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } } - this.level().getProfiler().pop(); + //this.level().getProfiler().pop(); // Purpur } protected Vec3i getPickupReach() { @@ -950,48 +950,48 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return; } // Paper end - Allow nerfed mobs to jump and float - ProfilerFiller gameprofilerfiller = this.level().getProfiler(); + //ProfilerFiller gameprofilerfiller = this.level().getProfiler(); // 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 if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.targetSelector.tickRunningGoals(false); - gameprofilerfiller.pop(); - gameprofilerfiller.push("goalSelector"); + //gameprofilerfiller.pop(); // Purpur + //gameprofilerfiller.push("goalSelector"); // Purpur if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.goalSelector.tickRunningGoals(false); - gameprofilerfiller.pop(); + //gameprofilerfiller.pop(); // Purpur } else { - gameprofilerfiller.push("targetSelector"); + //gameprofilerfiller.push("targetSelector"); // Purpur if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.targetSelector.tick(); - gameprofilerfiller.pop(); - gameprofilerfiller.push("goalSelector"); + //gameprofilerfiller.pop(); // Purpur + //gameprofilerfiller.push("goalSelector"); // Purpur if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking 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(); - 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 e32c3120f9c5ddf429d8428c370ff61320a38de6..c943a00b401c4e9f2d97113ffe1f7c344455d086 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 @@ -90,8 +90,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())) { // Paper - Perf: optimize goal types by removing streams @@ -100,8 +100,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 @@ -121,13 +121,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())) { @@ -135,7 +135,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 2e9991e6b3c05584002744a2ee2579b1dba218b2..544920a31b649985333f82beafa94a3392f5853e 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 @@ -172,12 +172,12 @@ public abstract class PathNavigation { } } // Paper end - EntityPathfindEvent - 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 51772f03a3469b11e7166ec6f3a1b9c64a606221..02f2f46ccc48bb4d9bd08555818b0489f60d9f13 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 498cd9cec1693445e98333c62052189bc276b1bb..62c62fd26660d8405378340315042d7b95ac7046 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 @@ -261,13 +261,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS private int behaviorTick = 0; // Pufferfish @Override protected void customServerAiStep() { - this.level().getProfiler().push("allayBrain"); + //this.level().getProfiler().push("allayBrain"); // Purpur if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider 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/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java index 75c05990b9ee6fd429c24415be3b98e258638e89..5b024bc6166a9034eeba729bf3a53236446a03de 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,12 +163,12 @@ public class Armadillo extends Animal { @Override protected void customServerAiStep() { - this.level().getProfiler().push("armadilloBrain"); + //this.level().getProfiler().push("armadilloBrain"); // Purpur ((Brain) this.brain).tick((ServerLevel) this.level(), this); // CraftBukkit - decompile error - this.level().getProfiler().pop(); - this.level().getProfiler().push("armadilloActivityUpdate"); + //this.level().getProfiler().pop(); // Purpur + //this.level().getProfiler().push("armadilloActivityUpdate"); // Purpur ArmadilloAi.updateActivity(this); - this.level().getProfiler().pop(); + //this.level().getProfiler().pop(); // Purpur if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { this.playSound(SoundEvents.ARMADILLO_SCUTE_DROP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.forceDrops = true; // CraftBukkit 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 f7f37f71518f5a74eb872014e669e844cf01a15c..3359f492d6a8f193707e08768d73049454f178f4 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 @@ -310,13 +310,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 c567b946e013852acfae7f5a417a292706e218f4..e88d6d691bb176e33afeb294d735dfb2cbac12ff 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,14 +154,14 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl @Override protected void customServerAiStep() { - this.level().getProfiler().push("camelBrain"); + //this.level().getProfiler().push("camelBrain"); // Purpur Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error behaviorcontroller.tick((ServerLevel) this.level(), this); - this.level().getProfiler().pop(); - this.level().getProfiler().push("camelActivityUpdate"); + //this.level().getProfiler().pop(); // Purpur + //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 66dea405cd08c6b4ca3b5fe39fb83552bdd863b4..4c861b18fbfbae3cb2f1e3563393cfcf4005591c 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 @@ -238,13 +238,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 ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider 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 b05276065c977ea5eae3e74d15b2b5c90e352e61..5cd69dd546f42e80a3d3e3a674f65c2ac39f3af9 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 @@ -123,13 +123,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 ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider 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 9513f9ba6bb677536d2ec136ae5b2f5c091c4c93..1b298bfb440e5ddcc88b0b41e8c733b3883c5998 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 @@ -225,13 +225,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 ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider 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/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java index d82b036b5a759574fe83027ec1000d7eb0455a28..b6f5281705ce4c7a755e3818cf6c4a2235a024f9 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 @@ -505,11 +505,11 @@ public class Sniffer extends Animal { @Override protected void customServerAiStep() { - this.level().getProfiler().push("snifferBrain"); + //this.level().getProfiler().push("snifferBrain"); // Purpur this.getBrain().tick((ServerLevel) this.level(), this); - this.level().getProfiler().popPush("snifferActivityUpdate"); + //this.level().getProfiler().popPush("snifferActivityUpdate"); // Purpur SnifferAi.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 6817f88c422480f201552300ae78053321e41bb8..0cf110be4ec7823996e89c1d1e014e091c1d3d8a 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java @@ -266,10 +266,10 @@ public class Zoglin extends Monster implements Enemy, HoglinBase { @Override protected void customServerAiStep() { - this.level().getProfiler().push("zoglinBrain"); + //this.level().getProfiler().push("zoglinBrain"); // Purpur if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider 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/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java index ee9098f311b5db7251fcaf3ca199ae51ec1f2a2a..0d8e49e4f3c52244f8f84d6e4beeaa60aa6acdd9 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 @@ -228,11 +228,11 @@ public class Breeze extends Monster { @Override protected void customServerAiStep() { - this.level().getProfiler().push("breezeBrain"); + //this.level().getProfiler().push("breezeBrain"); // Purpur this.getBrain().tick((ServerLevel)this.level(), this); - this.level().getProfiler().popPush("breezeActivityUpdate"); + //this.level().getProfiler().popPush("breezeActivityUpdate"); // Purpur BreezeAi.updateActivity(this); - this.level().getProfiler().pop(); + //this.level().getProfiler().pop(); // Purpur super.customServerAiStep(); } diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java index 4b4a81f78d0f3e4a44b423e7c67423a7237cdeaf..6525155cdb5edb326b4f770e68400911ec25d95d 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 @@ -194,10 +194,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 ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider 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 63c2486b25c1fd88675e3cd9411f2b440c652700..e2b3256184b860b2f27fbcff4e09b70b43aedae8 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 @@ -329,10 +329,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 ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider 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 5537f4e2bdce05ef5863955b9403eda7b04ec0d5..2f43bef3acd9db78ecc869f5ff0f4d0f5e121d28 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 @@ -139,10 +139,10 @@ public class PiglinBrute extends AbstractPiglin { @Override protected void customServerAiStep() { - this.level().getProfiler().push("piglinBruteBrain"); + //this.level().getProfiler().push("piglinBruteBrain"); // Purpur if (getRider() == null || this.isControllable()) // Purpur - only use brain if no rider 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 e8af1136b76704767e1ef1859968448c28e07f41..8e24cd9ed03e2f11da6f4fb2dd58dd9b9e5d7a06 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 @@ -301,10 +301,11 @@ public class Warden extends Monster implements VibrationSystem { protected void customServerAiStep() { ServerLevel worldserver = (ServerLevel) this.level(); - worldserver.getProfiler().push("wardenBrain"); + //worldserver.getProfiler().push("wardenBrain"); // Purpur + //if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - TODO: Move to Ridables patch 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 4af1857c4fbc18067b2fa0ae43501ce540630c6f..d58f845dc814011b8126cc641476b6e4e25bc328 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -345,7 +345,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } protected void customServerAiStep(boolean inactive) { // Purpur - not final // Paper end - this.level().getProfiler().push("villagerBrain"); + //this.level().getProfiler().push("villagerBrain"); // Purpur // Purpur start if (this.level().purpurConfig.villagerLobotomizeEnabled) { // treat as inactive if lobotomized @@ -360,7 +360,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } else if (this.isLobotomized && shouldRestock()) restock(); // Purpur // Pufferfish 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 f696afd7e241bf1966a2d505b5d59bff824b43e4..6395bd2ffd734ca73af17b003d1505971ea31a48 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -647,7 +647,7 @@ public class Explosion { } if (flag1) { - this.level.getProfiler().push("explosion_blocks"); + //this.level.getProfiler().push("explosion_blocks"); // Purpur List> list = new ArrayList(); Util.shuffle(this.toBlow, this.level.random); @@ -722,7 +722,7 @@ public class Explosion { Block.popResource(this.level, (BlockPos) pair.getSecond(), (ItemStack) pair.getFirst()); } - this.level.getProfiler().pop(); + //this.level.getProfiler().pop(); // Purpur } if (this.fire) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index ccc6204141298deea56d996fab24254d25857da5..5057d9d433ba002a22d22adfaf7323b2cfaee9af 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -269,7 +269,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public final List getEntitiesOfClass(final Class entityClass, final AABB boundingBox, final Predicate predicate) { - this.getProfiler().incrementCounter("getEntities"); + //this.getProfiler().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); @@ -279,7 +279,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) { - this.getProfiler().incrementCounter("getEntities"); + //this.getProfiler().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); @@ -1412,9 +1412,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } protected void tickBlockEntities() { - ProfilerFiller gameprofilerfiller = this.getProfiler(); + //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur - gameprofilerfiller.push("blockEntities"); + //gameprofilerfiller.push("blockEntities"); // Purpur //this.timings.tileEntityPending.startTiming(); // Spigot // Purpur this.tickingBlockEntities = true; if (!this.pendingBlockEntityTickers.isEmpty()) { @@ -1457,7 +1457,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl //this.timings.tileEntityTick.stopTiming(); // Spigot // Purpur this.tickingBlockEntities = false; co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper - gameprofilerfiller.pop(); + //gameprofilerfiller.pop(); // Purpur this.spigotConfig.currentPrimedTnt = 0; // Spigot } @@ -1686,7 +1686,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { - this.getProfiler().incrementCounter("getEntities"); + //this.getProfiler().incrementCounter("getEntities"); // Purpur // Paper start - rewrite chunk system final List ret = new java.util.ArrayList<>(); @@ -1712,7 +1712,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) { - this.getProfiler().incrementCounter("getEntities"); + //this.getProfiler().incrementCounter("getEntities"); // Purpur if (entityTypeTest instanceof net.minecraft.world.entity.EntityType byType) { if (maxCount != Integer.MAX_VALUE) { @@ -2007,7 +2007,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } 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 735f39fed209e086a52185565f8bd6873c0b8d6e..4dc060bc677984d91a30a88155c576d5e187aa1b 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -127,7 +127,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; @@ -182,7 +182,7 @@ public final class NaturalSpawner { } //world.timings.mobSpawn.stopTiming(); // Spigot // Purpur - world.getProfiler().pop(); + //world.getProfiler().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 a0e6f39ba00212a078e04b21831a5ed22ad0825b..a4578ae22409edb686d0bcbac8cbc1a2e1d7b988 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -397,11 +397,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p if (LightEngine.hasDifferentLightProperties(this, blockposition, iblockdata1, iblockdata)) { ProfilerFiller gameprofilerfiller = this.level.getProfiler(); - 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(); @@ -1037,9 +1037,9 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p if (LevelChunk.this.isTicking(blockposition)) { try { - ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); + //ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); - gameprofilerfiller.push(this::getType); + //gameprofilerfiller.push(this::getType); //this.blockEntity.tickTimer.startTiming(); // Spigot // Purpur BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); @@ -1056,7 +1056,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 18bbb3f8f99849333ff4bc020c8ce758a69312a5..404080976208c30e9e95e5bee47c2a749e709a45 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 - Perf: remove streams and 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 @@ -122,7 +122,7 @@ public class PathFinder { if (best == null || comparator.compare(path, best) < 0) best = path; } - profiler.pop(); + //profiler.pop(); // Purpur return best; // Paper end - Perf: remove streams and optimize collection } diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java index 7a69564572357a7acc043e35b9c113beeb738951..a6d62abd3102770652f914b9d697c6d3c2533cfc 100644 --- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java +++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java @@ -81,20 +81,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(); }