9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00
Files
DivineMC/divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch
2025-10-11 17:08:32 +03:00

2896 lines
140 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 9aa09e11032f539952edeeed119f7705c330db0a..9a7a40c1dcea57ba674d8431077d2477104a456f 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -59,7 +59,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;
@@ -141,7 +140,6 @@ import net.minecraft.server.commands.WorldBorderCommand;
import net.minecraft.server.commands.data.DataCommands;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.TagKey;
-import net.minecraft.util.profiling.Profiler;
import net.minecraft.util.profiling.jfr.JvmProfiler;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.flag.FeatureFlags;
@@ -193,7 +191,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);
@@ -364,7 +361,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 {
@@ -402,8 +398,6 @@ public class Commands {
commandSourceStack.sendFailure(Component.literal(Util.describeError(var12)));
LOGGER.error("'/{}' threw an exception", command, var12);
}
- } finally {
- Profiler.get().pop();
}
}
@@ -460,7 +454,7 @@ public class Commands {
int max = Math.max(1, server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH));
int _int = server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT);
- try (ExecutionContext<CommandSourceStack> executionContext1 = new ExecutionContext<>(max, _int, Profiler.get())) {
+ try (ExecutionContext<CommandSourceStack> executionContext1 = new ExecutionContext<>(max, _int)) {
CURRENT_EXECUTION_CONTEXT.set(executionContext1);
contextConsumer.accept(executionContext1);
executionContext1.runCommandQueue();
diff --git a/net/minecraft/commands/execution/ExecutionContext.java b/net/minecraft/commands/execution/ExecutionContext.java
index 18c7fff36ca26a659fa8ea022c93ea65f3199181..444cc14e9b9e6b77254bc1c5ada00f8fcd185b93 100644
--- a/net/minecraft/commands/execution/ExecutionContext.java
+++ b/net/minecraft/commands/execution/ExecutionContext.java
@@ -20,7 +20,6 @@ public class ExecutionContext<T> implements AutoCloseable {
private static final Logger LOGGER = LogUtils.getLogger();
private final int commandLimit;
private final int forkLimit;
- private final ProfilerFiller profiler;
@Nullable
private TraceCallbacks tracer;
private int commandQuota;
@@ -29,10 +28,9 @@ public class ExecutionContext<T> implements AutoCloseable {
private final List<CommandQueueEntry<T>> newTopCommands = new ObjectArrayList<>();
private int currentFrameDepth;
- public ExecutionContext(int commandLimit, int forkLimit, ProfilerFiller profiler) {
+ public ExecutionContext(int commandLimit, int forkLimit) {
this.commandLimit = commandLimit;
this.forkLimit = forkLimit;
- this.profiler = profiler;
this.commandQuota = commandLimit;
}
@@ -132,7 +130,7 @@ public class ExecutionContext<T> implements AutoCloseable {
}
public ProfilerFiller profiler() {
- return this.profiler;
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
}
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 5d761c36739981897fe165148e528ef6b0e80b8d..18c3599ceb7a1c9dc769af0ad4c3eff9e37e2a76 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -117,20 +117,9 @@ import net.minecraft.util.TimeUtil;
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;
@@ -203,13 +192,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public LevelStorageSource.LevelStorageAccess storageSource;
public final PlayerDataStorage playerDataStorage;
private final List<Runnable> tickables = Lists.newArrayList();
- private MetricsRecorder metricsRecorder = InactiveMetricsRecorder.INSTANCE;
- private Consumer<ProfileResults> onMetricsRecordingStopped = results -> this.stopRecordingMetrics();
- private Consumer<Path> onMetricsRecordingFinished = path -> {};
- private boolean willStartRecordingMetrics;
- @Nullable
- private MinecraftServer.TimeProfiler debugCommandProfiler;
- private boolean debugCommandProfilerDelayStart;
private ServerConnectionListener connection;
// Paper - per world load listener - moved LevelLoadListener to ServerLevel
@Nullable
@@ -993,9 +975,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
@@ -1164,10 +1143,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
@@ -1176,38 +1151,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().location()); // 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();
@@ -1252,7 +1212,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.waitingForNextTick = false;
}
- profiler.pop();
}
// Paper end - improve tick loop
@@ -1340,44 +1299,32 @@ 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())) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("tick");
- this.tickFrame.start();
- this.runAllTasksAtTickStart(); // Paper - improve tick loop
- this.tickServer(flag ? () -> false : this::haveTime);
- // Paper start - rewrite chunk system
- final Throwable crash = this.chunkSystemCrash;
- if (crash != null) {
- this.chunkSystemCrash = null;
- throw new RuntimeException("Chunk system crash propagated to tick()", crash);
- }
- // Paper end - rewrite chunk system
- this.tickFrame.end();
- this.recordEndOfTick(); // Paper - improve tick loop
- profilerFiller.popPush("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.tickFrame.start();
+ this.runAllTasksAtTickStart(); // Paper - improve tick loop
+ this.tickServer(flag ? () -> false : this::haveTime);
+ // Paper start - rewrite chunk system
+ final Throwable crash = this.chunkSystemCrash;
+ if (crash != null) {
+ this.chunkSystemCrash = null;
+ throw new RuntimeException("Chunk system crash propagated to tick()", crash);
+ }
+ // Paper end - rewrite chunk system
+ this.tickFrame.end();
+ this.recordEndOfTick(); // Paper - improve tick loop
+ 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);
}
@@ -1485,7 +1432,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
protected void waitUntilNextTick() {
- ProfilerFiller profilerFiller = Profiler.get();
// Paper - improve tick loop - moved to start of tick
this.waitingForNextTick = true;
@@ -1550,7 +1496,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public void doRunTask(TickTask task) {
- Profiler.get().incrementCounter("runTask");
super.doRunTask(task);
}
@@ -1640,12 +1585,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;
@@ -1660,10 +1603,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();
@@ -1671,7 +1613,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];
@@ -1679,16 +1620,12 @@ 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();
}
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");
}
@@ -1756,7 +1693,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
@@ -1771,9 +1707,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
@@ -1810,17 +1744,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().location());
/* Drop global time updates
if (this.tickCount % 20 == 0) {
- profilerFiller.push("timeSync");
this.synchronizeTime(serverLevel);
- profilerFiller.pop();
}
// CraftBukkit end */
- profilerFiller.push("tick");
-
try {
serverLevel.tick(hasTimeLeft);
} catch (Throwable var7) {
@@ -1829,37 +1758,25 @@ 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 (int i = 0; i < this.tickables.size(); i++) {
this.tickables.get(i).run();
}
- profilerFiller.popPush("send chunks");
-
for (ServerPlayer serverPlayer : this.playerList.getPlayers()) {
serverPlayer.connection.chunkSender.sendNextChunks(serverPlayer);
serverPlayer.connection.resumeFlushing();
}
-
- profilerFiller.pop();
}
// Paper start - per world respawn data - read "server global" respawn data from overworld dimension reference
@@ -1884,14 +1801,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void forceTimeSynchronization() {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("timeSync");
-
for (ServerLevel serverLevel : this.getAllLevels()) {
this.synchronizeTime(serverLevel);
}
-
- profilerFiller.pop();
}
public boolean isAllowedToEnterPortal(Level level) {
@@ -2736,55 +2648,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);
}
@@ -2834,24 +2697,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;
}
@@ -2999,55 +2844,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
}
- static class TimeProfiler {
- final long startNanos;
- final int startTick;
-
- TimeProfiler(long startNanos, int startTick) {
- this.startNanos = startNanos;
- this.startTick = startTick;
- }
-
- ProfileResults stop(final long endTimeNano, final int endTimeTicks) {
- return new ProfileResults() {
- @Override
- public List<ResultField> getTimes(String sectionPath) {
- return Collections.emptyList();
- }
-
- @Override
- public boolean saveResults(Path path) {
- return false;
- }
-
- @Override
- public long getStartTimeNano() {
- return TimeProfiler.this.startNanos;
- }
-
- @Override
- public int getStartTimeTicks() {
- return TimeProfiler.this.startTick;
- }
-
- @Override
- public long getEndTimeNano() {
- return endTimeNano;
- }
-
- @Override
- public int getEndTimeTicks() {
- return endTimeTicks;
- }
-
- @Override
- public String getProfilerResults() {
- return "";
- }
- };
- }
- }
-
// Paper start - Add tick times API and /mspt command
public static class TickTimes {
private final long[] times;
diff --git a/net/minecraft/server/ReloadableServerResources.java b/net/minecraft/server/ReloadableServerResources.java
index c891715968193f2ab4579b4a2b4aeeae6a210070..7b0cf6cdd0eeaea228380c5960704e632d97de98 100644
--- a/net/minecraft/server/ReloadableServerResources.java
+++ b/net/minecraft/server/ReloadableServerResources.java
@@ -99,7 +99,7 @@ public class ReloadableServerResources {
backgroundExecutor,
gameExecutor,
DATA_RELOAD_INITIAL_TASK,
- LOGGER.isDebugEnabled()
+ false // DivineMC - Completely remove Mojang profiler
)
.done()
.thenApply(object -> reloadableServerResources);
diff --git a/net/minecraft/server/ServerAdvancementManager.java b/net/minecraft/server/ServerAdvancementManager.java
index a524f5b9aa082ada267c8e20df4ff4d22a76d281..339626862c33bca9cbc34acc520ba5d7831e189f 100644
--- a/net/minecraft/server/ServerAdvancementManager.java
+++ b/net/minecraft/server/ServerAdvancementManager.java
@@ -17,7 +17,6 @@ import net.minecraft.resources.ResourceLocation;
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.slf4j.Logger;
public class ServerAdvancementManager extends SimpleJsonResourceReloadListener<Advancement> {
@@ -32,7 +31,7 @@ public class ServerAdvancementManager extends SimpleJsonResourceReloadListener<A
}
@Override
- protected void apply(Map<ResourceLocation, Advancement> object, ResourceManager resourceManager, ProfilerFiller profiler) {
+ protected void apply(Map<ResourceLocation, Advancement> object, ResourceManager resourceManager) {
Builder<ResourceLocation, AdvancementHolder> builder = ImmutableMap.builder();
object.forEach((resourceLocation, advancement) -> {
// Spigot start
diff --git a/net/minecraft/server/ServerFunctionManager.java b/net/minecraft/server/ServerFunctionManager.java
index e3cb5d9cd0332c32df82fa6aef37401c523e8af0..10c79570432491bfb2bbfedf0491ab2b803d0c71 100644
--- a/net/minecraft/server/ServerFunctionManager.java
+++ b/net/minecraft/server/ServerFunctionManager.java
@@ -14,8 +14,6 @@ import net.minecraft.commands.execution.ExecutionContext;
import net.minecraft.commands.functions.CommandFunction;
import net.minecraft.commands.functions.InstantiatedFunction;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public class ServerFunctionManager {
@@ -50,19 +48,12 @@ public class ServerFunctionManager {
}
private void executeTagFunctions(Collection<CommandFunction<CommandSourceStack>> functionObjects, ResourceLocation identifier) {
- Profiler.get().push(identifier::toString);
-
for (CommandFunction<CommandSourceStack> commandFunction : functionObjects) {
this.execute(commandFunction, this.getGameLoopSender());
}
-
- Profiler.get().pop();
}
public void execute(CommandFunction<CommandSourceStack> function, CommandSourceStack source) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push(() -> "function " + function.id());
-
try {
InstantiatedFunction<CommandSourceStack> instantiatedFunction = function.instantiate(null, this.getDispatcher());
Commands.executeCommandInContext(
@@ -72,8 +63,6 @@ public class ServerFunctionManager {
} catch (FunctionInstantiationException var9) {
} catch (Exception var10) {
LOGGER.warn("Failed to execute function {}", function.id(), var10);
- } finally {
- profilerFiller.pop();
}
}
diff --git a/net/minecraft/server/commands/DebugCommand.java b/net/minecraft/server/commands/DebugCommand.java
deleted file mode 100644
index a78213464c5c365c6395fdf1295cb406c618d33b..0000000000000000000000000000000000000000
--- a/net/minecraft/server/commands/DebugCommand.java
+++ /dev/null
@@ -1,277 +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.Util;
-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.ResourceLocation;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.util.TimeUtil;
-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(3))
- .then(Commands.literal("start").executes(commandContext -> start(commandContext.getSource())))
- .then(Commands.literal("stop").executes(context -> stop(context.getSource())))
- .then(
- Commands.literal("function")
- .requires(Commands.hasPermission(3))
- .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(2);
- 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, ResourceLocation 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 component) {
- this.newLine();
- this.printIndent(this.lastIndent + 1);
- this.output.print("[M] ");
- this.output.println(component.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 b10cb4a73df58a5fe64e88868733ba41616f59e4..9f9cbe6056f8a4eeca64c40872d7403bb0ddc600 100644
--- a/net/minecraft/server/commands/PerfCommand.java
+++ b/net/minecraft/server/commands/PerfCommand.java
@@ -19,9 +19,6 @@ import net.minecraft.network.chat.Component;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.FileZipper;
import net.minecraft.util.TimeUtil;
-import net.minecraft.util.profiling.EmptyProfileResults;
-import net.minecraft.util.profiling.ProfileResults;
-import net.minecraft.util.profiling.metrics.storage.MetricsPersister;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
@@ -42,66 +39,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 231935f74443241a710ed2099bb32090ef34731d..7486df33cedea98695c614bb3d584e1d8e84314f 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -1046,12 +1046,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 4221af18f5087badb5cd8c7cf66ab3312edf0394..e9d861182439eecacfab2ac431726e8adeaab3aa 100644
--- a/net/minecraft/server/level/ChunkGenerationTask.java
+++ b/net/minecraft/server/level/ChunkGenerationTask.java
@@ -5,8 +5,6 @@ import java.util.List;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable;
import net.minecraft.util.StaticCache2D;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.Zone;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.status.ChunkDependencies;
@@ -67,7 +65,6 @@ public class ChunkGenerationTask {
chunkStatus = ChunkStatus.getStatusList().get(this.scheduledStatus.getIndex() + 1);
}
- this.scheduleLayer(chunkStatus, this.needsGeneration);
this.scheduledStatus = chunkStatus;
}
@@ -112,22 +109,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 b488fcae8c961bd7c9319b8acdd65723de6981e9..6251e7dc5bbe7eee18b0c5a8979d9218fee728d0 100644
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -64,8 +64,6 @@ import net.minecraft.util.CsvOutput;
import net.minecraft.util.Mth;
import net.minecraft.util.StaticCache2D;
import net.minecraft.util.TriState;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.thread.BlockableEventLoop;
import net.minecraft.util.thread.ConsecutiveExecutor;
import net.minecraft.world.entity.Entity;
@@ -413,15 +411,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick(BooleanSupplier hasMoreTime) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("poi");
this.poiManager.tick(hasMoreTime);
- profilerFiller.popPush("chunk_unload");
if (!this.level.noSave()) {
this.processUnloads(hasMoreTime);
}
-
- profilerFiller.pop();
}
public boolean hasWork() {
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
index 413f0673557b9e3f9177d15e9bef61bded209e34..301b45e375dafeefed56eb0db5dd51eea4c97459 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -27,8 +27,6 @@ import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.server.MinecraftServer;
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;
@@ -467,37 +465,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();
}
@@ -506,22 +495,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) {
@@ -530,11 +512,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;
@@ -580,14 +560,11 @@ 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
this.shuffleRandom.setSeed(this.level.random.nextLong());
if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled
// Paper end - chunk tick iteration optimisation
- profiler.popPush("tickSpawningChunks");
for (LevelChunk levelChunk : list) {
this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, spawnState);
@@ -596,14 +573,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
list.clear();
}
- profiler.popPush("tickTickingChunks");
this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimisations
if (_boolean) {
- profiler.popPush("customSpawners");
this.level.tickCustomSpawners(this.spawnEnemies);
}
-
- profiler.pop();
}
private void tickSpawningChunk(LevelChunk chunk, long timeInhabited, List<MobCategory> spawnCategories, NaturalSpawner.SpawnState spawnState) {
@@ -824,7 +797,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 e4d9bf14564d5984da64b1ecefc589c740817c47..cea6213837b001d7a494d17aa7e6e326abd1b2fc 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -77,8 +77,6 @@ import net.minecraft.util.RandomSource;
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;
@@ -753,16 +751,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
public void tick(BooleanSupplier hasTimeLeft) {
- ProfilerFiller profilerFiller = Profiler.get();
this.handlingTick = true;
TickRateManager tickRateManager = this.tickRateManager();
boolean runsNormally = tickRateManager.runsNormally();
if (runsNormally) {
- profilerFiller.push("world border");
this.getWorldBorder().tick();
- profilerFiller.popPush("weather");
this.advanceWeatherCycle();
- profilerFiller.pop();
}
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
@@ -796,30 +790,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();
@@ -830,11 +816,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
@@ -843,9 +826,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) {
@@ -856,23 +837,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));
@@ -881,7 +855,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
this.debugSynchronizers.tick(this.server.debugSubscribers());
- profilerFiller.pop();
}
@Override
@@ -896,9 +869,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (this.tickTime) {
long l = this.levelData.getGameTime() + 1L;
this.serverLevelData.setGameTime(l);
- Profiler.get().push("scheduledFunctions");
this.serverLevelData.getScheduledEvents().tick(this.server, l);
- Profiler.get().pop();
if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
// Purpur start - Configurable daylight cycle
int incrementTicks = isBrightOutside() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks;
@@ -998,8 +969,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++) {
@@ -1009,12 +978,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) {
@@ -1022,8 +988,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)) {
@@ -1057,8 +1021,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
}
}
-
- profilerFiller.pop();
}
@VisibleForTesting
@@ -1402,17 +1364,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
@@ -1433,9 +1391,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();
@@ -1447,7 +1402,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 14bb0ae1e913adf25f86aa29487fa5f80d2c6c41..161dbd49495c33fb938a6312b6e24912474864c5 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -110,8 +110,6 @@ import net.minecraft.util.Mth;
import net.minecraft.util.ProblemReporter;
import net.minecraft.util.Unit;
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;
@@ -1560,14 +1558,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.unsetRemoved();
*/
// CraftBukkit end
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("moving");
if (level != null && resourceKey == net.minecraft.world.level.dimension.LevelStem.OVERWORLD && level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER) { // CraftBukkit - empty to fall through to null to event
this.enteredNetherPosition = this.position();
}
- profilerFiller.pop();
- profilerFiller.push("placing");
// CraftBukkit start
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
LevelData worlddata = level.getLevelData();
@@ -1585,7 +1579,6 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
level.addDuringTeleport(this);
- profilerFiller.pop();
this.triggerDimensionChangeTriggers(serverLevel);
this.stopUsingItem();
this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities()));
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index e98400719a4ab43dc0ce90cdca19ba86e4849720..4a333e87af17bd5b673b57c0fa0d3a239fb8db59 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -27,7 +27,6 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ClientInformation;
import net.minecraft.server.players.NameAndId;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
import org.slf4j.Logger;
public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener {
@@ -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 2a4acd6630d22c5004febcfb7e1298282523d1e1..06043c8fadeb6250a2950499ee67e8b677c39f4f 100644
--- a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
+++ b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
@@ -9,8 +9,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import net.minecraft.Util;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public class ProfiledReloadInstance extends SimpleReloadInstance<ProfiledReloadInstance.State> {
@@ -71,13 +69,10 @@ public class ProfiledReloadInstance extends SimpleReloadInstance<ProfiledReloadI
private static Executor profiledExecutor(Executor executor, AtomicLong timeTaken, AtomicLong timesRun, String name) {
return runnable -> executor.execute(() -> {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push(name);
long nanos = Util.getNanos();
runnable.run();
timeTaken.addAndGet(Util.getNanos() - nanos);
timesRun.incrementAndGet();
- profilerFiller.pop();
});
}
diff --git a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
index 09d5e178614f73dfe332220f4f02b71183ee8df7..7e5bb7708e01d9206bb49bfbf195f9e656466cd1 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 = sharedState.resourceManager();
return barrier.wait(Unit.INSTANCE).thenRunAsync(() -> {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("listener");
this.onResourceManagerReload(resourceManager);
- profilerFiller.pop();
}, applyExectutor);
}
diff --git a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java
index 16bab14884a5a7b8d7659379f5b7ea90aa9bd737..a2320c37e4ef495eae7a1978aa7c7dc642aefdf9 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.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.StrictJsonParser;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public abstract class SimpleJsonResourceReloadListener<T> extends SimplePreparableReloadListener<Map<ResourceLocation, T>> {
@@ -41,7 +40,7 @@ public abstract class SimpleJsonResourceReloadListener<T> extends SimplePreparab
}
@Override
- protected Map<ResourceLocation, T> prepare(ResourceManager resourceManager, ProfilerFiller profiler) {
+ protected Map<ResourceLocation, T> prepare(ResourceManager resourceManager) {
Map<ResourceLocation, 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 11884fc390d73b476632c372eb2d3d7876cdb7fd..6a4a63de2da352094d58c3c80c54ec164e7c0b58 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 sharedState, Executor exectutor, PreparableReloadListener.PreparationBarrier barrier, Executor applyExectutor
) {
ResourceManager resourceManager = sharedState.resourceManager();
- return CompletableFuture.<T>supplyAsync(() -> this.prepare(resourceManager, Profiler.get()), exectutor)
+ return CompletableFuture.<T>supplyAsync(() -> this.prepare(resourceManager), exectutor)
.thenCompose(barrier::wait)
- .thenAcceptAsync(object -> this.apply((T)object, resourceManager, Profiler.get()), applyExectutor);
+ .thenAcceptAsync(object -> this.apply((T)object, resourceManager), applyExectutor);
}
- 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 f4aa10bbd98f514f27224346b3b9332f2218602d..ff319fa2ddea43d5b3c55897b1aaaf9fe137abbc 100644
--- a/net/minecraft/util/thread/AbstractConsecutiveExecutor.java
+++ b/net/minecraft/util/thread/AbstractConsecutiveExecutor.java
@@ -7,13 +7,9 @@ import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.atomic.AtomicReference;
import net.minecraft.Util;
-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 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 +20,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 +103,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 ef29b33db3a665621f35a7480892c65fd9045a5a..e22b658f90d48ef59b5e7b4d0278f2ba7e05ee51 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
@@ -182,11 +177,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 2c4ed31a6573248a6730933fe447dbaf1856ea6d..79d224baca372cb1b6b89f7fcb63c5fe3707adb5 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -82,8 +82,6 @@ import net.minecraft.util.RandomSource;
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;
@@ -880,8 +878,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.inBlockState = null;
if (this.isPassenger() && this.getVehicle().isRemoved()) {
@@ -935,8 +931,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();
}
public void setSharedFlagOnFire(boolean isOnFire) {
@@ -1162,8 +1156,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);
@@ -1175,7 +1167,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
@@ -1200,8 +1191,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;
@@ -1224,7 +1213,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
}
if (this.isRemoved()) {
- profilerFiller.pop();
} else {
if (this.horizontalCollision) {
Vec3 deltaMovement = this.getDeltaMovement();
@@ -1268,7 +1256,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
@@ -3541,8 +3528,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) {
@@ -3552,8 +3537,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
this.teleport(portalDestination);
}
}
-
- profilerFiller.pop();
} else if (this.portalProcess.hasExpired()) {
this.portalProcess = null;
}
@@ -4120,15 +4103,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;
}
@@ -4145,11 +4125,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
@@ -4169,7 +4146,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 06ccbb08ddb0ed8c9f6e1be4d6306b79484c1467..4e8594985442fe4371504fca697569bd3c58339d 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -70,8 +70,6 @@ import net.minecraft.tags.FluidTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.Difficulty;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.damagesource.CombatRules;
@@ -440,8 +438,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()) {
@@ -528,7 +524,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() {
@@ -3402,11 +3397,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;
@@ -3418,7 +3409,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 {
@@ -3594,21 +3584,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()) {
@@ -3637,8 +3621,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.noJumpDelay = 0;
}
- profilerFiller.pop();
- profilerFiller.push("travel");
if (this.isFallFlying()) {
this.updateFallFlying();
}
@@ -3663,9 +3645,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));
}
@@ -3675,18 +3655,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 3f2e4b48b0ac7f2062c2cbeab36e14eb1c46e3f9..c3a7a41b399590e2c004fda4e97b1935575c4972 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;
@@ -332,8 +330,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();
@@ -341,7 +337,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
@Override
public void aiStep() {
super.aiStep();
- 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 Vec3i getPickupReach() {
@@ -791,42 +782,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 3e427a7e8be0e15bf867948ee21e838a8a9c3408..1f45b389553cd5782972193537ce7adcd9c7c600 100644
--- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -12,8 +12,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;
@@ -195,13 +193,10 @@ public abstract class PathNavigation {
}
}
// Paper end - EntityPathfindEvent
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("pathfind");
BlockPos blockPos = offsetUpward ? this.mob.blockPosition().above() : this.mob.blockPosition();
int i = (int)(followRange + regionOffset);
PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i));
Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, targets, followRange, accuracy, this.maxVisitedNodesMultiplier);
- profilerFiller.pop();
if (path != null && path.getTarget() != null) {
this.targetPos = path.getTarget();
this.reachRange = accuracy;
diff --git a/net/minecraft/world/entity/ai/sensing/Sensing.java b/net/minecraft/world/entity/ai/sensing/Sensing.java
index c569074403b1d8b443aaa98ba9cf9bbd0e98bd2d..b1aa7294f9479f45fcde77c5ea46db9f62370abf 100644
--- a/net/minecraft/world/entity/ai/sensing/Sensing.java
+++ b/net/minecraft/world/entity/ai/sensing/Sensing.java
@@ -2,8 +2,6 @@ package net.minecraft.world.entity.ai.sensing;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Mob;
@@ -28,10 +26,7 @@ public class Sensing {
} else if (this.unseen.contains(id)) {
return false;
} else {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("hasLineOfSight");
boolean hasLineOfSight = this.mob.hasLineOfSight(entity);
- profilerFiller.pop();
if (hasLineOfSight) {
this.seen.add(id);
} else {
diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java
index 5b08703e27a9e92fb4bcd019661b1407078c24e1..7fae9853c117cda03c516afc1508493af460fa8a 100644
--- a/net/minecraft/world/entity/animal/HappyGhast.java
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
@@ -13,8 +13,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;
@@ -430,13 +428,8 @@ public class HappyGhast extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
if (this.isBaby()) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("happyGhastBrain");
((Brain<HappyGhast>)this.brain).tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("happyGhastActivityUpdate");
HappyGhastAi.updateActivity(this);
- profilerFiller.pop();
}
this.checkRestriction();
diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java
index d2665a3bc4602ca8e9635bc9f8104c7ad8eacc5a..3a2451bfa5e59de51d703eac8a536284e1d3348b 100644
--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -24,8 +24,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 e3fad2dbf9f8e0523082540ecbd46a0b13a36101..5448b010f98e5c0da6e62ef9f91652747eddd650 100644
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -22,8 +22,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,13 +159,8 @@ public class Armadillo extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("armadilloBrain");
((Brain<Armadillo>)this.brain).tick(level, this);
- profilerFiller.pop();
- profilerFiller.push("armadilloActivityUpdate");
ArmadilloAi.updateActivity(this);
- profilerFiller.pop();
if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) {
this.forceDrops = true; // CraftBukkit
if (this.dropFromGiftLootTable(level, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) {
diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index 08fb591e860b7b2b93b42bfc7a91d63999567dc6..1927f8be451258d9f0f8eec1617d103a4140e1e7 100644
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -30,8 +30,6 @@ import net.minecraft.util.ByIdMap;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -374,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 bb750bcc35a3dd75c112dea445595ab27cc15fd5..5a436ae8893cd91944e8269f11c29bc82217c755 100644
--- a/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
@@ -17,8 +17,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 e18364baff00dc08aad75e0d40e86ae14fec56ad..1a504e30602d7d8feaf7a9180adf6382596aae02 100644
--- a/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
@@ -27,8 +27,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;
@@ -260,14 +258,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 4586969e406b24639893a393e2ebe19ec5b224ea..8312a0d5229043fd84125db809c4346bb80f2bc0 100644
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -11,8 +11,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 99980c9a69b51f81a9cd4429d59fab9497d79656..80714e2a6e74047af89680c261e2dbc097d86062 100644
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -19,8 +19,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/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index 204a9ee08668d12368b5c0e9ed990d0a4624b925..b77b763a3eb58b3135ad9c9cbb8a39f67393397d 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;
@@ -496,13 +494,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 e0ee4f71786dce5690cf75bb55def05c8608c8d2..2eb7f602f452917b5d88fd8237898dff920cf0a9 100644
--- a/net/minecraft/world/entity/monster/Zoglin.java
+++ b/net/minecraft/world/entity/monster/Zoglin.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.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 11408fd409eb00e6bf3289e6a5a35e98178fa6e2..44d638d5d96a58bcfd35cc8e2e0c08389717e48f 100644
--- a/net/minecraft/world/entity/monster/breeze/Breeze.java
+++ b/net/minecraft/world/entity/monster/breeze/Breeze.java
@@ -14,8 +14,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 c05d572fa2ab5a70c8825d2d2b6ffb36317e92fe..ffa881eb837aff53d50d0ffe8af44bbe2d0aeb6a 100644
--- a/net/minecraft/world/entity/monster/creaking/Creaking.java
+++ b/net/minecraft/world/entity/monster/creaking/Creaking.java
@@ -15,8 +15,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;
@@ -235,10 +233,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 08c3372555d098b62465437798bf6cbd08e73ec5..b22519a6d39bd52381fa6c17b9a415944374368b 100644
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -14,8 +14,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;
@@ -207,11 +205,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 000391f95bf2881765c304aecb013eb313d55ba1..dea7c211a2d2ee8f1833eaad49513b3690b06c55 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;
@@ -347,11 +345,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 70ee15527fa6f30783d6a58bb767b18124f25c53..c4eb58d0b0c51e930f9cb72e1de0103902badba7 100644
--- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
+++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
@@ -8,8 +8,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntitySpawnReason;
@@ -154,11 +152,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 137510f81e6454f45010f8d96001ad1ebdddfde6..ac7691a2a3e4c9db040408d1ecba780a89dea50e 100644
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -26,8 +26,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.java b/net/minecraft/world/entity/npc/Villager.java
index dda4563b0f0d6f0d1a0ccd64a4ec787bf27abf2d..3bcd3b7c9f7ad408d66fad5b1b70ebee96a61b43 100644
--- a/net/minecraft/world/entity/npc/Villager.java
+++ b/net/minecraft/world/entity/npc/Villager.java
@@ -35,8 +35,6 @@ import net.minecraft.stats.Stats;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.Mth;
import net.minecraft.util.SpawnUtil;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.Difficulty;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
@@ -393,8 +391,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
@@ -407,7 +403,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
else if (this.isLobotomized && shouldRestock()) 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 07d7c4737635f671f33b8f73001d67928fc75782..f2c82217811712625df594667330a73f8f44e261 100644
--- a/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/net/minecraft/world/item/crafting/RecipeManager.java
@@ -28,7 +28,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<ResourceLocation, 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 abde1d66d545a5aded66a908473aa52b3c7a9ce8..cd42348d3bd64aa8cabc337f57b56a7243887ef6 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -36,7 +36,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.DifficultyInstance;
import net.minecraft.world.TickRateManager;
@@ -259,7 +258,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);
@@ -269,7 +267,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);
@@ -1735,7 +1732,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
@@ -1764,8 +1760,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);
@@ -1850,7 +1844,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 c2e35467752c6cf5677fe8beee3145187a0090fc..b3649c97e5452d8cc6b7230891e827c6b460af44 100644
--- a/net/minecraft/world/level/NaturalSpawner.java
+++ b/net/minecraft/world/level/NaturalSpawner.java
@@ -24,8 +24,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;
@@ -154,9 +152,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;
@@ -191,8 +186,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 c0c87b7c8e0b6b941fe8a63dc361504e94459d86..3c4de8b43a5658e02ddce7db9f453bfd344703e3 100644
--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
@@ -14,8 +14,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.EntityTypeTags;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
@@ -657,10 +655,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/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java
index b84c03cb0bddfc6fdc362a5e1432b25f67e7e23d..98abda72d88fb38a5427a15cc59094f3a7db30dc 100644
--- a/net/minecraft/world/level/pathfinder/PathFinder.java
+++ b/net/minecraft/world/level/pathfinder/PathFinder.java
@@ -13,9 +13,6 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
-import net.minecraft.util.profiling.metrics.MetricCategory;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.PathNavigationRegion;
@@ -62,9 +59,6 @@ public class PathFinder {
@Nullable
private Path findPath(Node node, List<Map.Entry<Target, BlockPos>> positions, float maxRange, int accuracy, float searchDepthMultiplier) { // Paper - optimize collection
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("find_path");
- profilerFiller.markForCharting(MetricCategory.PATH_FINDING);
// Set<Target> set = targetPositions.keySet(); // Paper - unused
node.g = 0.0F;
node.h = this.getBestH(node, positions); // Paper - optimize collection
@@ -136,7 +130,6 @@ public class PathFinder {
best = path;
}
}
- profilerFiller.pop();
return best;
// Paper end - Perf: remove streams and optimize collection
}
diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java
index 7ea0273018b1a364a5e2b7bf57da840383c8ffa5..c7f9485191dc797de78e6524c5c2c737581ed838 100644
--- a/net/minecraft/world/ticks/LevelTicks.java
+++ b/net/minecraft/world/ticks/LevelTicks.java
@@ -23,8 +23,6 @@ import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
import net.minecraft.core.Vec3i;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
@@ -80,20 +78,13 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
}
public void tick(long gameTime, int maxAllowedTicks, BiConsumer<BlockPos, T> ticker) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("collect");
- this.collectTicks(gameTime, maxAllowedTicks, profilerFiller);
- profilerFiller.popPush("run");
- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size());
+ this.collectTicks(gameTime, maxAllowedTicks);
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();
}