9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-26 18:39:23 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0005-Remove-vanilla-profiler.patch
Dreeam b095bee8df Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@f7d5a0a0 [ci/skip] Add remote build cache configuration through Gradle properties (#12797)
PaperMC/Paper@b4466ec9 Dialog API (#12671)
2025-07-07 22:42:05 +08:00

2334 lines
112 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Thu, 22 Dec 2022 22:32:18 +0100
Subject: [PATCH] Remove vanilla profiler
License: MIT (https://opensource.org/licenses/MIT)
Gale - https://galemc.org
This patch is based on the following patch:
"Remove Mojang Profiler"
By: BillyGalbreath <blake.galbreath@gmail.com>
As part of: Purpur (https://github.com/PurpurMC/Purpur)
Licensed under: MIT (https://opensource.org/licenses/MIT)
* Purpur copyright *
MIT License
Copyright (c) 2019-2022 PurpurMC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index ec1cced129ef42be65d7b2b622638bfae8bd895e..f6017445c495c65fc71b10d2a8ed4f5d3d225668 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -58,7 +58,6 @@ import net.minecraft.server.commands.CloneCommands;
import net.minecraft.server.commands.DamageCommand;
import net.minecraft.server.commands.DataPackCommand;
import net.minecraft.server.commands.DeOpCommands;
-import net.minecraft.server.commands.DebugCommand;
import net.minecraft.server.commands.DebugConfigCommand;
import net.minecraft.server.commands.DebugMobSpawningCommand;
import net.minecraft.server.commands.DebugPathCommand;
@@ -139,7 +138,6 @@ import net.minecraft.server.commands.WorldBorderCommand;
import net.minecraft.server.commands.data.DataCommands;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.TagKey;
-import net.minecraft.util.profiling.Profiler;
import net.minecraft.util.profiling.jfr.JvmProfiler;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.flag.FeatureFlags;
@@ -191,7 +189,6 @@ public class Commands {
DamageCommand.register(this.dispatcher, context);
DataCommands.register(this.dispatcher);
DataPackCommand.register(this.dispatcher, context);
- DebugCommand.register(this.dispatcher);
DefaultGameModeCommands.register(this.dispatcher);
DialogCommand.register(this.dispatcher, context);
DifficultyCommand.register(this.dispatcher);
@@ -349,7 +346,6 @@ public class Commands {
org.spigotmc.AsyncCatcher.catchOp("Cannot perform command async");
// Paper end
CommandSourceStack commandSourceStack = parseResults.getContext().getSource();
- Profiler.get().push(() -> "/" + command);
ContextChain<CommandSourceStack> contextChain = finishParsing(parseResults, command, commandSourceStack);
try {
@@ -387,8 +383,6 @@ public class Commands {
commandSourceStack.sendFailure(Component.literal(Util.describeError(var12)));
LOGGER.error("'/{}' threw an exception", command, var12);
}
- } finally {
- Profiler.get().pop();
}
}
@@ -445,7 +439,7 @@ public class Commands {
int max = Math.max(1, server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH));
int _int = server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT);
- try (ExecutionContext<CommandSourceStack> executionContext1 = new ExecutionContext<>(max, _int, Profiler.get())) {
+ try (ExecutionContext<CommandSourceStack> executionContext1 = new ExecutionContext<>(max, _int)) { // Gale - Purpur - remove vanilla profiler
CURRENT_EXECUTION_CONTEXT.set(executionContext1);
contextConsumer.accept(executionContext1);
executionContext1.runCommandQueue();
diff --git a/net/minecraft/commands/execution/ExecutionContext.java b/net/minecraft/commands/execution/ExecutionContext.java
index 18c7fff36ca26a659fa8ea022c93ea65f3199181..5844db9e913ccb6a351907875aea2f37c3b4ceea 100644
--- a/net/minecraft/commands/execution/ExecutionContext.java
+++ b/net/minecraft/commands/execution/ExecutionContext.java
@@ -20,7 +20,6 @@ public class ExecutionContext<T> implements AutoCloseable {
private static final Logger LOGGER = LogUtils.getLogger();
private final int commandLimit;
private final int forkLimit;
- private final ProfilerFiller profiler;
@Nullable
private TraceCallbacks tracer;
private int commandQuota;
@@ -29,10 +28,9 @@ public class ExecutionContext<T> implements AutoCloseable {
private final List<CommandQueueEntry<T>> newTopCommands = new ObjectArrayList<>();
private int currentFrameDepth;
- public ExecutionContext(int commandLimit, int forkLimit, ProfilerFiller profiler) {
+ public ExecutionContext(int commandLimit, int forkLimit) { // Gale - Purpur - remove vanilla profiler
this.commandLimit = commandLimit;
this.forkLimit = forkLimit;
- this.profiler = profiler;
this.commandQuota = commandLimit;
}
@@ -132,7 +130,7 @@ public class ExecutionContext<T> implements AutoCloseable {
}
public ProfilerFiller profiler() {
- return this.profiler;
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Gale - Purpur - remove vanilla profiler
}
public int forkLimit() {
diff --git a/net/minecraft/commands/execution/tasks/BuildContexts.java b/net/minecraft/commands/execution/tasks/BuildContexts.java
index 569abbea01f585990d2017c68580257275bbb06d..46cf0f3ab7146ba2f37eb1a3ef97eca864219eae 100644
--- a/net/minecraft/commands/execution/tasks/BuildContexts.java
+++ b/net/minecraft/commands/execution/tasks/BuildContexts.java
@@ -42,9 +42,6 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
ChainModifiers chainModifiers1 = chainModifiers;
List<T> list = sources;
if (contextChain.getStage() != Stage.EXECUTE) {
- context.profiler().push(() -> "prepare " + this.commandInput);
-
- try {
for (int forkLimit = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) {
CommandContext<T> topContext = contextChain.getTopContext();
if (topContext.isForked()) {
@@ -84,9 +81,6 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
list = list1;
}
}
- } finally {
- context.profiler().pop();
- }
}
if (list.isEmpty()) {
diff --git a/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/net/minecraft/commands/execution/tasks/ExecuteCommand.java
index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..e30bb9c4046200c1a6e4e917d15b205f5e0f21c3 100644
--- a/net/minecraft/commands/execution/tasks/ExecuteCommand.java
+++ b/net/minecraft/commands/execution/tasks/ExecuteCommand.java
@@ -23,7 +23,6 @@ public class ExecuteCommand<T extends ExecutionCommandSource<T>> implements Unbo
@Override
public void execute(T source, ExecutionContext<T> executionContext, Frame frame) {
- executionContext.profiler().push(() -> "execute " + this.commandInput);
try {
executionContext.incrementCost();
@@ -34,8 +33,6 @@ public class ExecuteCommand<T extends ExecutionCommandSource<T>> implements Unbo
}
} catch (CommandSyntaxException var9) {
source.handleError(var9, this.modifiers.isForked(), executionContext.tracer());
- } finally {
- executionContext.profiler().pop();
}
}
}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 6713b462c8fc182f18f19a997037d337f78ff096..470e9f7570d1fa6b1328052e59ecd1324ec58825 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -114,19 +114,8 @@ import net.minecraft.util.TimeUtil;
import net.minecraft.util.debugchart.RemoteDebugSampleType;
import net.minecraft.util.debugchart.SampleLogger;
import net.minecraft.util.debugchart.TpsDebugDimensions;
-import net.minecraft.util.profiling.EmptyProfileResults;
-import net.minecraft.util.profiling.ProfileResults;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
-import net.minecraft.util.profiling.ResultField;
-import net.minecraft.util.profiling.SingleTickProfiler;
import net.minecraft.util.profiling.jfr.JvmProfiler;
import net.minecraft.util.profiling.jfr.callback.ProfiledDuration;
-import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder;
-import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder;
-import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder;
-import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider;
-import net.minecraft.util.profiling.metrics.storage.MetricsPersister;
import net.minecraft.util.thread.ReentrantBlockableEventLoop;
import net.minecraft.world.Difficulty;
import net.minecraft.world.RandomSequences;
@@ -199,13 +188,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public LevelStorageSource.LevelStorageAccess storageSource;
public final PlayerDataStorage playerDataStorage;
private final List<Runnable> tickables = Lists.newArrayList();
- private MetricsRecorder metricsRecorder = InactiveMetricsRecorder.INSTANCE;
- private Consumer<ProfileResults> onMetricsRecordingStopped = results -> this.stopRecordingMetrics();
- private Consumer<Path> onMetricsRecordingFinished = path -> {};
- private boolean willStartRecordingMetrics;
- @Nullable
- private MinecraftServer.TimeProfiler debugCommandProfiler;
- private boolean debugCommandProfilerDelayStart;
private ServerConnectionListener connection;
public final ChunkProgressListenerFactory progressListenerFactory;
@Nullable
@@ -992,9 +974,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
shutdownThread = Thread.currentThread(); // Paper - Improved watchdog support
org.spigotmc.WatchdogThread.doStop(); // Paper - Improved watchdog support
// CraftBukkit end
- if (this.metricsRecorder.isRecording()) {
- this.cancelRecordingMetrics();
- }
LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
@@ -1239,18 +1218,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Spigot end
boolean flag = l == 0L;
- if (this.debugCommandProfilerDelayStart) {
- this.debugCommandProfilerDelayStart = false;
- this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
- }
//MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
lastTick = currentTime;
this.nextTickTimeNanos += l;
- try (Profiler.Scope scope = Profiler.use(this.createProfiler())) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("tick");
this.tickFrame.start();
this.tickServer(flag ? () -> false : this::haveTime);
// Paper start - rewrite chunk system
@@ -1261,7 +1233,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Paper end - rewrite chunk system
this.tickFrame.end();
- profilerFiller.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
this.startMeasuringTaskExecutionTime();
@@ -1271,11 +1242,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickRateManager.endTickWork();
}
- profilerFiller.pop();
this.logFullTickTime();
- } finally {
- this.endMetricsRecordingTick();
- }
this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
@@ -1448,7 +1415,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public void doRunTask(TickTask task) {
- Profiler.get().incrementCounter("runTask");
super.doRunTask(task);
}
@@ -1538,12 +1504,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.ticksUntilAutosave--;
// Paper start - Incremental chunk and player saving
- final ProfilerFiller profiler = Profiler.get();
int playerSaveInterval = io.papermc.paper.configuration.GlobalConfiguration.get().playerAutoSave.rate;
if (playerSaveInterval < 0) {
playerSaveInterval = autosavePeriod;
}
- profiler.push("save");
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
try {
this.isSaving = true;
@@ -1558,10 +1522,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.isSaving = false;
}
- profiler.pop();
// Paper end - Incremental chunk and player saving
- ProfilerFiller profilerFiller = Profiler.get();
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
this.server.spark.executeMainThreadTasks(); // Paper - spark
// Paper start - Server Tick Events
@@ -1570,7 +1532,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
// Paper end - Server Tick Events
this.server.spark.tickEnd(((double)(endTime - lastTick) / 1000000D)); // Paper - spark
- profilerFiller.push("tallying");
long l = Util.getNanos() - nanos;
int i1 = this.tickCount % 100;
this.aggregatedTickTimesNanos = this.aggregatedTickTimesNanos - this.tickTimesNanos[i1];
@@ -1583,16 +1544,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickTimes60s.add(this.tickCount, l);
// Paper end - Add tick times API and /mspt command
this.logTickMethodTime(nanos);
- profilerFiller.pop();
}
private void autoSave() {
this.ticksUntilAutosave = this.autosavePeriod; // CraftBukkit
LOGGER.debug("Autosave started");
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("save");
this.saveEverything(true, false, false);
- profilerFiller.pop();
LOGGER.debug("Autosave finished");
}
@@ -1660,7 +1617,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final io.papermc.paper.threadedregions.EntityScheduler.EntitySchedulerTickList entitySchedulerTickList = new io.papermc.paper.threadedregions.EntityScheduler.EntitySchedulerTickList(); // Paper - optimise Folia entity scheduler
protected void tickChildren(BooleanSupplier hasTimeLeft) {
- ProfilerFiller profilerFiller = Profiler.get();
this.getPlayerList().getPlayers().forEach(serverPlayer1 -> serverPlayer1.connection.suspendFlushing());
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
// Paper start - optimise Folia entity scheduler
@@ -1675,9 +1631,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - optimise Folia entity scheduler
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.ADVENTURE_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.DIALOG_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
- profilerFiller.push("commandFunctions");
this.getFunctions().tick();
- profilerFiller.popPush("levels");
// CraftBukkit start
// Run tasks that are waiting on processing
@@ -1712,17 +1666,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
serverLevel.updateLagCompensationTick(); // Paper - lag compensation
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
- profilerFiller.push(() -> serverLevel + " " + serverLevel.dimension().location());
/* Drop global time updates
if (this.tickCount % 20 == 0) {
- profilerFiller.push("timeSync");
this.synchronizeTime(serverLevel);
- profilerFiller.pop();
}
// CraftBukkit end */
- profilerFiller.push("tick");
-
try {
serverLevel.tick(hasTimeLeft);
} catch (Throwable var7) {
@@ -1731,34 +1680,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw new ReportedException(crashReport);
}
- profilerFiller.pop();
- profilerFiller.pop();
serverLevel.explosionDensityCache.clear(); // Paper - Optimize explosions
}
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
- profilerFiller.popPush("connection");
this.tickConnection();
- profilerFiller.popPush("players");
this.playerList.tick();
if (this.tickRateManager.runsNormally()) {
GameTestTicker.SINGLETON.tick();
}
- profilerFiller.popPush("server gui refresh");
-
for (int i = 0; i < this.tickables.size(); i++) {
this.tickables.get(i).run();
}
- profilerFiller.popPush("send chunks");
-
for (ServerPlayer serverPlayer : this.playerList.getPlayers()) {
serverPlayer.connection.chunkSender.sendNextChunks(serverPlayer);
serverPlayer.connection.resumeFlushing();
}
-
- profilerFiller.pop();
}
public void tickConnection() {
@@ -1774,14 +1713,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void forceTimeSynchronization() {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("timeSync");
-
for (ServerLevel serverLevel : this.getAllLevels()) {
this.synchronizeTime(serverLevel);
}
-
- profilerFiller.pop();
}
public boolean isLevelEnabled(Level level) {
@@ -2597,55 +2531,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// CraftBukkit end
- private ProfilerFiller createProfiler() {
- if (this.willStartRecordingMetrics) {
- this.metricsRecorder = ActiveMetricsRecorder.createStarted(
- new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()),
- Util.timeSource,
- Util.ioPool(),
- new MetricsPersister("server"),
- this.onMetricsRecordingStopped,
- path -> {
- this.executeBlocking(() -> this.saveDebugReport(path.resolve("server")));
- this.onMetricsRecordingFinished.accept(path);
- }
- );
- this.willStartRecordingMetrics = false;
- }
-
- this.metricsRecorder.startTick();
- return SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server"));
- }
-
- public void endMetricsRecordingTick() {
- this.metricsRecorder.endTick();
- }
-
- public boolean isRecordingMetrics() {
- return this.metricsRecorder.isRecording();
- }
-
- public void startRecordingMetrics(Consumer<ProfileResults> output, Consumer<Path> onMetricsRecordingFinished) {
- this.onMetricsRecordingStopped = profileResults -> {
- this.stopRecordingMetrics();
- output.accept(profileResults);
- };
- this.onMetricsRecordingFinished = onMetricsRecordingFinished;
- this.willStartRecordingMetrics = true;
- }
-
- public void stopRecordingMetrics() {
- this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
- }
-
- public void finishRecordingMetrics() {
- this.metricsRecorder.end();
- }
-
- public void cancelRecordingMetrics() {
- this.metricsRecorder.cancel();
- }
-
public Path getWorldPath(LevelResource levelResource) {
return this.storageSource.getLevelPath(levelResource);
}
@@ -2695,24 +2580,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.isSaving;
}
- public boolean isTimeProfilerRunning() {
- return this.debugCommandProfilerDelayStart || this.debugCommandProfiler != null;
- }
-
- public void startTimeProfiler() {
- this.debugCommandProfilerDelayStart = true;
- }
-
- public ProfileResults stopTimeProfiler() {
- if (this.debugCommandProfiler == null) {
- return EmptyProfileResults.EMPTY;
- } else {
- ProfileResults profileResults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount);
- this.debugCommandProfiler = null;
- return profileResults;
- }
- }
-
public int getMaxChainedNeighborUpdates() {
return 1000000;
}
@@ -2822,55 +2689,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
}
- static class TimeProfiler {
- final long startNanos;
- final int startTick;
-
- TimeProfiler(long startNanos, int startTick) {
- this.startNanos = startNanos;
- this.startTick = startTick;
- }
-
- ProfileResults stop(final long endTimeNano, final int endTimeTicks) {
- return new ProfileResults() {
- @Override
- public List<ResultField> getTimes(String sectionPath) {
- return Collections.emptyList();
- }
-
- @Override
- public boolean saveResults(Path path) {
- return false;
- }
-
- @Override
- public long getStartTimeNano() {
- return TimeProfiler.this.startNanos;
- }
-
- @Override
- public int getStartTimeTicks() {
- return TimeProfiler.this.startTick;
- }
-
- @Override
- public long getEndTimeNano() {
- return endTimeNano;
- }
-
- @Override
- public int getEndTimeTicks() {
- return endTimeTicks;
- }
-
- @Override
- public String getProfilerResults() {
- return "";
- }
- };
- }
- }
-
// Paper start - Add tick times API and /mspt command
public static class TickTimes {
private final long[] times;
diff --git a/net/minecraft/server/ReloadableServerResources.java b/net/minecraft/server/ReloadableServerResources.java
index c891715968193f2ab4579b4a2b4aeeae6a210070..42326fc40b834c944e714fec91811d5c39dbe40c 100644
--- a/net/minecraft/server/ReloadableServerResources.java
+++ b/net/minecraft/server/ReloadableServerResources.java
@@ -99,7 +99,7 @@ public class ReloadableServerResources {
backgroundExecutor,
gameExecutor,
DATA_RELOAD_INITIAL_TASK,
- LOGGER.isDebugEnabled()
+ false // Gale - Purpur - remove vanilla profiler
)
.done()
.thenApply(object -> reloadableServerResources);
diff --git a/net/minecraft/server/ServerFunctionManager.java b/net/minecraft/server/ServerFunctionManager.java
index e3cb5d9cd0332c32df82fa6aef37401c523e8af0..10c79570432491bfb2bbfedf0491ab2b803d0c71 100644
--- a/net/minecraft/server/ServerFunctionManager.java
+++ b/net/minecraft/server/ServerFunctionManager.java
@@ -14,8 +14,6 @@ import net.minecraft.commands.execution.ExecutionContext;
import net.minecraft.commands.functions.CommandFunction;
import net.minecraft.commands.functions.InstantiatedFunction;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public class ServerFunctionManager {
@@ -50,19 +48,12 @@ public class ServerFunctionManager {
}
private void executeTagFunctions(Collection<CommandFunction<CommandSourceStack>> functionObjects, ResourceLocation identifier) {
- Profiler.get().push(identifier::toString);
-
for (CommandFunction<CommandSourceStack> commandFunction : functionObjects) {
this.execute(commandFunction, this.getGameLoopSender());
}
-
- Profiler.get().pop();
}
public void execute(CommandFunction<CommandSourceStack> function, CommandSourceStack source) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push(() -> "function " + function.id());
-
try {
InstantiatedFunction<CommandSourceStack> instantiatedFunction = function.instantiate(null, this.getDispatcher());
Commands.executeCommandInContext(
@@ -72,8 +63,6 @@ public class ServerFunctionManager {
} catch (FunctionInstantiationException var9) {
} catch (Exception var10) {
LOGGER.warn("Failed to execute function {}", function.id(), var10);
- } finally {
- profilerFiller.pop();
}
}
diff --git a/net/minecraft/server/commands/DebugCommand.java b/net/minecraft/server/commands/DebugCommand.java
index a78213464c5c365c6395fdf1295cb406c618d33b..fcc19c00b913d0a864f54f3833dac47fa2734239 100644
--- a/net/minecraft/server/commands/DebugCommand.java
+++ b/net/minecraft/server/commands/DebugCommand.java
@@ -67,6 +67,8 @@ public class DebugCommand {
}
private static int start(CommandSourceStack source) throws CommandSyntaxException {
+ // Gale start - Purpur - remove vanilla profiler
+ /*
MinecraftServer server = source.getServer();
if (server.isTimeProfilerRunning()) {
throw ERROR_ALREADY_RUNNING.create();
@@ -75,9 +77,14 @@ public class DebugCommand {
source.sendSuccess(() -> Component.translatable("commands.debug.started"), true);
return 0;
}
+ */
+ return 0;
+ // Gale end - Purpur - remove vanilla profiler
}
private static int stop(CommandSourceStack source) throws CommandSyntaxException {
+ // Gale start - Purpur - remove vanilla profiler
+ /*
MinecraftServer server = source.getServer();
if (!server.isTimeProfilerRunning()) {
throw ERROR_NOT_RUNNING.create();
@@ -93,6 +100,9 @@ public class DebugCommand {
);
return (int)d1;
}
+ */
+ return 0;
+ // Gale end - Purpur - remove vanilla profiler
}
static class TraceCustomExecutor
diff --git a/net/minecraft/server/commands/PerfCommand.java b/net/minecraft/server/commands/PerfCommand.java
index b10cb4a73df58a5fe64e88868733ba41616f59e4..ffbbd3c766046405b279692e5db83ce502c3d779 100644
--- a/net/minecraft/server/commands/PerfCommand.java
+++ b/net/minecraft/server/commands/PerfCommand.java
@@ -42,6 +42,9 @@ public class PerfCommand {
}
private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException {
+ // Gale start - Purpur - remove vanilla profiler
+ return removedMessage(source);
+ /*
MinecraftServer server = source.getServer();
if (server.isRecordingMetrics()) {
throw ERROR_ALREADY_RUNNING.create();
@@ -52,9 +55,14 @@ public class PerfCommand {
source.sendSuccess(() -> Component.translatable("commands.perf.started"), false);
return 0;
}
+ */
+ // Gale end - Purpur - remove vanilla profiler
}
private static int stopProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException {
+ // Gale start - Purpur - remove vanilla profiler
+ return removedMessage(source);
+ /*
MinecraftServer server = source.getServer();
if (!server.isRecordingMetrics()) {
throw ERROR_NOT_RUNNING.create();
@@ -62,8 +70,22 @@ public class PerfCommand {
server.finishRecordingMetrics();
return 0;
}
+ */
+ // Gale end - Purpur - remove vanilla profiler
}
+ // Gale start - Purpur - remove vanilla profiler
+ private static int removedMessage(CommandSourceStack source) {
+ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage();
+
+ source.getSender().sendMessage(mm.deserialize("<gold>Leaf has removed Mojang's Profiler to save your performance. Please use <click:suggest_command:'/spark'><grey>/spark</grey></click> instead"));
+ source.getSender().sendMessage(mm.deserialize("<gold>For more information, view its documentation at"));
+ source.getSender().sendMessage(mm.deserialize("<gold><click:open_url:'https://spark.lucko.me/docs/Command-Usage'>https://spark.lucko.me/docs/Command-Usage</click>"));
+
+ return 0;
+ }
+ // Gale end - Purpur - remove vanilla profiler
+
private static void saveResults(CommandSourceStack source, Path path, MinecraftServer server) {
String string = String.format(
Locale.ROOT, "%s-%s-%s", Util.getFilenameFormattedDateTime(), server.getWorldData().getLevelName(), SharedConstants.getCurrentVersion().id()
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
index d71213de973860cb3c7d689b59414fb6f5c964c8..b63f1b27c60faf90b3d991b9a88b0642afa29a93 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -755,12 +755,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
return this.settings.getProperties().serverResourcePackInfo;
}
- @Override
- public void endMetricsRecordingTick() {
- super.endMetricsRecordingTick();
- this.debugSampleSubscriptionTracker.tick(this.getTickCount());
- }
-
@Override
public SampleLogger getTickTimeLogger() {
return this.tickTimeLogger;
diff --git a/net/minecraft/server/level/ChunkGenerationTask.java b/net/minecraft/server/level/ChunkGenerationTask.java
index 4221af18f5087badb5cd8c7cf66ab3312edf0394..f102afff61d5577a0f5002f2a52335bd4810f150 100644
--- a/net/minecraft/server/level/ChunkGenerationTask.java
+++ b/net/minecraft/server/level/ChunkGenerationTask.java
@@ -5,8 +5,6 @@ import java.util.List;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable;
import net.minecraft.util.StaticCache2D;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.Zone;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.status.ChunkDependencies;
@@ -113,8 +111,6 @@ public class ChunkGenerationTask {
}
private void scheduleLayer(ChunkStatus status, boolean needsGeneration) {
- try (Zone zone = Profiler.get().zone("scheduleLayer")) {
- zone.addText(status::getName);
int radiusForLayer = this.getRadiusForLayer(status, needsGeneration);
for (int i = this.pos.x - radiusForLayer; i <= this.pos.x + radiusForLayer; i++) {
@@ -125,7 +121,6 @@ public class ChunkGenerationTask {
}
}
}
- }
}
private int getRadiusForLayer(ChunkStatus status, boolean needsGeneration) {
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
index eb352aa4296abc3ed4cf31c590bc0be66daf4de3..edda52a8430386238be4963e8ea2406f0c2d4df3 100644
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -62,8 +62,6 @@ import net.minecraft.util.CsvOutput;
import net.minecraft.util.Mth;
import net.minecraft.util.StaticCache2D;
import net.minecraft.util.TriState;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.thread.BlockableEventLoop;
import net.minecraft.util.thread.ConsecutiveExecutor;
import net.minecraft.world.entity.Entity;
@@ -409,15 +407,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick(BooleanSupplier hasMoreTime) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("poi");
this.poiManager.tick(hasMoreTime);
- profilerFiller.popPush("chunk_unload");
if (!this.level.noSave()) {
this.processUnloads(hasMoreTime);
}
-
- profilerFiller.pop();
}
public boolean hasWork() {
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
index 2882cd829d4d8e1f8615f085f6908efcdf68ac62..6020b71802babb35ef60aca65afe9c2612c05bb7 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -26,8 +26,6 @@ import net.minecraft.network.protocol.Packet;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.thread.BlockableEventLoop;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.MobCategory;
@@ -472,37 +470,28 @@ 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();
- gameprofilerfiller.push("purge");
this.ticketStorage.purgeStaleTickets(this.chunkMap);
this.runDistanceManagerUpdates();
- gameprofilerfiller.popPush("unload");
this.chunkMap.tick(() -> true);
- gameprofilerfiller.pop();
this.clearCache();
}
// CraftBukkit end
@Override
public void tick(BooleanSupplier hasTimeLeft, boolean tickChunks) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("purge");
if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot
this.ticketStorage.purgeStaleTickets(this.chunkMap);
}
this.runDistanceManagerUpdates();
- profilerFiller.popPush("chunks");
if (tickChunks) {
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().tick(); // Paper - rewrite chunk system
this.tickChunks();
this.chunkMap.tick();
}
- profilerFiller.popPush("unload");
this.chunkMap.tick(hasTimeLeft);
- profilerFiller.pop();
this.clearCache();
}
@@ -511,22 +500,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
long l = gameTime - this.lastInhabitedUpdate;
this.lastInhabitedUpdate = gameTime;
if (!this.level.isDebug()) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("pollingChunks");
if (this.level.tickRateManager().runsNormally()) {
- profilerFiller.push("tickingChunks");
- this.tickChunks(profilerFiller, l);
- profilerFiller.pop();
+ this.tickChunks(l); // Gale - Purpur - remove vanilla profiler
}
- this.broadcastChangedChunks(profilerFiller);
- profilerFiller.pop();
+ this.broadcastChangedChunks(); // Gale - Purpur - remove vanilla profiler
}
}
- private void broadcastChangedChunks(ProfilerFiller profiler) {
- profiler.push("broadcast");
-
+ private void broadcastChangedChunks() { // Gale - Purpur - remove vanilla profiler
for (ChunkHolder chunkHolder : this.chunkHoldersToBroadcast) {
LevelChunk tickingChunk = chunkHolder.getChunkToSend(); // Paper - rewrite chunk system
if (tickingChunk != null) {
@@ -535,11 +517,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
this.chunkHoldersToBroadcast.clear();
- profiler.pop();
}
- private void tickChunks(ProfilerFiller profiler, long timeInhabited) {
- profiler.popPush("naturalSpawnCount");
+ private void tickChunks(long timeInhabited) { // Gale - Purpur - remove vanilla profiler
int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - Optional per player mob spawns
NaturalSpawner.SpawnState spawnState;
@@ -564,7 +544,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
// Paper end - Optional per player mob spawns
this.lastSpawnState = spawnState;
- profiler.popPush("spawnAndTick");
boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
List<MobCategory> filteredSpawningCategories;
@@ -586,14 +565,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
List<LevelChunk> list = this.spawningChunks;
try {
- profiler.push("filteringSpawningChunks");
this.chunkMap.collectSpawningChunks(list);
- profiler.popPush("shuffleSpawningChunks");
// 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
- profiler.popPush("tickSpawningChunks");
for (LevelChunk levelChunk : list) {
this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, spawnState);
@@ -602,10 +578,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
list.clear();
}
- profiler.popPush("tickTickingChunks");
this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimisations
- profiler.pop();
- profiler.popPush("customSpawners");
if (_boolean) {
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
}
@@ -817,7 +790,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@Override
protected void doRunTask(Runnable task) {
- Profiler.get().incrementCounter("runTask");
super.doRunTask(task);
}
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index b4c983216cd839d793a09e327bb2f15ab90cbff8..1413511500ce8ae25cc4af1d54fc33c8912c24bc 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -75,8 +75,6 @@ import net.minecraft.util.Mth;
import net.minecraft.util.ProgressListener;
import net.minecraft.util.RandomSource;
import net.minecraft.util.datafix.DataFixTypes;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.valueproviders.IntProvider;
import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.DifficultyInstance;
@@ -708,16 +706,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
public void tick(BooleanSupplier hasTimeLeft) {
- ProfilerFiller profilerFiller = Profiler.get();
this.handlingTick = true;
TickRateManager tickRateManager = this.tickRateManager();
boolean runsNormally = tickRateManager.runsNormally();
if (runsNormally) {
- profilerFiller.push("world border");
this.getWorldBorder().tick();
- profilerFiller.popPush("weather");
this.advanceWeatherCycle();
- profilerFiller.pop();
}
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
@@ -751,41 +745,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.tickTime();
}
- profilerFiller.push("tickPending");
if (!this.isDebug() && runsNormally) {
long l = this.getGameTime();
- profilerFiller.push("blockTicks");
this.blockTicks.tick(l, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks
- profilerFiller.popPush("fluidTicks");
this.fluidTicks.tick(l, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks
- profilerFiller.pop();
}
- profilerFiller.popPush("raid");
if (runsNormally) {
this.raids.tick(this);
}
- profilerFiller.popPush("chunkSource");
this.getChunkSource().tick(hasTimeLeft, true);
- profilerFiller.popPush("blockEvents");
if (runsNormally) {
this.runBlockEvents();
}
this.handlingTick = false;
- profilerFiller.pop();
boolean flag = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this
if (flag) {
this.resetEmptyTime();
}
if (flag || this.emptyTime++ < 300) {
- profilerFiller.push("entities");
if (this.dragonFight != null && runsNormally) {
- profilerFiller.push("dragonFight");
this.dragonFight.tick();
- profilerFiller.pop();
}
io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR
@@ -794,9 +777,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity -> {
if (!entity.isRemoved()) {
if (!tickRateManager.isEntityFrozen(entity)) {
- profilerFiller.push("checkDespawn");
entity.checkDespawn();
- profilerFiller.pop();
if (true) { // Paper - rewrite chunk system
Entity vehicle = entity.getVehicle();
if (vehicle != null) {
@@ -807,21 +788,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.stopRiding();
}
- profilerFiller.push("tick");
this.guardEntityTick(this::tickNonPassenger, entity);
- profilerFiller.pop();
}
}
}
}
);
- profilerFiller.pop();
this.tickBlockEntities();
}
-
- profilerFiller.push("entityManagement");
// Paper - rewrite chunk system
- profilerFiller.pop();
}
@Override
@@ -836,9 +811,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (this.tickTime) {
long l = this.levelData.getGameTime() + 1L;
this.serverLevelData.setGameTime(l);
- Profiler.get().push("scheduledFunctions");
this.serverLevelData.getScheduledEvents().tick(this.server, l);
- Profiler.get().pop();
if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
this.setDayTime(this.levelData.getDayTime() + 1L);
}
@@ -917,8 +890,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
ChunkPos pos = chunk.getPos();
int minBlockX = pos.getMinBlockX();
int minBlockZ = pos.getMinBlockZ();
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("iceandsnow");
if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow
for (int i = 0; i < randomTickSpeed; i++) {
@@ -928,12 +899,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
} // Paper - Option to disable ice and snow
- profilerFiller.popPush("tickBlocks");
if (randomTickSpeed > 0) {
this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking
}
-
- profilerFiller.pop();
}
public void tickThunder(LevelChunk chunk) {
@@ -941,8 +909,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
boolean isRaining = this.isRaining();
int minBlockX = pos.getMinBlockX();
int minBlockZ = pos.getMinBlockZ();
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("thunder");
if (!this.paperConfig().environment.disableThunder && isRaining && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder
BlockPos blockPos = this.findLightningTargetAround(this.getBlockRandomPos(minBlockX, 0, minBlockZ, 15));
if (this.isRainingAt(blockPos)) {
@@ -968,8 +934,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
}
}
-
- profilerFiller.pop();
}
@VisibleForTesting
@@ -1267,17 +1231,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
// Paper end - log detailed entity tick information
entity.setOldPosAndRot();
- ProfilerFiller profilerFiller = Profiler.get();
entity.tickCount++;
entity.totalEntityAge++; // Paper - age-like counter for all entities
- profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString());
- profilerFiller.incrementCounter("tickNonPassenger");
final boolean isActive = io.papermc.paper.entity.activation.ActivationRange.checkIfActive(entity); // Paper - EAR 2
if (isActive) { // Paper - EAR 2
entity.tick();
entity.postTick(); // CraftBukkit
} else {entity.inactiveTick();} // Paper - EAR 2
- profilerFiller.pop();
for (Entity entity1 : entity.getPassengers()) {
this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2
@@ -1298,9 +1258,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
passengerEntity.setOldPosAndRot();
passengerEntity.tickCount++;
passengerEntity.totalEntityAge++; // Paper - age-like counter for all entities
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(passengerEntity.getType()).toString());
- profilerFiller.incrementCounter("tickPassenger");
// Paper start - EAR 2
if (isActive) {
passengerEntity.rideTick();
@@ -1312,7 +1269,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
ridingEntity.positionRider(passengerEntity);
}
// Paper end - EAR 2
- profilerFiller.pop();
for (Entity entity : passengerEntity.getPassengers()) {
this.tickPassenger(passengerEntity, entity, isActive); // Paper - EAR 2
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 21ae237a94232090029539652310f7d1e4aba381..4132ebc316af92aedd3b5f21d291e7d57560e985 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -106,8 +106,6 @@ import net.minecraft.util.HashOps;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.Container;
import net.minecraft.world.Difficulty;
import net.minecraft.world.InteractionHand;
@@ -1405,14 +1403,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.unsetRemoved();
*/
// CraftBukkit end
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("moving");
if (level != null && resourceKey == net.minecraft.world.level.dimension.LevelStem.OVERWORLD && level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER) { // CraftBukkit - empty to fall through to null to event
this.enteredNetherPosition = this.position();
}
- profilerFiller.pop();
- profilerFiller.push("placing");
// CraftBukkit start
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
LevelData worlddata = level.getLevelData();
@@ -1429,7 +1423,6 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
level.addDuringTeleport(this);
- profilerFiller.pop();
this.triggerDimensionChangeTriggers(serverLevel);
this.stopUsingItem();
this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities()));
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 08c59d603fca038fc2dde36384eea1b6c971e659..5e7f2c9bc266074aa661a8f8fe38bf311150fc4a 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -26,7 +26,6 @@ import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ClientInformation;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
import org.slf4j.Logger;
public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener {
@@ -260,7 +259,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
protected void keepConnectionAlive() {
- Profiler.get().push("keepAlive");
long millis = Util.getMillis();
// Paper start - improve keepalives
if (this.checkIfClosed(millis) && !this.processedDisconnect) {
@@ -281,8 +279,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
// Paper end - improve keepalives
}
}
-
- Profiler.get().pop();
}
private boolean checkIfClosed(long time) {
diff --git a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
index f0e2bca572c6f1790772980cd3ec651e9077382d..954e4103c9c359bc13c9a07bec885af90df14cb5 100644
--- a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
+++ b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
@@ -9,8 +9,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import net.minecraft.Util;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public class ProfiledReloadInstance extends SimpleReloadInstance<ProfiledReloadInstance.State> {
@@ -71,13 +69,10 @@ public class ProfiledReloadInstance extends SimpleReloadInstance<ProfiledReloadI
private static Executor profiledExecutor(Executor executor, AtomicLong timeTaken, AtomicLong timesRun, String name) {
return runnable -> executor.execute(() -> {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push(name);
long nanos = Util.getNanos();
runnable.run();
timeTaken.addAndGet(Util.getNanos() - nanos);
timesRun.incrementAndGet();
- profilerFiller.pop();
});
}
diff --git a/net/minecraft/server/packs/resources/ReloadableResourceManager.java b/net/minecraft/server/packs/resources/ReloadableResourceManager.java
index 51cec338f5948b69ad1cff896ce19dc3adb74380..be7fd9e55957ba6fa70c711d1ea4d42e3bbfd752 100644
--- a/net/minecraft/server/packs/resources/ReloadableResourceManager.java
+++ b/net/minecraft/server/packs/resources/ReloadableResourceManager.java
@@ -43,7 +43,7 @@ public class ReloadableResourceManager implements ResourceManager, AutoCloseable
LOGGER.info("Reloading ResourceManager: {}", LogUtils.defer(() -> resourcePacks.stream().map(PackResources::packId).collect(Collectors.joining(", "))));
this.resources.close();
this.resources = new MultiPackResourceManager(this.type, resourcePacks);
- return SimpleReloadInstance.create(this.resources, this.listeners, backgroundExecutor, gameExecutor, waitingFor, LOGGER.isDebugEnabled());
+ return SimpleReloadInstance.create(this.resources, this.listeners, backgroundExecutor, gameExecutor, waitingFor, false); // Gale - Purpur - remove vanilla profiler
}
@Override
diff --git a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
index 407bd4b8026869bc14ee5e79ff80e7bdd1a07bcb..6e2a3d4171dbb2a30ba18f165723691713fac0f6 100644
--- a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
+++ b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
@@ -3,20 +3,13 @@ package net.minecraft.server.packs.resources;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
public interface ResourceManagerReloadListener extends PreparableReloadListener {
@Override
default CompletableFuture<Void> reload(
PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager, Executor backgroundExecutor, Executor gameExecutor
) {
- return barrier.wait(Unit.INSTANCE).thenRunAsync(() -> {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("listener");
- this.onResourceManagerReload(manager);
- profilerFiller.pop();
- }, gameExecutor);
+ return barrier.wait(Unit.INSTANCE).thenRunAsync(() -> this.onResourceManagerReload(manager), gameExecutor); // Gale - Purpur - remove vanilla profiler
}
void onResourceManagerReload(ResourceManager resourceManager);
diff --git a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
index 64b0508ef21952c65b0b967b756b2a4c64d96899..b6b03fbbd669e6331b30255df5419611c38e0495 100644
--- a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
+++ b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
@@ -2,7 +2,6 @@ package net.minecraft.server.packs.resources;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
-import net.minecraft.util.profiling.Profiler;
import net.minecraft.util.profiling.ProfilerFiller;
public abstract class SimplePreparableReloadListener<T> implements PreparableReloadListener {
@@ -10,9 +9,9 @@ public abstract class SimplePreparableReloadListener<T> implements PreparableRel
public final CompletableFuture<Void> reload(
PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager, Executor backgroundExecutor, Executor gameExecutor
) {
- return CompletableFuture.<T>supplyAsync(() -> this.prepare(manager, Profiler.get()), backgroundExecutor)
+ return CompletableFuture.<T>supplyAsync(() -> this.prepare(manager, net.minecraft.util.profiling.InactiveProfiler.INSTANCE), backgroundExecutor) // Gale - Purpur - remove vanilla profiler
.thenCompose(barrier::wait)
- .thenAcceptAsync(object -> this.apply((T)object, manager, Profiler.get()), gameExecutor);
+ .thenAcceptAsync(object -> this.apply((T)object, manager, net.minecraft.util.profiling.InactiveProfiler.INSTANCE), gameExecutor); // Gale - Purpur - remove vanilla profiler
}
protected abstract T prepare(ResourceManager resourceManager, ProfilerFiller profiler);
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 162dfba21cee2f3a9eb8403bf04aa3de5211a31c..31a939facfd4b506a2cff3cee6e4b86a12b1d343 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -80,8 +80,6 @@ import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
import net.minecraft.util.ProblemReporter;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.Nameable;
@@ -841,8 +839,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// CraftBukkit end
public void baseTick() {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("entityBaseTick");
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()) {
@@ -896,8 +892,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.level() instanceof ServerLevel serverLevelx && this instanceof Leashable) {
Leashable.tickLeash(serverLevelx, (Entity & Leashable)this);
}
-
- profilerFiller.pop();
}
public void setSharedFlagOnFire(boolean isOnFire) {
@@ -1117,8 +1111,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("move");
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) {
movement = movement.multiply(this.stuckSpeedMultiplier);
this.stuckSpeedMultiplier = Vec3.ZERO;
@@ -1127,7 +1119,6 @@ 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);
- profilerFiller.pop();
return;
}
// Paper end
@@ -1152,8 +1143,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setPos(vec32);
}
- profilerFiller.pop();
- profilerFiller.push("rest");
boolean flag = !Mth.equal(movement.x, vec3.x);
boolean flag1 = !Mth.equal(movement.z, vec3.z);
this.horizontalCollision = flag || flag1;
@@ -1176,7 +1165,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
if (this.isRemoved()) {
- profilerFiller.pop();
} else {
if (this.horizontalCollision) {
Vec3 deltaMovement = this.getDeltaMovement();
@@ -1220,7 +1208,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
float blockSpeedFactor = this.getBlockSpeedFactor();
this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor));
- profilerFiller.pop();
}
}
// Paper start - detailed watchdog information
@@ -3407,8 +3394,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.processPortalCooldown();
if (this.portalProcess != null) {
if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("portal");
this.setPortalCooldown();
TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this);
if (portalDestination != null) {
@@ -3419,7 +3404,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
- profilerFiller.pop();
} else if (this.portalProcess.hasExpired()) {
this.portalProcess = null;
}
@@ -3986,15 +3970,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
entity.teleport(this.calculatePassengerTransition(teleportTransition, entity));
}
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("teleportSameDimension");
this.teleportSetPosition(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives());
if (!teleportTransition.asPassenger()) {
this.sendTeleportTransitionToRidingPlayers(teleportTransition);
}
teleportTransition.postTeleportTransition().onTransition(this);
- profilerFiller.pop();
return this;
}
@@ -4010,11 +3991,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("teleportCrossDimension");
Entity entityx = this.getType().create(newLevel, EntitySpawnReason.DIMENSION_TRAVEL);
if (entityx == null) {
- profilerFiller.pop();
return null;
} else {
// Paper start - Fix item duplication and teleport issues
@@ -4034,7 +4012,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
newLevel.resetEmptyTime();
teleportTransition.postTeleportTransition().onTransition(entityx);
this.teleportSpectators(teleportTransition, oldLevel);
- profilerFiller.pop();
return entityx;
}
}
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 35d71978a3d360eed97feb66d1048bee337ef2b9..97431aa47b5425578bf14b992596962c64c87f35 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -69,8 +69,6 @@ import net.minecraft.tags.FluidTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.Difficulty;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.damagesource.CombatRules;
@@ -429,8 +427,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
super.baseTick();
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("livingEntityBaseTick");
if (this.fireImmune() || this.level().isClientSide) {
this.clearFire();
}
@@ -515,7 +511,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.yBodyRotO = this.yBodyRot;
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
- profilerFiller.pop();
}
@Override
@@ -3285,11 +3280,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
f1 = this.getYRot();
}
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("headTurn");
this.tickHeadTurn(f1);
- profilerFiller.pop();
- profilerFiller.push("rangeChecks");
// Paper start - stop large pitch and yaw changes from crashing the server
this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F;
@@ -3301,7 +3292,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
// Paper end - stop large pitch and yaw changes from crashing the server
- profilerFiller.pop();
if (this.isFallFlying()) {
this.fallFlyTicks++;
} else {
@@ -3477,21 +3467,15 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
this.setDeltaMovement(d, d1, d2);
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("ai");
this.applyInput();
if (this.isImmobile()) {
this.jumping = false;
this.xxa = 0.0F;
this.zza = 0.0F;
} else if (this.isEffectiveAi() && !this.level().isClientSide) {
- profilerFiller.push("newAi");
this.serverAiStep();
- profilerFiller.pop();
}
- profilerFiller.pop();
- profilerFiller.push("jump");
if (this.jumping && this.isAffectedByFluids()) {
double fluidHeight;
if (this.isInLava()) {
@@ -3520,8 +3504,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.noJumpDelay = 0;
}
- profilerFiller.pop();
- profilerFiller.push("travel");
if (this.isFallFlying()) {
this.updateFallFlying();
}
@@ -3546,9 +3528,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.calculateEntityAnimation(this instanceof FlyingAnimal);
}
- profilerFiller.pop();
if (this.level() instanceof ServerLevel serverLevel) {
- profilerFiller.push("freezing");
if ((!this.isInPowderSnow || !this.canFreeze()) && !this.freezeLocked) { // Paper - Freeze Tick Lock API
this.setTicksFrozen(Math.max(0, this.getTicksFrozen() - 2));
}
@@ -3558,18 +3538,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
if (this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) {
this.hurtServer(serverLevel, this.damageSources().freeze(), 1.0F);
}
-
- profilerFiller.pop();
}
- profilerFiller.push("push");
if (this.autoSpinAttackTicks > 0) {
this.autoSpinAttackTicks--;
this.checkAutoSpinAttack(boundingBox, this.getBoundingBox());
}
this.pushEntities();
- profilerFiller.pop();
// Paper start - Add EntityMoveEvent
if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof Player)) {
if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index 0470c4bbf8be7e48ce8dfa4910c3b9f5ebb23360..4d4b58b684ca115f4d8f672362d4c8252ef9481a 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -26,8 +26,6 @@ import net.minecraft.sounds.SoundEvent;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.Container;
import net.minecraft.world.Difficulty;
import net.minecraft.world.DifficultyInstance;
@@ -319,14 +317,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
public void baseTick() {
super.baseTick();
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("mobBaseTick");
if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) {
this.resetAmbientSoundTime();
this.playAmbientSound();
}
-
- profilerFiller.pop();
}
@Override
@@ -502,8 +496,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
public void aiStep() {
super.aiStep();
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("looting");
if (this.level() instanceof ServerLevel serverLevel
&& this.canPickUpLoot()
&& this.isAlive()
@@ -526,8 +518,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
}
}
-
- profilerFiller.pop();
}
protected Vec3i getPickupReach() {
@@ -741,42 +731,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
return;
}
// Paper end - Allow nerfed mobs to jump and float
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("sensing");
this.sensing.tick();
- profilerFiller.pop();
int i = this.tickCount + this.getId();
if (i % 2 != 0 && this.tickCount > 1) {
- profilerFiller.push("targetSelector");
this.targetSelector.tickRunningGoals(false);
- profilerFiller.pop();
- profilerFiller.push("goalSelector");
this.goalSelector.tickRunningGoals(false);
- profilerFiller.pop();
} else {
- profilerFiller.push("targetSelector");
this.targetSelector.tick();
- profilerFiller.pop();
- profilerFiller.push("goalSelector");
this.goalSelector.tick();
- profilerFiller.pop();
}
- profilerFiller.push("navigation");
this.navigation.tick();
- profilerFiller.pop();
- profilerFiller.push("mob tick");
this.customServerAiStep((ServerLevel)this.level());
- profilerFiller.pop();
- profilerFiller.push("controls");
- profilerFiller.push("move");
this.moveControl.tick();
- profilerFiller.popPush("look");
this.lookControl.tick();
- profilerFiller.popPush("jump");
this.jumpControl.tick();
- profilerFiller.pop();
- profilerFiller.pop();
this.sendDebugPackets();
}
diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 859b859d29b637200cf7c9a0bd52d9f712413e3d..653c58c7637c46c8b46a5082f671324a2221d431 100644
--- a/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -6,8 +6,6 @@ import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
public class GoalSelector {
private static final WrappedGoal NO_GOAL = new WrappedGoal(Integer.MAX_VALUE, new Goal() {
@@ -82,9 +80,6 @@ public class GoalSelector {
}
public void tick() {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("goalCleanup");
-
for (WrappedGoal wrappedGoal : this.availableGoals) {
if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper - Perf: optimize goal types by removing streams
wrappedGoal.stop();
@@ -92,8 +87,6 @@ public class GoalSelector {
}
this.lockedFlags.entrySet().removeIf(entry -> !entry.getValue().isRunning());
- profilerFiller.pop();
- profilerFiller.push("goalUpdate");
for (WrappedGoal wrappedGoalx : this.availableGoals) {
// Paper start
@@ -113,21 +106,15 @@ public class GoalSelector {
}
}
- profilerFiller.pop();
this.tickRunningGoals(true);
}
public void tickRunningGoals(boolean tickAllRunning) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("goalTick");
-
for (WrappedGoal wrappedGoal : this.availableGoals) {
if (wrappedGoal.isRunning() && (tickAllRunning || wrappedGoal.requiresUpdateEveryTick())) {
wrappedGoal.tick();
}
}
-
- profilerFiller.pop();
}
public Set<WrappedGoal> getAvailableGoals() {
diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index dd1a95111d965bcd7f53be9d4224dd213e4e0705..24dd92449f70144c79f25bf24942ebd666655ed2 100644
--- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -10,8 +10,6 @@ import net.minecraft.core.Vec3i;
import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.attributes.Attributes;
@@ -189,13 +187,10 @@ public abstract class PathNavigation {
}
}
// Paper end - EntityPathfindEvent
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("pathfind");
BlockPos blockPos = offsetUpward ? this.mob.blockPosition().above() : this.mob.blockPosition();
int i = (int)(followRange + regionOffset);
PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i));
Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, targets, followRange, accuracy, this.maxVisitedNodesMultiplier);
- profilerFiller.pop();
if (path != null && path.getTarget() != null) {
this.targetPos = path.getTarget();
this.reachRange = accuracy;
diff --git a/net/minecraft/world/entity/ai/sensing/Sensing.java b/net/minecraft/world/entity/ai/sensing/Sensing.java
index c569074403b1d8b443aaa98ba9cf9bbd0e98bd2d..b1aa7294f9479f45fcde77c5ea46db9f62370abf 100644
--- a/net/minecraft/world/entity/ai/sensing/Sensing.java
+++ b/net/minecraft/world/entity/ai/sensing/Sensing.java
@@ -2,8 +2,6 @@ package net.minecraft.world.entity.ai.sensing;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Mob;
@@ -28,10 +26,7 @@ public class Sensing {
} else if (this.unseen.contains(id)) {
return false;
} else {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("hasLineOfSight");
boolean hasLineOfSight = this.mob.hasLineOfSight(entity);
- profilerFiller.pop();
if (hasLineOfSight) {
this.seen.add(id);
} else {
diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java
index 272f57aca640e045efca64dd018b221335c667ee..f07dcf7d45b1b717faeae0c4129fb00a22fb7d57 100644
--- a/net/minecraft/world/entity/animal/HappyGhast.java
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
@@ -14,8 +14,6 @@ import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@@ -385,13 +383,8 @@ public class HappyGhast extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
if (this.isBaby()) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("happyGhastBrain");
((Brain<HappyGhast>)this.brain).tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("happyGhastActivityUpdate");
HappyGhastAi.updateActivity(this);
- profilerFiller.pop();
}
this.checkRestriction();
diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java
index b7b964bd4e2d611a3e48ece072d5787193077a92..de3bf0b62371f06ecb5d2035638e352ca0c06182 100644
--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -25,8 +25,6 @@ import net.minecraft.tags.GameEventTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.SimpleContainer;
@@ -226,13 +224,8 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("allayBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("allayActivityUpdate");
AllayAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
index c1798db2972c8f2a343cf6e16fd9354ff212d906..ee2c6c86631ba50a4e8503131c678596bc2c0363 100644
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -23,8 +23,6 @@ import net.minecraft.util.ByIdMap;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable;
import net.minecraft.util.TimeUtil;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@@ -135,13 +133,8 @@ public class Armadillo extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("armadilloBrain");
((Brain<Armadillo>)this.brain).tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("armadilloActivityUpdate");
ArmadilloAi.updateActivity(this);
- profilerFiller.pop();
if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) {
this.forceDrops = true; // CraftBukkit
if (this.dropFromGiftLootTable(level, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) {
diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index b0467750dab4c6f411fd2f318009d25f83d94bc0..6a5e9e9582e322aaa1555933de97e545ba74f8f4 100644
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -31,8 +31,6 @@ import net.minecraft.util.ByIdMap;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -329,13 +327,8 @@ public class Axolotl extends Animal implements Bucketable {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("axolotlBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("axolotlActivityUpdate");
AxolotlAi.updateActivity(this);
- profilerFiller.pop();
if (!this.isNoAi()) {
Optional<Integer> memory = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS);
this.setPlayingDead(memory.isPresent() && memory.get() > 0);
diff --git a/net/minecraft/world/entity/animal/camel/Camel.java b/net/minecraft/world/entity/animal/camel/Camel.java
index 757b63ee059c95e673a098706b4ee7ab4fc21f70..adc336c6cec601b8855c1013adf1eebf018597f0 100644
--- a/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
@@ -18,8 +18,6 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -159,14 +157,9 @@ public class Camel extends AbstractHorse {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("camelBrain");
Brain<?> brain = this.getBrain();
((Brain<Camel>)brain).tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("camelActivityUpdate");
CamelAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java
index 66f503e045ccb0985ec718b39be07eea538fad8d..b8703409dd3dc8e3020ed81b44ce4812984c88c3 100644
--- a/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
@@ -28,8 +28,6 @@ import net.minecraft.tags.ItemTags;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AgeableMob;
@@ -204,13 +202,8 @@ public class Frog extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("frogBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("frogActivityUpdate");
FrogAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java
index 17f58246849ed407821a987b200cc765eb7943f9..c1510a6f1146f446ed65a1f08984af6c29de439a 100644
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -12,8 +12,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.ItemTags;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@@ -100,13 +98,8 @@ public class Tadpole extends AbstractFish {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("tadpoleBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("tadpoleActivityUpdate");
TadpoleAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
index 75af1b92a0a60cffa3317d83bd599a3d4d26f93c..bdac4929db71a39fc02985109cedc9cd316ec3cc 100644
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -20,8 +20,6 @@ import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -190,13 +188,8 @@ public class Goat extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("goatBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("goatActivityUpdate");
GoatAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index 6a9f31c1f39cc14ad7b5ae3af85908bc7a4caae4..05d269b51715a71fa653900e7187b07d001afdb7 100644
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -29,8 +29,6 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.ByIdMap;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@@ -465,12 +463,8 @@ public class Sniffer extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("snifferBrain");
this.getBrain().tick(level, this);
- profilerFiller.popPush("snifferActivityUpdate");
SnifferAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/monster/Zoglin.java b/net/minecraft/world/entity/monster/Zoglin.java
index 0dbc528bcad2b2f79585e2462a265d43fcbebe76..662b95d27f6630ec27fd88ca279e395438faa96b 100644
--- a/net/minecraft/world/entity/monster/Zoglin.java
+++ b/net/minecraft/world/entity/monster/Zoglin.java
@@ -14,8 +14,6 @@ import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
@@ -250,10 +248,7 @@ public class Zoglin extends Monster implements HoglinBase {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("zoglinBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
this.updateActivity();
}
diff --git a/net/minecraft/world/entity/monster/breeze/Breeze.java b/net/minecraft/world/entity/monster/breeze/Breeze.java
index c12653070d62c44b97a07676f24caf7ab570cd2a..d91ce14cc39b1b6ccd558f53ed605d4c6a5acae5 100644
--- a/net/minecraft/world/entity/monster/breeze/Breeze.java
+++ b/net/minecraft/world/entity/monster/breeze/Breeze.java
@@ -12,8 +12,6 @@ import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.EntityTypeTags;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AnimationState;
import net.minecraft.world.entity.Entity;
@@ -232,12 +230,8 @@ public class Breeze extends Monster {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("breezeBrain");
this.getBrain().tick(level, this);
- profilerFiller.popPush("breezeActivityUpdate");
BreezeAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/monster/creaking/Creaking.java b/net/minecraft/world/entity/monster/creaking/Creaking.java
index 567e7952efec69b4222563fae724d18a9902bb05..f66bd6cc4aab828e847b990b193be54cd0d0dc01 100644
--- a/net/minecraft/world/entity/monster/creaking/Creaking.java
+++ b/net/minecraft/world/entity/monster/creaking/Creaking.java
@@ -16,8 +16,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.DamageTypeTags;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AnimationState;
import net.minecraft.world.entity.Entity;
@@ -205,10 +203,7 @@ public class Creaking extends Monster {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("creakingBrain");
this.getBrain().tick((ServerLevel)this.level(), this);
- profilerFiller.pop();
CreakingAi.updateActivity(this);
}
diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 0ecf8533f6cad081df8713856feb74db93028f71..bde6f9d9d1cc7a5ee8334ee9207afae304ddcfa9 100644
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -15,8 +15,6 @@ import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -162,10 +160,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("hoglinBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
HoglinAi.updateActivity(this);
if (this.isConverting()) {
this.timeInOverworld++;
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
index 8392ff1316f0c5be685a6ded7ccd08933c10ff4e..689f200554d8c03313b3d194f209c527f315c29a 100644
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -16,8 +16,6 @@ import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.util.RandomSource;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -320,10 +318,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("piglinBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
PiglinAi.updateActivity(this);
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
index 219978cb0341b2d691f44c1146707d875788881e..589a130f8855f464c1930a0aa8b54c0326a22e23 100644
--- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
+++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
@@ -8,8 +8,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntitySpawnReason;
@@ -115,10 +113,7 @@ public class PiglinBrute extends AbstractPiglin {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("piglinBruteBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
PiglinBruteAi.updateActivity(this);
PiglinBruteAi.maybePlayActivitySound(this);
super.customServerAiStep(level);
diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java
index 4a4cc7f9c95d4f4b6ad4948e3ed3504efbbcef15..dd6666bd8b8df4148a1557627ce2a6ddab245ed6 100644
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -27,8 +27,6 @@ import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffectInstance;
@@ -279,10 +277,7 @@ public class Warden extends Monster implements VibrationSystem {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("wardenBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
super.customServerAiStep(level);
if ((this.tickCount + this.getId()) % 120 == 0) {
applyDarknessAround(level, this.position(), this, 20);
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
index e1e2bdb35866a8f32a41f6efd24ad77cf916b2e9..6cf2af33d22d3df8374746f5926f3f2d5093431d 100644
--- a/net/minecraft/world/entity/npc/Villager.java
+++ b/net/minecraft/world/entity/npc/Villager.java
@@ -35,8 +35,6 @@ import net.minecraft.stats.Stats;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.Mth;
import net.minecraft.util.SpawnUtil;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.Difficulty;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
@@ -294,10 +292,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
protected void customServerAiStep(ServerLevel level, final boolean inactive) {
// Paper end - EAR 2
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("villagerBrain");
if (!inactive) this.getBrain().tick(level, this); // Paper - EAR 2
- profilerFiller.pop();
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
}
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 4b96e512905aca3b69408145054c0658ee932eed..9f630dda781dd540ab5655bd7ce916949eeee61c 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -35,8 +35,6 @@ import net.minecraft.util.AbortableIterationConsumer;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.TickRateManager;
import net.minecraft.world.damagesource.DamageSource;
@@ -215,7 +213,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@Override
public final <T extends Entity> List<T> getEntitiesOfClass(final Class<T> entityClass, final AABB boundingBox, final Predicate<? super T> predicate) {
- Profiler.get().incrementCounter("getEntities");
final List<T> ret = new java.util.ArrayList<>();
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate);
@@ -225,7 +222,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@Override
public final List<Entity> moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate<? super Entity> predicate) {
- Profiler.get().incrementCounter("getEntities");
final List<Entity> ret = new java.util.ArrayList<>();
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate);
@@ -1452,8 +1448,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
}
protected void tickBlockEntities() {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("blockEntities");
this.tickingBlockEntities = true;
if (!this.pendingBlockEntityTickers.isEmpty()) {
this.blockEntityTickers.addAll(this.pendingBlockEntityTickers);
@@ -1483,7 +1477,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
this.tickingBlockEntities = false;
- profilerFiller.pop();
this.spigotConfig.currentPrimedTnt = 0; // Spigot
}
@@ -1735,7 +1728,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@Override
public List<Entity> getEntities(@Nullable Entity entity, AABB boundingBox, Predicate<? super Entity> predicate) {
- Profiler.get().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList();
// Paper start - rewrite chunk system
@@ -1764,8 +1756,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
public <T extends Entity> void getEntities(final EntityTypeTest<Entity, T> entityTypeTest,
final AABB boundingBox, final Predicate<? super T> predicate,
final List<? super T> into, final int maxCount) {
- Profiler.get().incrementCounter("getEntities");
-
if (entityTypeTest instanceof net.minecraft.world.entity.EntityType<T> byType) {
if (maxCount != Integer.MAX_VALUE) {
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(byType, boundingBox, into, predicate, maxCount);
diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java
index 14a2514a408a66a83f7b5fb43b4c4dc8f23fd5f4..ec32d77447dd250857a2af1d8cc3e6e233aa3e6e 100644
--- a/net/minecraft/world/level/NaturalSpawner.java
+++ b/net/minecraft/world/level/NaturalSpawner.java
@@ -23,8 +23,6 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.random.WeightedList;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntitySpawnReason;
@@ -152,9 +150,6 @@ public final class NaturalSpawner {
}
public static void spawnForChunk(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, List<MobCategory> categories) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("spawner");
-
for (MobCategory mobCategory : categories) {
// Paper start - Optional per player mob spawns
final boolean canSpawn;
@@ -189,8 +184,6 @@ public final class NaturalSpawner {
// Paper end - Optional per player mob spawns
}
}
-
- profilerFiller.pop();
}
// Paper start - Add mobcaps commands
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index 07e4025ca6c9c31905db2e6921138a0ded479dde..fa4695b7ee56724b4d47ce4da0a5aeb8b5467db4 100644
--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
@@ -13,8 +13,6 @@ import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
@@ -652,10 +650,7 @@ public class ServerExplosion implements Explosion {
List<BlockPos> list = this.calculateExplodedPositions();
this.hurtEntities();
if (this.interactsWithBlocks()) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("explosion_blocks");
this.interactWithBlocks(list);
- profilerFiller.pop();
}
if (this.fire) {
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
index 75578e6ed7233a03d9b6cd3c6d3997f1c6148392..b88254fb3c12b99684c6ede1ae8a6671ffbe9ad6 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -24,8 +24,6 @@ import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData;
import net.minecraft.server.level.FullChunkStatus;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.ProblemReporter;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
@@ -385,12 +383,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
}
if (LightEngine.hasDifferentLightProperties(blockState, state)) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("updateSkyLightSources");
// Paper - rewrite chunk system
- profilerFiller.popPush("queueCheckLight");
this.level.getChunkSource().getLightEngine().checkBlock(pos);
- profilerFiller.pop();
}
boolean flag = !blockState.is(block);
@@ -922,8 +916,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
BlockPos blockPos = this.blockEntity.getBlockPos();
if (LevelChunk.this.isTicking(blockPos)) {
try {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push(this::getType);
BlockState blockState = LevelChunk.this.getBlockState(blockPos);
if (this.blockEntity.getType().isValid(blockState)) {
this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity);
@@ -937,8 +929,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
}
// Paper end - Remove the Block Entity if it's invalid
}
-
- profilerFiller.pop();
} catch (Throwable var5) {
// Paper start - Prevent block entity and entity crashes
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
diff --git a/net/minecraft/world/level/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java
index 81de6c1bbef1cafd3036e736dd305fbedc8368c6..c2baadcdceb1df6a881d6f73aa4eb4dd264bcdfe 100644
--- a/net/minecraft/world/level/pathfinder/PathFinder.java
+++ b/net/minecraft/world/level/pathfinder/PathFinder.java
@@ -12,9 +12,6 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
-import net.minecraft.util.profiling.metrics.MetricCategory;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.PathNavigationRegion;
@@ -57,9 +54,6 @@ public class PathFinder {
@Nullable
private Path findPath(Node node, List<Map.Entry<Target, BlockPos>> positions, float maxRange, int accuracy, float searchDepthMultiplier) { // Paper - optimize collection
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("find_path");
- profilerFiller.markForCharting(MetricCategory.PATH_FINDING);
// Set<Target> set = targetPositions.keySet(); // Paper
node.g = 0.0F;
node.h = this.getBestH(node, positions); // Paper - optimize collection
@@ -129,7 +123,6 @@ public class PathFinder {
best = path;
}
}
- profilerFiller.pop();
return best;
// Paper end - Perf: remove streams and optimize collection
}
diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java
index 66abc2e7adee60fa98eed1ba36e018814fd02cad..fbf0d3b808c66e8971c747619f6acf7417af5ef7 100644
--- a/net/minecraft/world/ticks/LevelTicks.java
+++ b/net/minecraft/world/ticks/LevelTicks.java
@@ -23,8 +23,6 @@ import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
import net.minecraft.core.Vec3i;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
@@ -80,20 +78,13 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
}
public void tick(long gameTime, int maxAllowedTicks, BiConsumer<BlockPos, T> ticker) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("collect");
- this.collectTicks(gameTime, maxAllowedTicks, profilerFiller);
- profilerFiller.popPush("run");
- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size());
+ this.collectTicks(gameTime, maxAllowedTicks); // Gale - Purpur - remove vanilla profiler
this.runCollectedTicks(ticker);
- profilerFiller.popPush("cleanup");
this.cleanupAfterTick();
- profilerFiller.pop();
}
- private void collectTicks(long gameTime, int maxAllowedTicks, ProfilerFiller profiler) {
+ private void collectTicks(long gameTime, int maxAllowedTicks) { // Gale - Purpur - remove vanilla profiler
this.sortContainersToTick(gameTime);
- profiler.incrementCounter("containersToTick", this.containersToTick.size());
this.drainContainers(gameTime, maxAllowedTicks);
this.rescheduleLeftoverContainers();
}