9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-28 03:09:11 +00:00
Files
DivineMC/divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch
2025-12-11 16:56:39 +03:00

2977 lines
145 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 2 Feb 2025 14:43:32 +0300
Subject: [PATCH] Completely remove Mojang profiler
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index 83148f756ecc77ae45abffbd1d7cbfacf6c99e7f..ace1dc38dac79298141bca666b188a4258183df7 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -56,7 +56,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;
@@ -144,7 +143,6 @@ import net.minecraft.server.permissions.PermissionSetSupplier;
import net.minecraft.server.permissions.Permissions;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Util;
-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;
@@ -202,7 +200,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);
@@ -374,7 +371,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 {
@@ -412,8 +408,6 @@ public class Commands {
commandSourceStack.sendFailure(Component.literal(Util.describeError(var12)));
LOGGER.error("'/{}' threw an exception", command, var12);
}
- } finally {
- Profiler.get().pop();
}
}
@@ -471,7 +465,7 @@ public class Commands {
int max = Math.max(1, gameRules.get(GameRules.MAX_COMMAND_SEQUENCE_LENGTH));
int i = gameRules.get(GameRules.MAX_COMMAND_FORKS);
- try (ExecutionContext<CommandSourceStack> executionContext1 = new ExecutionContext<>(max, i, Profiler.get())) {
+ try (ExecutionContext<CommandSourceStack> executionContext1 = new ExecutionContext<>(max, i)) {
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 f109be01de8346f6729d30e27784e4cd45cdd48b..c98c4bc7dddb70d25ed3b08ab71ae91fb27286d7 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;
private @Nullable TraceCallbacks tracer;
private int commandQuota;
private boolean queueOverflow;
@@ -28,10 +27,9 @@ public class ExecutionContext<T> implements AutoCloseable {
private final List<CommandQueueEntry<T>> newTopCommands = new ObjectArrayList<>();
private int currentFrameDepth;
- public ExecutionContext(int commandQuota, int forkLimit, ProfilerFiller profiler) {
+ public ExecutionContext(int commandQuota, int forkLimit) {
this.commandLimit = commandQuota;
this.forkLimit = forkLimit;
- this.profiler = profiler;
this.commandQuota = commandQuota;
}
@@ -130,7 +128,7 @@ public class ExecutionContext<T> implements AutoCloseable {
}
public ProfilerFiller profiler() {
- return this.profiler;
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
}
public int forkLimit() {
diff --git a/net/minecraft/commands/execution/tasks/BuildContexts.java b/net/minecraft/commands/execution/tasks/BuildContexts.java
index 569abbea01f585990d2017c68580257275bbb06d..824ccbfa77cd1135d409f5f46e6ae5422d323036 100644
--- a/net/minecraft/commands/execution/tasks/BuildContexts.java
+++ b/net/minecraft/commands/execution/tasks/BuildContexts.java
@@ -42,51 +42,47 @@ 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);
+ // DivineMC start - Completely remove Mojang profiler
+ for (int forkLimit = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) {
+ CommandContext<T> topContext = contextChain.getTopContext();
+ if (topContext.isForked()) {
+ chainModifiers1 = chainModifiers1.setForked();
+ }
- try {
- for (int forkLimit = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) {
- CommandContext<T> topContext = contextChain.getTopContext();
- if (topContext.isForked()) {
- chainModifiers1 = chainModifiers1.setForked();
- }
+ RedirectModifier<T> redirectModifier = topContext.getRedirectModifier();
+ if (redirectModifier instanceof CustomModifierExecutor.ModifierAdapter<T> customModifierExecutor) {
+ customModifierExecutor.apply(originalSource, list, contextChain, chainModifiers1, ExecutionControl.create(context, frame));
+ return;
+ }
- RedirectModifier<T> redirectModifier = topContext.getRedirectModifier();
- if (redirectModifier instanceof CustomModifierExecutor.ModifierAdapter<T> customModifierExecutor) {
- customModifierExecutor.apply(originalSource, list, contextChain, chainModifiers1, ExecutionControl.create(context, frame));
- return;
- }
+ if (redirectModifier != null) {
+ context.incrementCost();
+ boolean isForked = chainModifiers1.isForked();
+ List<T> list1 = new ObjectArrayList<>();
+
+ for (T executionCommandSource : list) {
+ try {
+ Collection<T> collection = ContextChain.runModifier(
+ topContext, executionCommandSource, (commandContext, flag, i) -> {}, isForked
+ );
+ if (list1.size() + collection.size() >= forkLimit) {
+ originalSource.handleError(ERROR_FORK_LIMIT_REACHED.create(forkLimit), isForked, context.tracer());
+ return;
+ }
- if (redirectModifier != null) {
- context.incrementCost();
- boolean isForked = chainModifiers1.isForked();
- List<T> list1 = new ObjectArrayList<>();
-
- for (T executionCommandSource : list) {
- try {
- Collection<T> collection = ContextChain.runModifier(
- topContext, executionCommandSource, (commandContext, flag, i) -> {}, isForked
- );
- if (list1.size() + collection.size() >= forkLimit) {
- originalSource.handleError(ERROR_FORK_LIMIT_REACHED.create(forkLimit), isForked, context.tracer());
- return;
- }
-
- list1.addAll(collection);
- } catch (CommandSyntaxException var20) {
- executionCommandSource.handleError(var20, isForked, context.tracer());
- if (!isForked) {
- return;
- }
+ list1.addAll(collection);
+ } catch (CommandSyntaxException var20) {
+ executionCommandSource.handleError(var20, isForked, context.tracer());
+ if (!isForked) {
+ return;
}
}
-
- list = list1;
}
+
+ list = list1;
}
- } finally {
- context.profiler().pop();
}
+ // DivineMC end - Completely remove Mojang profiler
}
if (list.isEmpty()) {
diff --git a/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/net/minecraft/commands/execution/tasks/ExecuteCommand.java
index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..aa25f5ebaf7d1b22825b962b02dcae02bc35468f 100644
--- a/net/minecraft/commands/execution/tasks/ExecuteCommand.java
+++ b/net/minecraft/commands/execution/tasks/ExecuteCommand.java
@@ -23,8 +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();
int i = ContextChain.runExecutable(this.executionContext, source, ExecutionCommandSource.resultConsumer(), this.modifiers.isForked());
@@ -34,8 +32,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 826cc9be6d333d01b83f78159a7809d07091c15c..4195b8ec98ec5706c6a4641350a18cda0c456d23 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -120,20 +120,9 @@ import net.minecraft.util.Util;
import net.minecraft.util.debug.ServerDebugSubscribers;
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.Environment;
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;
@@ -212,12 +201,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;
- private MinecraftServer.@Nullable TimeProfiler debugCommandProfiler;
- private boolean debugCommandProfilerDelayStart;
private ServerConnectionListener connection;
// Paper - per world load listener - moved LevelLoadListener to ServerLevel
private @Nullable ServerStatus status;
@@ -1021,9 +1004,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.spigotmc.WatchdogThread.doStop(); // Paper - Improved watchdog support
// CraftBukkit end
this.packetProcessor.close();
- 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
@@ -1194,10 +1174,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// note: To avoid possibly spinning forever, only execute tasks that are roughly available at the beginning
// of this call. Packet processing and chunk system tasks are possibly always being queued.
- final ProfilerFiller profiler = Profiler.get();
- profiler.push("moonrise:run_all_tasks");
-
- profiler.push("moonrise:run_all_server");
// avoid calling MinecraftServer#pollTask - we just want to execute queued tasks
while (super.pollTask()) {
// execute small amounts of other tasks just in case the number of tasks we are
@@ -1206,38 +1182,23 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this).moonrise$executeMidTickTasks(); // Paper - rewrite chunk system
this.packetProcessor.executeSinglePacket();
}
- profiler.popPush("moonrise:run_all_packets");
while (this.packetProcessor.executeSinglePacket()) {
// execute possibly latency sensitive chunk system tasks (see above)
((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this).moonrise$executeMidTickTasks(); // Paper - rewrite chunk system
}
- profiler.popPush("moonrise:run_all_chunk");
// Paper start - rewrite chunk system
for (final ServerLevel world : this.getAllLevels()) {
- profiler.push(world.toString() + " " + world.dimension().identifier()); // keep same formatting from regular tick, see tickChildren
-
// note: legacy tasks may expect a distance manager update
- profiler.push("moonrise:distance_manager_update");
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)world).moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates();
- profiler.popPush("moonrise:legacy_chunk_tasks");
world.getChunkSource().mainThreadProcessor.executeAllRecentInternalTasks();
- profiler.popPush("moonrise:chunk_system_tasks");
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)world).moonrise$getChunkTaskScheduler().executeAllRecentlyQueuedMainThreadTasks();
- profiler.pop();
-
- profiler.pop(); // world name
}
// Paper end - rewrite chunk system
- profiler.pop(); // moonrise:run_all_chunk
- profiler.pop(); // moonrise:run_all_tasks
this.finishMeasuringTaskExecutionTime();
}
private void recordTaskExecutionTimeWhileWaiting() {
- final ProfilerFiller profiler = Profiler.get();
-
- profiler.push("moonrise:execute_tasks_until_tick");
this.waitingForNextTick = true;
// implement waitForTasks
final boolean isLoggingEnabled = this.isTickTimeLoggingEnabled();
@@ -1274,7 +1235,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.waitingForNextTick = false;
}
- profiler.pop();
}
// Paper end - improve tick loop
@@ -1371,32 +1331,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - improve tick loop
boolean flag = l == 0L;
- if (this.debugCommandProfilerDelayStart) {
- this.debugCommandProfilerDelayStart = false;
- this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
- }
// Paper - improve tick loop - done above
- try (Profiler.Scope scope = Profiler.use(this.createProfiler())) {
- this.processPacketsAndTick(flag);
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("nextTickWait");
- this.mayHaveDelayedTasks = true;
- this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
- this.startMeasuringTaskExecutionTime();
- this.recordTaskExecutionTimeWhileWaiting(); // Paper - improve tick loop - record task execution here on MSPT
- this.finishMeasuringTaskExecutionTime();
- if (flag) {
- this.tickRateManager.endTickWork();
- }
-
- profilerFiller.pop();
- this.logFullTickTime();
- } finally {
- this.endMetricsRecordingTick();
+ this.processPacketsAndTick(flag);
+ this.mayHaveDelayedTasks = true;
+ this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
+ this.startMeasuringTaskExecutionTime();
+ this.recordTaskExecutionTimeWhileWaiting(); // Paper - improve tick loop - record task execution here on MSPT
+ this.finishMeasuringTaskExecutionTime();
+ if (flag) {
+ this.tickRateManager.endTickWork();
}
+ this.logFullTickTime();
+
this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
}
@@ -1568,7 +1517,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public void doRunTask(TickTask task) {
- Profiler.get().incrementCounter("runTask");
super.doRunTask(task);
}
@@ -1663,12 +1611,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;
@@ -1683,10 +1629,9 @@ 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
long endTime = System.nanoTime();
@@ -1694,7 +1639,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - this.currentTickStart) / 1000000D), remaining).callEvent();
// Paper end - Server Tick Events
this.server.spark.tickEnd(((double)(endTime - this.currentTickStart) / 1000000D)); // Paper - spark
- profilerFiller.push("tallying");
long l = Util.getNanos() - nanos;
int i1 = this.tickCount % 100;
this.aggregatedTickTimesNanos = this.aggregatedTickTimesNanos - this.tickTimesNanos[i1];
@@ -1702,12 +1646,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickTimesNanos[i1] = l;
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float)l / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
this.logTickMethodTime(nanos);
- profilerFiller.pop();
}
protected void processPacketsAndTick(boolean sprinting) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("tick");
this.tickFrame.start();
// Paper - improve tick loop - moved into runAllTasksAtTickStart
this.runAllTasksAtTickStart(); // Paper - improve tick loop
@@ -1721,16 +1662,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - rewrite chunk system
this.tickFrame.end();
this.recordEndOfTick(); // Paper - improve tick loop
- 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");
}
@@ -1798,7 +1735,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
@@ -1813,9 +1749,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");
this.updateEffectiveRespawnData();
// CraftBukkit start
@@ -1852,17 +1786,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
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
serverLevel.hasRidableMoveEvent = org.purpurmc.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur - Ridables
- profilerFiller.push(() -> serverLevel + " " + serverLevel.dimension().identifier());
/* 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) {
@@ -1871,37 +1800,26 @@ 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();
- profilerFiller.popPush("debugSubscribers");
this.debugSubscribers.tick();
if (this.tickRateManager.runsNormally()) {
- profilerFiller.popPush("gameTests");
GameTestTicker.SINGLETON.tick();
}
- profilerFiller.popPush("server gui refresh");
-
for (Runnable runnable : this.tickables) {
runnable.run();
}
- profilerFiller.popPush("send chunks");
-
for (ServerPlayer serverPlayer : this.playerList.getPlayers()) {
serverPlayer.connection.chunkSender.sendNextChunks(serverPlayer);
serverPlayer.connection.resumeFlushing();
}
- profilerFiller.pop();
this.serverActivityMonitor.tick();
}
@@ -1926,14 +1844,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 void addTickable(Runnable tickable) {
@@ -2752,55 +2665,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);
}
@@ -2849,24 +2713,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;
}
@@ -3039,55 +2885,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 e13ddecde6a5599a4688707a1898db093d314d2b..245fbc53356e0f6d53482bdaa3ae87944c29887d 100644
--- a/net/minecraft/server/ReloadableServerResources.java
+++ b/net/minecraft/server/ReloadableServerResources.java
@@ -100,7 +100,7 @@ public class ReloadableServerResources {
backgroundExecutor,
gameExecutor,
DATA_RELOAD_INITIAL_TASK,
- LOGGER.isDebugEnabled()
+ false // DivineMC - Completely remove Mojang profiler
)
.done()
.thenApply(object -> reloadableServerResources);
diff --git a/net/minecraft/server/ServerAdvancementManager.java b/net/minecraft/server/ServerAdvancementManager.java
index 86e9b9d751c9c1f43e9fec4115773dfec773f163..c5fc43995752318a4adc09c4ec253a98b1803ea4 100644
--- a/net/minecraft/server/ServerAdvancementManager.java
+++ b/net/minecraft/server/ServerAdvancementManager.java
@@ -16,7 +16,6 @@ import net.minecraft.resources.Identifier;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
import net.minecraft.util.ProblemReporter;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.jspecify.annotations.Nullable;
import org.slf4j.Logger;
@@ -32,7 +31,7 @@ public class ServerAdvancementManager extends SimpleJsonResourceReloadListener<A
}
@Override
- protected void apply(Map<Identifier, Advancement> object, ResourceManager resourceManager, ProfilerFiller profiler) {
+ protected void apply(Map<Identifier, Advancement> object, ResourceManager resourceManager) {
Builder<Identifier, AdvancementHolder> builder = ImmutableMap.builder();
object.forEach((identifier, advancement) -> {
// Spigot start
diff --git a/net/minecraft/server/ServerFunctionManager.java b/net/minecraft/server/ServerFunctionManager.java
index 747e51132cfddc0c1d619dca81a4dd34605475bd..306bf89d21f6f2dd42710926c13089997d7de39c 100644
--- a/net/minecraft/server/ServerFunctionManager.java
+++ b/net/minecraft/server/ServerFunctionManager.java
@@ -15,8 +15,6 @@ import net.minecraft.commands.functions.CommandFunction;
import net.minecraft.commands.functions.InstantiatedFunction;
import net.minecraft.resources.Identifier;
import net.minecraft.server.permissions.LevelBasedPermissionSet;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public class ServerFunctionManager {
@@ -51,19 +49,12 @@ public class ServerFunctionManager {
}
private void executeTagFunctions(Collection<CommandFunction<CommandSourceStack>> functionObjects, Identifier 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(
@@ -73,8 +64,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
deleted file mode 100644
index 05fa05111a99e1d4b4f992c2349f43125e8b330f..0000000000000000000000000000000000000000
--- a/net/minecraft/server/commands/DebugCommand.java
+++ /dev/null
@@ -1,278 +0,0 @@
-package net.minecraft.server.commands;
-
-import com.mojang.brigadier.CommandDispatcher;
-import com.mojang.brigadier.context.CommandContext;
-import com.mojang.brigadier.context.ContextChain;
-import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
-import com.mojang.logging.LogUtils;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.UncheckedIOException;
-import java.io.Writer;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.Locale;
-import net.minecraft.commands.CommandResultCallback;
-import net.minecraft.commands.CommandSource;
-import net.minecraft.commands.CommandSourceStack;
-import net.minecraft.commands.Commands;
-import net.minecraft.commands.FunctionInstantiationException;
-import net.minecraft.commands.arguments.item.FunctionArgument;
-import net.minecraft.commands.execution.ChainModifiers;
-import net.minecraft.commands.execution.CustomCommandExecutor;
-import net.minecraft.commands.execution.ExecutionContext;
-import net.minecraft.commands.execution.ExecutionControl;
-import net.minecraft.commands.execution.Frame;
-import net.minecraft.commands.execution.TraceCallbacks;
-import net.minecraft.commands.execution.tasks.CallFunction;
-import net.minecraft.commands.functions.CommandFunction;
-import net.minecraft.commands.functions.InstantiatedFunction;
-import net.minecraft.network.chat.Component;
-import net.minecraft.resources.Identifier;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.permissions.LevelBasedPermissionSet;
-import net.minecraft.util.TimeUtil;
-import net.minecraft.util.Util;
-import net.minecraft.util.profiling.ProfileResults;
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-
-public class DebugCommand {
- static final Logger LOGGER = LogUtils.getLogger();
- private static final SimpleCommandExceptionType ERROR_NOT_RUNNING = new SimpleCommandExceptionType(Component.translatable("commands.debug.notRunning"));
- private static final SimpleCommandExceptionType ERROR_ALREADY_RUNNING = new SimpleCommandExceptionType(
- Component.translatable("commands.debug.alreadyRunning")
- );
- static final SimpleCommandExceptionType NO_RECURSIVE_TRACES = new SimpleCommandExceptionType(Component.translatable("commands.debug.function.noRecursion"));
- static final SimpleCommandExceptionType NO_RETURN_RUN = new SimpleCommandExceptionType(Component.translatable("commands.debug.function.noReturnRun"));
-
- public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
- dispatcher.register(
- Commands.literal("debug")
- .requires(Commands.hasPermission(Commands.LEVEL_ADMINS))
- .then(Commands.literal("start").executes(context -> start(context.getSource())))
- .then(Commands.literal("stop").executes(context -> stop(context.getSource())))
- .then(
- Commands.literal("function")
- .requires(Commands.hasPermission(Commands.LEVEL_ADMINS))
- .then(
- Commands.argument("name", FunctionArgument.functions())
- .suggests(FunctionCommand.SUGGEST_FUNCTION)
- .executes(new DebugCommand.TraceCustomExecutor())
- )
- )
- );
- }
-
- private static int start(CommandSourceStack source) throws CommandSyntaxException {
- MinecraftServer server = source.getServer();
- if (server.isTimeProfilerRunning()) {
- throw ERROR_ALREADY_RUNNING.create();
- } else {
- server.startTimeProfiler();
- source.sendSuccess(() -> Component.translatable("commands.debug.started"), true);
- return 0;
- }
- }
-
- private static int stop(CommandSourceStack source) throws CommandSyntaxException {
- MinecraftServer server = source.getServer();
- if (!server.isTimeProfilerRunning()) {
- throw ERROR_NOT_RUNNING.create();
- } else {
- ProfileResults profileResults = server.stopTimeProfiler();
- double d = (double)profileResults.getNanoDuration() / TimeUtil.NANOSECONDS_PER_SECOND;
- double d1 = profileResults.getTickDuration() / d;
- source.sendSuccess(
- () -> Component.translatable(
- "commands.debug.stopped", String.format(Locale.ROOT, "%.2f", d), profileResults.getTickDuration(), String.format(Locale.ROOT, "%.2f", d1)
- ),
- true
- );
- return (int)d1;
- }
- }
-
- static class TraceCustomExecutor
- extends CustomCommandExecutor.WithErrorHandling<CommandSourceStack>
- implements CustomCommandExecutor.CommandAdapter<CommandSourceStack> {
- @Override
- public void runGuarded(
- CommandSourceStack source,
- ContextChain<CommandSourceStack> contextChain,
- ChainModifiers chainModifiers,
- ExecutionControl<CommandSourceStack> executionControl
- ) throws CommandSyntaxException {
- if (chainModifiers.isReturn()) {
- throw DebugCommand.NO_RETURN_RUN.create();
- } else if (executionControl.tracer() != null) {
- throw DebugCommand.NO_RECURSIVE_TRACES.create();
- } else {
- CommandContext<CommandSourceStack> topContext = contextChain.getTopContext();
- Collection<CommandFunction<CommandSourceStack>> functions = FunctionArgument.getFunctions(topContext, "name");
- MinecraftServer server = source.getServer();
- String string = "debug-trace-" + Util.getFilenameFormattedDateTime() + ".txt";
- CommandDispatcher<CommandSourceStack> dispatcher = source.getServer().getFunctions().getDispatcher();
- int i = 0;
-
- try {
- Path file = server.getFile("debug");
- Files.createDirectories(file);
- final PrintWriter printWriter = new PrintWriter(Files.newBufferedWriter(file.resolve(string), StandardCharsets.UTF_8));
- DebugCommand.Tracer tracer = new DebugCommand.Tracer(printWriter);
- executionControl.tracer(tracer);
-
- for (final CommandFunction<CommandSourceStack> commandFunction : functions) {
- try {
- CommandSourceStack commandSourceStack = source.withSource(tracer).withMaximumPermission(LevelBasedPermissionSet.GAMEMASTER);
- InstantiatedFunction<CommandSourceStack> instantiatedFunction = commandFunction.instantiate(null, dispatcher);
- executionControl.queueNext((new CallFunction<CommandSourceStack>(instantiatedFunction, CommandResultCallback.EMPTY, false) {
- @Override
- public void execute(CommandSourceStack source1, ExecutionContext<CommandSourceStack> executionContext, Frame frame) {
- printWriter.println(commandFunction.id());
- super.execute(source1, executionContext, frame);
- }
- }).bind(commandSourceStack));
- i += instantiatedFunction.entries().size();
- } catch (FunctionInstantiationException var18) {
- source.sendFailure(var18.messageComponent());
- }
- }
- } catch (IOException | UncheckedIOException var19) {
- DebugCommand.LOGGER.warn("Tracing failed", (Throwable)var19);
- source.sendFailure(Component.translatable("commands.debug.function.traceFailed"));
- }
-
- int i1 = i;
- executionControl.queueNext(
- (executionContext, frame) -> {
- if (functions.size() == 1) {
- source.sendSuccess(
- () -> Component.translatable(
- "commands.debug.function.success.single", i1, Component.translationArg(functions.iterator().next().id()), string
- ),
- true
- );
- } else {
- source.sendSuccess(() -> Component.translatable("commands.debug.function.success.multiple", i1, functions.size(), string), true);
- }
- }
- );
- }
- }
- }
-
- static class Tracer implements CommandSource, TraceCallbacks {
- public static final int INDENT_OFFSET = 1;
- private final PrintWriter output;
- private int lastIndent;
- private boolean waitingForResult;
-
- Tracer(PrintWriter output) {
- this.output = output;
- }
-
- private void indentAndSave(int indent) {
- this.printIndent(indent);
- this.lastIndent = indent;
- }
-
- private void printIndent(int indent) {
- for (int i = 0; i < indent + 1; i++) {
- this.output.write(" ");
- }
- }
-
- private void newLine() {
- if (this.waitingForResult) {
- this.output.println();
- this.waitingForResult = false;
- }
- }
-
- @Override
- public void onCommand(int depth, String command) {
- this.newLine();
- this.indentAndSave(depth);
- this.output.print("[C] ");
- this.output.print(command);
- this.waitingForResult = true;
- }
-
- @Override
- public void onReturn(int depth, String command, int returnValue) {
- if (this.waitingForResult) {
- this.output.print(" -> ");
- this.output.println(returnValue);
- this.waitingForResult = false;
- } else {
- this.indentAndSave(depth);
- this.output.print("[R = ");
- this.output.print(returnValue);
- this.output.print("] ");
- this.output.println(command);
- }
- }
-
- @Override
- public void onCall(int depth, Identifier function, int commands) {
- this.newLine();
- this.indentAndSave(depth);
- this.output.print("[F] ");
- this.output.print(function);
- this.output.print(" size=");
- this.output.println(commands);
- }
-
- @Override
- public void onError(String errorMessage) {
- this.newLine();
- this.indentAndSave(this.lastIndent + 1);
- this.output.print("[E] ");
- this.output.print(errorMessage);
- }
-
- @Override
- public void sendSystemMessage(Component message) {
- this.newLine();
- this.printIndent(this.lastIndent + 1);
- this.output.print("[M] ");
- this.output.println(message.getString());
- }
-
- @Override
- public boolean acceptsSuccess() {
- return true;
- }
-
- @Override
- public boolean acceptsFailure() {
- return true;
- }
-
- @Override
- public boolean shouldInformAdmins() {
- return false;
- }
-
- @Override
- public boolean alwaysAccepts() {
- return true;
- }
-
- // Paper start
- @Override
- public org.bukkit.command.CommandSender getBukkitSender(final CommandSourceStack wrapper) {
- throw new UnsupportedOperationException();
- }
- // Paper end
-
- @Override
- public void close() {
- IOUtils.closeQuietly((Writer)this.output);
- }
- }
-}
diff --git a/net/minecraft/server/commands/PerfCommand.java b/net/minecraft/server/commands/PerfCommand.java
index cdb4b00d636ba20e72b00dbb8cc34406819ac1b5..3d10ea9c7902d2e645c2f6fcf956b2c82c01c48a 100644
--- a/net/minecraft/server/commands/PerfCommand.java
+++ b/net/minecraft/server/commands/PerfCommand.java
@@ -42,66 +42,22 @@ public class PerfCommand {
}
private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException {
- MinecraftServer server = source.getServer();
- if (server.isRecordingMetrics()) {
- throw ERROR_ALREADY_RUNNING.create();
- } else {
- Consumer<ProfileResults> consumer = profileResults -> whenStopped(source, profileResults);
- Consumer<Path> consumer1 = path -> saveResults(source, path, server);
- server.startRecordingMetrics(consumer, consumer1);
- source.sendSuccess(() -> Component.translatable("commands.perf.started"), false);
- return 0;
- }
+ return removedMessage(source); // DivineMC - Completely remove Mojang profiler
}
private static int stopProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException {
- MinecraftServer server = source.getServer();
- if (!server.isRecordingMetrics()) {
- throw ERROR_NOT_RUNNING.create();
- } else {
- server.finishRecordingMetrics();
- return 0;
- }
+ return removedMessage(source); // DivineMC - Completely remove Mojang 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()
- );
-
- String string1;
- try {
- string1 = FileUtil.findAvailableName(MetricsPersister.PROFILING_RESULTS_DIR, string, ".zip");
- } catch (IOException var11) {
- source.sendFailure(Component.translatable("commands.perf.reportFailed"));
- LOGGER.error("Failed to create report name", (Throwable)var11);
- return;
- }
-
- try (FileZipper fileZipper = new FileZipper(MetricsPersister.PROFILING_RESULTS_DIR.resolve(string1))) {
- fileZipper.add(Paths.get("system.txt"), server.fillSystemReport(new SystemReport()).toLineSeparatedString());
- fileZipper.add(path);
- }
+ // DivineMC start - Completely remove Mojang profiler
+ private static int removedMessage(CommandSourceStack source) {
+ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage();
- try {
- FileUtils.forceDelete(path.toFile());
- } catch (IOException var9) {
- LOGGER.warn("Failed to delete temporary profiling file {}", path, var9);
- }
-
- source.sendSuccess(() -> Component.translatable("commands.perf.reportSaved", string1), false);
- }
+ source.getSender().sendMessage(mm.deserialize("<gold>Mojang's Profiler has been removed in DivineMC to save your server 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>"));
- private static void whenStopped(CommandSourceStack source, ProfileResults results) {
- if (results != EmptyProfileResults.EMPTY) {
- int tickDuration = results.getTickDuration();
- double d = (double)results.getNanoDuration() / TimeUtil.NANOSECONDS_PER_SECOND;
- source.sendSuccess(
- () -> Component.translatable(
- "commands.perf.stopped", String.format(Locale.ROOT, "%.2f", d), tickDuration, String.format(Locale.ROOT, "%.2f", tickDuration / d)
- ),
- false
- );
- }
+ return 0;
}
+ // DivineMC end - Completely remove Mojang profiler
}
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
index 6c02ab6c4076e8223229626754ed766b16537cfd..684ce31d079a6669028eb7d87628d823066e3da4 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -1044,12 +1044,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
return this.settings.getProperties().serverResourcePackInfo;
}
- @Override
- public void endMetricsRecordingTick() {
- super.endMetricsRecordingTick();
- this.isTickTimeLoggingEnabled = this.debugSubscribers().hasAnySubscriberFor(DebugSubscriptions.DEDICATED_SERVER_TICK_TIME);
- }
-
@Override
public SampleLogger getTickTimeLogger() {
return this.tickTimeLogger;
diff --git a/net/minecraft/server/level/ChunkGenerationTask.java b/net/minecraft/server/level/ChunkGenerationTask.java
index afb82b065b5a7dbffcdb5028b1e92815b9b5f72a..db6bef78f2afdc96ebd3ab15c98f01a22c29e0d6 100644
--- a/net/minecraft/server/level/ChunkGenerationTask.java
+++ b/net/minecraft/server/level/ChunkGenerationTask.java
@@ -4,8 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
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;
@@ -65,7 +63,6 @@ public class ChunkGenerationTask {
chunkStatus = ChunkStatus.getStatusList().get(this.scheduledStatus.getIndex() + 1);
}
- this.scheduleLayer(chunkStatus, this.needsGeneration);
this.scheduledStatus = chunkStatus;
}
@@ -110,22 +107,6 @@ public class ChunkGenerationTask {
return this.cache.get(this.pos.x, this.pos.z);
}
- 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++) {
- for (int i1 = this.pos.z - radiusForLayer; i1 <= this.pos.z + radiusForLayer; i1++) {
- GenerationChunkHolder generationChunkHolder = this.cache.get(i, i1);
- if (this.markedForCancellation || !this.scheduleChunkInLayer(status, needsGeneration, generationChunkHolder)) {
- return;
- }
- }
- }
- }
- }
-
private int getRadiusForLayer(ChunkStatus status, boolean needsGeneration) {
ChunkPyramid chunkPyramid = needsGeneration ? ChunkPyramid.GENERATION_PYRAMID : ChunkPyramid.LOADING_PYRAMID;
return chunkPyramid.getStepTo(this.targetStatus).getAccumulatedRadiusOf(status);
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
index 21738241221f4fc1504678f76851702fea84a70b..82e08606f04564de296cb224cfd9d07b586ba928 100644
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -67,8 +67,6 @@ import net.minecraft.util.StaticCache2D;
import net.minecraft.util.TriState;
import net.minecraft.util.Util;
import net.minecraft.util.datafix.DataFixTypes;
-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;
@@ -415,15 +413,10 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP
}
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 6106e79cdb3dc77b4848d1536801a40ec7f8991e..d58f05a6ffd7d445cdeae35bbe81fed9d52ee9f5 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -26,8 +26,6 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.util.FileUtil;
import net.minecraft.util.Util;
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;
@@ -461,37 +459,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();
}
@@ -500,22 +489,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);
}
- this.broadcastChangedChunks(profilerFiller);
- profilerFiller.pop();
+ this.broadcastChangedChunks();
}
}
- private void broadcastChangedChunks(ProfilerFiller profiler) {
- profiler.push("broadcast");
-
+ private void broadcastChangedChunks() {
for (ChunkHolder chunkHolder : this.chunkHoldersToBroadcast) {
LevelChunk tickingChunk = chunkHolder.getChunkToSend(); // Paper - rewrite chunk system
if (tickingChunk != null) {
@@ -524,11 +506,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
this.chunkHoldersToBroadcast.clear();
- profiler.pop();
}
- private void tickChunks(ProfilerFiller profiler, long timeInhabited) {
- profiler.push("naturalSpawnCount");
+ private void tickChunks(long timeInhabited) {
int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - Optional per player mob spawns
NaturalSpawner.SpawnState spawnState;
@@ -574,16 +554,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
List<LevelChunk> list = this.spawningChunks;
try {
- profiler.popPush("filteringSpawningChunks");
this.chunkMap.collectSpawningChunks(list);
- profiler.popPush("shuffleSpawningChunks");
// Paper start - chunk tick iteration optimisation
if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
this.shuffleRandom.setSeed(this.level.random.nextLong());
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);
@@ -592,14 +569,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
list.clear();
}
- profiler.popPush("tickTickingChunks");
this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimizations
if (flag) {
- profiler.popPush("customSpawners");
this.level.tickCustomSpawners(this.spawnEnemies);
}
-
- profiler.pop();
}
private void tickSpawningChunk(LevelChunk chunk, long timeInhabited, List<MobCategory> spawnCategories, NaturalSpawner.SpawnState spawnState) {
@@ -819,7 +792,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 c99ba8c3eba14efcf7906fe2b42e4db1c73c90fe..857a1ac427644a1f24a8564041ba3f41da540ef4 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -75,8 +75,6 @@ import net.minecraft.util.Util;
import net.minecraft.util.datafix.DataFixTypes;
import net.minecraft.util.debug.DebugSubscriptions;
import net.minecraft.util.debug.LevelDebugSynchronizers;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.random.WeightedList;
import net.minecraft.util.valueproviders.IntProvider;
import net.minecraft.util.valueproviders.UniformInt;
@@ -768,16 +766,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 i = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
@@ -811,30 +805,22 @@ 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 hasActiveTickets = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || this.chunkSource.hasActiveTickets(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this
if (hasActiveTickets) {
this.resetEmptyTime();
@@ -845,11 +831,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
if (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
@@ -858,9 +841,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) {
@@ -871,23 +852,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.stopRiding();
}
- profilerFiller.push("tick");
this.guardEntityTick(this::tickNonPassenger, entity);
- profilerFiller.pop();
}
}
}
}
);
- profilerFiller.popPush("blockEntities");
this.tickBlockEntities();
- profilerFiller.pop();
}
- profilerFiller.push("entityManagement");
// Paper - rewrite chunk system
- profilerFiller.pop();
- profilerFiller.push("debugSynchronizers");
if (this.debugSynchronizers.hasAnySubscriberFor(DebugSubscriptions.NEIGHBOR_UPDATES)) {
this.neighborUpdater
.setDebugListener(blockPos -> this.debugSynchronizers.broadcastEventToTracking(blockPos, DebugSubscriptions.NEIGHBOR_UPDATES, blockPos));
@@ -896,7 +870,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
this.debugSynchronizers.tick(this.server.debugSubscribers());
- profilerFiller.pop();
this.environmentAttributes().invalidateTickCache();
}
@@ -912,9 +885,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.getGameRules().get(GameRules.ADVANCE_TIME)) {
// Purpur start - Configurable daylight cycle
int incrementTicks = isBrightOutside() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks;
@@ -1018,8 +989,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++) {
@@ -1029,12 +998,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) {
@@ -1042,8 +1008,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)) {
@@ -1077,8 +1041,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
}
}
-
- profilerFiller.pop();
}
@VisibleForTesting
@@ -1440,17 +1402,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
@@ -1471,9 +1429,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();
@@ -1485,7 +1440,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 bf27843ac3a1b914aea602abeeee0c780e6e7c30..e662869de396db5d2481b86146096e0b262ab94f 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -105,8 +105,6 @@ import net.minecraft.util.ProblemReporter;
import net.minecraft.util.Unit;
import net.minecraft.util.Util;
import net.minecraft.util.debug.DebugSubscription;
-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;
@@ -1567,20 +1565,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.portalProcess = null; // SPIGOT-7785: there is no need to carry this over as it contains the old world/location and we might run into trouble if there is a portal in the same spot in both worlds
serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("moving");
if (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");
this.portalPos = org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(exit); // Purpur - Fix stuck in portals
this.setServerLevel(level);
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 02c6733ce1de543dab3bf558148879039e501257..9b7dc6b3b1037fb2aa285c33537e9b5c342cdb39 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -26,7 +26,6 @@ import net.minecraft.server.level.ClientInformation;
import net.minecraft.server.players.NameAndId;
import net.minecraft.util.Util;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
import org.jspecify.annotations.Nullable;
import org.slf4j.Logger;
@@ -284,7 +283,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
protected void keepConnectionAlive() {
- Profiler.get().push("keepAlive");
long millis = Util.getMillis();
// Paper start - improve keepalives
// Purpur start - Alternative Keepalive Handling
@@ -322,8 +320,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 524a7029b5080e4ec08136cdc40e195a8a8fd8e4..7e63744b6846a719921afc73ef0ac041998be8ca 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.Unit;
import net.minecraft.util.Util;
-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/ResourceManagerReloadListener.java b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
index ea99b9f766dbeeb625523334fb53fb5a9e040497..a5479b67006e0f083078a7af2dde0c3dde970e8b 100644
--- a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
+++ b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
@@ -3,8 +3,6 @@ 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
@@ -13,10 +11,7 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener
) {
ResourceManager resourceManager = state.resourceManager();
return preparation.wait(Unit.INSTANCE).thenRunAsync(() -> {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("listener");
this.onResourceManagerReload(resourceManager);
- profilerFiller.pop();
}, gameExecutor);
}
diff --git a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java
index cac326043f80847d1bb3a9e68536c6dc67f8b1f6..c74243e5ad82f764027930c24c825c0d40fedad1 100644
--- a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java
+++ b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java
@@ -17,7 +17,6 @@ import net.minecraft.resources.FileToIdConverter;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.util.StrictJsonParser;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public abstract class SimpleJsonResourceReloadListener<T> extends SimplePreparableReloadListener<Map<Identifier, T>> {
@@ -41,7 +40,7 @@ public abstract class SimpleJsonResourceReloadListener<T> extends SimplePreparab
}
@Override
- protected Map<Identifier, T> prepare(ResourceManager resourceManager, ProfilerFiller profiler) {
+ protected Map<Identifier, T> prepare(ResourceManager resourceManager) {
Map<Identifier, T> map = new HashMap<>();
scanDirectory(resourceManager, this.lister, this.ops, this.codec, map);
return map;
diff --git a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
index 6e07a06234b34250087e70e18be22a526417fa80..ff5e508838340ee575d83216e33400721bdc6f05 100644
--- a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
+++ b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
@@ -2,8 +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 {
@Override
@@ -11,12 +9,12 @@ public abstract class SimplePreparableReloadListener<T> implements PreparableRel
PreparableReloadListener.SharedState state, Executor backgroundExecutor, PreparableReloadListener.PreparationBarrier preparation, Executor gameExecutor
) {
ResourceManager resourceManager = state.resourceManager();
- return CompletableFuture.<T>supplyAsync(() -> this.prepare(resourceManager, Profiler.get()), backgroundExecutor)
+ return CompletableFuture.<T>supplyAsync(() -> this.prepare(resourceManager), backgroundExecutor)
.thenCompose(preparation::wait)
- .thenAcceptAsync(object -> this.apply((T)object, resourceManager, Profiler.get()), gameExecutor);
+ .thenAcceptAsync(object -> this.apply((T)object, resourceManager), gameExecutor);
}
- protected abstract T prepare(ResourceManager resourceManager, ProfilerFiller profiler);
+ protected abstract T prepare(ResourceManager resourceManager);
- protected abstract void apply(T object, ResourceManager resourceManager, ProfilerFiller profiler);
+ protected abstract void apply(T object, ResourceManager resourceManager);
}
diff --git a/net/minecraft/util/thread/AbstractConsecutiveExecutor.java b/net/minecraft/util/thread/AbstractConsecutiveExecutor.java
index 49ea56f2238277c0f09cced41d3b4a1f4bf5ac73..da3760683b10701e793d9743cd7eca7ecefce73a 100644
--- a/net/minecraft/util/thread/AbstractConsecutiveExecutor.java
+++ b/net/minecraft/util/thread/AbstractConsecutiveExecutor.java
@@ -13,7 +13,7 @@ import net.minecraft.util.profiling.metrics.MetricsRegistry;
import net.minecraft.util.profiling.metrics.ProfilerMeasured;
import org.slf4j.Logger;
-public abstract class AbstractConsecutiveExecutor<T extends Runnable> implements ProfilerMeasured, TaskScheduler<T>, Runnable {
+public abstract class AbstractConsecutiveExecutor<T extends Runnable> implements TaskScheduler<T>, Runnable {
private static final Logger LOGGER = LogUtils.getLogger();
private final AtomicReference<AbstractConsecutiveExecutor.Status> status = new AtomicReference<>(AbstractConsecutiveExecutor.Status.SLEEPING);
private final StrictQueue<T> queue;
@@ -24,7 +24,6 @@ public abstract class AbstractConsecutiveExecutor<T extends Runnable> implements
this.executor = executor;
this.queue = queue;
this.name = name;
- MetricsRegistry.INSTANCE.add(this);
}
private boolean canBeScheduled() {
@@ -108,11 +107,6 @@ public abstract class AbstractConsecutiveExecutor<T extends Runnable> implements
return this.name;
}
- @Override
- public List<MetricSampler> profiledMetrics() {
- return ImmutableList.of(MetricSampler.create(this.name + "-queue-size", MetricCategory.CONSECUTIVE_EXECUTORS, this::size));
- }
-
private boolean setRunning() {
return this.status.compareAndSet(AbstractConsecutiveExecutor.Status.SLEEPING, AbstractConsecutiveExecutor.Status.RUNNING);
}
diff --git a/net/minecraft/util/thread/BlockableEventLoop.java b/net/minecraft/util/thread/BlockableEventLoop.java
index cf7dcb2e02a1cc8019bb9380a3cf9ba2a06f4ff0..285e9be79e68b2a2430c9d864dfa17e4df2885dc 100644
--- a/net/minecraft/util/thread/BlockableEventLoop.java
+++ b/net/minecraft/util/thread/BlockableEventLoop.java
@@ -15,13 +15,9 @@ import java.util.function.Supplier;
import javax.annotation.CheckReturnValue;
import net.minecraft.ReportedException;
import net.minecraft.SharedConstants;
-import net.minecraft.util.profiling.metrics.MetricCategory;
-import net.minecraft.util.profiling.metrics.MetricSampler;
-import net.minecraft.util.profiling.metrics.MetricsRegistry;
-import net.minecraft.util.profiling.metrics.ProfilerMeasured;
import org.slf4j.Logger;
-public abstract class BlockableEventLoop<R extends Runnable> implements ProfilerMeasured, TaskScheduler<R>, Executor {
+public abstract class BlockableEventLoop<R extends Runnable> implements TaskScheduler<R>, Executor {
public static final long BLOCK_TIME_NANOS = 100000L;
private final String name;
private static final Logger LOGGER = LogUtils.getLogger();
@@ -30,7 +26,6 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
protected BlockableEventLoop(String name) {
this.name = name;
- MetricsRegistry.INSTANCE.add(this);
}
// Paper start
@@ -183,11 +178,6 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
}
}
- @Override
- public List<MetricSampler> profiledMetrics() {
- return ImmutableList.of(MetricSampler.create(this.name + "-pending-tasks", MetricCategory.EVENT_LOOPS, this::getPendingTasksCount));
- }
-
public static boolean isNonRecoverable(Throwable error) {
return error instanceof ReportedException reportedException
? isNonRecoverable(reportedException.getCause())
diff --git a/net/minecraft/util/thread/PriorityConsecutiveExecutor.java b/net/minecraft/util/thread/PriorityConsecutiveExecutor.java
index 39a604c9a53930b53d959b1d2eb504aa964e9a58..0d0380e3955836ce125f777841477503bb6c0aae 100644
--- a/net/minecraft/util/thread/PriorityConsecutiveExecutor.java
+++ b/net/minecraft/util/thread/PriorityConsecutiveExecutor.java
@@ -3,12 +3,10 @@ package net.minecraft.util.thread;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
-import net.minecraft.util.profiling.metrics.MetricsRegistry;
public class PriorityConsecutiveExecutor extends AbstractConsecutiveExecutor<StrictQueue.RunnableWithPriority> {
public PriorityConsecutiveExecutor(int size, Executor executor, String name) {
super(new StrictQueue.FixedPriorityQueue(size), executor, name);
- MetricsRegistry.INSTANCE.add(this);
}
@Override
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index d2542c2bd15d274f9844c731a2e2b388a318ee4c..c1fff7f3d74a804d9608e3ff78386f49845b8f59 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -83,8 +83,6 @@ import net.minecraft.util.Util;
import net.minecraft.util.debug.DebugEntityBlockIntersection;
import net.minecraft.util.debug.DebugSubscriptions;
import net.minecraft.util.debug.DebugValueSource;
-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;
@@ -884,8 +882,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
// 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.computeSpeed();
this.inBlockState = null;
@@ -940,8 +936,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
if (this.level() instanceof ServerLevel serverLevelx && this instanceof Leashable) {
Leashable.tickLeash(serverLevelx, (Entity & Leashable)this);
}
-
- profilerFiller.pop();
}
protected void computeSpeed() {
@@ -1176,8 +1170,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
}
}
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("move");
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) {
if (type != MoverType.PISTON) {
movement = movement.multiply(this.stuckSpeedMultiplier);
@@ -1189,7 +1181,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
// 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
@@ -1214,8 +1205,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
this.setPos(vec33);
}
- 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;
@@ -1238,7 +1227,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
}
if (this.isRemoved()) {
- profilerFiller.pop();
} else {
if (this.horizontalCollision) {
Vec3 deltaMovement = this.getDeltaMovement();
@@ -1282,7 +1270,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
float blockSpeedFactor = this.getBlockSpeedFactor();
this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor));
- profilerFiller.pop();
}
}
// Paper start - detailed watchdog information
@@ -3553,8 +3540,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
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) {
@@ -3566,8 +3551,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
this.teleport(portalDestination);
}
}
-
- profilerFiller.pop();
} else if (this.portalProcess.hasExpired()) {
this.portalProcess = null;
}
@@ -4132,15 +4115,12 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
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;
}
@@ -4156,11 +4136,8 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
}
}
- 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
@@ -4180,7 +4157,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
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 1dccf3208160e8fe531febb6d448fd55777e11c0..c37daba105fec721e39d35fdbb22d06b6af3226f 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -70,8 +70,6 @@ import net.minecraft.tags.TagKey;
import net.minecraft.util.BlockUtil;
import net.minecraft.util.Mth;
import net.minecraft.util.Util;
-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;
@@ -441,8 +439,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
super.baseTick();
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("livingEntityBaseTick");
if (this.isAlive() && this.level() instanceof ServerLevel serverLevel1) {
boolean flag = this instanceof Player;
if (this.isInWall()) {
@@ -529,7 +525,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.yBodyRotO = this.yBodyRot;
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
- profilerFiller.pop();
}
protected boolean shouldTakeDrowningDamage() {
@@ -3487,11 +3482,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;
@@ -3503,7 +3494,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 {
@@ -3734,21 +3724,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()) {
@@ -3777,8 +3761,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.noJumpDelay = 0;
}
- profilerFiller.pop();
- profilerFiller.push("travel");
if (this.isFallFlying()) {
this.updateFallFlying();
}
@@ -3803,9 +3785,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));
}
@@ -3815,18 +3795,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
// Purpur start - Ridables
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 615293655410eeb9b330ec4f0d4d18bb318d33fb..64b12c6617e4a787c614f0c9c1bf2ba704f45d17 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -31,8 +31,6 @@ import net.minecraft.util.debug.DebugGoalInfo;
import net.minecraft.util.debug.DebugPathInfo;
import net.minecraft.util.debug.DebugSubscriptions;
import net.minecraft.util.debug.DebugValueSource;
-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;
@@ -329,8 +327,6 @@ 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();
@@ -338,7 +334,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.fixMc183990 && this.target != null && this.target.isDeadOrDying()) this.setTarget(null); // DivineMC - Fix MC-183990
- profilerFiller.pop();
incrementTicksSinceLastInteraction(); // Purpur - Entity lifespan
}
@@ -550,8 +545,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
this.burnUndead();
}*/ // Purpur end - implemented in LivingEntity - API for any mob to burn daylight
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("looting");
if (this.level() instanceof ServerLevel serverLevel
&& this.canPickUpLoot()
&& this.isAlive()
@@ -574,8 +567,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
}
}
-
- profilerFiller.pop();
}
protected EquipmentSlot sunProtectionSlot() {
@@ -819,42 +810,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();
}
protected void customServerAiStep(ServerLevel level) {
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 61c7ca1d262098583d40b78e22db8fa67cf1dec2..9d145a526d797e2fac5a72d376e67c1e2b62573f 100644
--- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -11,8 +11,6 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth;
import net.minecraft.util.debug.DebugSubscriptions;
import net.minecraft.util.debug.ServerDebugSubscribers;
-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;
@@ -181,13 +179,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, reachRange, this.maxVisitedNodesMultiplier);
- profilerFiller.pop();
if (path != null && path.getTarget() != null) {
this.targetPos = path.getTarget();
this.reachRange = reachRange;
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/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java
index ea7666cc10aee49e13dbdd6e3367fabaa0dcbc17..9e0fe52c81f764843580ebb5fe6a5bd6b2522794 100644
--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -23,8 +23,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;
@@ -268,14 +266,9 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("allayBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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 8502205994ecf28b1b791195088d183d7574760f..4bf6144e822e201d9c2e009c1ac8d332ae02518b 100644
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -21,8 +21,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;
@@ -161,11 +159,7 @@ 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.scuteTime <= 0 && this.shouldDropLoot(level)) {
diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index e5ac43bf5631254c31d91abb1c5de408807429dd..73ff138007002a6203b6a0df88d34d26f025a827 100644
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -372,14 +372,9 @@ public class Axolotl extends Animal implements Bucketable {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("axolotlBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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 842b20242c323572d4c04d3a2d5fe21a54d53ed4..1f5ab385e780fc4c4242be3559ca36e3da364775 100644
--- a/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
@@ -16,8 +16,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;
@@ -172,14 +170,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 7d6dbdef68b25e774b5a83bb8aeb2535246459aa..62de0bd9fce5c6abc168df34f9eda357b789d049 100644
--- a/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
@@ -26,8 +26,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;
@@ -259,14 +257,9 @@ public class Frog extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("frogBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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 ae65292c9be65894532f11833c68e68970dbb257..f712a189107c1bcde82126f96c087b3520cf2dd3 100644
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -10,8 +10,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;
@@ -136,14 +134,9 @@ public class Tadpole extends AbstractFish {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("tadpoleBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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 64916356de4b9981e04c5befef15b067914f6d75..95ea226cde95155ddfdc87763af368ac11a644e6 100644
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -18,8 +18,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;
@@ -227,14 +225,9 @@ public class Goat extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("goatBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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/golem/CopperGolem.java b/net/minecraft/world/entity/animal/golem/CopperGolem.java
index 4f92ac01a6d362a7ef748b74b75773575970859f..bd272670c6b5c51efd057d925086c4fcfc038259 100644
--- a/net/minecraft/world/entity/animal/golem/CopperGolem.java
+++ b/net/minecraft/world/entity/animal/golem/CopperGolem.java
@@ -13,8 +13,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;
@@ -242,14 +240,9 @@ public class CopperGolem extends AbstractGolem implements ContainerUser, Shearab
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("copperGolemBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
this.getBrain().tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("copperGolemActivityUpdate");
CopperGolemAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
index 8034ce67266b6baab35c72eaebf5ad67fc1a29c6..856ef72aaf9a076609c29bce743c62dbd7edb4d6 100644
--- a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
+++ b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
@@ -12,8 +12,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;
@@ -429,13 +427,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/nautilus/Nautilus.java b/net/minecraft/world/entity/animal/nautilus/Nautilus.java
index 7c4467933061f097425d6c82188a65fd5e4c4d3b..1872db098c810a178f2d831ee0a98f94a26f73c9 100644
--- a/net/minecraft/world/entity/animal/nautilus/Nautilus.java
+++ b/net/minecraft/world/entity/animal/nautilus/Nautilus.java
@@ -4,8 +4,6 @@ import com.mojang.serialization.Dynamic;
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.world.damagesource.DamageSource;
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.EntitySpawnReason;
@@ -74,13 +72,8 @@ public class Nautilus extends AbstractNautilus {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("nautilusBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("nautilusActivityUpdate");
NautilusAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java b/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
index 7e4d005053e6812f329ab7ac1f252c547d4c9a12..71a78975f9c7ed0af4e22466a32edf56df138140 100644
--- a/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
+++ b/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
@@ -13,8 +13,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.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AgeableMob;
@@ -99,13 +97,8 @@ public class ZombieNautilus extends AbstractNautilus {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("zombieNautilusBrain");
this.getBrain().tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("zombieNautilusActivityUpdate");
ZombieNautilusAi.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 7ef3c94f63c8a25d09e69b818ecdf79795803570..6f08f08c53831dd5b68e06a4a6aee95204334a3b 100644
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -28,8 +28,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;
@@ -497,13 +495,9 @@ public class Sniffer extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("snifferBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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 d6de61ed4415cd00858375406567ea9407030e1e..47c56ae6dc62b0f72d7721ef1685ab279b8db0cb 100644
--- a/net/minecraft/world/entity/monster/Zoglin.java
+++ b/net/minecraft/world/entity/monster/Zoglin.java
@@ -12,8 +12,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;
@@ -288,11 +286,8 @@ public class Zoglin extends Monster implements HoglinBase {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("zoglinBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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 6f22312d0a5ab38be4a07b93fdb29b7f36f67c71..7980537bed5aff4ef832aa0a4300f9d2cc857383 100644
--- a/net/minecraft/world/entity/monster/breeze/Breeze.java
+++ b/net/minecraft/world/entity/monster/breeze/Breeze.java
@@ -13,8 +13,6 @@ import net.minecraft.tags.EntityTypeTags;
import net.minecraft.util.debug.DebugBreezeInfo;
import net.minecraft.util.debug.DebugSubscriptions;
import net.minecraft.util.debug.DebugValueSource;
-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;
@@ -234,13 +232,9 @@ public class Breeze extends Monster {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("breezeBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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 a84edd4953e59daed6816531545a6ec1c914bce6..6faf372eaaf8013e0a69c408ce82392b27c8bb3b 100644
--- a/net/minecraft/world/entity/monster/creaking/Creaking.java
+++ b/net/minecraft/world/entity/monster/creaking/Creaking.java
@@ -14,8 +14,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;
@@ -236,10 +234,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 460640f5512be6553f1ec69e20e27c7cc797068b..81cca68abdf5fa2e176d0121785bbdeed44377a7 100644
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -13,8 +13,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;
@@ -209,11 +207,8 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("hoglinBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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 49ed463ae7ef65b2630a5b914689e04fa729a40c..5ceca0b60903b6a5a51db009ac7e583eef24d119 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;
@@ -356,11 +354,8 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("piglinBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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 7baccc23f868ac9b8720bfd77b2af6b7dd368820..9cc8b965b5e39265e932e25253a1d5382cfa33c7 100644
--- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
+++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
@@ -7,8 +7,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;
@@ -153,11 +151,8 @@ public class PiglinBrute extends AbstractPiglin {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("piglinBruteBrain");
if (getRider() == null || this.isControllable()) // Purpur - only use brain if no rider
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 4f4bf16cfa1390f19a7e8745d86e42e24ffb3bbc..96db45d6885831c290ea6e29400633a502961f01 100644
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -25,8 +25,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;
@@ -302,11 +300,8 @@ public class Warden extends Monster implements VibrationSystem {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("wardenBrain");
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
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/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java
index 996468c21a79d698a8d842189ffd4f2dc86a4302..40fae3fdcd9fc875df1db02d8c0d1f2388e0436a 100644
--- a/net/minecraft/world/entity/npc/villager/Villager.java
+++ b/net/minecraft/world/entity/npc/villager/Villager.java
@@ -34,8 +34,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;
@@ -394,8 +392,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
protected void customServerAiStep(ServerLevel level, boolean inactive) { // Purpur - Lobotomize stuck villagers - not final
// Paper end - EAR 2
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("villagerBrain");
// Purpur start - Lobotomize stuck villagers
if (this.level().purpurConfig.villagerLobotomizeEnabled) {
// treat as inactive if lobotomized
@@ -408,7 +404,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
else if (this.isLobotomized && shouldRestock(level)) restock();
// Purpur end - Lobotomize stuck villagers
- profilerFiller.pop();
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
}
diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java
index 4e0b0d630e18bde916a07889bcaf0e7accf064ca..158e42d22da29a184d51c43e3e4ad4a1a41b0506 100644
--- a/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/net/minecraft/world/item/crafting/RecipeManager.java
@@ -27,7 +27,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
import net.minecraft.server.packs.resources.SimplePreparableReloadListener;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.item.crafting.display.RecipeDisplay;
import net.minecraft.world.item.crafting.display.RecipeDisplayEntry;
@@ -67,7 +66,7 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
}
@Override
- protected RecipeMap prepare(ResourceManager resourceManager, ProfilerFiller profiler) {
+ protected RecipeMap prepare(ResourceManager resourceManager) {
SortedMap<Identifier, Recipe<?>> map = new TreeMap<>();
SimpleJsonResourceReloadListener.scanDirectory(
resourceManager, RECIPE_LISTER, this.registries.createSerializationContext(JsonOps.INSTANCE), Recipe.CODEC, map
@@ -82,7 +81,7 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
}
@Override
- protected void apply(RecipeMap object, ResourceManager resourceManager, ProfilerFiller profiler) {
+ protected void apply(RecipeMap object, ResourceManager resourceManager) {
this.recipes = object;
LOGGER.info("Loaded {} recipes", object.values().size());
}
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 414cb1bd92e082dbe34a5078a4269fc98900e1f3..a2f6fe78fc822634ac5c2db9a88000add60134f4 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -35,7 +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.random.WeightedList;
import net.minecraft.world.TickRateManager;
import net.minecraft.world.attribute.EnvironmentAttributeSystem;
@@ -260,7 +259,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@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);
@@ -270,7 +268,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@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);
@@ -1726,7 +1723,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@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
@@ -1755,8 +1751,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
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);
@@ -1841,7 +1835,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
// Paper end - rewrite chunk system
public <T extends Entity> boolean hasEntities(EntityTypeTest<Entity, T> entityTypeTest, AABB bounds, Predicate<? super T> predicate) {
- Profiler.get().incrementCounter("hasEntities");
MutableBoolean mutableBoolean = new MutableBoolean();
this.getEntities().get(entityTypeTest, bounds, value -> {
if (predicate.test(value)) {
diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java
index 14e21c5439cfdf870feeccf638d6494a0c003d64..24cbfb900eeed9c666334ca178e6bc02abc25a77 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;
@@ -155,9 +153,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;
@@ -192,8 +187,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 efb92720ddfb5f0a95e8552a88dadc495736329a..cd032aee3ccb20b3499eb9770eeb3847a388bd9a 100644
--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
@@ -13,8 +13,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.EntityTypeTags;
import net.minecraft.util.Mth;
import net.minecraft.util.Util;
-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;
@@ -661,10 +659,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 435695ceef32d106f9b2a0af87a5a2c69cbb78c7..1cea69f07a0b28cf8b112c202c668b915bf1b88f 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -28,8 +28,6 @@ import net.minecraft.util.ProblemReporter;
import net.minecraft.util.debug.DebugStructureInfo;
import net.minecraft.util.debug.DebugSubscriptions;
import net.minecraft.util.debug.DebugValueSource;
-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;
@@ -397,12 +395,8 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot
}
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);
@@ -959,8 +953,6 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot
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);
@@ -974,8 +966,6 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot
}
// 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 168b475b38b2872b27c1ab15f6846323ac16dd2c..919769ae40efea904be6adbbb13542bd39bf0291 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.BooleanSupplier;
import java.util.function.Function;
import java.util.stream.Collectors;
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;
import org.jspecify.annotations.Nullable;
@@ -60,9 +57,6 @@ public class PathFinder {
}
private @Nullable Path findPath(Node node, List<Map.Entry<Target, BlockPos>> positions, float maxRange, int reachRange, float maxVisitedNodesMultiplier) { // Paper - optimize collection
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("find_path");
- profilerFiller.markForCharting(MetricCategory.PATH_FINDING);
// Set<Target> set = targetPositions.keySet(); // Paper - unused
node.g = 0.0F;
node.h = this.getBestH(node, positions); // Paper - optimize collection
@@ -137,7 +131,6 @@ public class PathFinder {
best = path;
}
}
- profilerFiller.pop();
if(asBoolean && best != null) {
Set<Target> set = Sets.newHashSet();
for(Map.Entry<Target, BlockPos> entry : positions) {
diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java
index b932f32d08ad663cd05910140c861045a9b1f922..a1e2b0c4dca30b32e5bae6f99d38084128127325 100644
--- a/net/minecraft/world/ticks/LevelTicks.java
+++ b/net/minecraft/world/ticks/LevelTicks.java
@@ -23,8 +23,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
import net.minecraft.core.Vec3i;
import net.minecraft.util.Util;
-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);
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) {
this.sortContainersToTick(gameTime);
- profiler.incrementCounter("containersToTick", this.containersToTick.size());
this.drainContainers(gameTime, maxAllowedTicks);
this.rescheduleLeftoverContainers();
}