9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-31 12:46:31 +00:00
Files
Gale/patches/server/0011-Remove-vanilla-profiler.patch
2024-11-09 11:29:30 -05:00

2350 lines
112 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Thu, 22 Dec 2022 22:32:18 +0100
Subject: [PATCH] Remove vanilla profiler
License: MIT (https://opensource.org/licenses/MIT)
Gale - https://galemc.org
This patch is based on the following patch:
"Remove Mojang Profiler"
By: BillyGalbreath <blake.galbreath@gmail.com>
As part of: Purpur (https://github.com/PurpurMC/Purpur)
Licensed under: MIT (https://opensource.org/licenses/MIT)
* Purpur copyright *
MIT License
Copyright (c) 2019-2022 PurpurMC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 260350422fc724ba5cd5769cbb387b6007f36a84..bd2ee66047c3c7f24ab90951ff50aec5ddc9362d 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -55,7 +55,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;
@@ -132,7 +131,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;
@@ -169,7 +167,6 @@ public class Commands {
DamageCommand.register(this.dispatcher, commandRegistryAccess);
DataCommands.register(this.dispatcher);
DataPackCommand.register(this.dispatcher);
- DebugCommand.register(this.dispatcher);
DefaultGameModeCommands.register(this.dispatcher);
DifficultyCommand.register(this.dispatcher);
EffectCommands.register(this.dispatcher, commandRegistryAccess);
@@ -345,9 +342,6 @@ public class Commands {
// Paper end
CommandSourceStack commandlistenerwrapper = (CommandSourceStack) parseresults.getContext().getSource();
- Profiler.get().push(() -> {
- return "/" + s;
- });
ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent
try {
@@ -376,8 +370,6 @@ public class Commands {
commandlistenerwrapper.sendFailure(Component.literal(Util.describeError(exception)));
Commands.LOGGER.error("'/{}' threw an exception", s, exception);
}
- } finally {
- Profiler.get().pop();
}
}
@@ -440,7 +432,7 @@ public class Commands {
int j = minecraftserver.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT);
try {
- ExecutionContext<CommandSourceStack> executioncontext1 = new ExecutionContext<>(i, j, Profiler.get());
+ ExecutionContext<CommandSourceStack> executioncontext1 = new ExecutionContext<>(i, j); // Gale - Purpur - remove vanilla profiler
try {
Commands.CURRENT_EXECUTION_CONTEXT.set(executioncontext1);
diff --git a/src/main/java/net/minecraft/commands/execution/ExecutionContext.java b/src/main/java/net/minecraft/commands/execution/ExecutionContext.java
index f626a2f28f2aebb3237cebb6afef3c4fa1a6cb37..2200d34ce40c61c0eee81b8f8903458c548e65ec 100644
--- a/src/main/java/net/minecraft/commands/execution/ExecutionContext.java
+++ b/src/main/java/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 maxCommandChainLength, int maxCommandForkCount, ProfilerFiller profiler) {
+ public ExecutionContext(int maxCommandChainLength, int maxCommandForkCount) { // Gale - Purpur - remove vanilla profiler
this.commandLimit = maxCommandChainLength;
this.forkLimit = maxCommandForkCount;
- this.profiler = profiler;
this.commandQuota = maxCommandChainLength;
}
@@ -130,7 +128,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/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java
index e8b8c453a7ff7af0a60ae915cfd85aba313139c9..0bb5f1e421b56703d9c4d99a98db29d31ffc26f9 100644
--- a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java
+++ b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java
@@ -42,9 +42,6 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
ChainModifiers chainModifiers = flags;
List<T> list = sources;
if (contextChain.getStage() != Stage.EXECUTE) {
- context.profiler().push(() -> "prepare " + this.commandInput);
-
- try {
for (int i = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) {
CommandContext<T> commandContext = contextChain.getTopContext();
if (commandContext.isForked()) {
@@ -85,9 +82,6 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
list = list2;
}
}
- } finally {
- context.profiler().pop();
- }
}
if (list.isEmpty()) {
diff --git a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java
index e9775b4506909bee65a74964f0d5391a0513de1d..1c4dd8acdcd571aceffe4b78599ca2c7362aea5d 100644
--- a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java
+++ b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java
@@ -23,8 +23,6 @@ public class ExecuteCommand<T extends ExecutionCommandSource<T>> implements Unbo
@Override
public void execute(T executionCommandSource, ExecutionContext<T> executionContext, Frame frame) {
- executionContext.profiler().push(() -> "execute " + this.commandInput);
-
try {
executionContext.incrementCost();
int i = ContextChain.runExecutable(
@@ -36,8 +34,6 @@ public class ExecuteCommand<T extends ExecutionCommandSource<T>> implements Unbo
}
} catch (CommandSyntaxException var9) {
executionCommandSource.handleError(var9, this.modifiers.isForked(), executionContext.tracer());
- } finally {
- executionContext.profiler().pop();
}
}
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 072e0188280d4d49fd5a96dbfa95344eec250e8b..8a643e65d805e167516ff3331ab9c6482aa3ec8a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -108,19 +108,8 @@ import net.minecraft.util.datafix.DataFixers;
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;
@@ -229,13 +218,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;
- private Consumer<ProfileResults> onMetricsRecordingStopped;
- private Consumer<Path> onMetricsRecordingFinished;
- private boolean willStartRecordingMetrics;
- @Nullable
- private MinecraftServer.TimeProfiler debugCommandProfiler;
- private boolean debugCommandProfilerDelayStart;
private ServerConnectionListener connection;
public final ChunkProgressListenerFactory progressListenerFactory;
@Nullable
@@ -429,12 +411,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public MinecraftServer(OptionSet options, WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
super("Server");
SERVER = this; // Paper - better singleton
- this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
- this.onMetricsRecordingStopped = (methodprofilerresults) -> {
- this.stopRecordingMetrics();
- };
- this.onMetricsRecordingFinished = (path) -> {
- };
this.random = RandomSource.create();
this.port = -1;
this.levels = Maps.newLinkedHashMap();
@@ -1048,9 +1024,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.spigotmc.WatchdogThread.doStop(); // Paper
// Paper end
// CraftBukkit end
- if (this.metricsRecorder.isRecording()) {
- this.cancelRecordingMetrics();
- }
MinecraftServer.LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
@@ -1310,22 +1283,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
boolean flag = i == 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 += i;
- try {
- Profiler.Scope profiler_a = Profiler.use(this.createProfiler());
-
- try {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("tick");
this.tickFrame.start();
this.tickServer(flag ? () -> {
return false;
@@ -1338,7 +1299,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Paper end - rewrite chunk system
this.tickFrame.end();
- gameprofilerfiller.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + i, this.nextTickTimeNanos);
this.startMeasuringTaskExecutionTime();
@@ -1348,26 +1308,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickRateManager.endTickWork();
}
- gameprofilerfiller.pop();
this.logFullTickTime();
- } catch (Throwable throwable) {
- if (profiler_a != null) {
- try {
- profiler_a.close();
- } catch (Throwable throwable1) {
- throwable.addSuppressed(throwable1);
- }
- }
-
- throw throwable;
- }
-
- if (profiler_a != null) {
- profiler_a.close();
- }
- } finally {
- this.endMetricsRecordingTick();
- }
this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
@@ -1574,7 +1515,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
- Profiler.get().incrementCounter("runTask");
super.doRunTask(ticktask);
}
@@ -1669,12 +1609,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;
@@ -1689,11 +1627,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.isSaving = false;
}
- profiler.pop();
// Paper end - Incremental chunk and player saving
- ProfilerFiller gameprofilerfiller = 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
@@ -1702,7 +1637,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
- gameprofilerfiller.push("tallying");
long k = Util.getNanos() - i;
int l = this.tickCount % 100;
@@ -1716,17 +1650,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickTimes60s.add(this.tickCount, k);
// Paper end - Add tick times API and /mspt command
this.logTickMethodTime(i);
- gameprofilerfiller.pop();
}
private void autoSave() {
this.ticksUntilAutosave = this.autosavePeriod; // CraftBukkit
MinecraftServer.LOGGER.debug("Autosave started");
- ProfilerFiller gameprofilerfiller = Profiler.get();
- gameprofilerfiller.push("save");
this.saveEverything(true, false, false);
- gameprofilerfiller.pop();
MinecraftServer.LOGGER.debug("Autosave finished");
}
@@ -1795,8 +1725,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
protected void tickChildren(BooleanSupplier shouldKeepTicking) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing();
});
@@ -1816,9 +1744,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
});
// Paper end - Folia scheduler API
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
- gameprofilerfiller.push("commandFunctions");
this.getFunctions().tick();
- gameprofilerfiller.popPush("levels");
//Iterator iterator = this.getAllLevels().iterator(); // Paper - Throw exception on world create while being ticked; moved down
// CraftBukkit start
@@ -1856,21 +1782,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
worldserver.updateLagCompensationTick(); // Paper - lag compensation
- gameprofilerfiller.push(() -> {
- String s = String.valueOf(worldserver);
-
- return s + " " + String.valueOf(worldserver.dimension().location());
- });
/* Drop global time updates
if (this.tickCount % 20 == 0) {
- gameprofilerfiller.push("timeSync");
this.synchronizeTime(worldserver);
- gameprofilerfiller.pop();
}
// CraftBukkit end */
- gameprofilerfiller.push("tick");
-
try {
worldserver.tick(shouldKeepTicking);
} catch (Throwable throwable) {
@@ -1880,27 +1797,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw new ReportedException(crashreport);
}
- gameprofilerfiller.pop();
- gameprofilerfiller.pop();
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
}
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
- gameprofilerfiller.popPush("connection");
this.tickConnection();
- gameprofilerfiller.popPush("players");
this.playerList.tick();
if (SharedConstants.IS_RUNNING_IN_IDE && this.tickRateManager.runsNormally()) {
GameTestTicker.SINGLETON.tick();
}
- gameprofilerfiller.popPush("server gui refresh");
-
for (int i = 0; i < this.tickables.size(); ++i) {
((Runnable) this.tickables.get(i)).run();
}
- gameprofilerfiller.popPush("send chunks");
iterator = this.playerList.getPlayers().iterator();
while (iterator.hasNext()) {
@@ -1909,8 +1819,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
entityplayer.connection.chunkSender.sendNextChunks(entityplayer);
entityplayer.connection.resumeFlushing();
}
-
- gameprofilerfiller.pop();
}
public void tickConnection() {
@@ -1922,9 +1830,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void forceTimeSynchronization() {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("timeSync");
Iterator iterator = this.getAllLevels().iterator();
while (iterator.hasNext()) {
@@ -1932,8 +1837,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.synchronizeTime(worldserver);
}
-
- gameprofilerfiller.pop();
}
public boolean isLevelEnabled(Level world) {
@@ -2885,50 +2788,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> resultConsumer, Consumer<Path> dumpConsumer) {
- this.onMetricsRecordingStopped = (methodprofilerresults) -> {
- this.stopRecordingMetrics();
- resultConsumer.accept(methodprofilerresults);
- };
- this.onMetricsRecordingFinished = dumpConsumer;
- 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 worldSavePath) {
return this.storageSource.getLevelPath(worldSavePath);
}
@@ -2978,25 +2837,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 methodprofilerresults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount);
-
- this.debugCommandProfiler = null;
- return methodprofilerresults;
- }
- }
-
public int getMaxChainedNeighborUpdates() {
return 1000000;
}
@@ -3109,56 +2949,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
- private static class TimeProfiler {
-
- final long startNanos;
- final int startTick;
-
- TimeProfiler(long time, int tick) {
- this.startNanos = time;
- this.startTick = tick;
- }
-
- ProfileResults stop(final long endTime, final int endTick) {
- return new ProfileResults() {
- @Override
- public List<ResultField> getTimes(String parentPath) {
- 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 endTime;
- }
-
- @Override
- public int getEndTimeTicks() {
- return endTick;
- }
-
- @Override
- public String getProfilerResults() {
- return "";
- }
- };
- }
- }
-
public static record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
}
diff --git a/src/main/java/net/minecraft/server/ReloadableServerResources.java b/src/main/java/net/minecraft/server/ReloadableServerResources.java
index 47d5d5fcc8623969c6ab7c148c043bc367f1d6cf..eaccec0df4ae9ea8f22074ab551209c6604ea054 100644
--- a/src/main/java/net/minecraft/server/ReloadableServerResources.java
+++ b/src/main/java/net/minecraft/server/ReloadableServerResources.java
@@ -98,7 +98,7 @@ public class ReloadableServerResources {
prepareExecutor,
applyExecutor,
DATA_RELOAD_INITIAL_TASK,
- LOGGER.isDebugEnabled()
+ false // Gale - Purpur - remove vanilla profiler
)
.done()
.thenApply(void_ -> reloadableServerResources);
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
index 0b348f701b61c7b7ed0190eff8b2d73f3a3d5c74..13b637afe8652327a69c926eded50b0afbf27103 100644
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
@@ -16,8 +16,6 @@ import net.minecraft.commands.functions.CommandFunction;
import net.minecraft.commands.functions.InstantiatedFunction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public class ServerFunctionManager {
@@ -54,10 +52,7 @@ public class ServerFunctionManager {
}
private void executeTagFunctions(Collection<CommandFunction<CommandSourceStack>> functions, ResourceLocation label) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
Objects.requireNonNull(label);
- gameprofilerfiller.push(label::toString);
Iterator iterator = functions.iterator();
while (iterator.hasNext()) {
@@ -65,17 +60,9 @@ public class ServerFunctionManager {
this.execute(commandfunction, this.getGameLoopSender());
}
-
- Profiler.get().pop();
}
public void execute(CommandFunction<CommandSourceStack> function, CommandSourceStack source) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push(() -> {
- return "function " + String.valueOf(function.id());
- });
-
try {
InstantiatedFunction<CommandSourceStack> instantiatedfunction = function.instantiate((CompoundTag) null, this.getDispatcher());
@@ -86,8 +73,6 @@ public class ServerFunctionManager {
;
} catch (Exception exception) {
ServerFunctionManager.LOGGER.warn("Failed to execute function {}", function.id(), exception);
- } finally {
- gameprofilerfiller.pop();
}
}
diff --git a/src/main/java/net/minecraft/server/commands/PerfCommand.java b/src/main/java/net/minecraft/server/commands/PerfCommand.java
index 8c587f829c5e8c6b6df3150024c4ae704988c47b..9f00cd7d23710787d0cb94377f21a541b7e19a95 100644
--- a/src/main/java/net/minecraft/server/commands/PerfCommand.java
+++ b/src/main/java/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 minecraftServer = source.getServer();
if (minecraftServer.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 minecraftServer = source.getServer();
if (!minecraftServer.isRecordingMetrics()) {
throw ERROR_NOT_RUNNING.create();
@@ -62,8 +70,22 @@ public class PerfCommand {
minecraftServer.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>Gale 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 tempProfilingDirectory, MinecraftServer server) {
String string = String.format(
Locale.ROOT, "%s-%s-%s", Util.getFilenameFormattedDateTime(), server.getWorldData().getLevelName(), SharedConstants.getCurrentVersion().getId()
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 43e2ffd275e4ea74edf5eb4065ce2ccb415740f3..7c3e5d77a63b433c3212c8aab5a37d2af5634091 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -837,12 +837,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/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java b/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java
index 7ea8c13c9993576c1408e710d3ceb9947b09090d..6a0a44ecc7ee6e838574b82f2faf5dcbd19abfa6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java
+++ b/src/main/java/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 targetStatus, boolean allowGeneration) {
- try (Zone zone = Profiler.get().zone("scheduleLayer")) {
- zone.addText(targetStatus::getName);
int i = this.getRadiusForLayer(targetStatus, allowGeneration);
for (int j = this.pos.x - i; j <= this.pos.x + i; j++) {
@@ -125,7 +121,6 @@ public class ChunkGenerationTask {
}
}
}
- }
}
private int getRadiusForLayer(ChunkStatus status, boolean generate) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..d72c49b7861f049ebc32f7bb15345243c4be5838 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -65,8 +65,6 @@ import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput;
import net.minecraft.util.Mth;
import net.minecraft.util.StaticCache2D;
-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;
@@ -406,16 +404,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick(BooleanSupplier shouldKeepTicking) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("poi");
this.poiManager.tick(shouldKeepTicking);
- gameprofilerfiller.popPush("chunk_unload");
if (!this.level.noSave()) {
this.processUnloads(shouldKeepTicking);
}
-
- gameprofilerfiller.pop();
}
public boolean hasWork() {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 381b2535d598094990af532b72b15eadc13208ad..0f9ea834c02114ad864abd13382665c02cb69ba4 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/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.ai.village.poi.PoiManager;
@@ -436,38 +434,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.distanceManager.purgeStaleTickets();
this.runDistanceManagerUpdates();
- gameprofilerfiller.popPush("unload");
this.chunkMap.tick(() -> true);
- gameprofilerfiller.pop();
this.clearCache();
}
// CraftBukkit end
@Override
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("purge");
if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot
this.distanceManager.purgeStaleTickets();
}
this.runDistanceManagerUpdates();
- gameprofilerfiller.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();
}
- gameprofilerfiller.popPush("unload");
this.chunkMap.tick(shouldKeepTicking);
- gameprofilerfiller.pop();
this.clearCache();
}
@@ -477,34 +465,26 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
this.lastInhabitedUpdate = i;
if (!this.level.isDebug()) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("pollingChunks");
if (this.level.tickRateManager().runsNormally()) {
List<LevelChunk> list = this.tickingChunks;
try {
- gameprofilerfiller.push("filteringTickingChunks");
this.collectTickingChunks(list);
- gameprofilerfiller.popPush("shuffleChunks");
// 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
- this.tickChunks(gameprofilerfiller, j, list);
- gameprofilerfiller.pop();
+ this.tickChunks(j, list); // Gale - Purpur - remove vanilla profiler
} finally {
list.clear();
}
}
- this.broadcastChangedChunks(gameprofilerfiller);
- gameprofilerfiller.pop();
+ this.broadcastChangedChunks(); // Gale - Purpur - remove vanilla profiler
}
}
- private void broadcastChangedChunks(ProfilerFiller profiler) {
- profiler.push("broadcast");
+ private void broadcastChangedChunks() { // Gale - Purpur - remove vanilla profiler
Iterator iterator = this.chunkHoldersToBroadcast.iterator();
while (iterator.hasNext()) {
@@ -517,7 +497,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
this.chunkHoldersToBroadcast.clear();
- profiler.pop();
}
private void collectTickingChunks(List<LevelChunk> chunks) {
@@ -543,8 +522,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
// Paper end - chunk tick iteration optimisation
}
- private void tickChunks(ProfilerFiller profiler, long timeDelta, List<LevelChunk> chunks) {
- profiler.popPush("naturalSpawnCount");
+ private void tickChunks(long timeDelta, List<LevelChunk> chunks) { // Gale - Purpur - remove vanilla profiler
int j = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - Optional per player mob spawns
final int naturalSpawnChunkCount = j;
@@ -571,7 +549,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
// Paper end - Optional per player mob spawns
this.lastSpawnState = spawnercreature_d;
- profiler.popPush("spawnAndTick");
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
List list1;
@@ -609,7 +586,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
}
- profiler.popPush("customSpawners");
if (flag) {
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
}
@@ -807,7 +783,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/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index d406eebb7efb00b79128bdceb71d51be4efbce4c..3401602c57337e96012c2768b38f523ca7dd6798 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -79,8 +79,6 @@ import net.minecraft.util.ProgressListener;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
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;
@@ -703,18 +701,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
public void tick(BooleanSupplier shouldKeepTicking) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
this.handlingTick = true;
TickRateManager tickratemanager = this.tickRateManager();
boolean flag = tickratemanager.runsNormally();
if (flag) {
- gameprofilerfiller.push("world border");
this.getWorldBorder().tick();
- gameprofilerfiller.popPush("weather");
this.advanceWeatherCycle();
- gameprofilerfiller.pop();
}
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
@@ -745,30 +738,22 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.tickTime();
}
- gameprofilerfiller.push("tickPending");
if (!this.isDebug() && flag) {
j = this.getGameTime();
- gameprofilerfiller.push("blockTicks");
this.blockTicks.tick(j, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks
- gameprofilerfiller.popPush("fluidTicks");
this.fluidTicks.tick(j, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks
- gameprofilerfiller.pop();
}
- gameprofilerfiller.popPush("raid");
if (flag) {
this.raids.tick();
}
- gameprofilerfiller.popPush("chunkSource");
this.getChunkSource().tick(shouldKeepTicking, true);
- gameprofilerfiller.popPush("blockEvents");
if (flag) {
this.runBlockEvents();
}
this.handlingTick = false;
- gameprofilerfiller.pop();
boolean flag1 = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this
if (flag1) {
@@ -776,20 +761,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
if (flag1 || this.emptyTime++ < 300) {
- gameprofilerfiller.push("entities");
if (this.dragonFight != null && flag) {
- gameprofilerfiller.push("dragonFight");
this.dragonFight.tick();
- gameprofilerfiller.pop();
}
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
if (!tickratemanager.isEntityFrozen(entity)) {
- gameprofilerfiller.push("checkDespawn");
entity.checkDespawn();
- gameprofilerfiller.pop();
if (true) { // Paper - rewrite chunk system
Entity entity1 = entity.getVehicle();
@@ -801,20 +781,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.stopRiding();
}
- gameprofilerfiller.push("tick");
this.guardEntityTick(this::tickNonPassenger, entity);
- gameprofilerfiller.pop();
}
}
}
});
- gameprofilerfiller.pop();
this.tickBlockEntities();
}
- gameprofilerfiller.push("entityManagement");
// Paper - rewrite chunk system
- gameprofilerfiller.pop();
}
@Override
@@ -830,9 +805,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
long i = this.levelData.getGameTime() + 1L;
this.serverLevelData.setGameTime(i);
- Profiler.get().push("scheduledFunctions");
this.serverLevelData.getScheduledEvents().tick(this.server, i);
- Profiler.get().pop();
if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
this.setDayTime(this.levelData.getDayTime() + 1L);
}
@@ -920,9 +893,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
boolean flag = this.isRaining();
int j = chunkcoordintpair.getMinBlockX();
int k = chunkcoordintpair.getMinBlockZ();
- ProfilerFiller gameprofilerfiller = Profiler.get();
- gameprofilerfiller.push("thunder");
if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking
BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15));
@@ -951,8 +922,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
}
- gameprofilerfiller.popPush("iceandsnow");
-
if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow
for (int l = 0; l < randomTickSpeed; ++l) {
if (simpleRandom.nextInt(48) == 0) { // Paper - optimise random ticking
@@ -961,12 +930,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
} // Paper - Option to disable ice and snow
- gameprofilerfiller.popPush("tickBlocks");
if (randomTickSpeed > 0) {
this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking
}
-
- gameprofilerfiller.pop();
}
@VisibleForTesting
@@ -1286,19 +1252,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}*/ // Paper - comment out EAR 2
// Spigot end
entity.setOldPosAndRot();
- ProfilerFiller gameprofilerfiller = Profiler.get();
++entity.tickCount;
- gameprofilerfiller.push(() -> {
- return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
- });
- gameprofilerfiller.incrementCounter("tickNonPassenger");
+
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); // Paper - EAR 2
if (isActive) { // Paper - EAR 2
entity.tick();
entity.postTick(); // CraftBukkit
} else { entity.inactiveTick(); } // Paper - EAR 2
- gameprofilerfiller.pop();
Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) {
@@ -1321,12 +1282,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
passenger.setOldPosAndRot();
++passenger.tickCount;
- ProfilerFiller gameprofilerfiller = Profiler.get();
- gameprofilerfiller.push(() -> {
- return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
- });
- gameprofilerfiller.incrementCounter("tickPassenger");
// Paper start - EAR 2
if (isActive) {
passenger.rideTick();
@@ -1338,7 +1294,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
vehicle.positionRider(passenger);
}
// Paper end - EAR 2
- gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator();
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index cffbd3300967e5d80b5973b35a76235bb2aa1b73..a0d940312e37d7b74df7103878ff547a45fc5c05 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -102,8 +102,6 @@ import net.minecraft.tags.FluidTags;
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.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.effect.MobEffectInstance;
@@ -1643,15 +1641,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
this.unsetRemoved();
*/
// CraftBukkit end
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("moving");
if (worldserver != null && resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit - empty to fall through to null to event
this.enteredNetherPosition = this.position();
}
- gameprofilerfiller.pop();
- gameprofilerfiller.push("placing");
// CraftBukkit start
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
LevelData worlddata = worldserver.getLevelData();
@@ -1668,7 +1661,6 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
this.connection.internalTeleport(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
worldserver.addDuringTeleport(this);
- gameprofilerfiller.pop();
this.triggerDimensionChangeTriggers(worldserver1);
this.stopUsingItem();
this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities()));
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index b0bc66dc7248aae691dcab68b925b52a1695e63f..d777e5914148103dbdbfef7c8e4f8e012fa58b6d 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -30,7 +30,6 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ClientInformation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
import net.minecraft.util.thread.BlockableEventLoop;
import org.slf4j.Logger;
@@ -255,7 +254,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
protected void keepConnectionAlive() {
- Profiler.get().push("keepAlive");
// Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
// This should effectively place the keepalive handling back to "as it was" before 1.12.2
long currentTime = Util.getMillis();
@@ -272,8 +270,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
}
// Paper end - give clients a longer time to respond to pings as per pre 1.12.2 timings
-
- Profiler.get().pop();
}
private boolean checkIfClosed(long time) {
diff --git a/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
index 5a2b07340c63577f6d32c0658ce5f9b616c82f91..cac2ac26242e6901080fc0a92684d2f4a11b0c47 100644
--- a/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
+++ b/src/main/java/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> {
@@ -51,12 +49,9 @@ public class ProfiledReloadInstance extends SimpleReloadInstance<ProfiledReloadI
private static Executor profiledExecutor(Executor executor, AtomicLong atomicLong, String string) {
return runnable -> executor.execute(() -> {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push(string);
long l = Util.getNanos();
runnable.run();
atomicLong.addAndGet(Util.getNanos() - l);
- profilerFiller.pop();
});
}
diff --git a/src/main/java/net/minecraft/server/packs/resources/ReloadableResourceManager.java b/src/main/java/net/minecraft/server/packs/resources/ReloadableResourceManager.java
index f0257e295d9e856391b8e881370610c06fab9fba..7b327b59374474f68b189cefbf97d4a4b4478472 100644
--- a/src/main/java/net/minecraft/server/packs/resources/ReloadableResourceManager.java
+++ b/src/main/java/net/minecraft/server/packs/resources/ReloadableResourceManager.java
@@ -41,7 +41,7 @@ public class ReloadableResourceManager implements ResourceManager, AutoCloseable
LOGGER.info("Reloading ResourceManager: {}", LogUtils.defer(() -> packs.stream().map(PackResources::packId).collect(Collectors.joining(", "))));
this.resources.close();
this.resources = new MultiPackResourceManager(this.type, packs);
- return SimpleReloadInstance.create(this.resources, this.listeners, prepareExecutor, applyExecutor, initialStage, LOGGER.isDebugEnabled());
+ return SimpleReloadInstance.create(this.resources, this.listeners, prepareExecutor, applyExecutor, initialStage, false); // Gale - Purpur - remove vanilla profiler
}
@Override
diff --git a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
index d2d82e4f22bfeac8881b6815e4bef56c254fded9..fd5d678dd2d514ab7b60c4378e05182be38f52c4 100644
--- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
+++ b/src/main/java/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 synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor
) {
- return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("listener");
- this.onResourceManagerReload(manager);
- profilerFiller.pop();
- }, applyExecutor);
+ return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> this.onResourceManagerReload(manager), applyExecutor); // Gale - Purpur - remove vanilla profiler
}
void onResourceManagerReload(ResourceManager manager);
diff --git a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
index 0aaab6a2a10bf012c9d275f7cee2095c8fbb8809..0d8f20035e051af8143dea154593f8a6fc3235f2 100644
--- a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
+++ b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
@@ -2,7 +2,8 @@ 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.InactiveProfiler;
import net.minecraft.util.profiling.ProfilerFiller;
public abstract class SimplePreparableReloadListener<T> implements PreparableReloadListener {
@@ -10,9 +11,9 @@ public abstract class SimplePreparableReloadListener<T> implements PreparableRel
public final CompletableFuture<Void> reload(
PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor
) {
- return CompletableFuture.<T>supplyAsync(() -> this.prepare(manager, Profiler.get()), prepareExecutor)
+ return CompletableFuture.<T>supplyAsync(() -> this.prepare(manager, InactiveProfiler.INSTANCE), prepareExecutor) // Gale - Purpur - remove vanilla profiler
.thenCompose(synchronizer::wait)
- .thenAcceptAsync(prepared -> this.apply((T)prepared, manager, Profiler.get()), applyExecutor);
+ .thenAcceptAsync(prepared -> this.apply((T)prepared, manager, InactiveProfiler.INSTANCE), applyExecutor); // Gale - Purpur - remove vanilla profiler
}
protected abstract T prepare(ResourceManager manager, ProfilerFiller profiler);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8be1b051543cda2b2e9e3d337834757e53f442de..47246af8ee1089ecbe4002236035e69bc61fbe46 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -84,8 +84,6 @@ import net.minecraft.tags.FluidTags;
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.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.Nameable;
@@ -925,9 +923,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// CraftBukkit end
public void baseTick() {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.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()) {
@@ -995,8 +990,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
Leashable.tickLeash(worldserver, (Entity & Leashable) this); // CraftBukkit - decompile error
}
}
-
- gameprofilerfiller.pop();
}
public void setSharedFlagOnFire(boolean onFire) {
@@ -1222,9 +1215,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("move");
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) {
movement = movement.multiply(this.stuckSpeedMultiplier);
this.stuckSpeedMultiplier = Vec3.ZERO;
@@ -1233,7 +1223,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);
- gameprofilerfiller.pop();
return;
}
// Paper end
@@ -1254,8 +1243,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z);
}
- gameprofilerfiller.pop();
- gameprofilerfiller.push("rest");
boolean flag = !Mth.equal(movement.x, vec3d1.x);
boolean flag1 = !Mth.equal(movement.z, vec3d1.z);
@@ -1277,7 +1264,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
if (this.isRemoved()) {
- gameprofilerfiller.pop();
} else {
if (this.horizontalCollision) {
Vec3 vec3d2 = this.getDeltaMovement();
@@ -1326,7 +1312,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
float f = this.getBlockSpeedFactor();
this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f));
- gameprofilerfiller.pop();
}
}
// Paper start - detailed watchdog information
@@ -3472,9 +3457,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.processPortalCooldown();
if (this.portalProcess != null) {
if (this.portalProcess.processPortalTeleportation(worldserver, this, this.canUsePortal(false))) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("portal");
this.setPortalCooldown();
TeleportTransition teleporttransition = this.portalProcess.getPortalDestination(worldserver, this);
@@ -3485,8 +3467,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.teleport(teleporttransition);
}
}
-
- gameprofilerfiller.pop();
} else if (this.portalProcess.hasExpired()) {
this.portalProcess = null;
}
@@ -4008,16 +3988,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
entity.teleport(this.calculatePassengerTransition(teleportTarget, entity));
}
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("teleportSameDimension");
this.teleportSetPosition(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives());
if (!teleportTarget.asPassenger()) {
this.sendTeleportTransitionToRidingPlayers(teleportTarget);
}
teleportTarget.postTeleportTransition().onTransition(this);
- gameprofilerfiller.pop();
return this;
}
@@ -4039,12 +4015,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("teleportCrossDimension");
entity = this.getType().create(world, EntitySpawnReason.DIMENSION_TRAVEL);
if (entity == null) {
- gameprofilerfiller.pop();
return null;
} else {
// Paper start - Fix item duplication and teleport issues
@@ -4070,7 +4042,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
world.resetEmptyTime();
teleportTarget.postTeleportTransition().onTransition(entity);
- gameprofilerfiller.pop();
return entity;
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e86314de8d908a0c3e9f17d3e163c11180cf3f59..098bedc39031b03a4cab24c0c02983e89174cead 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -73,8 +73,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;
@@ -452,9 +450,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
super.baseTick();
- ProfilerFiller gameprofilerfiller = Profiler.get();
- gameprofilerfiller.push("livingEntityBaseTick");
if (this.fireImmune() || this.level().isClientSide) {
this.clearFire();
}
@@ -561,7 +557,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.yHeadRotO = this.yHeadRot;
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
- gameprofilerfiller.pop();
}
@Override
@@ -3316,12 +3311,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.run += (f3 - this.run) * 0.3F;
- ProfilerFiller gameprofilerfiller = Profiler.get();
- gameprofilerfiller.push("headTurn");
f2 = this.tickHeadTurn(f1, f2);
- gameprofilerfiller.pop();
- gameprofilerfiller.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;
@@ -3333,7 +3324,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
// Paper end
- gameprofilerfiller.pop();
this.animStep += f2;
if (this.isFallFlying()) {
++this.fallFlyTicks;
@@ -3563,21 +3553,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.setDeltaMovement(d0, d1, d2);
- ProfilerFiller gameprofilerfiller = Profiler.get();
- gameprofilerfiller.push("ai");
if (this.isImmobile()) {
this.jumping = false;
this.xxa = 0.0F;
this.zza = 0.0F;
} else if (this.isEffectiveAi()) {
- gameprofilerfiller.push("newAi");
this.serverAiStep();
- gameprofilerfiller.pop();
}
- gameprofilerfiller.pop();
- gameprofilerfiller.push("jump");
if (this.jumping && this.isAffectedByFluids()) {
double d3;
@@ -3604,8 +3588,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.noJumpDelay = 0;
}
- gameprofilerfiller.pop();
- gameprofilerfiller.push("travel");
this.xxa *= 0.98F;
this.zza *= 0.98F;
if (this.isFallFlying()) {
@@ -3638,8 +3620,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.calculateEntityAnimation(this instanceof FlyingAnimal);
- gameprofilerfiller.pop();
- gameprofilerfiller.push("freezing");
if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API
int i = this.getTicksFrozen();
@@ -3660,15 +3640,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
- gameprofilerfiller.pop();
- gameprofilerfiller.push("push");
if (this.autoSpinAttackTicks > 0) {
--this.autoSpinAttackTicks;
this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
}
this.pushEntities();
- gameprofilerfiller.pop();
+
// Paper start - Add EntityMoveEvent
if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index dbd321f3dc3cc80737830db63aed47a6935e8e89..3ccc39e142f946e3fc34753fdc91a2cb62f9bd2d 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -34,8 +34,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.Difficulty;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
@@ -369,15 +367,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
public void baseTick() {
super.baseTick();
- ProfilerFiller gameprofilerfiller = Profiler.get();
- gameprofilerfiller.push("mobBaseTick");
if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) {
this.resetAmbientSoundTime();
this.playAmbientSound();
}
-
- gameprofilerfiller.pop();
}
@Override
@@ -670,9 +664,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
public void aiStep() {
super.aiStep();
- ProfilerFiller gameprofilerfiller = Profiler.get();
- gameprofilerfiller.push("looting");
Level world = this.level();
if (world instanceof ServerLevel worldserver) {
@@ -695,8 +687,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
}
}
-
- gameprofilerfiller.pop();
}
protected Vec3i getPickupReach() {
@@ -918,44 +908,24 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
return;
}
// Paper end - Allow nerfed mobs to jump and float
- ProfilerFiller gameprofilerfiller = Profiler.get();
- gameprofilerfiller.push("sensing");
this.sensing.tick();
- gameprofilerfiller.pop();
+
int i = this.tickCount + this.getId();
if (i % 2 != 0 && this.tickCount > 1) {
- gameprofilerfiller.push("targetSelector");
this.targetSelector.tickRunningGoals(false);
- gameprofilerfiller.pop();
- gameprofilerfiller.push("goalSelector");
this.goalSelector.tickRunningGoals(false);
- gameprofilerfiller.pop();
} else {
- gameprofilerfiller.push("targetSelector");
this.targetSelector.tick();
- gameprofilerfiller.pop();
- gameprofilerfiller.push("goalSelector");
this.goalSelector.tick();
- gameprofilerfiller.pop();
}
- gameprofilerfiller.push("navigation");
this.navigation.tick();
- gameprofilerfiller.pop();
- gameprofilerfiller.push("mob tick");
this.customServerAiStep((ServerLevel) this.level());
- gameprofilerfiller.pop();
- gameprofilerfiller.push("controls");
- gameprofilerfiller.push("move");
this.moveControl.tick();
- gameprofilerfiller.popPush("look");
this.lookControl.tick();
- gameprofilerfiller.popPush("jump");
this.jumpControl.tick();
- gameprofilerfiller.pop();
- gameprofilerfiller.pop();
this.sendDebugPackets();
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 29ae74339a4831ccef3d01e8054931715ba192ad..7ac88cb8704f84f1d932dff0fee927dfab8cad6a 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -7,8 +7,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 wrappedGoal2 : this.availableGoals) {
// Paper start
@@ -113,21 +106,15 @@ public class GoalSelector {
}
}
- profilerFiller.pop();
this.tickRunningGoals(true);
}
public void tickRunningGoals(boolean tickAll) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("goalTick");
-
for (WrappedGoal wrappedGoal : this.availableGoals) {
if (wrappedGoal.isRunning() && (tickAll || wrappedGoal.requiresUpdateEveryTick())) {
wrappedGoal.tick();
}
}
-
- profilerFiller.pop();
}
public Set<WrappedGoal> getAvailableGoals() {
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 48c0de870a5bbf647309e69361dfb10ab56c65ab..79342566ae54b5a8ccd8cab01b8282fada5b7bab 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -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;
@@ -188,13 +186,10 @@ public abstract class PathNavigation {
}
}
// Paper end - EntityPathfindEvent
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("pathfind");
BlockPos blockPos = useHeadPos ? this.mob.blockPosition().above() : this.mob.blockPosition();
int i = (int)(followRange + (float)range);
PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i));
Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier);
- profilerFiller.pop();
if (path != null && path.getTarget() != null) {
this.targetPos = path.getTarget();
this.reachRange = distance;
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java
index 116b1e251ffe68bae5c404d0823c2bc7c1afddf6..ed440b9a84ac0e4619c075491515fa072d6aebec 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java
@@ -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(i)) {
return false;
} else {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("hasLineOfSight");
boolean bl = this.mob.hasLineOfSight(entity);
- profilerFiller.pop();
if (bl) {
this.seen.add(i);
} else {
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
index 05c3d43fafc781e2c2d762dd5f509753df8da3b3..3a89c8bb4fbbe5a3a219e2fbc823c3abe529d1f2 100644
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
@@ -31,8 +31,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;
@@ -221,14 +219,8 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("allayBrain");
this.getBrain().tick(world, this);
- gameprofilerfiller.pop();
- gameprofilerfiller.push("allayActivityUpdate");
AllayAi.updateActivity(this);
- gameprofilerfiller.pop();
super.customServerAiStep(world);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
index c1ef714096159608752d744b98f615cd45fe459a..844a5a61428234adcc12e7e8af8f2781a4ad4be8 100644
--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -23,8 +23,6 @@ import net.minecraft.util.ByIdMap;
import net.minecraft.util.RandomSource;
import net.minecraft.util.StringRepresentable;
import net.minecraft.util.TimeUtil;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@@ -135,14 +133,8 @@ public class Armadillo extends Animal {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("armadilloBrain");
((Brain<Armadillo>) this.brain).tick(world, this); // CraftBukkit - decompile error
- gameprofilerfiller.pop();
- gameprofilerfiller.push("armadilloActivityUpdate");
ArmadilloAi.updateActivity(this);
- gameprofilerfiller.pop();
if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) {
this.forceDrops = true; // CraftBukkit
if (this.dropFromGiftLootTable(world, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index 31b10cd404b672d7ce21c2107d8f83e32de26ef4..22dbc237498d765bc9a13f6c5924769122406c8a 100644
--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -26,8 +26,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;
@@ -294,14 +292,8 @@ public class Axolotl extends Animal implements VariantHolder<Axolotl.Variant>, B
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("axolotlBrain");
this.getBrain().tick(world, this);
- gameprofilerfiller.pop();
- gameprofilerfiller.push("axolotlActivityUpdate");
AxolotlAi.updateActivity(this);
- gameprofilerfiller.pop();
if (!this.isNoAi()) {
Optional<Integer> optional = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS);
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index f3c884ab9c09f04dd01cabf2ee9de3b5b620563d..002e8b5a7037e48a7d9bd84c321b152f40fe1fce 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -17,8 +17,6 @@ import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.BlockTags;
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.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -143,16 +141,10 @@ public class Camel extends AbstractHorse {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("camelBrain");
Brain<Camel> behaviorcontroller = (Brain<Camel>) this.getBrain(); // CraftBukkit - decompile error
behaviorcontroller.tick(world, this);
- gameprofilerfiller.pop();
- gameprofilerfiller.push("camelActivityUpdate");
CamelAi.updateActivity(this);
- gameprofilerfiller.pop();
super.customServerAiStep(world);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
index 36846ba6b6c7494c745ebd8b221479a9d02ff318..1a71f1d094271b5ce798210562000f6d0160eaa6 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -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;
@@ -186,13 +184,8 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("frogBrain");
this.getBrain().tick(world, this);
- profilerFiller.pop();
- profilerFiller.push("frogActivityUpdate");
FrogAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(world);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
index 48ac8c3f6e00c3c2dc67b6c994be7c0ac6dfcf81..76ecf98d91a368cd223f09bb0c56a50320999735 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -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;
@@ -85,14 +83,8 @@ public class Tadpole extends AbstractFish {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("tadpoleBrain");
this.getBrain().tick(world, this);
- gameprofilerfiller.pop();
- gameprofilerfiller.push("tadpoleActivityUpdate");
TadpoleAi.updateActivity(this);
- gameprofilerfiller.pop();
super.customServerAiStep(world);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
index 76aca47d8638d5c37c57d3a59fa7f8ceaa5a53b4..f480ee1d0cde254d9621b85b4064771bdab2d3a3 100644
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -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;
@@ -194,14 +192,8 @@ public class Goat extends Animal {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("goatBrain");
this.getBrain().tick(world, this);
- gameprofilerfiller.pop();
- gameprofilerfiller.push("goatActivityUpdate");
GoatAi.updateActivity(this);
- gameprofilerfiller.pop();
super.customServerAiStep(world);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index af2f6e690fc51d319b77d081466c2dc7a1d8fe19..b61b41f542bd52965a9fbd79644038c68e7dea98 100644
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -30,8 +30,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;
@@ -467,13 +465,8 @@ public class Sniffer extends Animal {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("snifferBrain");
this.getBrain().tick(world, this);
- gameprofilerfiller.popPush("snifferActivityUpdate");
SnifferAi.updateActivity(this);
- gameprofilerfiller.pop();
super.customServerAiStep(world);
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
index 35b0c5c322864e2f5ae5a412296072f268adcd05..50b559a92b54c0be7624b1aebc70537573c58666 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
@@ -15,8 +15,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;
@@ -248,10 +246,7 @@ public class Zoglin extends Monster implements HoglinBase {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("zoglinBrain");
this.getBrain().tick(world, this);
- profilerFiller.pop();
this.updateActivity();
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java
index a16fd9c4679e874ad2d499f3c00c2ddfd780a7a5..5214b332acce9ad4096776bb4f0d263ec70dbc7b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java
+++ b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java
@@ -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;
@@ -235,12 +233,8 @@ public class Breeze extends Monster {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("breezeBrain");
this.getBrain().tick(world, this);
- profilerFiller.popPush("breezeActivityUpdate");
BreezeAi.updateActivity(this);
- profilerFiller.pop();
super.customServerAiStep(world);
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java
index 7b5f9284972b3a6bd8125891b23f73438e875c08..444e67eb9fa1fabff2304896bdd71772747dc437 100644
--- a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java
+++ b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java
@@ -13,8 +13,6 @@ import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AnimationState;
import net.minecraft.world.entity.Entity;
@@ -121,10 +119,7 @@ public class Creaking extends Monster {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("creakingBrain");
this.getBrain().tick((ServerLevel)this.level(), this);
- profilerFiller.pop();
CreakingAi.updateActivity(this);
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 6ea90e54759dbeab025e0a1896ee834ea9986427..7d2d3838c0ab2d13b301142aa633f76cd4e598e7 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -16,8 +16,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;
@@ -158,10 +156,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("hoglinBrain");
this.getBrain().tick(world, this);
- profilerFiller.pop();
HoglinAi.updateActivity(this);
if (this.isConverting()) {
this.timeInOverworld++;
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
index e04d2c5e75dc774fe893a552474fdb8045c32693..ad987660373cf1fd0edb778fa4203e3948b12fd4 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -6,8 +6,6 @@ import java.util.List;
import javax.annotation.Nullable;
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;
@@ -306,11 +304,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("piglinBrain");
this.getBrain().tick(world, this);
- gameprofilerfiller.pop();
PiglinAi.updateActivity(this);
super.customServerAiStep(world);
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
index 24eaeb93284fe1a573026b85818a93a34fd9e1ec..0cab5d5aa80f9ca8c34f982f0b81044328ba2d8f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
@@ -8,8 +8,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntitySpawnReason;
@@ -115,10 +113,7 @@ public class PiglinBrute extends AbstractPiglin {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("piglinBruteBrain");
this.getBrain().tick(world, this);
- profilerFiller.pop();
PiglinBruteAi.updateActivity(this);
PiglinBruteAi.maybePlayActivitySound(this);
super.customServerAiStep(world);
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
index 6180019da58b19d2595da508aed3196af922d587..9d9d58ab055b5bccedd6ebc9f6853ca8206cde65 100644
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
@@ -32,8 +32,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;
@@ -277,11 +275,7 @@ public class Warden extends Monster implements VibrationSystem {
@Override
protected void customServerAiStep(ServerLevel world) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("wardenBrain");
this.getBrain().tick(world, this);
- gameprofilerfiller.pop();
super.customServerAiStep(world);
if ((this.tickCount + this.getId()) % 120 == 0) {
Warden.applyDarknessAround(world, this.position(), this, 20);
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..08c780e9e1e167b84f70dce691bb564c8420b286 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -38,8 +38,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;
@@ -252,11 +250,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
protected void customServerAiStep(ServerLevel world, final boolean inactive) {
// Paper end - EAR 2
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("villagerBrain");
if (!inactive) this.getBrain().tick(world, this);
- gameprofilerfiller.pop();
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index c0e4b996715dec16dd181b7dac87c361a16a1f7f..38408c004bdf8e31ad8665f75205a0f42ef1ff99 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -34,8 +34,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;
@@ -230,7 +228,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@Override
public final <T extends Entity> List<T> getEntitiesOfClass(final Class<T> entityClass, final AABB boundingBox, final Predicate<? super T> predicate) {
- Profiler.get().incrementCounter("getEntities");
final List<T> ret = new java.util.ArrayList<>();
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate);
@@ -240,7 +237,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@Override
public final List<Entity> moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate<? super Entity> predicate) {
- Profiler.get().incrementCounter("getEntities");
final List<Entity> ret = new java.util.ArrayList<>();
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate);
@@ -1445,9 +1441,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
}
protected void tickBlockEntities() {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("blockEntities");
this.tickingBlockEntities = true;
if (!this.pendingBlockEntityTickers.isEmpty()) {
this.blockEntityTickers.addAll(this.pendingBlockEntityTickers);
@@ -1485,7 +1478,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
this.tickingBlockEntities = false;
- gameprofilerfiller.pop();
this.spigotConfig.currentPrimedTnt = 0; // Spigot
}
@@ -1655,7 +1647,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@Override
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
- Profiler.get().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList();
// Paper start - rewrite chunk system
@@ -1685,8 +1676,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
public <T extends Entity> void getEntities(final EntityTypeTest<Entity, T> entityTypeTest,
final AABB boundingBox, final Predicate<? super T> predicate,
final List<? super T> into, final int maxCount) {
- Profiler.get().incrementCounter("getEntities");
-
if (entityTypeTest instanceof net.minecraft.world.entity.EntityType<T> byType) {
if (maxCount != Integer.MAX_VALUE) {
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(byType, boundingBox, into, predicate, maxCount);
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 5297798c2be1ba85569c2b92ed221956bf75477a..3c7da8e11aad02d2b87c8913762e2f3f6040257b 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -24,8 +24,6 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.Profiler;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.random.WeightedRandomList;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntitySpawnReason;
@@ -163,9 +161,6 @@ public final class NaturalSpawner {
}
public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, List<MobCategory> spawnableGroups) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("spawner");
Iterator iterator = spawnableGroups.iterator();
while (iterator.hasNext()) {
@@ -210,8 +205,6 @@ public final class NaturalSpawner {
// Paper end - Optional per player mob spawns
}
}
-
- gameprofilerfiller.pop();
}
// Paper start - Add mobcaps commands
diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java
index bbbd451ff184be8fa13bd93d53c89a9502f9951a..4de71492339c3d31a34f1fa2aa75e8b216485ef0 100644
--- a/src/main/java/net/minecraft/world/level/ServerExplosion.java
+++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java
@@ -15,8 +15,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
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;
@@ -683,11 +681,7 @@ public class ServerExplosion implements Explosion {
this.hurtEntities();
if (this.interactsWithBlocks()) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("explosion_blocks");
this.interactWithBlocks(list);
- gameprofilerfiller.pop();
}
if (this.fire) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 4640baec5bed6c2d53cc0f8ca1d273cc115abe9b..09a6d7410bc029889ce4b89ab149a52f31468b9b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -25,8 +25,6 @@ import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData;
import net.minecraft.server.level.FullChunkStatus;
import net.minecraft.server.level.ServerLevel;
-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;
@@ -405,13 +403,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
}
if (LightEngine.hasDifferentLightProperties(iblockdata1, iblockdata)) {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push("updateSkyLightSources");
// Paper - rewrite chunk system
- gameprofilerfiller.popPush("queueCheckLight");
this.level.getChunkSource().getLightEngine().checkBlock(blockposition);
- gameprofilerfiller.pop();
}
boolean flag3 = iblockdata1.hasBlockEntity();
@@ -1058,9 +1051,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
if (LevelChunk.this.isTicking(blockposition)) {
try {
- ProfilerFiller gameprofilerfiller = Profiler.get();
-
- gameprofilerfiller.push(this::getType);
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
if (this.blockEntity.getType().isValid(iblockdata)) {
@@ -1075,8 +1065,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
}
// Paper end - Remove the Block Entity if it's invalid
}
-
- gameprofilerfiller.pop();
} catch (Throwable throwable) {
if (throwable instanceof ThreadDeath) throw throwable; // Paper
// Paper start - Prevent block entity and entity crashes
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
index cc7d94144e39f7dace7b569b4567def98396e8f9..d7ac3a6a1d7d5561aae153ecb1455b8972d9a61d 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
+++ b/src/main/java/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;
@@ -58,9 +55,6 @@ public class PathFinder {
@Nullable
// Paper start - Perf: remove streams and optimize collection
private Path findPath(Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("find_path");
- profilerFiller.markForCharting(MetricCategory.PATH_FINDING);
// Set<Target> set = positions.keySet();
startNode.g = 0.0F;
startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection
@@ -128,7 +122,6 @@ public class PathFinder {
if (best == null || comparator.compare(path, best) < 0)
best = path;
}
- profilerFiller.pop();
return best;
// Paper end - Perf: remove streams and optimize collection
}
diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java
index 778e6476c86d823dc8efe603a95e589e8b2ea9d9..97f304e287603dbe44080182665ef4454df2c66f 100644
--- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java
+++ b/src/main/java/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;
@@ -79,20 +77,13 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
}
public void tick(long time, int maxTicks, BiConsumer<BlockPos, T> ticker) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("collect");
- this.collectTicks(time, maxTicks, profilerFiller);
- profilerFiller.popPush("run");
- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size());
+ this.collectTicks(time, maxTicks); // Gale - Purpur - remove vanilla profiler
this.runCollectedTicks(ticker);
- profilerFiller.popPush("cleanup");
this.cleanupAfterTick();
- profilerFiller.pop();
}
- private void collectTicks(long time, int maxTicks, ProfilerFiller profiler) {
+ private void collectTicks(long time, int maxTicks) { // Gale - Purpur - remove vanilla profiler
this.sortContainersToTick(time);
- profiler.incrementCounter("containersToTick", this.containersToTick.size());
this.drainContainers(time, maxTicks);
this.rescheduleLeftoverContainers();
}