9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-31 12:56:29 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0006-Remove-vanilla-profiler.patch
Dreeam 3b162fb788 Move Purpur patches to first
To reduce the difficulty on maintenance and reduce chances to fix conflicts on updating
2025-10-01 18:27:42 -04:00

2352 lines
113 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Thu, 22 Dec 2022 22:32:18 +0100
Subject: [PATCH] Remove vanilla profiler
License: MIT (https://opensource.org/licenses/MIT)
Gale - https://galemc.org
This patch is based on the following patch:
"Remove Mojang Profiler"
By: BillyGalbreath <blake.galbreath@gmail.com>
As part of: Purpur (https://github.com/PurpurMC/Purpur)
Licensed under: MIT (https://opensource.org/licenses/MIT)
* Purpur copyright *
MIT License
Copyright (c) 2019-2022 PurpurMC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index 2408a65d64847d13476b2bf77bdf56f205d28795..a41a6cbf08a636309b2e4cf527ab8922a09f784c 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -58,7 +58,6 @@ import net.minecraft.server.commands.CloneCommands;
import net.minecraft.server.commands.DamageCommand;
import net.minecraft.server.commands.DataPackCommand;
import net.minecraft.server.commands.DeOpCommands;
-import net.minecraft.server.commands.DebugCommand;
import net.minecraft.server.commands.DebugConfigCommand;
import net.minecraft.server.commands.DebugMobSpawningCommand;
import net.minecraft.server.commands.DebugPathCommand;
@@ -139,7 +138,6 @@ import net.minecraft.server.commands.WorldBorderCommand;
import net.minecraft.server.commands.data.DataCommands;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.TagKey;
-import net.minecraft.util.profiling.Profiler;
import net.minecraft.util.profiling.jfr.JvmProfiler;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.flag.FeatureFlags;
@@ -191,7 +189,6 @@ public class Commands {
DamageCommand.register(this.dispatcher, context);
DataCommands.register(this.dispatcher);
DataPackCommand.register(this.dispatcher, context);
- DebugCommand.register(this.dispatcher);
DefaultGameModeCommands.register(this.dispatcher);
DialogCommand.register(this.dispatcher, context);
DifficultyCommand.register(this.dispatcher);
@@ -363,7 +360,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 {
@@ -401,8 +397,6 @@ public class Commands {
commandSourceStack.sendFailure(Component.literal(Util.describeError(var12)));
LOGGER.error("'/{}' threw an exception", command, var12);
}
- } finally {
- Profiler.get().pop();
}
}
@@ -459,7 +453,7 @@ public class Commands {
int max = Math.max(1, server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH));
int _int = server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT);
- try (ExecutionContext<CommandSourceStack> executionContext1 = new ExecutionContext<>(max, _int, Profiler.get())) {
+ try (ExecutionContext<CommandSourceStack> executionContext1 = new ExecutionContext<>(max, _int)) { // Gale - Purpur - remove vanilla profiler
CURRENT_EXECUTION_CONTEXT.set(executionContext1);
contextConsumer.accept(executionContext1);
executionContext1.runCommandQueue();
diff --git a/net/minecraft/commands/execution/ExecutionContext.java b/net/minecraft/commands/execution/ExecutionContext.java
index 18c7fff36ca26a659fa8ea022c93ea65f3199181..5844db9e913ccb6a351907875aea2f37c3b4ceea 100644
--- a/net/minecraft/commands/execution/ExecutionContext.java
+++ b/net/minecraft/commands/execution/ExecutionContext.java
@@ -20,7 +20,6 @@ public class ExecutionContext<T> implements AutoCloseable {
private static final Logger LOGGER = LogUtils.getLogger();
private final int commandLimit;
private final int forkLimit;
- private final ProfilerFiller profiler;
@Nullable
private TraceCallbacks tracer;
private int commandQuota;
@@ -29,10 +28,9 @@ public class ExecutionContext<T> implements AutoCloseable {
private final List<CommandQueueEntry<T>> newTopCommands = new ObjectArrayList<>();
private int currentFrameDepth;
- public ExecutionContext(int commandLimit, int forkLimit, ProfilerFiller profiler) {
+ public ExecutionContext(int commandLimit, int forkLimit) { // Gale - Purpur - remove vanilla profiler
this.commandLimit = commandLimit;
this.forkLimit = forkLimit;
- this.profiler = profiler;
this.commandQuota = commandLimit;
}
@@ -132,7 +130,7 @@ public class ExecutionContext<T> implements AutoCloseable {
}
public ProfilerFiller profiler() {
- return this.profiler;
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Gale - Purpur - remove vanilla profiler
}
public int forkLimit() {
diff --git a/net/minecraft/commands/execution/tasks/BuildContexts.java b/net/minecraft/commands/execution/tasks/BuildContexts.java
index 569abbea01f585990d2017c68580257275bbb06d..46cf0f3ab7146ba2f37eb1a3ef97eca864219eae 100644
--- a/net/minecraft/commands/execution/tasks/BuildContexts.java
+++ b/net/minecraft/commands/execution/tasks/BuildContexts.java
@@ -42,9 +42,6 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
ChainModifiers chainModifiers1 = chainModifiers;
List<T> list = sources;
if (contextChain.getStage() != Stage.EXECUTE) {
- context.profiler().push(() -> "prepare " + this.commandInput);
-
- try {
for (int forkLimit = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) {
CommandContext<T> topContext = contextChain.getTopContext();
if (topContext.isForked()) {
@@ -84,9 +81,6 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
list = list1;
}
}
- } finally {
- context.profiler().pop();
- }
}
if (list.isEmpty()) {
diff --git a/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/net/minecraft/commands/execution/tasks/ExecuteCommand.java
index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..e30bb9c4046200c1a6e4e917d15b205f5e0f21c3 100644
--- a/net/minecraft/commands/execution/tasks/ExecuteCommand.java
+++ b/net/minecraft/commands/execution/tasks/ExecuteCommand.java
@@ -23,7 +23,6 @@ public class ExecuteCommand<T extends ExecutionCommandSource<T>> implements Unbo
@Override
public void execute(T source, ExecutionContext<T> executionContext, Frame frame) {
- executionContext.profiler().push(() -> "execute " + this.commandInput);
try {
executionContext.incrementCost();
@@ -34,8 +33,6 @@ public class ExecuteCommand<T extends ExecutionCommandSource<T>> implements Unbo
}
} catch (CommandSyntaxException var9) {
source.handleError(var9, this.modifiers.isForked(), executionContext.tracer());
- } finally {
- executionContext.profiler().pop();
}
}
}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index c4c7491dfee075e2c75f11631558bed89061f4f6..a084ac0399e5b3a321ad53fcfb3d7052192d2a36 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -114,19 +114,8 @@ import net.minecraft.util.TimeUtil;
import net.minecraft.util.debugchart.RemoteDebugSampleType;
import net.minecraft.util.debugchart.SampleLogger;
import net.minecraft.util.debugchart.TpsDebugDimensions;
-import net.minecraft.util.profiling.EmptyProfileResults;
-import net.minecraft.util.profiling.ProfileResults;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
-import net.minecraft.util.profiling.ResultField;
-import net.minecraft.util.profiling.SingleTickProfiler;
import net.minecraft.util.profiling.jfr.JvmProfiler;
import net.minecraft.util.profiling.jfr.callback.ProfiledDuration;
-import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder;
-import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder;
-import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder;
-import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider;
-import net.minecraft.util.profiling.metrics.storage.MetricsPersister;
import net.minecraft.util.thread.ReentrantBlockableEventLoop;
import net.minecraft.world.Difficulty;
import net.minecraft.world.RandomSequences;
@@ -199,13 +188,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public LevelStorageSource.LevelStorageAccess storageSource;
public final PlayerDataStorage playerDataStorage;
private final List<Runnable> tickables = Lists.newArrayList();
- private MetricsRecorder metricsRecorder = InactiveMetricsRecorder.INSTANCE;
- private Consumer<ProfileResults> onMetricsRecordingStopped = results -> this.stopRecordingMetrics();
- private Consumer<Path> onMetricsRecordingFinished = path -> {};
- private boolean willStartRecordingMetrics;
- @Nullable
- private MinecraftServer.TimeProfiler debugCommandProfiler;
- private boolean debugCommandProfilerDelayStart;
private ServerConnectionListener connection;
public final ChunkProgressListenerFactory progressListenerFactory;
@Nullable
@@ -995,9 +977,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
shutdownThread = Thread.currentThread(); // Paper - Improved watchdog support
org.spigotmc.WatchdogThread.doStop(); // Paper - Improved watchdog support
// CraftBukkit end
- if (this.metricsRecorder.isRecording()) {
- this.cancelRecordingMetrics();
- }
LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
@@ -1265,18 +1244,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Spigot end
boolean flag = l == 0L;
- if (this.debugCommandProfilerDelayStart) {
- this.debugCommandProfilerDelayStart = false;
- this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
- }
//MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
lastTick = currentTime;
this.nextTickTimeNanos += l;
- try (Profiler.Scope scope = Profiler.use(this.createProfiler())) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("tick");
this.tickFrame.start();
this.tickServer(flag ? () -> false : this::haveTime);
// Paper start - rewrite chunk system
@@ -1287,7 +1259,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Paper end - rewrite chunk system
this.tickFrame.end();
- profilerFiller.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
// Purpur start - Configurable TPS Catchup
@@ -1303,11 +1274,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickRateManager.endTickWork();
}
- profilerFiller.pop();
this.logFullTickTime();
- } finally {
- this.endMetricsRecordingTick();
- }
this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
@@ -1480,7 +1447,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public void doRunTask(TickTask task) {
- Profiler.get().incrementCounter("runTask");
super.doRunTask(task);
}
@@ -1570,12 +1536,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;
@@ -1590,10 +1554,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.isSaving = false;
}
- profiler.pop();
// Paper end - Incremental chunk and player saving
- ProfilerFiller profilerFiller = Profiler.get();
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
this.server.spark.executeMainThreadTasks(); // Paper - spark
// Paper start - Server Tick Events
@@ -1602,7 +1564,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
// Paper end - Server Tick Events
this.server.spark.tickEnd(((double)(endTime - lastTick) / 1000000D)); // Paper - spark
- profilerFiller.push("tallying");
long l = Util.getNanos() - nanos;
int i1 = this.tickCount % 100;
this.aggregatedTickTimesNanos = this.aggregatedTickTimesNanos - this.tickTimesNanos[i1];
@@ -1615,16 +1576,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickTimes60s.add(this.tickCount, l);
// Paper end - Add tick times API and /mspt command
this.logTickMethodTime(nanos);
- profilerFiller.pop();
}
private void autoSave() {
this.ticksUntilAutosave = this.autosavePeriod; // CraftBukkit
LOGGER.debug("Autosave started");
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("save");
this.saveEverything(true, false, false);
- profilerFiller.pop();
LOGGER.debug("Autosave finished");
}
@@ -1692,7 +1649,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
@@ -1707,9 +1663,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - optimise Folia entity scheduler
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.ADVENTURE_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.DIALOG_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
- profilerFiller.push("commandFunctions");
this.getFunctions().tick();
- profilerFiller.popPush("levels");
// CraftBukkit start
// Run tasks that are waiting on processing
@@ -1745,17 +1699,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) {
@@ -1764,34 +1713,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw new ReportedException(crashReport);
}
- profilerFiller.pop();
- profilerFiller.pop();
serverLevel.explosionDensityCache.clear(); // Paper - Optimize explosions
}
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
- profilerFiller.popPush("connection");
this.tickConnection();
- profilerFiller.popPush("players");
this.playerList.tick();
if (this.tickRateManager.runsNormally()) {
GameTestTicker.SINGLETON.tick();
}
- profilerFiller.popPush("server gui refresh");
-
for (int i = 0; i < this.tickables.size(); i++) {
this.tickables.get(i).run();
}
- profilerFiller.popPush("send chunks");
-
for (ServerPlayer serverPlayer : this.playerList.getPlayers()) {
serverPlayer.connection.chunkSender.sendNextChunks(serverPlayer);
serverPlayer.connection.resumeFlushing();
}
-
- profilerFiller.pop();
}
public void tickConnection() {
@@ -1807,14 +1746,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void forceTimeSynchronization() {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("timeSync");
-
for (ServerLevel serverLevel : this.getAllLevels()) {
this.synchronizeTime(serverLevel);
}
-
- profilerFiller.pop();
}
public boolean isLevelEnabled(Level level) {
@@ -2633,55 +2567,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);
}
@@ -2731,24 +2616,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;
}
@@ -2858,55 +2725,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
}
- static class TimeProfiler {
- final long startNanos;
- final int startTick;
-
- TimeProfiler(long startNanos, int startTick) {
- this.startNanos = startNanos;
- this.startTick = startTick;
- }
-
- ProfileResults stop(final long endTimeNano, final int endTimeTicks) {
- return new ProfileResults() {
- @Override
- public List<ResultField> getTimes(String sectionPath) {
- return Collections.emptyList();
- }
-
- @Override
- public boolean saveResults(Path path) {
- return false;
- }
-
- @Override
- public long getStartTimeNano() {
- return TimeProfiler.this.startNanos;
- }
-
- @Override
- public int getStartTimeTicks() {
- return TimeProfiler.this.startTick;
- }
-
- @Override
- public long getEndTimeNano() {
- return endTimeNano;
- }
-
- @Override
- public int getEndTimeTicks() {
- return endTimeTicks;
- }
-
- @Override
- public String getProfilerResults() {
- return "";
- }
- };
- }
- }
-
// Paper start - Add tick times API and /mspt command
public static class TickTimes {
private final long[] times;
diff --git a/net/minecraft/server/ReloadableServerResources.java b/net/minecraft/server/ReloadableServerResources.java
index c891715968193f2ab4579b4a2b4aeeae6a210070..42326fc40b834c944e714fec91811d5c39dbe40c 100644
--- a/net/minecraft/server/ReloadableServerResources.java
+++ b/net/minecraft/server/ReloadableServerResources.java
@@ -99,7 +99,7 @@ public class ReloadableServerResources {
backgroundExecutor,
gameExecutor,
DATA_RELOAD_INITIAL_TASK,
- LOGGER.isDebugEnabled()
+ false // Gale - Purpur - remove vanilla profiler
)
.done()
.thenApply(object -> reloadableServerResources);
diff --git a/net/minecraft/server/ServerFunctionManager.java b/net/minecraft/server/ServerFunctionManager.java
index e3cb5d9cd0332c32df82fa6aef37401c523e8af0..10c79570432491bfb2bbfedf0491ab2b803d0c71 100644
--- a/net/minecraft/server/ServerFunctionManager.java
+++ b/net/minecraft/server/ServerFunctionManager.java
@@ -14,8 +14,6 @@ import net.minecraft.commands.execution.ExecutionContext;
import net.minecraft.commands.functions.CommandFunction;
import net.minecraft.commands.functions.InstantiatedFunction;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public class ServerFunctionManager {
@@ -50,19 +48,12 @@ public class ServerFunctionManager {
}
private void executeTagFunctions(Collection<CommandFunction<CommandSourceStack>> functionObjects, ResourceLocation identifier) {
- Profiler.get().push(identifier::toString);
-
for (CommandFunction<CommandSourceStack> commandFunction : functionObjects) {
this.execute(commandFunction, this.getGameLoopSender());
}
-
- Profiler.get().pop();
}
public void execute(CommandFunction<CommandSourceStack> function, CommandSourceStack source) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push(() -> "function " + function.id());
-
try {
InstantiatedFunction<CommandSourceStack> instantiatedFunction = function.instantiate(null, this.getDispatcher());
Commands.executeCommandInContext(
@@ -72,8 +63,6 @@ public class ServerFunctionManager {
} catch (FunctionInstantiationException var9) {
} catch (Exception var10) {
LOGGER.warn("Failed to execute function {}", function.id(), var10);
- } finally {
- profilerFiller.pop();
}
}
diff --git a/net/minecraft/server/commands/DebugCommand.java b/net/minecraft/server/commands/DebugCommand.java
index a78213464c5c365c6395fdf1295cb406c618d33b..fcc19c00b913d0a864f54f3833dac47fa2734239 100644
--- a/net/minecraft/server/commands/DebugCommand.java
+++ b/net/minecraft/server/commands/DebugCommand.java
@@ -67,6 +67,8 @@ public class DebugCommand {
}
private static int start(CommandSourceStack source) throws CommandSyntaxException {
+ // Gale start - Purpur - remove vanilla profiler
+ /*
MinecraftServer server = source.getServer();
if (server.isTimeProfilerRunning()) {
throw ERROR_ALREADY_RUNNING.create();
@@ -75,9 +77,14 @@ public class DebugCommand {
source.sendSuccess(() -> Component.translatable("commands.debug.started"), true);
return 0;
}
+ */
+ return 0;
+ // Gale end - Purpur - remove vanilla profiler
}
private static int stop(CommandSourceStack source) throws CommandSyntaxException {
+ // Gale start - Purpur - remove vanilla profiler
+ /*
MinecraftServer server = source.getServer();
if (!server.isTimeProfilerRunning()) {
throw ERROR_NOT_RUNNING.create();
@@ -93,6 +100,9 @@ public class DebugCommand {
);
return (int)d1;
}
+ */
+ return 0;
+ // Gale end - Purpur - remove vanilla profiler
}
static class TraceCustomExecutor
diff --git a/net/minecraft/server/commands/PerfCommand.java b/net/minecraft/server/commands/PerfCommand.java
index b10cb4a73df58a5fe64e88868733ba41616f59e4..ffbbd3c766046405b279692e5db83ce502c3d779 100644
--- a/net/minecraft/server/commands/PerfCommand.java
+++ b/net/minecraft/server/commands/PerfCommand.java
@@ -42,6 +42,9 @@ public class PerfCommand {
}
private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException {
+ // Gale start - Purpur - remove vanilla profiler
+ return removedMessage(source);
+ /*
MinecraftServer server = source.getServer();
if (server.isRecordingMetrics()) {
throw ERROR_ALREADY_RUNNING.create();
@@ -52,9 +55,14 @@ public class PerfCommand {
source.sendSuccess(() -> Component.translatable("commands.perf.started"), false);
return 0;
}
+ */
+ // Gale end - Purpur - remove vanilla profiler
}
private static int stopProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException {
+ // Gale start - Purpur - remove vanilla profiler
+ return removedMessage(source);
+ /*
MinecraftServer server = source.getServer();
if (!server.isRecordingMetrics()) {
throw ERROR_NOT_RUNNING.create();
@@ -62,8 +70,22 @@ public class PerfCommand {
server.finishRecordingMetrics();
return 0;
}
+ */
+ // Gale end - Purpur - remove vanilla profiler
}
+ // Gale start - Purpur - remove vanilla profiler
+ private static int removedMessage(CommandSourceStack source) {
+ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage();
+
+ source.getSender().sendMessage(mm.deserialize("<gold>Leaf has removed Mojang's Profiler to save your performance. Please use <click:suggest_command:'/spark'><grey>/spark</grey></click> instead"));
+ source.getSender().sendMessage(mm.deserialize("<gold>For more information, view its documentation at"));
+ source.getSender().sendMessage(mm.deserialize("<gold><click:open_url:'https://spark.lucko.me/docs/Command-Usage'>https://spark.lucko.me/docs/Command-Usage</click>"));
+
+ return 0;
+ }
+ // Gale end - Purpur - remove vanilla profiler
+
private static void saveResults(CommandSourceStack source, Path path, MinecraftServer server) {
String string = String.format(
Locale.ROOT, "%s-%s-%s", Util.getFilenameFormattedDateTime(), server.getWorldData().getLevelName(), SharedConstants.getCurrentVersion().id()
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
index b615dd89bbbb4c1a027c63ca714ebf8cb80e0c4d..95974662877830cb6251b769e01b2b9c70f77c60 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -791,12 +791,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
return this.settings.getProperties().serverResourcePackInfo;
}
- @Override
- public void endMetricsRecordingTick() {
- super.endMetricsRecordingTick();
- this.debugSampleSubscriptionTracker.tick(this.getTickCount());
- }
-
@Override
public SampleLogger getTickTimeLogger() {
return this.tickTimeLogger;
diff --git a/net/minecraft/server/level/ChunkGenerationTask.java b/net/minecraft/server/level/ChunkGenerationTask.java
index 4221af18f5087badb5cd8c7cf66ab3312edf0394..f102afff61d5577a0f5002f2a52335bd4810f150 100644
--- a/net/minecraft/server/level/ChunkGenerationTask.java
+++ b/net/minecraft/server/level/ChunkGenerationTask.java
@@ -5,8 +5,6 @@ import java.util.List;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable;
import net.minecraft.util.StaticCache2D;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.Zone;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.status.ChunkDependencies;
@@ -113,8 +111,6 @@ public class ChunkGenerationTask {
}
private void scheduleLayer(ChunkStatus status, boolean needsGeneration) {
- try (Zone zone = Profiler.get().zone("scheduleLayer")) {
- zone.addText(status::getName);
int radiusForLayer = this.getRadiusForLayer(status, needsGeneration);
for (int i = this.pos.x - radiusForLayer; i <= this.pos.x + radiusForLayer; i++) {
@@ -125,7 +121,6 @@ public class ChunkGenerationTask {
}
}
}
- }
}
private int getRadiusForLayer(ChunkStatus status, boolean needsGeneration) {
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
index eb352aa4296abc3ed4cf31c590bc0be66daf4de3..edda52a8430386238be4963e8ea2406f0c2d4df3 100644
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -62,8 +62,6 @@ import net.minecraft.util.CsvOutput;
import net.minecraft.util.Mth;
import net.minecraft.util.StaticCache2D;
import net.minecraft.util.TriState;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.thread.BlockableEventLoop;
import net.minecraft.util.thread.ConsecutiveExecutor;
import net.minecraft.world.entity.Entity;
@@ -409,15 +407,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick(BooleanSupplier hasMoreTime) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("poi");
this.poiManager.tick(hasMoreTime);
- profilerFiller.popPush("chunk_unload");
if (!this.level.noSave()) {
this.processUnloads(hasMoreTime);
}
-
- profilerFiller.pop();
}
public boolean hasWork() {
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
index 2882cd829d4d8e1f8615f085f6908efcdf68ac62..6020b71802babb35ef60aca65afe9c2612c05bb7 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -26,8 +26,6 @@ import net.minecraft.network.protocol.Packet;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.thread.BlockableEventLoop;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.MobCategory;
@@ -472,37 +470,28 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
// CraftBukkit start - modelled on below
public void purgeUnload() {
if (true) return; // Paper - rewrite chunk system
- ProfilerFiller gameprofilerfiller = Profiler.get();
- gameprofilerfiller.push("purge");
this.ticketStorage.purgeStaleTickets(this.chunkMap);
this.runDistanceManagerUpdates();
- gameprofilerfiller.popPush("unload");
this.chunkMap.tick(() -> true);
- gameprofilerfiller.pop();
this.clearCache();
}
// CraftBukkit end
@Override
public void tick(BooleanSupplier hasTimeLeft, boolean tickChunks) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("purge");
if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot
this.ticketStorage.purgeStaleTickets(this.chunkMap);
}
this.runDistanceManagerUpdates();
- profilerFiller.popPush("chunks");
if (tickChunks) {
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().tick(); // Paper - rewrite chunk system
this.tickChunks();
this.chunkMap.tick();
}
- profilerFiller.popPush("unload");
this.chunkMap.tick(hasTimeLeft);
- profilerFiller.pop();
this.clearCache();
}
@@ -511,22 +500,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
long l = gameTime - this.lastInhabitedUpdate;
this.lastInhabitedUpdate = gameTime;
if (!this.level.isDebug()) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("pollingChunks");
if (this.level.tickRateManager().runsNormally()) {
- profilerFiller.push("tickingChunks");
- this.tickChunks(profilerFiller, l);
- profilerFiller.pop();
+ this.tickChunks(l); // Gale - Purpur - remove vanilla profiler
}
- this.broadcastChangedChunks(profilerFiller);
- profilerFiller.pop();
+ this.broadcastChangedChunks(); // Gale - Purpur - remove vanilla profiler
}
}
- private void broadcastChangedChunks(ProfilerFiller profiler) {
- profiler.push("broadcast");
-
+ private void broadcastChangedChunks() { // Gale - Purpur - remove vanilla profiler
for (ChunkHolder chunkHolder : this.chunkHoldersToBroadcast) {
LevelChunk tickingChunk = chunkHolder.getChunkToSend(); // Paper - rewrite chunk system
if (tickingChunk != null) {
@@ -535,11 +517,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
this.chunkHoldersToBroadcast.clear();
- profiler.pop();
}
- private void tickChunks(ProfilerFiller profiler, long timeInhabited) {
- profiler.popPush("naturalSpawnCount");
+ private void tickChunks(long timeInhabited) { // Gale - Purpur - remove vanilla profiler
int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - Optional per player mob spawns
NaturalSpawner.SpawnState spawnState;
@@ -564,7 +544,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
// Paper end - Optional per player mob spawns
this.lastSpawnState = spawnState;
- profiler.popPush("spawnAndTick");
boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
List<MobCategory> filteredSpawningCategories;
@@ -586,14 +565,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
List<LevelChunk> list = this.spawningChunks;
try {
- profiler.push("filteringSpawningChunks");
this.chunkMap.collectSpawningChunks(list);
- profiler.popPush("shuffleSpawningChunks");
// Paper start - chunk tick iteration optimisation
this.shuffleRandom.setSeed(this.level.random.nextLong());
if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled
// Paper end - chunk tick iteration optimisation
- profiler.popPush("tickSpawningChunks");
for (LevelChunk levelChunk : list) {
this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, spawnState);
@@ -602,10 +578,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
list.clear();
}
- profiler.popPush("tickTickingChunks");
this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimisations
- profiler.pop();
- profiler.popPush("customSpawners");
if (_boolean) {
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
}
@@ -817,7 +790,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@Override
protected void doRunTask(Runnable task) {
- Profiler.get().incrementCounter("runTask");
super.doRunTask(task);
}
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 5c098d89e6a878f59b606306926413468a10e99f..9238db4c47d5297d992139988631ab38a5967a89 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -75,8 +75,6 @@ import net.minecraft.util.Mth;
import net.minecraft.util.ProgressListener;
import net.minecraft.util.RandomSource;
import net.minecraft.util.datafix.DataFixTypes;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.valueproviders.IntProvider;
import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.DifficultyInstance;
@@ -729,16 +727,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);
@@ -772,41 +766,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.tickTime();
}
- profilerFiller.push("tickPending");
if (!this.isDebug() && runsNormally) {
long l = this.getGameTime();
- profilerFiller.push("blockTicks");
this.blockTicks.tick(l, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks
- profilerFiller.popPush("fluidTicks");
this.fluidTicks.tick(l, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks
- profilerFiller.pop();
}
- profilerFiller.popPush("raid");
if (runsNormally) {
this.raids.tick(this);
}
- profilerFiller.popPush("chunkSource");
this.getChunkSource().tick(hasTimeLeft, true);
- profilerFiller.popPush("blockEvents");
if (runsNormally) {
this.runBlockEvents();
}
this.handlingTick = false;
- profilerFiller.pop();
boolean flag = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this
if (flag) {
this.resetEmptyTime();
}
if (flag || this.emptyTime++ < 300) {
- profilerFiller.push("entities");
if (this.dragonFight != null && runsNormally) {
- profilerFiller.push("dragonFight");
this.dragonFight.tick();
- profilerFiller.pop();
}
io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR
@@ -815,9 +798,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) {
@@ -828,21 +809,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.stopRiding();
}
- profilerFiller.push("tick");
this.guardEntityTick(this::tickNonPassenger, entity);
- profilerFiller.pop();
}
}
}
}
);
- profilerFiller.pop();
this.tickBlockEntities();
}
-
- profilerFiller.push("entityManagement");
// Paper - rewrite chunk system
- profilerFiller.pop();
}
@Override
@@ -857,9 +832,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;
@@ -959,8 +932,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++) {
@@ -970,12 +941,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) {
@@ -983,8 +951,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)) {
@@ -1018,8 +984,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
}
}
-
- profilerFiller.pop();
}
@VisibleForTesting
@@ -1363,17 +1327,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
@@ -1394,9 +1354,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();
@@ -1408,7 +1365,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 35efaa78b62a38e3d9e4a50baa227c0ff5098ff6..cdeac61ab3322e1dc375d1496d088407885df6b1 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -106,8 +106,6 @@ import net.minecraft.util.HashOps;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.Container;
import net.minecraft.world.Difficulty;
import net.minecraft.world.InteractionHand;
@@ -1450,14 +1448,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();
@@ -1475,7 +1469,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 58215f4a156e4cf57338e78975be7b6abfd961db..dc55800b006f3ad67c94108af915b645e33a75dd 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -26,7 +26,6 @@ import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ClientInformation;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
import org.slf4j.Logger;
public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener {
@@ -270,7 +269,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
protected void keepConnectionAlive() {
- Profiler.get().push("keepAlive");
long millis = Util.getMillis();
// Paper start - improve keepalives
if (this.checkIfClosed(millis) && !this.processedDisconnect) {
@@ -291,8 +289,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
// Paper end - improve keepalives
}
}
-
- Profiler.get().pop();
}
private boolean checkIfClosed(long time) {
diff --git a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
index f0e2bca572c6f1790772980cd3ec651e9077382d..954e4103c9c359bc13c9a07bec885af90df14cb5 100644
--- a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
+++ b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
@@ -9,8 +9,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import net.minecraft.Util;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public class ProfiledReloadInstance extends SimpleReloadInstance<ProfiledReloadInstance.State> {
@@ -71,13 +69,10 @@ public class ProfiledReloadInstance extends SimpleReloadInstance<ProfiledReloadI
private static Executor profiledExecutor(Executor executor, AtomicLong timeTaken, AtomicLong timesRun, String name) {
return runnable -> executor.execute(() -> {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push(name);
long nanos = Util.getNanos();
runnable.run();
timeTaken.addAndGet(Util.getNanos() - nanos);
timesRun.incrementAndGet();
- profilerFiller.pop();
});
}
diff --git a/net/minecraft/server/packs/resources/ReloadableResourceManager.java b/net/minecraft/server/packs/resources/ReloadableResourceManager.java
index 51cec338f5948b69ad1cff896ce19dc3adb74380..be7fd9e55957ba6fa70c711d1ea4d42e3bbfd752 100644
--- a/net/minecraft/server/packs/resources/ReloadableResourceManager.java
+++ b/net/minecraft/server/packs/resources/ReloadableResourceManager.java
@@ -43,7 +43,7 @@ public class ReloadableResourceManager implements ResourceManager, AutoCloseable
LOGGER.info("Reloading ResourceManager: {}", LogUtils.defer(() -> resourcePacks.stream().map(PackResources::packId).collect(Collectors.joining(", "))));
this.resources.close();
this.resources = new MultiPackResourceManager(this.type, resourcePacks);
- return SimpleReloadInstance.create(this.resources, this.listeners, backgroundExecutor, gameExecutor, waitingFor, LOGGER.isDebugEnabled());
+ return SimpleReloadInstance.create(this.resources, this.listeners, backgroundExecutor, gameExecutor, waitingFor, false); // Gale - Purpur - remove vanilla profiler
}
@Override
diff --git a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
index 407bd4b8026869bc14ee5e79ff80e7bdd1a07bcb..6e2a3d4171dbb2a30ba18f165723691713fac0f6 100644
--- a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
+++ b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
@@ -3,20 +3,13 @@ package net.minecraft.server.packs.resources;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
public interface ResourceManagerReloadListener extends PreparableReloadListener {
@Override
default CompletableFuture<Void> reload(
PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager, Executor backgroundExecutor, Executor gameExecutor
) {
- return barrier.wait(Unit.INSTANCE).thenRunAsync(() -> {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("listener");
- this.onResourceManagerReload(manager);
- profilerFiller.pop();
- }, gameExecutor);
+ return barrier.wait(Unit.INSTANCE).thenRunAsync(() -> this.onResourceManagerReload(manager), gameExecutor); // Gale - Purpur - remove vanilla profiler
}
void onResourceManagerReload(ResourceManager resourceManager);
diff --git a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
index 64b0508ef21952c65b0b967b756b2a4c64d96899..b6b03fbbd669e6331b30255df5419611c38e0495 100644
--- a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
+++ b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
@@ -2,7 +2,6 @@ package net.minecraft.server.packs.resources;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
-import net.minecraft.util.profiling.Profiler;
import net.minecraft.util.profiling.ProfilerFiller;
public abstract class SimplePreparableReloadListener<T> implements PreparableReloadListener {
@@ -10,9 +9,9 @@ public abstract class SimplePreparableReloadListener<T> implements PreparableRel
public final CompletableFuture<Void> reload(
PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager, Executor backgroundExecutor, Executor gameExecutor
) {
- return CompletableFuture.<T>supplyAsync(() -> this.prepare(manager, Profiler.get()), backgroundExecutor)
+ return CompletableFuture.<T>supplyAsync(() -> this.prepare(manager, net.minecraft.util.profiling.InactiveProfiler.INSTANCE), backgroundExecutor) // Gale - Purpur - remove vanilla profiler
.thenCompose(barrier::wait)
- .thenAcceptAsync(object -> this.apply((T)object, manager, Profiler.get()), gameExecutor);
+ .thenAcceptAsync(object -> this.apply((T)object, manager, net.minecraft.util.profiling.InactiveProfiler.INSTANCE), gameExecutor); // Gale - Purpur - remove vanilla profiler
}
protected abstract T prepare(ResourceManager resourceManager, ProfilerFiller profiler);
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 613d412374b0ec465364565f9f445cc32385097a..04425c357eedda8049d3e1780011b274ce3ec575 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -80,8 +80,6 @@ import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
import net.minecraft.util.ProblemReporter;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.Nameable;
@@ -873,8 +871,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// CraftBukkit end
public void baseTick() {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("entityBaseTick");
if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups
this.inBlockState = null;
if (this.isPassenger() && this.getVehicle().isRemoved()) {
@@ -928,8 +924,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.level() instanceof ServerLevel serverLevelx && this instanceof Leashable) {
Leashable.tickLeash(serverLevelx, (Entity & Leashable)this);
}
-
- profilerFiller.pop();
}
public void setSharedFlagOnFire(boolean isOnFire) {
@@ -1150,8 +1144,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("move");
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) {
movement = movement.multiply(this.stuckSpeedMultiplier);
this.stuckSpeedMultiplier = Vec3.ZERO;
@@ -1160,7 +1152,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// Paper start - ignore movement changes while inactive.
if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) {
setDeltaMovement(Vec3.ZERO);
- profilerFiller.pop();
return;
}
// Paper end
@@ -1185,8 +1176,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setPos(vec32);
}
- profilerFiller.pop();
- profilerFiller.push("rest");
boolean flag = !Mth.equal(movement.x, vec3.x);
boolean flag1 = !Mth.equal(movement.z, vec3.z);
this.horizontalCollision = flag || flag1;
@@ -1209,7 +1198,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
if (this.isRemoved()) {
- profilerFiller.pop();
} else {
if (this.horizontalCollision) {
Vec3 deltaMovement = this.getDeltaMovement();
@@ -1253,7 +1241,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
float blockSpeedFactor = this.getBlockSpeedFactor();
this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor));
- profilerFiller.pop();
}
}
// Paper start - detailed watchdog information
@@ -3466,8 +3453,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.processPortalCooldown();
if (this.portalProcess != null) {
if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("portal");
this.setPortalCooldown();
TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this);
if (portalDestination != null) {
@@ -3478,7 +3463,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
- profilerFiller.pop();
} else if (this.portalProcess.hasExpired()) {
this.portalProcess = null;
}
@@ -4045,15 +4029,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
entity.teleport(this.calculatePassengerTransition(teleportTransition, entity));
}
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("teleportSameDimension");
this.teleportSetPosition(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives());
if (!teleportTransition.asPassenger()) {
this.sendTeleportTransitionToRidingPlayers(teleportTransition);
}
teleportTransition.postTeleportTransition().onTransition(this);
- profilerFiller.pop();
return this;
}
@@ -4069,11 +4050,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("teleportCrossDimension");
Entity entityx = this.getType().create(newLevel, EntitySpawnReason.DIMENSION_TRAVEL);
if (entityx == null) {
- profilerFiller.pop();
return null;
} else {
// Paper start - Fix item duplication and teleport issues
@@ -4093,7 +4071,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
newLevel.resetEmptyTime();
teleportTransition.postTeleportTransition().onTransition(entityx);
this.teleportSpectators(teleportTransition, oldLevel);
- profilerFiller.pop();
return entityx;
}
}
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index a3b985cc454b2c62e7642f7eb05de590ecde9272..9fee96683e2738745aedd57ee3665701ab682db5 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -69,8 +69,6 @@ import net.minecraft.tags.FluidTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.Difficulty;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.damagesource.CombatRules;
@@ -434,8 +432,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
super.baseTick();
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("livingEntityBaseTick");
if (this.fireImmune() || this.level().isClientSide) {
this.clearFire();
}
@@ -526,7 +522,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.yBodyRotO = this.yBodyRot;
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
- profilerFiller.pop();
}
@Override
@@ -3364,11 +3359,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;
@@ -3380,7 +3371,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 {
@@ -3556,21 +3546,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()) {
@@ -3599,8 +3583,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.noJumpDelay = 0;
}
- profilerFiller.pop();
- profilerFiller.push("travel");
if (this.isFallFlying()) {
this.updateFallFlying();
}
@@ -3625,9 +3607,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));
}
@@ -3637,18 +3617,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 035eb50335daa88679672cba550ed87ac3fa5873..b2026e29a0633f971bf551fad8be7161bb6293f3 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -26,8 +26,6 @@ import net.minecraft.sounds.SoundEvent;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.Container;
import net.minecraft.world.Difficulty;
import net.minecraft.world.DifficultyInstance;
@@ -322,14 +320,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
public void baseTick() {
super.baseTick();
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("mobBaseTick");
if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) {
this.resetAmbientSoundTime();
this.playAmbientSound();
}
- profilerFiller.pop();
incrementTicksSinceLastInteraction(); // Purpur - Entity lifespan
}
@@ -533,8 +528,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()
@@ -557,8 +550,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
}
}
-
- profilerFiller.pop();
}
protected Vec3i getPickupReach() {
@@ -778,42 +769,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
return;
}
// Paper end - Allow nerfed mobs to jump and float
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("sensing");
this.sensing.tick();
- profilerFiller.pop();
int i = this.tickCount + this.getId();
if (i % 2 != 0 && this.tickCount > 1) {
- profilerFiller.push("targetSelector");
this.targetSelector.tickRunningGoals(false);
- profilerFiller.pop();
- profilerFiller.push("goalSelector");
this.goalSelector.tickRunningGoals(false);
- profilerFiller.pop();
} else {
- profilerFiller.push("targetSelector");
this.targetSelector.tick();
- profilerFiller.pop();
- profilerFiller.push("goalSelector");
this.goalSelector.tick();
- profilerFiller.pop();
}
- profilerFiller.push("navigation");
this.navigation.tick();
- profilerFiller.pop();
- profilerFiller.push("mob tick");
this.customServerAiStep((ServerLevel)this.level());
- profilerFiller.pop();
- profilerFiller.push("controls");
- profilerFiller.push("move");
this.moveControl.tick();
- profilerFiller.popPush("look");
this.lookControl.tick();
- profilerFiller.popPush("jump");
this.jumpControl.tick();
- profilerFiller.pop();
- profilerFiller.pop();
this.sendDebugPackets();
}
diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 859b859d29b637200cf7c9a0bd52d9f712413e3d..653c58c7637c46c8b46a5082f671324a2221d431 100644
--- a/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -6,8 +6,6 @@ import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
public class GoalSelector {
private static final WrappedGoal NO_GOAL = new WrappedGoal(Integer.MAX_VALUE, new Goal() {
@@ -82,9 +80,6 @@ public class GoalSelector {
}
public void tick() {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("goalCleanup");
-
for (WrappedGoal wrappedGoal : this.availableGoals) {
if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper - Perf: optimize goal types by removing streams
wrappedGoal.stop();
@@ -92,8 +87,6 @@ public class GoalSelector {
}
this.lockedFlags.entrySet().removeIf(entry -> !entry.getValue().isRunning());
- profilerFiller.pop();
- profilerFiller.push("goalUpdate");
for (WrappedGoal wrappedGoalx : this.availableGoals) {
// Paper start
@@ -113,21 +106,15 @@ public class GoalSelector {
}
}
- profilerFiller.pop();
this.tickRunningGoals(true);
}
public void tickRunningGoals(boolean tickAllRunning) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("goalTick");
-
for (WrappedGoal wrappedGoal : this.availableGoals) {
if (wrappedGoal.isRunning() && (tickAllRunning || wrappedGoal.requiresUpdateEveryTick())) {
wrappedGoal.tick();
}
}
-
- profilerFiller.pop();
}
public Set<WrappedGoal> getAvailableGoals() {
diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index dd1a95111d965bcd7f53be9d4224dd213e4e0705..24dd92449f70144c79f25bf24942ebd666655ed2 100644
--- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -10,8 +10,6 @@ import net.minecraft.core.Vec3i;
import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.attributes.Attributes;
@@ -189,13 +187,10 @@ public abstract class PathNavigation {
}
}
// Paper end - EntityPathfindEvent
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("pathfind");
BlockPos blockPos = offsetUpward ? this.mob.blockPosition().above() : this.mob.blockPosition();
int i = (int)(followRange + regionOffset);
PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i));
Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, targets, followRange, accuracy, this.maxVisitedNodesMultiplier);
- profilerFiller.pop();
if (path != null && path.getTarget() != null) {
this.targetPos = path.getTarget();
this.reachRange = accuracy;
diff --git a/net/minecraft/world/entity/ai/sensing/Sensing.java b/net/minecraft/world/entity/ai/sensing/Sensing.java
index c569074403b1d8b443aaa98ba9cf9bbd0e98bd2d..b1aa7294f9479f45fcde77c5ea46db9f62370abf 100644
--- a/net/minecraft/world/entity/ai/sensing/Sensing.java
+++ b/net/minecraft/world/entity/ai/sensing/Sensing.java
@@ -2,8 +2,6 @@ package net.minecraft.world.entity.ai.sensing;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Mob;
@@ -28,10 +26,7 @@ public class Sensing {
} else if (this.unseen.contains(id)) {
return false;
} else {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("hasLineOfSight");
boolean hasLineOfSight = this.mob.hasLineOfSight(entity);
- profilerFiller.pop();
if (hasLineOfSight) {
this.seen.add(id);
} else {
diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java
index fb37669b4d66bb853eabf2d15a369d7ad5a2dbb9..9763a5e24e0fed9b49b6ac59911f6c9f8e893db5 100644
--- a/net/minecraft/world/entity/animal/HappyGhast.java
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
@@ -14,8 +14,6 @@ import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@@ -426,13 +424,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 f372d8b21282e8fdd00dd19eb14ce6ee45b358b0..dd10b0535baf48aea47020d890f102800b0af11a 100644
--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -25,8 +25,6 @@ import net.minecraft.tags.GameEventTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.SimpleContainer;
@@ -269,14 +267,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 0da5c51c4830cf1826261f4d8877303b34c6cb87..6fbeaff7178a21338920d6738767033260b7a726 100644
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -23,8 +23,6 @@ import net.minecraft.util.ByIdMap;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable;
import net.minecraft.util.TimeUtil;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@@ -167,13 +165,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 40e4cc14f10bd465ee7bee124e7e194c74c070b4..deb2fdea7be9dda1c4b267ac25326bb9b05ae739 100644
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -31,8 +31,6 @@ import net.minecraft.util.ByIdMap;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -375,14 +373,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 0c698241b10f84afb17ae10d3661a90bc62ec243..949b6c563658e6e46ac5842d6f088ecae6d4cd0c 100644
--- a/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
@@ -18,8 +18,6 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -173,14 +171,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 8d6da6ce15c266c7b4b9763a37516d2b160f1b85..f67d18f32f73e0e6be35939781bd0bd0188cdfbd 100644
--- a/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
@@ -28,8 +28,6 @@ import net.minecraft.tags.ItemTags;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AgeableMob;
@@ -261,14 +259,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 40b57095812fc1dd2ed14da4933fc949afd855b2..e5cefb1d327053761a8c2195c6f39128a23520c1 100644
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -12,8 +12,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.ItemTags;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@@ -137,14 +135,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 979befb6a51c855e439d7576db57abf1143731be..d8b726fb954a3b8ca20f3f500e4087d5936e7646 100644
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -20,8 +20,6 @@ import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -228,14 +226,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 745c821facbbf0e9641e371bb26a8d6abde7a813..71e7931f7007f73b552bbc2cbc8e843e10b40b43 100644
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -29,8 +29,6 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.ByIdMap;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@@ -497,13 +495,9 @@ public class Sniffer extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("snifferBrain");
if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider
this.getBrain().tick(level, this);
- profilerFiller.popPush("snifferActivityUpdate");
SnifferAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(level);
}
diff --git a/net/minecraft/world/entity/monster/Zoglin.java b/net/minecraft/world/entity/monster/Zoglin.java
index e37c6dcbe62cba2cb7f33ac1792d539f9b07aa24..2a905e8cdf22f9d7f38cc41c1474e80f704d0cb1 100644
--- a/net/minecraft/world/entity/monster/Zoglin.java
+++ b/net/minecraft/world/entity/monster/Zoglin.java
@@ -14,8 +14,6 @@ import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
@@ -289,11 +287,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 4e47a1e6d1dcf15a316ff6bed6c03e9c42777853..793db0e9977fe64e7cdbe5b337deb6d8e32f0627 100644
--- a/net/minecraft/world/entity/monster/breeze/Breeze.java
+++ b/net/minecraft/world/entity/monster/breeze/Breeze.java
@@ -12,8 +12,6 @@ import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.EntityTypeTags;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AnimationState;
import net.minecraft.world.entity.Entity;
@@ -232,13 +230,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 1b01d2b37dd221d5832cb68c072af9863aeb6868..775c11f658b81379784f7e5bdfdc8105b3410480 100644
--- a/net/minecraft/world/entity/monster/creaking/Creaking.java
+++ b/net/minecraft/world/entity/monster/creaking/Creaking.java
@@ -16,8 +16,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.DamageTypeTags;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AnimationState;
import net.minecraft.world.entity.Entity;
@@ -236,10 +234,7 @@ public class Creaking extends Monster {
@Override
protected void customServerAiStep(ServerLevel level) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("creakingBrain");
this.getBrain().tick((ServerLevel)this.level(), this);
- profilerFiller.pop();
CreakingAi.updateActivity(this);
}
diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 6062167a25d9d66c0264624f0761bcb9d47f0c77..952fba6d141576089e563e829cae4a177f19d639 100644
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -15,8 +15,6 @@ import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -208,11 +206,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 b5ab1ea7ebf1e1a67f51f53f92fbc2a84506174a..03b6640c95c86ea9f6219d6e39feffa4643dd648 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;
@@ -359,11 +357,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 bc691e17a974a3b4175ceb34f7e40291f1f1f83c..091b9cc338e37efbecdd4187a9824dae7bff2af9 100644
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -27,8 +27,6 @@ import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffectInstance;
@@ -303,11 +301,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 cab85afb6a460297511b0d391364670124d5a3f3..db5c287161c50bafd672b9cb439b3a06b1ff16d7 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
this.getBrain().tick(level, this); // Paper - EAR 2
}
else if (this.isLobotomized && shouldRestock()) restock(); // Purpur - Lobotomize stuck villagers
- profilerFiller.pop();
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
}
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index e37635e452a38140099ba0a1fd5fcc6e8eaea2cd..9a0cd86cffaaa974c0e4dfeec646cbb9a0a3431c 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -35,8 +35,6 @@ import net.minecraft.util.AbortableIterationConsumer;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.TickRateManager;
import net.minecraft.world.damagesource.DamageSource;
@@ -260,7 +258,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@Override
public final <T extends Entity> List<T> getEntitiesOfClass(final Class<T> entityClass, final AABB boundingBox, final Predicate<? super T> predicate) {
- Profiler.get().incrementCounter("getEntities");
final List<T> ret = new java.util.ArrayList<>();
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate);
@@ -270,7 +267,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@Override
public final List<Entity> moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate<? super Entity> predicate) {
- Profiler.get().incrementCounter("getEntities");
final List<Entity> ret = new java.util.ArrayList<>();
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate);
@@ -1499,8 +1495,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
}
protected void tickBlockEntities() {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("blockEntities");
this.tickingBlockEntities = true;
if (!this.pendingBlockEntityTickers.isEmpty()) {
this.blockEntityTickers.addAll(this.pendingBlockEntityTickers);
@@ -1530,7 +1524,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
this.tickingBlockEntities = false;
- profilerFiller.pop();
this.spigotConfig.currentPrimedTnt = 0; // Spigot
}
@@ -1782,7 +1775,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@Override
public List<Entity> getEntities(@Nullable Entity entity, AABB boundingBox, Predicate<? super Entity> predicate) {
- Profiler.get().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList();
// Paper start - rewrite chunk system
@@ -1811,8 +1803,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
public <T extends Entity> void getEntities(final EntityTypeTest<Entity, T> entityTypeTest,
final AABB boundingBox, final Predicate<? super T> predicate,
final List<? super T> into, final int maxCount) {
- Profiler.get().incrementCounter("getEntities");
-
if (entityTypeTest instanceof net.minecraft.world.entity.EntityType<T> byType) {
if (maxCount != Integer.MAX_VALUE) {
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(byType, boundingBox, into, predicate, maxCount);
diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java
index f0f5aa48af099c8244cd59da2c1dac6744a41abe..102d88fc2989f80a39826e50ee706d853bfb2c5e 100644
--- a/net/minecraft/world/level/NaturalSpawner.java
+++ b/net/minecraft/world/level/NaturalSpawner.java
@@ -23,8 +23,6 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.random.WeightedList;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntitySpawnReason;
@@ -152,9 +150,6 @@ public final class NaturalSpawner {
}
public static void spawnForChunk(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, List<MobCategory> categories) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("spawner");
-
for (MobCategory mobCategory : categories) {
// Paper start - Optional per player mob spawns
final boolean canSpawn;
@@ -189,8 +184,6 @@ public final class NaturalSpawner {
// Paper end - Optional per player mob spawns
}
}
-
- profilerFiller.pop();
}
// Paper start - Add mobcaps commands
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index b80924fbe054b00fe5117df896358e330f41e993..1669c21534a453c9cf16b992df7a6bf276dea887 100644
--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
@@ -13,8 +13,6 @@ import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
@@ -669,10 +667,7 @@ public class ServerExplosion implements Explosion {
List<BlockPos> list = this.calculateExplodedPositions();
this.hurtEntities();
if (this.interactsWithBlocks()) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("explosion_blocks");
this.interactWithBlocks(list);
- profilerFiller.pop();
}
if (this.fire) {
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
index 75578e6ed7233a03d9b6cd3c6d3997f1c6148392..b88254fb3c12b99684c6ede1ae8a6671ffbe9ad6 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -24,8 +24,6 @@ import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData;
import net.minecraft.server.level.FullChunkStatus;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.ProblemReporter;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
@@ -385,12 +383,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
}
if (LightEngine.hasDifferentLightProperties(blockState, state)) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("updateSkyLightSources");
// Paper - rewrite chunk system
- profilerFiller.popPush("queueCheckLight");
this.level.getChunkSource().getLightEngine().checkBlock(pos);
- profilerFiller.pop();
}
boolean flag = !blockState.is(block);
@@ -922,8 +916,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
BlockPos blockPos = this.blockEntity.getBlockPos();
if (LevelChunk.this.isTicking(blockPos)) {
try {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push(this::getType);
BlockState blockState = LevelChunk.this.getBlockState(blockPos);
if (this.blockEntity.getType().isValid(blockState)) {
this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity);
@@ -937,8 +929,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
}
// Paper end - Remove the Block Entity if it's invalid
}
-
- profilerFiller.pop();
} catch (Throwable var5) {
// Paper start - Prevent block entity and entity crashes
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
diff --git a/net/minecraft/world/level/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java
index 81de6c1bbef1cafd3036e736dd305fbedc8368c6..c2baadcdceb1df6a881d6f73aa4eb4dd264bcdfe 100644
--- a/net/minecraft/world/level/pathfinder/PathFinder.java
+++ b/net/minecraft/world/level/pathfinder/PathFinder.java
@@ -12,9 +12,6 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
-import net.minecraft.util.profiling.metrics.MetricCategory;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.PathNavigationRegion;
@@ -57,9 +54,6 @@ public class PathFinder {
@Nullable
private Path findPath(Node node, List<Map.Entry<Target, BlockPos>> positions, float maxRange, int accuracy, float searchDepthMultiplier) { // Paper - optimize collection
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("find_path");
- profilerFiller.markForCharting(MetricCategory.PATH_FINDING);
// Set<Target> set = targetPositions.keySet(); // Paper
node.g = 0.0F;
node.h = this.getBestH(node, positions); // Paper - optimize collection
@@ -129,7 +123,6 @@ public class PathFinder {
best = path;
}
}
- profilerFiller.pop();
return best;
// Paper end - Perf: remove streams and optimize collection
}
diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java
index 7ea0273018b1a364a5e2b7bf57da840383c8ffa5..9dc03a8fff08111b6a68aa94d658f1e965ef0d25 100644
--- a/net/minecraft/world/ticks/LevelTicks.java
+++ b/net/minecraft/world/ticks/LevelTicks.java
@@ -23,8 +23,6 @@ import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
import net.minecraft.core.Vec3i;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
@@ -80,20 +78,13 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
}
public void tick(long gameTime, int maxAllowedTicks, BiConsumer<BlockPos, T> ticker) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("collect");
- this.collectTicks(gameTime, maxAllowedTicks, profilerFiller);
- profilerFiller.popPush("run");
- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size());
+ this.collectTicks(gameTime, maxAllowedTicks); // Gale - Purpur - remove vanilla profiler
this.runCollectedTicks(ticker);
- profilerFiller.popPush("cleanup");
this.cleanupAfterTick();
- profilerFiller.pop();
}
- private void collectTicks(long gameTime, int maxAllowedTicks, ProfilerFiller profiler) {
+ private void collectTicks(long gameTime, int maxAllowedTicks) { // Gale - Purpur - remove vanilla profiler
this.sortContainersToTick(gameTime);
- profiler.incrementCounter("containersToTick", this.containersToTick.size());
this.drainContainers(gameTime, maxAllowedTicks);
this.rescheduleLeftoverContainers();
}