mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-28 11:09:09 +00:00
2009 lines
105 KiB
Diff
2009 lines
105 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 b7f338e982d0dcab99137ab6dc200b82ac6b7cba..7600991949de84b6667c0a80bfec4a13823ab9b8 100644
|
|
--- a/src/main/java/net/minecraft/commands/Commands.java
|
|
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
|
@@ -54,7 +54,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;
|
|
@@ -165,7 +164,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);
|
|
@@ -326,9 +324,6 @@ public class Commands {
|
|
public void performCommand(ParseResults<CommandSourceStack> parseresults, String s, String label) { // CraftBukkit
|
|
CommandSourceStack commandlistenerwrapper = (CommandSourceStack) parseresults.getContext().getSource();
|
|
|
|
- commandlistenerwrapper.getServer().getProfiler().push(() -> {
|
|
- return "/" + s;
|
|
- });
|
|
ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent
|
|
|
|
try {
|
|
@@ -356,8 +351,6 @@ public class Commands {
|
|
commandlistenerwrapper.sendFailure(Component.literal(Util.describeError(exception)));
|
|
Commands.LOGGER.error("'/{}' threw an exception", s, exception);
|
|
}
|
|
- } finally {
|
|
- commandlistenerwrapper.getServer().getProfiler().pop();
|
|
}
|
|
|
|
}
|
|
@@ -426,7 +419,7 @@ public class Commands {
|
|
int j = minecraftserver.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT);
|
|
|
|
try {
|
|
- ExecutionContext executioncontext1 = new ExecutionContext<>(i, j, minecraftserver.getProfiler());
|
|
+ ExecutionContext 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 38854a047c6da7e2551f206478d17628e765168d..cc827443a812735336e18ff3c7b7f15a448e02d0 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;
|
|
}
|
|
|
|
@@ -128,7 +126,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 446b7e585afccb034816a5371a3b7376cbef7177..f8e7b0336ca2545312d877db5a0f05386b025aed 100644
|
|
--- a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java
|
|
+++ b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java
|
|
@@ -43,11 +43,7 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
|
|
ChainModifiers chainModifiers = flags;
|
|
List<T> list = sources;
|
|
if (contextChain.getStage() != Stage.EXECUTE) {
|
|
- context.profiler().push(() -> {
|
|
- return "prepare " + this.commandInput;
|
|
- });
|
|
|
|
- try {
|
|
for(int i = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) {
|
|
CommandContext<T> commandContext = contextChain.getTopContext();
|
|
if (commandContext.isForked()) {
|
|
@@ -87,9 +83,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 821dc4aeaf48460000682604fba51b340b9738e7..4f4540ed9b3e603eec0d46fb5b58de24f27e734b 100644
|
|
--- a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java
|
|
+++ b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java
|
|
@@ -23,9 +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(() -> {
|
|
- return "execute " + this.commandInput;
|
|
- });
|
|
|
|
try {
|
|
executionContext.incrementCost();
|
|
@@ -36,8 +33,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 4919e1f741e4b1680cb9e3736d8096616adb6def..6f3d488fda697299f604e813b8eaa06ed9de828f 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -106,18 +106,9 @@ import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.SignatureValidator;
|
|
import net.minecraft.util.TimeUtil;
|
|
import net.minecraft.util.datafix.DataFixers;
|
|
-import net.minecraft.util.profiling.EmptyProfileResults;
|
|
-import net.minecraft.util.profiling.ProfileResults;
|
|
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;
|
|
@@ -215,14 +206,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 ProfilerFiller profiler;
|
|
- 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
|
|
@@ -336,13 +319,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.profiler = this.metricsRecorder.getProfiler();
|
|
- this.onMetricsRecordingStopped = (methodprofilerresults) -> {
|
|
- this.stopRecordingMetrics();
|
|
- };
|
|
- this.onMetricsRecordingFinished = (path) -> {
|
|
- };
|
|
this.random = RandomSource.create();
|
|
this.port = -1;
|
|
this.levels = Maps.newLinkedHashMap();
|
|
@@ -968,9 +944,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
// 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
|
|
@@ -1209,20 +1182,12 @@ 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;
|
|
- this.startMetricsRecordingTick();
|
|
- this.profiler.push("tick");
|
|
this.tickServer(flag ? () -> {
|
|
return false;
|
|
} : this::haveTime);
|
|
- this.profiler.popPush("nextTickWait");
|
|
this.mayHaveDelayedTasks = true;
|
|
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + i, this.nextTickTimeNanos);
|
|
this.waitUntilNextTick();
|
|
@@ -1230,8 +1195,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
this.tickRateManager.endTickWork();
|
|
}
|
|
|
|
- this.profiler.pop();
|
|
- this.endMetricsRecordingTick();
|
|
this.isReady = true;
|
|
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
|
|
}
|
|
@@ -1457,7 +1420,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
|
|
- this.getProfiler().incrementCounter("runTask");
|
|
super.doRunTask(ticktask);
|
|
}
|
|
|
|
@@ -1530,7 +1492,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
if (playerSaveInterval < 0) {
|
|
playerSaveInterval = autosavePeriod;
|
|
}
|
|
- this.profiler.push("save");
|
|
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
|
|
try {
|
|
this.isSaving = true;
|
|
@@ -1545,7 +1506,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
} finally {
|
|
this.isSaving = false;
|
|
}
|
|
- this.profiler.pop();
|
|
// Paper end - Incremental chunk and player saving
|
|
io.papermc.paper.util.CachedLists.reset(); // Paper
|
|
// Paper start - move executeAll() into full server tick timing
|
|
@@ -1558,7 +1518,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
|
|
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
|
|
// Paper end - Server Tick Events
|
|
- this.profiler.push("tallying");
|
|
long j = Util.getNanos() - i;
|
|
int k = this.tickCount % 100;
|
|
|
|
@@ -1574,7 +1533,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
tickTimes60s.add(this.tickCount, j);
|
|
// Paper end - Add tick times API and /mspt command
|
|
this.logTickTime(l - i);
|
|
- this.profiler.pop();
|
|
org.spigotmc.WatchdogThread.tick(); // Spigot
|
|
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTimingFullServerTick(); // Paper // Gale - final timings calls
|
|
}
|
|
@@ -1656,11 +1614,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
});
|
|
// Paper end - Folia scheduler API
|
|
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
|
|
- this.profiler.push("commandFunctions");
|
|
MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
|
|
this.getFunctions().tick();
|
|
MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper
|
|
- this.profiler.popPush("levels");
|
|
//Iterator iterator = this.getAllLevels().iterator(); // Paper - Throw exception on world create while being ticked; moved down
|
|
|
|
// CraftBukkit start
|
|
@@ -1702,19 +1658,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
|
|
|
|
- this.profiler.push(() -> {
|
|
- return worldserver + " " + worldserver.dimension().location();
|
|
- });
|
|
/* Drop global time updates
|
|
if (this.tickCount % 20 == 0) {
|
|
- this.profiler.push("timeSync");
|
|
this.synchronizeTime(worldserver);
|
|
- this.profiler.pop();
|
|
}
|
|
// CraftBukkit end */
|
|
|
|
- this.profiler.push("tick");
|
|
-
|
|
try {
|
|
worldserver.timings.doTick.startTiming(); // Spigot
|
|
worldserver.tick(shouldKeepTicking);
|
|
@@ -1731,17 +1680,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
throw new ReportedException(crashreport);
|
|
}
|
|
|
|
- this.profiler.pop();
|
|
- this.profiler.pop();
|
|
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
|
|
}
|
|
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
|
|
|
- this.profiler.popPush("connection");
|
|
MinecraftTimings.connectionTimer.startTiming(); // Spigot // Paper
|
|
this.getConnection().tick();
|
|
MinecraftTimings.connectionTimer.stopTiming(); // Spigot // Paper
|
|
- this.profiler.popPush("players");
|
|
MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper
|
|
this.playerList.tick();
|
|
MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper
|
|
@@ -1749,15 +1694,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
GameTestTicker.SINGLETON.tick();
|
|
}
|
|
|
|
- this.profiler.popPush("server gui refresh");
|
|
-
|
|
MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
|
|
for (int i = 0; i < this.tickables.size(); ++i) {
|
|
((Runnable) this.tickables.get(i)).run();
|
|
}
|
|
MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
|
|
|
|
- this.profiler.popPush("send chunks");
|
|
iterator = this.playerList.getPlayers().iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
@@ -1767,7 +1709,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
entityplayer.connection.resumeFlushing();
|
|
}
|
|
|
|
- this.profiler.pop();
|
|
}
|
|
|
|
private void synchronizeTime(ServerLevel world) {
|
|
@@ -1775,7 +1716,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
public void forceTimeSynchronization() {
|
|
- this.profiler.push("timeSync");
|
|
Iterator iterator = this.getAllLevels().iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
@@ -1783,8 +1723,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
|
|
this.synchronizeTime(worldserver);
|
|
}
|
|
-
|
|
- this.profiler.pop();
|
|
}
|
|
|
|
public boolean isNetherEnabled() {
|
|
@@ -2448,7 +2386,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
public ProfilerFiller getProfiler() {
|
|
- return this.profiler;
|
|
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Gale - Purpur - remove vanilla profiler
|
|
}
|
|
|
|
public abstract boolean isSingleplayerOwner(GameProfile profile);
|
|
@@ -2686,53 +2624,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
// CraftBukkit end
|
|
|
|
- private void startMetricsRecordingTick() {
|
|
- 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.profiler = SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server"));
|
|
- this.metricsRecorder.startTick();
|
|
- this.profiler.startTick();
|
|
- }
|
|
-
|
|
- private void endMetricsRecordingTick() {
|
|
- this.profiler.endTick();
|
|
- 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();
|
|
- this.profiler = this.metricsRecorder.getProfiler();
|
|
- }
|
|
-
|
|
public Path getWorldPath(LevelResource worldSavePath) {
|
|
return this.storageSource.getLevelPath(worldSavePath);
|
|
}
|
|
@@ -2778,25 +2669,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;
|
|
}
|
|
@@ -2837,56 +2709,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 3192ad97889f1a199b4b7b3dc43ff9bbafe748b3..28c77578f3d157c7fe47732850565b8e6ae69d03 100644
|
|
--- a/src/main/java/net/minecraft/server/ReloadableServerResources.java
|
|
+++ b/src/main/java/net/minecraft/server/ReloadableServerResources.java
|
|
@@ -69,7 +69,7 @@ public class ReloadableServerResources {
|
|
|
|
public static CompletableFuture<ReloadableServerResources> loadResources(ResourceManager manager, RegistryAccess.Frozen dynamicRegistryManager, FeatureFlagSet enabledFeatures, Commands.CommandSelection environment, int functionPermissionLevel, Executor prepareExecutor, Executor applyExecutor) {
|
|
ReloadableServerResources reloadableServerResources = new ReloadableServerResources(dynamicRegistryManager, enabledFeatures, environment, functionPermissionLevel);
|
|
- return SimpleReloadInstance.create(manager, reloadableServerResources.listeners(), prepareExecutor, applyExecutor, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled()).done().whenComplete((void_, throwable) -> {
|
|
+ return SimpleReloadInstance.create(manager, reloadableServerResources.listeners(), prepareExecutor, applyExecutor, DATA_RELOAD_INITIAL_TASK, false).done().whenComplete((void_, throwable) -> { // Gale - Purpur - remove vanilla profiler
|
|
reloadableServerResources.commandBuildContext.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.FAIL);
|
|
}).thenApply((void_) -> {
|
|
return reloadableServerResources;
|
|
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
|
|
index df0c15f6b5b2224d53e4f8fad42b9a1e5f33dc25..caa6dcfec13728863dcf21f9f778665b2bcd3d50 100644
|
|
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
|
|
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
|
|
@@ -16,7 +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.ProfilerFiller;
|
|
import org.slf4j.Logger;
|
|
|
|
public class ServerFunctionManager {
|
|
@@ -53,10 +52,7 @@ public class ServerFunctionManager {
|
|
}
|
|
|
|
private void executeTagFunctions(Collection<CommandFunction<CommandSourceStack>> functions, ResourceLocation label) {
|
|
- ProfilerFiller gameprofilerfiller = this.server.getProfiler();
|
|
-
|
|
Objects.requireNonNull(label);
|
|
- gameprofilerfiller.push(label::toString);
|
|
Iterator iterator = functions.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
@@ -64,17 +60,9 @@ public class ServerFunctionManager {
|
|
|
|
this.execute(commandfunction, this.getGameLoopSender());
|
|
}
|
|
-
|
|
- this.server.getProfiler().pop();
|
|
}
|
|
|
|
public void execute(CommandFunction<CommandSourceStack> function, CommandSourceStack source) {
|
|
- ProfilerFiller gameprofilerfiller = this.server.getProfiler();
|
|
-
|
|
- gameprofilerfiller.push(() -> {
|
|
- return "function " + function.id();
|
|
- });
|
|
-
|
|
try {
|
|
InstantiatedFunction<CommandSourceStack> instantiatedfunction = function.instantiate((CompoundTag) null, this.getDispatcher(), source);
|
|
|
|
@@ -85,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/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index 5a7278b093e37b95fb005ad5cc3cac90ac36f8fb..f07a0008387c18dae5b133b90ed291b364428d02 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -68,7 +68,6 @@ import net.minecraft.server.level.progress.ChunkProgressListener;
|
|
import net.minecraft.server.network.ServerPlayerConnection;
|
|
import net.minecraft.util.CsvOutput;
|
|
import net.minecraft.util.Mth;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.util.thread.BlockableEventLoop;
|
|
import net.minecraft.util.thread.ProcessorHandle;
|
|
import net.minecraft.util.thread.ProcessorMailbox;
|
|
@@ -538,20 +537,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
}
|
|
|
|
protected void tick(BooleanSupplier shouldKeepTicking) {
|
|
- ProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
|
-
|
|
try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper
|
|
- gameprofilerfiller.push("poi");
|
|
this.poiManager.tick(shouldKeepTicking);
|
|
} // Paper
|
|
- gameprofilerfiller.popPush("chunk_unload");
|
|
if (!this.level.noSave()) {
|
|
try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper
|
|
this.processUnloads(shouldKeepTicking);
|
|
} // Paper
|
|
}
|
|
-
|
|
- 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 366c0c9b45a819f7f94ebe3e49b8ab7f9edf9ce7..20ec10b843f90d2077f49d293d65fa6ed4876961 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
@@ -23,7 +23,6 @@ import net.minecraft.core.SectionPos;
|
|
import net.minecraft.network.protocol.Packet;
|
|
import net.minecraft.server.level.progress.ChunkProgressListener;
|
|
import net.minecraft.util.VisibleForDebug;
|
|
-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;
|
|
@@ -261,16 +260,12 @@ public class ServerChunkCache extends ChunkSource {
|
|
return ifLoaded;
|
|
}
|
|
// Paper end - Perf: Optimise getChunkAt calls for loaded chunks
|
|
- ProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
|
-
|
|
- gameprofilerfiller.incrementCounter("getChunk");
|
|
long k = ChunkPos.asLong(x, z);
|
|
|
|
ChunkAccess ichunkaccess;
|
|
|
|
// Paper - rewrite chunk system - there are no correct callbacks to remove items from cache in the new chunk system
|
|
|
|
- gameprofilerfiller.incrementCounter("getChunkCacheMiss");
|
|
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create, true); // Paper
|
|
ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor;
|
|
|
|
@@ -464,24 +459,19 @@ public class ServerChunkCache extends ChunkSource {
|
|
// CraftBukkit start - modelled on below
|
|
public void purgeUnload() {
|
|
if (true) return; // Paper - tickets will be removed later, this behavior isn't really well accounted for by the chunk system
|
|
- this.level.getProfiler().push("purge");
|
|
this.distanceManager.purgeStaleTickets();
|
|
this.runDistanceManagerUpdates();
|
|
- this.level.getProfiler().popPush("unload");
|
|
this.chunkMap.tick(() -> true);
|
|
- this.level.getProfiler().pop();
|
|
this.clearCache();
|
|
}
|
|
// CraftBukkit end
|
|
|
|
@Override
|
|
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
|
|
- this.level.getProfiler().push("purge");
|
|
this.level.timings.doChunkMap.startTiming(); // Spigot
|
|
this.distanceManager.purgeStaleTickets();
|
|
this.runDistanceManagerUpdates();
|
|
this.level.timings.doChunkMap.stopTiming(); // Spigot
|
|
- this.level.getProfiler().popPush("chunks");
|
|
if (tickChunks) {
|
|
this.level.timings.chunks.startTiming(); // Paper - timings
|
|
this.chunkMap.level.playerChunkLoader.tick(); // Paper - replace player chunk loader - this is mostly required to account for view distance changes
|
|
@@ -491,10 +481,8 @@ public class ServerChunkCache extends ChunkSource {
|
|
}
|
|
|
|
this.level.timings.doChunkUnload.startTiming(); // Spigot
|
|
- this.level.getProfiler().popPush("unload");
|
|
this.chunkMap.tick(shouldKeepTicking);
|
|
this.level.timings.doChunkUnload.stopTiming(); // Spigot
|
|
- this.level.getProfiler().pop();
|
|
this.clearCache();
|
|
}
|
|
|
|
@@ -504,17 +492,12 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
this.lastInhabitedUpdate = i;
|
|
if (!this.level.isDebug()) {
|
|
- ProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
|
-
|
|
- gameprofilerfiller.push("pollingChunks");
|
|
- gameprofilerfiller.push("filteringLoadedChunks");
|
|
// Paper - optimise chunk tick iteration
|
|
if (this.level.getServer().tickRateManager().runsNormally()) this.level.timings.chunkTicks.startTiming(); // Paper
|
|
|
|
// Paper - optimise chunk tick iteration
|
|
|
|
if (this.level.getServer().tickRateManager().runsNormally()) {
|
|
- gameprofilerfiller.popPush("naturalSpawnCount");
|
|
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
|
|
int k = this.distanceManager.getNaturalSpawnChunkCount();
|
|
// Paper start - Optional per player mob spawns
|
|
@@ -543,7 +526,6 @@ public class ServerChunkCache extends ChunkSource {
|
|
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
|
|
|
|
this.lastSpawnState = spawnercreature_d;
|
|
- gameprofilerfiller.popPush("spawnAndTick");
|
|
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
|
|
|
// Paper start - optimise chunk tick iteration
|
|
@@ -651,7 +633,6 @@ public class ServerChunkCache extends ChunkSource {
|
|
// Paper end - optimise chunk tick iteration
|
|
this.level.timings.chunkTicks.stopTiming(); // Paper
|
|
|
|
- gameprofilerfiller.popPush("customSpawners");
|
|
if (flag) {
|
|
try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
|
|
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
|
|
@@ -659,7 +640,6 @@ public class ServerChunkCache extends ChunkSource {
|
|
}
|
|
}
|
|
|
|
- gameprofilerfiller.popPush("broadcast");
|
|
// Paper - optimise chunk tick iteration
|
|
this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
|
|
// Paper start - optimise chunk tick iteration
|
|
@@ -677,8 +657,6 @@ public class ServerChunkCache extends ChunkSource {
|
|
// Paper end - optimise chunk tick iteration
|
|
this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
|
|
// Paper - optimise chunk tick iteration
|
|
- gameprofilerfiller.pop();
|
|
- gameprofilerfiller.pop();
|
|
}
|
|
}
|
|
|
|
@@ -850,7 +828,6 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
@Override
|
|
protected void doRunTask(Runnable task) {
|
|
- ServerChunkCache.this.level.getProfiler().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 3267978df4039d7b5096eee486d56345d619606d..2de2c2c09a57f46a7c7ff9603f57c104d5a911d9 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -78,7 +78,6 @@ import net.minecraft.util.Mth;
|
|
import net.minecraft.util.ProgressListener;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.Unit;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.util.valueproviders.IntProvider;
|
|
import net.minecraft.util.valueproviders.UniformInt;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
@@ -690,15 +689,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|
|
|
|
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
|
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), spigotConfig -> minecraftserver.galeConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor // Gale - Gale configuration
|
|
+ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), spigotConfig -> minecraftserver.galeConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor // Gale - Gale configuration // Gale - Purpur - remove vanilla profiler
|
|
this.pvpMode = minecraftserver.isPvpAllowed();
|
|
this.convertable = convertable_conversionsession;
|
|
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
|
|
// CraftBukkit end
|
|
this.players = Lists.newArrayList();
|
|
this.entityTickList = new EntityTickList();
|
|
- this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
|
- this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
|
+ // Gale start - Purpur - remove vanilla profiler
|
|
+ this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded);
|
|
+ this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded);
|
|
+ // Gale end - Purpur - remove vanilla profiler
|
|
this.navigatingMobs = new ObjectOpenHashSet();
|
|
this.blockEvents = new ObjectLinkedOpenHashSet();
|
|
this.blockEventsToReschedule = new ArrayList(64);
|
|
@@ -801,16 +802,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
|
|
public void tick(BooleanSupplier shouldKeepTicking) {
|
|
- ProfilerFiller gameprofilerfiller = this.getProfiler();
|
|
-
|
|
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();
|
|
}
|
|
|
|
@@ -842,30 +839,23 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
this.tickTime();
|
|
}
|
|
|
|
- gameprofilerfiller.popPush("tickPending");
|
|
this.timings.scheduledBlocks.startTiming(); // Paper
|
|
if (!this.isDebug() && flag) {
|
|
j = this.getGameTime();
|
|
- gameprofilerfiller.push("blockTicks");
|
|
this.blockTicks.tick(j, 65536, this::tickBlock);
|
|
- gameprofilerfiller.popPush("fluidTicks");
|
|
this.fluidTicks.tick(j, 65536, this::tickFluid);
|
|
- gameprofilerfiller.pop();
|
|
}
|
|
this.timings.scheduledBlocks.stopTiming(); // Paper
|
|
|
|
- gameprofilerfiller.popPush("raid");
|
|
if (flag) {
|
|
this.timings.raids.startTiming(); // Paper - timings
|
|
this.raids.tick();
|
|
this.timings.raids.stopTiming(); // Paper - timings
|
|
}
|
|
|
|
- gameprofilerfiller.popPush("chunkSource");
|
|
this.timings.chunkProviderTick.startTiming(); // Paper - timings
|
|
this.getChunkSource().tick(shouldKeepTicking, true);
|
|
this.timings.chunkProviderTick.stopTiming(); // Paper - timings
|
|
- gameprofilerfiller.popPush("blockEvents");
|
|
if (flag) {
|
|
this.timings.doSounds.startTiming(); // Spigot
|
|
this.runBlockEvents();
|
|
@@ -873,7 +863,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
|
|
this.handlingTick = false;
|
|
- gameprofilerfiller.pop();
|
|
boolean flag1 = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
|
|
|
|
if (flag1) {
|
|
@@ -881,12 +870,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
|
|
if (flag1 || this.emptyTime++ < 300) {
|
|
- gameprofilerfiller.push("entities");
|
|
this.timings.tickEntities.startTiming(); // Spigot
|
|
if (this.dragonFight != null && flag) {
|
|
- gameprofilerfiller.push("dragonFight");
|
|
this.dragonFight.tick();
|
|
- gameprofilerfiller.pop();
|
|
}
|
|
|
|
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
|
@@ -896,9 +882,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
|
|
entity.discard();
|
|
} else if (!tickratemanager.isEntityFrozen(entity)) {
|
|
- gameprofilerfiller.push("checkDespawn");
|
|
entity.checkDespawn();
|
|
- gameprofilerfiller.pop();
|
|
if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list
|
|
Entity entity1 = entity.getVehicle();
|
|
|
|
@@ -910,22 +894,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
entity.stopRiding();
|
|
}
|
|
|
|
- gameprofilerfiller.push("tick");
|
|
this.guardEntityTick(this::tickNonPassenger, entity);
|
|
- gameprofilerfiller.pop();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
this.timings.entityTick.stopTiming(); // Spigot
|
|
this.timings.tickEntities.stopTiming(); // Spigot
|
|
- gameprofilerfiller.pop();
|
|
this.tickBlockEntities();
|
|
}
|
|
|
|
- gameprofilerfiller.push("entityManagement");
|
|
//this.entityManager.tick(); // Paper - rewrite chunk system
|
|
- gameprofilerfiller.pop();
|
|
}
|
|
|
|
@Override
|
|
@@ -984,9 +963,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
boolean flag = this.isRaining();
|
|
int j = chunkcoordintpair.getMinBlockX();
|
|
int k = chunkcoordintpair.getMinBlockZ();
|
|
- ProfilerFiller gameprofilerfiller = this.getProfiler();
|
|
-
|
|
- gameprofilerfiller.push("thunder");
|
|
final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
|
|
|
|
if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder
|
|
@@ -1017,8 +993,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
}
|
|
|
|
- gameprofilerfiller.popPush("iceandsnow");
|
|
-
|
|
if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow
|
|
for (int l = 0; l < randomTickSpeed; ++l) {
|
|
if (this.random.nextInt(48) == 0) {
|
|
@@ -1030,7 +1004,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
} // Paper - Option to disable ice and snow
|
|
|
|
- gameprofilerfiller.popPush("tickBlocks");
|
|
timings.chunkTicksBlocks.startTiming(); // Paper
|
|
if (randomTickSpeed > 0) {
|
|
// Paper start - optimize random block ticking
|
|
@@ -1066,7 +1039,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
// Paper end - optimise random block ticking
|
|
|
|
timings.chunkTicksBlocks.stopTiming(); // Paper
|
|
- gameprofilerfiller.pop();
|
|
}
|
|
|
|
@VisibleForTesting
|
|
@@ -1395,19 +1367,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
try {
|
|
// Paper end - timings
|
|
entity.setOldPosAndRot();
|
|
- ProfilerFiller gameprofilerfiller = this.getProfiler();
|
|
|
|
++entity.tickCount;
|
|
- this.getProfiler().push(() -> {
|
|
- return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
|
|
- });
|
|
- gameprofilerfiller.incrementCounter("tickNonPassenger");
|
|
if (isActive) { // Paper - EAR 2
|
|
TimingHistory.activatedEntityTicks++;
|
|
entity.tick();
|
|
entity.postTick(); // CraftBukkit
|
|
} else { entity.inactiveTick(); } // Paper - EAR 2
|
|
- this.getProfiler().pop();
|
|
} finally { timer.stopTiming(); } // Paper - timings
|
|
Iterator iterator = entity.getPassengers().iterator();
|
|
|
|
@@ -1436,12 +1402,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
// Paper end
|
|
passenger.setOldPosAndRot();
|
|
++passenger.tickCount;
|
|
- ProfilerFiller gameprofilerfiller = this.getProfiler();
|
|
-
|
|
- gameprofilerfiller.push(() -> {
|
|
- return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
|
|
- });
|
|
- gameprofilerfiller.incrementCounter("tickPassenger");
|
|
// Paper start - EAR 2
|
|
if (isActive) {
|
|
passenger.rideTick();
|
|
@@ -1453,7 +1413,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
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 58591bf2f63b9c5e97d9ce4188dff3366968a178..deb9a8931bbc6d8687d629fac9787361fc96aae6 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -1213,7 +1213,6 @@ public class ServerPlayer extends Player {
|
|
PortalInfo shapedetectorshape = this.findDimensionEntryPoint(worldserver);
|
|
|
|
if (shapedetectorshape != null) {
|
|
- worldserver1.getProfiler().push("moving");
|
|
worldserver = shapedetectorshape.world; // CraftBukkit
|
|
if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event
|
|
if (resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit
|
|
@@ -1236,8 +1235,6 @@ public class ServerPlayer extends Player {
|
|
worldserver = ((CraftWorld) exit.getWorld()).getHandle();
|
|
// CraftBukkit end
|
|
|
|
- worldserver1.getProfiler().pop();
|
|
- worldserver1.getProfiler().push("placing");
|
|
if (true) { // CraftBukkit
|
|
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
|
|
|
|
@@ -1254,7 +1251,6 @@ public class ServerPlayer extends Player {
|
|
this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
|
|
this.connection.resetPosition();
|
|
worldserver.addDuringPortalTeleport(this);
|
|
- worldserver1.getProfiler().pop();
|
|
this.triggerDimensionChangeTriggers(worldserver1);
|
|
this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities()));
|
|
playerlist.sendLevelInfo(this, worldserver);
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
index 0306771b8f90dcdd77f151c19c6c2d75c41f8feb..e7583996cc6d750cbd72f749de39ecded56d7f7c 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
@@ -203,7 +203,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
|
}
|
|
|
|
protected void keepConnectionAlive() {
|
|
- this.server.getProfiler().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();
|
|
@@ -224,7 +223,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
|
|
|
|
- this.server.getProfiler().pop();
|
|
}
|
|
|
|
public void suspendFlushing() {
|
|
diff --git a/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java
|
|
index 828196decc89e7e03f88c4a3208ee1ab2bb69242..ff1ac081ba9de69bd684a26a6455ac2b6cd2cae9 100644
|
|
--- a/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java
|
|
+++ b/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java
|
|
@@ -5,7 +5,13 @@ import java.util.concurrent.Executor;
|
|
import net.minecraft.util.profiling.ProfilerFiller;
|
|
|
|
public interface PreparableReloadListener {
|
|
- CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor);
|
|
+ // Gale start - Purpur - remove vanilla profiler
|
|
+ default CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) {
|
|
+ return this.reload(synchronizer, manager, prepareExecutor, applyExecutor);
|
|
+ }
|
|
+
|
|
+ CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor);
|
|
+ // Gale end - Purpur - remove vanilla profiler
|
|
|
|
default String getName() {
|
|
return this.getClass().getSimpleName();
|
|
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 c83c6fe5f7e2dc00a36cdd76c23317f232a2336b..47091691ca667e8ee58fa96ee9a2a827bcee5ce3 100644
|
|
--- a/src/main/java/net/minecraft/server/packs/resources/ReloadableResourceManager.java
|
|
+++ b/src/main/java/net/minecraft/server/packs/resources/ReloadableResourceManager.java
|
|
@@ -43,7 +43,7 @@ public class ReloadableResourceManager implements ResourceManager, AutoCloseable
|
|
}));
|
|
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 9ddbfcf80d9a381dace78a62880f85a4d767e0eb..61a7c5e253e790b1e966c704af2f9645322a026e 100644
|
|
--- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
|
|
+++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
|
|
@@ -3,17 +3,12 @@ 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.ProfilerFiller;
|
|
|
|
public interface ResourceManagerReloadListener extends PreparableReloadListener {
|
|
@Override
|
|
- default CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) {
|
|
+ default CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor) { // Gale - Purpur - remove vanilla profiler
|
|
return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> {
|
|
- applyProfiler.startTick();
|
|
- applyProfiler.push("listener");
|
|
this.onResourceManagerReload(manager);
|
|
- applyProfiler.pop();
|
|
- applyProfiler.endTick();
|
|
}, applyExecutor);
|
|
}
|
|
|
|
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 7ab57748b2f2aea1003d9b7e70e76c372aa1e432..47e75ec4a01f8a456ec6ebc13031c1f0c5537d6a 100644
|
|
--- a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
|
|
+++ b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
|
|
@@ -2,15 +2,17 @@ package net.minecraft.server.packs.resources;
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.Executor;
|
|
+
|
|
+import net.minecraft.util.profiling.InactiveProfiler;
|
|
import net.minecraft.util.profiling.ProfilerFiller;
|
|
|
|
public abstract class SimplePreparableReloadListener<T> implements PreparableReloadListener {
|
|
@Override
|
|
- public final CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) {
|
|
+ public final CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor) { // Gale - Purpur - remove vanilla profiler
|
|
return CompletableFuture.supplyAsync(() -> {
|
|
- return this.prepare(manager, prepareProfiler);
|
|
+ return this.prepare(manager, InactiveProfiler.INSTANCE); // Gale - Purpur - remove vanilla profiler
|
|
}, prepareExecutor).thenCompose(synchronizer::wait).thenAcceptAsync((prepared) -> {
|
|
- this.apply(prepared, manager, applyProfiler);
|
|
+ this.apply(prepared, manager, InactiveProfiler.INSTANCE); // Gale - Purpur - remove vanilla profiler
|
|
}, applyExecutor);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 906eded9a2ab61737a30cfe89292a71237ce4eb7..b4ba0ff5a32fea0afcd987a530c4301371ec1f82 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -820,7 +820,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
// CraftBukkit end
|
|
|
|
public void baseTick() {
|
|
- this.level().getProfiler().push("entityBaseTick");
|
|
if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups
|
|
this.feetBlockState = null;
|
|
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
|
@@ -881,7 +880,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
}
|
|
|
|
this.firstTick = false;
|
|
- this.level().getProfiler().pop();
|
|
}
|
|
|
|
public void setSharedFlagOnFire(boolean onFire) {
|
|
@@ -1100,7 +1098,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
}
|
|
}
|
|
|
|
- this.level().getProfiler().push("move");
|
|
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) {
|
|
movement = movement.multiply(this.stuckSpeedMultiplier);
|
|
this.stuckSpeedMultiplier = Vec3.ZERO;
|
|
@@ -1109,7 +1106,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
// Paper start - ignore movement changes while inactive.
|
|
if (isTemporarilyActive && !(this instanceof ItemEntity || this instanceof net.minecraft.world.entity.vehicle.AbstractMinecart) && movement == getDeltaMovement() && movementType == MoverType.SELF) {
|
|
setDeltaMovement(Vec3.ZERO);
|
|
- this.level.getProfiler().pop();
|
|
return;
|
|
}
|
|
// Paper end
|
|
@@ -1130,8 +1126,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z);
|
|
}
|
|
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("rest");
|
|
boolean flag = !Mth.equal(movement.x, vec3d1.x);
|
|
boolean flag1 = !Mth.equal(movement.z, vec3d1.z);
|
|
|
|
@@ -1149,9 +1143,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
BlockState iblockdata = this.level().getBlockState(blockposition);
|
|
|
|
this.checkFallDamage(vec3d1.y, this.onGround(), iblockdata, blockposition);
|
|
- if (this.isRemoved()) {
|
|
- this.level().getProfiler().pop();
|
|
- } else {
|
|
+ if (!this.isRemoved()) {
|
|
if (this.horizontalCollision) {
|
|
Vec3 vec3d2 = this.getDeltaMovement();
|
|
|
|
@@ -1287,8 +1279,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
if (this.isOnFire() && (this.isInPowderSnow || this.isInWaterRainOrBubble())) {
|
|
this.setRemainingFireTicks(-this.getFireImmuneTicks());
|
|
}
|
|
-
|
|
- this.level().getProfiler().pop();
|
|
}
|
|
}
|
|
// Paper start - detailed watchdog information
|
|
@@ -3143,7 +3133,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
ServerLevel worldserver1 = minecraftserver.getLevel(resourcekey);
|
|
|
|
if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
|
|
- this.level().getProfiler().push("portal");
|
|
this.portalTime = i;
|
|
// Paper start - Add EntityPortalReadyEvent
|
|
io.papermc.paper.event.entity.EntityPortalReadyEvent event = new io.papermc.paper.event.entity.EntityPortalReadyEvent(this.getBukkitEntity(), worldserver1 == null ? null : worldserver1.getWorld(), org.bukkit.PortalType.NETHER);
|
|
@@ -3161,7 +3150,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
}
|
|
} // Paper - Add EntityPortalReadyEvent
|
|
// CraftBukkit end
|
|
- this.level().getProfiler().pop();
|
|
}
|
|
|
|
this.isInsidePortal = false;
|
|
@@ -3635,14 +3623,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
}
|
|
// Paper end - Fix item duplication and teleport issues
|
|
if (this.level() instanceof ServerLevel && !this.isRemoved()) {
|
|
- this.level().getProfiler().push("changeDimension");
|
|
// CraftBukkit start
|
|
// this.unRide();
|
|
if (worldserver == null) {
|
|
return null;
|
|
}
|
|
// CraftBukkit end
|
|
- this.level().getProfiler().push("reposition");
|
|
PortalInfo shapedetectorshape = (location == null) ? this.findDimensionEntryPoint(worldserver) : new PortalInfo(new Vec3(location.x(), location.y(), location.z()), Vec3.ZERO, this.yRot, this.xRot, worldserver, null); // CraftBukkit
|
|
|
|
if (shapedetectorshape == null) {
|
|
@@ -3681,7 +3667,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
this.unRide();
|
|
// CraftBukkit end
|
|
|
|
- this.level().getProfiler().popPush("reloading");
|
|
// Paper start - Fix item duplication and teleport issues
|
|
if (this instanceof Mob) {
|
|
((Mob) this).dropLeash(true, true); // Paper drop lead
|
|
@@ -3708,10 +3693,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
}
|
|
|
|
this.removeAfterChangingDimensions();
|
|
- this.level().getProfiler().pop();
|
|
((ServerLevel) this.level()).resetEmptyTime();
|
|
worldserver.resetEmptyTime();
|
|
- this.level().getProfiler().pop();
|
|
return entity;
|
|
}
|
|
} else {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 902c0e7f2a167845f46adef4578bc71ca8cabfe8..68b23175b5ea1c10cad0c865b8445c0d461f41e4 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -404,7 +404,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
}
|
|
|
|
super.baseTick();
|
|
- this.level().getProfiler().push("livingEntityBaseTick");
|
|
if (this.fireImmune() || this.level().isClientSide) {
|
|
this.clearFire();
|
|
}
|
|
@@ -506,7 +505,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
this.yHeadRotO = this.yHeadRot;
|
|
this.yRotO = this.getYRot();
|
|
this.xRotO = this.getXRot();
|
|
- this.level().getProfiler().pop();
|
|
}
|
|
|
|
public boolean canSpawnSoulSpeedParticle() {
|
|
@@ -3089,10 +3087,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
}
|
|
|
|
this.run += (f3 - this.run) * 0.3F;
|
|
- this.level().getProfiler().push("headTurn");
|
|
f2 = this.tickHeadTurn(f1, f2);
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().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;
|
|
@@ -3104,7 +3099,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
|
|
// Paper end
|
|
|
|
- this.level().getProfiler().pop();
|
|
this.animStep += f2;
|
|
if (this.isFallFlying()) {
|
|
++this.fallFlyTicks;
|
|
@@ -3399,19 +3393,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
}
|
|
|
|
this.setDeltaMovement(d0, d1, d2);
|
|
- this.level().getProfiler().push("ai");
|
|
if (this.isImmobile()) {
|
|
this.jumping = false;
|
|
this.xxa = 0.0F;
|
|
this.zza = 0.0F;
|
|
} else if (this.isEffectiveAi()) {
|
|
- this.level().getProfiler().push("newAi");
|
|
this.serverAiStep();
|
|
- this.level().getProfiler().pop();
|
|
}
|
|
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("jump");
|
|
if (this.jumping && this.isAffectedByFluids()) {
|
|
double d3;
|
|
|
|
@@ -3438,8 +3427,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
this.noJumpDelay = 0;
|
|
}
|
|
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("travel");
|
|
this.xxa *= 0.98F;
|
|
this.zza *= 0.98F;
|
|
this.updateFallFlying();
|
|
@@ -3466,8 +3453,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
this.travel(vec3d1);
|
|
}
|
|
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("freezing");
|
|
if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API
|
|
int i = this.getTicksFrozen();
|
|
|
|
@@ -3484,15 +3469,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
this.hurt(this.damageSources().freeze(), 1.0F);
|
|
}
|
|
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("push");
|
|
if (this.autoSpinAttackTicks > 0) {
|
|
--this.autoSpinAttackTicks;
|
|
this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
|
|
}
|
|
|
|
this.pushEntities();
|
|
- this.level().getProfiler().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 fa0b78139fecc0245e168ebeb4172ea2531a3fec..2dfdeec25ef0d9a004601fd9b5050c881156de26 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
|
@@ -146,8 +146,10 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
|
this.pathfindingMalus = Maps.newEnumMap(BlockPathTypes.class);
|
|
this.restrictCenter = BlockPos.ZERO;
|
|
this.restrictRadius = -1.0F;
|
|
- this.goalSelector = new GoalSelector(world.getProfilerSupplier());
|
|
- this.targetSelector = new GoalSelector(world.getProfilerSupplier());
|
|
+ // Gale start - Purpur - remove vanilla profiler
|
|
+ this.goalSelector = new GoalSelector();
|
|
+ this.targetSelector = new GoalSelector();
|
|
+ // Gale end - Purpur - remove vanilla profiler
|
|
this.lookControl = new LookControl(this);
|
|
this.moveControl = new MoveControl(this);
|
|
this.jumpControl = new JumpControl(this);
|
|
@@ -362,13 +364,10 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
|
@Override
|
|
public void baseTick() {
|
|
super.baseTick();
|
|
- this.level().getProfiler().push("mobBaseTick");
|
|
if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) {
|
|
this.resetAmbientSoundTime();
|
|
this.playAmbientSound();
|
|
}
|
|
-
|
|
- this.level().getProfiler().pop();
|
|
}
|
|
|
|
@Override
|
|
@@ -673,7 +672,6 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
|
@Override
|
|
public void aiStep() {
|
|
super.aiStep();
|
|
- this.level().getProfiler().push("looting");
|
|
if (!this.level().isClientSide && this.canPickUpLoot() && this.isAlive() && !this.dead && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
|
Vec3i baseblockposition = this.getPickupReach();
|
|
List<ItemEntity> list = this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ()));
|
|
@@ -692,8 +690,6 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
|
}
|
|
}
|
|
}
|
|
-
|
|
- this.level().getProfiler().pop();
|
|
}
|
|
|
|
protected Vec3i getPickupReach() {
|
|
@@ -905,42 +901,22 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
|
return;
|
|
}
|
|
// Paper end - Allow nerfed mobs to jump and float
|
|
- this.level().getProfiler().push("sensing");
|
|
this.sensing.tick();
|
|
- this.level().getProfiler().pop();
|
|
int i = this.level().getServer().getTickCount() + this.getId();
|
|
|
|
if (i % 2 != 0 && this.tickCount > 1) {
|
|
- this.level().getProfiler().push("targetSelector");
|
|
this.targetSelector.tickRunningGoals(false);
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("goalSelector");
|
|
this.goalSelector.tickRunningGoals(false);
|
|
- this.level().getProfiler().pop();
|
|
} else {
|
|
- this.level().getProfiler().push("targetSelector");
|
|
this.targetSelector.tick();
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("goalSelector");
|
|
this.goalSelector.tick();
|
|
- this.level().getProfiler().pop();
|
|
}
|
|
|
|
- this.level().getProfiler().push("navigation");
|
|
this.navigation.tick();
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("mob tick");
|
|
this.customServerAiStep();
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("controls");
|
|
- this.level().getProfiler().push("move");
|
|
this.moveControl.tick();
|
|
- this.level().getProfiler().popPush("look");
|
|
this.lookControl.tick();
|
|
- this.level().getProfiler().popPush("jump");
|
|
this.jumpControl.tick();
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().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 676f5485a4ca9252e911213dcda8d51776b637b6..fda42ae6579819aa140766829d852633415e8d76 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
|
|
@@ -11,7 +11,6 @@ import java.util.Set;
|
|
import java.util.function.Predicate;
|
|
import java.util.function.Supplier;
|
|
import java.util.stream.Stream;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import org.slf4j.Logger;
|
|
|
|
public class GoalSelector {
|
|
@@ -29,7 +28,6 @@ public class GoalSelector {
|
|
};
|
|
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
|
|
private final Set<WrappedGoal> availableGoals = Sets.newLinkedHashSet();
|
|
- private final Supplier<ProfilerFiller> profiler;
|
|
private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
|
|
private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
|
|
private int tickCount;
|
|
@@ -37,9 +35,7 @@ public class GoalSelector {
|
|
private int curRate;
|
|
private static final Goal.Flag[] GOAL_FLAG_VALUES = Goal.Flag.values(); // Paper - remove streams from pathfindergoalselector
|
|
|
|
- public GoalSelector(Supplier<ProfilerFiller> profiler) {
|
|
- this.profiler = profiler;
|
|
- }
|
|
+ public GoalSelector() {} // Gale - Purpur - remove vanilla profiler
|
|
|
|
public void addGoal(int priority, Goal goal) {
|
|
this.availableGoals.add(new WrappedGoal(priority, goal));
|
|
@@ -102,9 +98,6 @@ public class GoalSelector {
|
|
}
|
|
|
|
public void tick() {
|
|
- ProfilerFiller profilerFiller = this.profiler.get();
|
|
- profilerFiller.push("goalCleanup");
|
|
-
|
|
for(WrappedGoal wrappedGoal : this.availableGoals) {
|
|
if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) {
|
|
wrappedGoal.stop();
|
|
@@ -120,9 +113,6 @@ public class GoalSelector {
|
|
}
|
|
}
|
|
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("goalUpdate");
|
|
-
|
|
for(WrappedGoal wrappedGoal2 : this.availableGoals) {
|
|
// Paper start
|
|
if (!wrappedGoal2.isRunning() && !goalContainsAnyFlags(wrappedGoal2, this.goalTypes) && goalCanBeReplacedForAllFlags(wrappedGoal2, this.lockedFlags) && wrappedGoal2.canUse()) {
|
|
@@ -141,21 +131,15 @@ public class GoalSelector {
|
|
}
|
|
}
|
|
|
|
- profilerFiller.pop();
|
|
this.tickRunningGoals(true);
|
|
}
|
|
|
|
public void tickRunningGoals(boolean tickAll) {
|
|
- ProfilerFiller profilerFiller = this.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 a04fb58c29b462e20ed0b702cef478e3985b7cd2..33983ed67ad6b0d25d2ae00e03415bda940584eb 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
|
|
@@ -173,12 +173,10 @@ public abstract class PathNavigation {
|
|
}
|
|
}
|
|
// Paper end - EntityPathfindEvent
|
|
- this.level.getProfiler().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);
|
|
- this.level.getProfiler().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 51772f03a3469b11e7166ec6f3a1b9c64a606221..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
|
|
@@ -26,9 +26,7 @@ public class Sensing {
|
|
} else if (this.unseen.contains(i)) {
|
|
return false;
|
|
} else {
|
|
- this.mob.level().getProfiler().push("hasLineOfSight");
|
|
boolean bl = this.mob.hasLineOfSight(entity);
|
|
- this.mob.level().getProfiler().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 5ad5f22e5aa26445e5eb229958e7bf356bdd460e..26731a659fe3c40fc20135d473bacf105cc15300 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
|
|
@@ -223,12 +223,8 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("allayBrain");
|
|
this.getBrain().tick((ServerLevel) this.level(), this);
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("allayActivityUpdate");
|
|
AllayAi.updateActivity(this);
|
|
- this.level().getProfiler().pop();
|
|
super.customServerAiStep();
|
|
}
|
|
|
|
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 b21e180641d17438997a80e5bcb0ec7998d24a2e..207d41b91bc02d94c5b40799619f7314ef84e41d 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
|
|
@@ -277,12 +277,8 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder<Axolo
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("axolotlBrain");
|
|
this.getBrain().tick((ServerLevel) this.level(), this);
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("axolotlActivityUpdate");
|
|
AxolotlAi.updateActivity(this);
|
|
- this.level().getProfiler().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 1f09d47b0ffb07b49b4d8bd79a371dd61f1c2a92..c3f5d82fb3d738ef7c80eae69ba06bd785042380 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
|
|
@@ -147,13 +147,9 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("camelBrain");
|
|
Brain<Camel> brain = (Brain<Camel>) this.getBrain(); // Paper - decompile fix
|
|
brain.tick((ServerLevel)this.level(), this);
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("camelActivityUpdate");
|
|
CamelAi.updateActivity(this);
|
|
- this.level().getProfiler().pop();
|
|
super.customServerAiStep();
|
|
}
|
|
|
|
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 295769d039f2a1e4f48912a60f9dbe267d8992c1..81e69ea2858228942177e54c92b50b2b908bc010 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
|
|
@@ -161,12 +161,8 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("frogBrain");
|
|
this.getBrain().tick((ServerLevel)this.level(), this);
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("frogActivityUpdate");
|
|
FrogAi.updateActivity(this);
|
|
- this.level().getProfiler().pop();
|
|
super.customServerAiStep();
|
|
}
|
|
|
|
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 4aeab90e778629c355189dfe79c39c4b21f5f5ac..0f3a11203dd0353d74626a273e9003131356f5e1 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
|
|
@@ -79,12 +79,8 @@ public class Tadpole extends AbstractFish {
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("tadpoleBrain");
|
|
this.getBrain().tick((ServerLevel) this.level(), this);
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("tadpoleActivityUpdate");
|
|
TadpoleAi.updateActivity(this);
|
|
- this.level().getProfiler().pop();
|
|
super.customServerAiStep();
|
|
}
|
|
|
|
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 5d247ac38fe8a61603b3d934f3000bcda773142b..c6ff7c756aff281e7de094c05749740370988fe5 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
|
|
@@ -193,12 +193,8 @@ public class Goat extends Animal {
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("goatBrain");
|
|
this.getBrain().tick((ServerLevel) this.level(), this);
|
|
- this.level().getProfiler().pop();
|
|
- this.level().getProfiler().push("goatActivityUpdate");
|
|
GoatAi.updateActivity(this);
|
|
- this.level().getProfiler().pop();
|
|
super.customServerAiStep();
|
|
}
|
|
|
|
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 0a5b953bd8c0c7f181da4090b950e9e6524b6d61..817f269d28305ae2d08b3f680d06af74a232e1f1 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
|
|
@@ -490,11 +490,8 @@ public class Sniffer extends Animal {
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("snifferBrain");
|
|
this.getBrain().tick((ServerLevel) this.level(), this);
|
|
- this.level().getProfiler().popPush("snifferActivityUpdate");
|
|
SnifferAi.updateActivity(this);
|
|
- this.level().getProfiler().pop();
|
|
super.customServerAiStep();
|
|
}
|
|
|
|
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 05b4c054327bb86cf3b08e45916aac31aa9e000b..3e79562f51efbac51785fa0998d6a1a6e3036939 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
|
|
@@ -200,9 +200,7 @@ public class Zoglin extends Monster implements Enemy, HoglinBase {
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("zoglinBrain");
|
|
this.getBrain().tick((ServerLevel)this.level(), this);
|
|
- this.level().getProfiler().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 1268ce642a79495450845734085f281589415fef..9672afb372e3b376d46864fed5bc8af12aaae48a 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
|
|
@@ -200,10 +200,7 @@ public class Breeze extends Monster {
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("breezeBrain");
|
|
this.getBrain().tick((ServerLevel)this.level(), this);
|
|
- this.level().getProfiler().popPush("breezeActivityUpdate");
|
|
- this.level().getProfiler().pop();
|
|
super.customServerAiStep();
|
|
}
|
|
|
|
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 01a2016ac82807d28ffe407b7dbb74bdbcde503e..c97a3c7060b846aa92a730760e3428ba98919879 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
|
|
@@ -130,9 +130,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("hoglinBrain");
|
|
this.getBrain().tick((ServerLevel)this.level(), this);
|
|
- this.level().getProfiler().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 a9813da7f2b248f98f22e0ad2e7842915025ec12..104f3ed9230f6397bfe306b7fbfb9893b7c8e94d 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
|
|
@@ -302,9 +302,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("piglinBrain");
|
|
this.getBrain().tick((ServerLevel) this.level(), this);
|
|
- this.level().getProfiler().pop();
|
|
PiglinAi.updateActivity(this);
|
|
super.customServerAiStep();
|
|
}
|
|
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 5d1a30e09870a5a535c71a2e44b8e6933de0c1e8..5aab051998b67b7ba95cbf568de60e325b905eab 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
|
|
@@ -85,9 +85,7 @@ public class PiglinBrute extends AbstractPiglin {
|
|
|
|
@Override
|
|
protected void customServerAiStep() {
|
|
- this.level().getProfiler().push("piglinBruteBrain");
|
|
this.getBrain().tick((ServerLevel)this.level(), this);
|
|
- this.level().getProfiler().pop();
|
|
PiglinBruteAi.updateActivity(this);
|
|
PiglinBruteAi.maybePlayActivitySound(this);
|
|
super.customServerAiStep();
|
|
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 937f81a859953498abe73bea560c86e6560e1c33..b73bccfcb1b94936f500926a06a28a6a134bbc33 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
|
|
@@ -277,9 +277,7 @@ public class Warden extends Monster implements VibrationSystem {
|
|
protected void customServerAiStep() {
|
|
ServerLevel worldserver = (ServerLevel) this.level();
|
|
|
|
- worldserver.getProfiler().push("wardenBrain");
|
|
this.getBrain().tick(worldserver, this);
|
|
- this.level().getProfiler().pop();
|
|
super.customServerAiStep();
|
|
if ((this.tickCount + this.getId()) % 120 == 0) {
|
|
Warden.applyDarknessAround(worldserver, 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 1aae466e3e334d7f4bbb3ea9365a255afcc3dd3a..1edc23e457432b571d00bce5a4c32c6d790368c2 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
|
@@ -253,9 +253,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
|
}
|
|
protected void customServerAiStep(final boolean inactive) {
|
|
// Paper end
|
|
- this.level().getProfiler().push("villagerBrain");
|
|
if (!inactive) this.getBrain().tick((ServerLevel) this.level(), this); // Paper
|
|
- this.level().getProfiler().pop();
|
|
if (this.assignProfessionWhenSpawned) {
|
|
this.assignProfessionWhenSpawned = false;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
index f0fbde839a527481314f54a1aefa0fc317ba2221..289396ef9e7d4d9038e957e53a46db4ac7f0b435 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
@@ -665,7 +665,6 @@ public class Explosion {
|
|
}
|
|
|
|
if (flag1) {
|
|
- this.level.getProfiler().push("explosion_blocks");
|
|
List<Pair<ItemStack, BlockPos>> list = new ArrayList();
|
|
|
|
Util.shuffle(this.toBlow, this.level.random);
|
|
@@ -741,7 +740,6 @@ public class Explosion {
|
|
Block.popResource(this.level, (BlockPos) pair.getSecond(), (ItemStack) pair.getFirst());
|
|
}
|
|
|
|
- this.level.getProfiler().pop();
|
|
}
|
|
|
|
if (this.fire) {
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index c7abd433e70a6479fc81e5bce94144c9479eb372..680cfc6e2e3acd0d5ce364c774772e3c4d072c31 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -130,7 +130,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
private final ResourceKey<DimensionType> dimensionTypeId;
|
|
private final Holder<DimensionType> dimensionTypeRegistration;
|
|
public final WritableLevelData levelData;
|
|
- private final Supplier<ProfilerFiller> profiler;
|
|
public final boolean isClientSide;
|
|
private final WorldBorder worldBorder;
|
|
private final BiomeManager biomeManager;
|
|
@@ -208,7 +207,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
public abstract ResourceKey<LevelStem> getTypeKey();
|
|
|
|
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.function.Function<org.spigotmc.SpigotWorldConfig, GaleWorldConfiguration> galeWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor // Gale - Gale configuration
|
|
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.function.Function<org.spigotmc.SpigotWorldConfig, GaleWorldConfiguration> galeWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor // Gale - Gale configuration // Gale - Purpur - remove vanilla profiler
|
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
|
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
|
this.galeConfig = galeWorldConfigCreator.apply(this.spigotConfig); // Gale - Gale configuration
|
|
@@ -223,7 +222,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
}
|
|
|
|
// CraftBukkit end
|
|
- this.profiler = supplier;
|
|
this.levelData = worlddatamutable;
|
|
this.dimensionTypeRegistration = holder;
|
|
this.dimensionTypeId = (ResourceKey) holder.unwrapKey().orElseThrow(() -> {
|
|
@@ -1259,9 +1257,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
}
|
|
|
|
protected void tickBlockEntities() {
|
|
- ProfilerFiller gameprofilerfiller = this.getProfiler();
|
|
-
|
|
- gameprofilerfiller.push("blockEntities");
|
|
this.timings.tileEntityPending.startTiming(); // Spigot
|
|
this.tickingBlockEntities = true;
|
|
if (!this.pendingBlockEntityTickers.isEmpty()) {
|
|
@@ -1302,7 +1297,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
this.timings.tileEntityTick.stopTiming(); // Spigot
|
|
this.tickingBlockEntities = false;
|
|
co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper
|
|
- gameprofilerfiller.pop();
|
|
this.spigotConfig.currentPrimedTnt = 0; // Spigot
|
|
}
|
|
|
|
@@ -1512,7 +1506,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
@Override
|
|
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
|
|
- this.getProfiler().incrementCounter("getEntities");
|
|
List<Entity> list = Lists.newArrayList();
|
|
((ServerLevel)this).getEntityLookup().getEntities(except, box, list, predicate); // Paper - optimise this call
|
|
return list;
|
|
@@ -1531,7 +1524,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
}
|
|
|
|
public <T extends Entity> void getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate, List<? super T> result, int limit) {
|
|
- this.getProfiler().incrementCounter("getEntities");
|
|
// Paper start - optimise this call
|
|
//TODO use limit
|
|
if (filter instanceof net.minecraft.world.entity.EntityType entityTypeTest) {
|
|
@@ -1790,11 +1782,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
}
|
|
|
|
public ProfilerFiller getProfiler() {
|
|
- return (ProfilerFiller) this.profiler.get();
|
|
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Gale - Purpur - remove vanilla profiler
|
|
}
|
|
|
|
public Supplier<ProfilerFiller> getProfilerSupplier() {
|
|
- return this.profiler;
|
|
+ return () -> net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Gale - Purpur - remove vanilla profiler
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
index da7489986848316fed029b71d1bc4e1248c9c9a8..71581713596594f8f8c39dac4971111e1a2cad3d 100644
|
|
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
@@ -132,7 +132,6 @@ public final class NaturalSpawner {
|
|
}
|
|
|
|
public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn) {
|
|
- world.getProfiler().push("spawner");
|
|
world.timings.mobSpawn.startTiming(); // Spigot
|
|
MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES;
|
|
int i = aenumcreaturetype.length;
|
|
@@ -187,7 +186,6 @@ public final class NaturalSpawner {
|
|
}
|
|
|
|
world.timings.mobSpawn.stopTiming(); // Spigot
|
|
- world.getProfiler().pop();
|
|
}
|
|
|
|
// Paper start - Add mobcaps commands
|
|
diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
|
|
index 0f1025495237aebe30132ace0832aa5718d6f9bb..9c2321ebb1237b4ecd3e7f7053e5039b800d89ff 100644
|
|
--- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
|
|
@@ -8,7 +8,6 @@ import net.minecraft.core.BlockPos;
|
|
import net.minecraft.core.Holder;
|
|
import net.minecraft.core.SectionPos;
|
|
import net.minecraft.core.registries.Registries;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.level.biome.Biome;
|
|
@@ -154,8 +153,4 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter {
|
|
public int getHeight() {
|
|
return this.level.getHeight();
|
|
}
|
|
-
|
|
- public ProfilerFiller getProfiler() {
|
|
- return this.level.getProfiler();
|
|
- }
|
|
}
|
|
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 6ec3fc801453fd54c25b642e6fa71c19b463311d..b02a2ca45152693e9974e802866feaa6bd2f2508 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
@@ -25,7 +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.ProfilerFiller;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.level.ChunkPos;
|
|
import net.minecraft.world.level.Level;
|
|
@@ -441,13 +440,8 @@ public class LevelChunk extends ChunkAccess {
|
|
}
|
|
|
|
if (LightEngine.hasDifferentLightProperties(this, blockposition, iblockdata1, iblockdata)) {
|
|
- ProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
|
-
|
|
- gameprofilerfiller.push("updateSkyLightSources");
|
|
// Paper - starlight - remove skyLightSources
|
|
- gameprofilerfiller.popPush("queueCheckLight");
|
|
this.level.getChunkSource().getLightEngine().checkBlock(blockposition);
|
|
- gameprofilerfiller.pop();
|
|
}
|
|
|
|
boolean flag3 = iblockdata1.hasBlockEntity();
|
|
@@ -1160,9 +1154,6 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
if (LevelChunk.this.isTicking(blockposition)) {
|
|
try {
|
|
- ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler();
|
|
-
|
|
- gameprofilerfiller.push(this::getType);
|
|
this.blockEntity.tickTimer.startTiming(); // Spigot
|
|
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
|
|
|
|
@@ -1173,8 +1164,6 @@ public class LevelChunk extends ChunkAccess {
|
|
this.loggedInvalidBlockState = true;
|
|
LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
|
|
}
|
|
-
|
|
- 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 eb18494bd7257fa5eb00dea16cf4d5667b796f2b..61d5fe8e5344a6cb94d427859488c34821c8a3f6 100644
|
|
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
|
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
|
@@ -12,7 +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.ProfilerFiller;
|
|
import net.minecraft.util.profiling.metrics.MetricCategory;
|
|
import net.minecraft.world.entity.Mob;
|
|
import net.minecraft.world.level.PathNavigationRegion;
|
|
@@ -44,7 +43,7 @@ public class PathFinder {
|
|
map.add(new java.util.AbstractMap.SimpleEntry<>(this.nodeEvaluator.getGoal(pos.getX(), pos.getY(), pos.getZ()), pos));
|
|
}
|
|
// Paper end - Perf: remove streams and optimize collection
|
|
- Path path = this.findPath(world.getProfiler(), node, map, followRange, distance, rangeMultiplier);
|
|
+ Path path = this.findPath(node, map, followRange, distance, rangeMultiplier); // Gale - Purpur - remove vanilla profiler
|
|
this.nodeEvaluator.done();
|
|
return path;
|
|
}
|
|
@@ -52,9 +51,7 @@ public class PathFinder {
|
|
|
|
@Nullable
|
|
// Paper start - Perf: remove streams and optimize collection
|
|
- private Path findPath(ProfilerFiller profiler, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
|
|
- profiler.push("find_path");
|
|
- profiler.markForCharting(MetricCategory.PATH_FINDING);
|
|
+ private Path findPath(Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) { // Gale - Purpur - remove vanilla profiler
|
|
// Set<Target> set = positions.keySet();
|
|
startNode.g = 0.0F;
|
|
startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection
|
|
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
|
|
index 3ddf6ab00de2456ebf504985b88994f970e3b5c4..3b2eb7738380c9385c0227e6f04e3c1691093b1f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
|
|
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
|
|
@@ -20,7 +20,6 @@ import net.minecraft.server.packs.resources.PreparableReloadListener;
|
|
import net.minecraft.server.packs.resources.ResourceManager;
|
|
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
|
|
import net.minecraft.util.ProblemReporter;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
|
|
import org.bukkit.craftbukkit.CraftLootTable;
|
|
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
|
@@ -37,7 +36,7 @@ public class LootDataManager implements PreparableReloadListener, LootDataResolv
|
|
public LootDataManager() {}
|
|
|
|
@Override
|
|
- public final CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) {
|
|
+ public final CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor) { // Gale - Purpur - remove vanilla profiler
|
|
Map<LootDataType<?>, Map<ResourceLocation, ?>> map = new HashMap();
|
|
CompletableFuture<?>[] acompletablefuture = (CompletableFuture[]) LootDataType.values().map((lootdatatype) -> {
|
|
return LootDataManager.scheduleElementParse(lootdatatype, manager, prepareExecutor, map);
|
|
diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java
|
|
index 1d7c663fa0e550bd0cfb9a4b83ccd7e2968666f0..cf685940e09251bef1a3d06f1e2468ce4ff46cc5 100644
|
|
--- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java
|
|
+++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java
|
|
@@ -23,7 +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.ProfilerFiller;
|
|
import net.minecraft.world.level.ChunkPos;
|
|
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
|
|
|
@@ -32,7 +31,6 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
|
|
return ScheduledTick.INTRA_TICK_DRAIN_ORDER.compare(a.peek(), b.peek());
|
|
};
|
|
private final LongPredicate tickCheck;
|
|
- private final Supplier<ProfilerFiller> profiler;
|
|
private final Long2ObjectMap<LevelChunkTicks<T>> allContainers = new Long2ObjectOpenHashMap<>();
|
|
private final Long2LongMap nextTickForContainer = Util.make(new Long2LongOpenHashMap(), (map) -> {
|
|
map.defaultReturnValue(Long.MAX_VALUE);
|
|
@@ -48,9 +46,8 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
|
|
|
|
};
|
|
|
|
- public LevelTicks(LongPredicate tickingFutureReadyPredicate, Supplier<ProfilerFiller> profilerGetter) {
|
|
+ public LevelTicks(LongPredicate tickingFutureReadyPredicate) { // Gale - Purpur - remove vanilla profiler
|
|
this.tickCheck = tickingFutureReadyPredicate;
|
|
- this.profiler = profilerGetter;
|
|
}
|
|
|
|
public void addContainer(ChunkPos pos, LevelChunkTicks<T> scheduler) {
|
|
@@ -86,20 +83,13 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
|
|
}
|
|
|
|
public void tick(long time, int maxTicks, BiConsumer<BlockPos, T> ticker) {
|
|
- ProfilerFiller profilerFiller = this.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();
|
|
}
|