mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
2968 lines
144 KiB
Diff
2968 lines
144 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Sun, 2 Feb 2025 14:43:32 +0300
|
|
Subject: [PATCH] Completely remove Mojang profiler
|
|
|
|
|
|
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
|
index 9aa09e11032f539952edeeed119f7705c330db0a..9a7a40c1dcea57ba674d8431077d2477104a456f 100644
|
|
--- a/net/minecraft/commands/Commands.java
|
|
+++ b/net/minecraft/commands/Commands.java
|
|
@@ -59,7 +59,6 @@ import net.minecraft.server.commands.CloneCommands;
|
|
import net.minecraft.server.commands.DamageCommand;
|
|
import net.minecraft.server.commands.DataPackCommand;
|
|
import net.minecraft.server.commands.DeOpCommands;
|
|
-import net.minecraft.server.commands.DebugCommand;
|
|
import net.minecraft.server.commands.DebugConfigCommand;
|
|
import net.minecraft.server.commands.DebugMobSpawningCommand;
|
|
import net.minecraft.server.commands.DebugPathCommand;
|
|
@@ -141,7 +140,6 @@ import net.minecraft.server.commands.WorldBorderCommand;
|
|
import net.minecraft.server.commands.data.DataCommands;
|
|
import net.minecraft.server.level.ServerPlayer;
|
|
import net.minecraft.tags.TagKey;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
import net.minecraft.util.profiling.jfr.JvmProfiler;
|
|
import net.minecraft.world.flag.FeatureFlagSet;
|
|
import net.minecraft.world.flag.FeatureFlags;
|
|
@@ -193,7 +191,6 @@ public class Commands {
|
|
DamageCommand.register(this.dispatcher, context);
|
|
DataCommands.register(this.dispatcher);
|
|
DataPackCommand.register(this.dispatcher, context);
|
|
- DebugCommand.register(this.dispatcher);
|
|
DefaultGameModeCommands.register(this.dispatcher);
|
|
DialogCommand.register(this.dispatcher, context);
|
|
DifficultyCommand.register(this.dispatcher);
|
|
@@ -364,7 +361,6 @@ public class Commands {
|
|
org.spigotmc.AsyncCatcher.catchOp("Cannot perform command async");
|
|
// Paper end
|
|
CommandSourceStack commandSourceStack = parseResults.getContext().getSource();
|
|
- Profiler.get().push(() -> "/" + command);
|
|
ContextChain<CommandSourceStack> contextChain = finishParsing(parseResults, command, commandSourceStack);
|
|
|
|
try {
|
|
@@ -402,8 +398,6 @@ public class Commands {
|
|
commandSourceStack.sendFailure(Component.literal(Util.describeError(var12)));
|
|
LOGGER.error("'/{}' threw an exception", command, var12);
|
|
}
|
|
- } finally {
|
|
- Profiler.get().pop();
|
|
}
|
|
}
|
|
|
|
@@ -460,7 +454,7 @@ public class Commands {
|
|
int max = Math.max(1, server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH));
|
|
int _int = server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT);
|
|
|
|
- try (ExecutionContext<CommandSourceStack> executionContext1 = new ExecutionContext<>(max, _int, Profiler.get())) {
|
|
+ try (ExecutionContext<CommandSourceStack> executionContext1 = new ExecutionContext<>(max, _int)) {
|
|
CURRENT_EXECUTION_CONTEXT.set(executionContext1);
|
|
contextConsumer.accept(executionContext1);
|
|
executionContext1.runCommandQueue();
|
|
diff --git a/net/minecraft/commands/execution/ExecutionContext.java b/net/minecraft/commands/execution/ExecutionContext.java
|
|
index 952cc09864de5ec147afd2525c70170280393bd6..c54f4e5ff70c40081e8bde054aa35e48cc700849 100644
|
|
--- a/net/minecraft/commands/execution/ExecutionContext.java
|
|
+++ b/net/minecraft/commands/execution/ExecutionContext.java
|
|
@@ -20,7 +20,6 @@ public class ExecutionContext<T> implements AutoCloseable {
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
private final int commandLimit;
|
|
private final int forkLimit;
|
|
- private final ProfilerFiller profiler;
|
|
@Nullable
|
|
private TraceCallbacks tracer;
|
|
private int commandQuota;
|
|
@@ -29,10 +28,9 @@ public class ExecutionContext<T> implements AutoCloseable {
|
|
private final List<CommandQueueEntry<T>> newTopCommands = new ObjectArrayList<>();
|
|
private int currentFrameDepth;
|
|
|
|
- public ExecutionContext(int commandQuota, int forkLimit, ProfilerFiller profiler) {
|
|
+ public ExecutionContext(int commandQuota, int forkLimit) {
|
|
this.commandLimit = commandQuota;
|
|
this.forkLimit = forkLimit;
|
|
- this.profiler = profiler;
|
|
this.commandQuota = commandQuota;
|
|
}
|
|
|
|
@@ -132,7 +130,7 @@ public class ExecutionContext<T> implements AutoCloseable {
|
|
}
|
|
|
|
public ProfilerFiller profiler() {
|
|
- return this.profiler;
|
|
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
|
|
}
|
|
|
|
public int forkLimit() {
|
|
diff --git a/net/minecraft/commands/execution/tasks/BuildContexts.java b/net/minecraft/commands/execution/tasks/BuildContexts.java
|
|
index 569abbea01f585990d2017c68580257275bbb06d..824ccbfa77cd1135d409f5f46e6ae5422d323036 100644
|
|
--- a/net/minecraft/commands/execution/tasks/BuildContexts.java
|
|
+++ b/net/minecraft/commands/execution/tasks/BuildContexts.java
|
|
@@ -42,51 +42,47 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
|
|
ChainModifiers chainModifiers1 = chainModifiers;
|
|
List<T> list = sources;
|
|
if (contextChain.getStage() != Stage.EXECUTE) {
|
|
- context.profiler().push(() -> "prepare " + this.commandInput);
|
|
+ // DivineMC start - Completely remove Mojang profiler
|
|
+ for (int forkLimit = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) {
|
|
+ CommandContext<T> topContext = contextChain.getTopContext();
|
|
+ if (topContext.isForked()) {
|
|
+ chainModifiers1 = chainModifiers1.setForked();
|
|
+ }
|
|
|
|
- try {
|
|
- for (int forkLimit = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) {
|
|
- CommandContext<T> topContext = contextChain.getTopContext();
|
|
- if (topContext.isForked()) {
|
|
- chainModifiers1 = chainModifiers1.setForked();
|
|
- }
|
|
+ RedirectModifier<T> redirectModifier = topContext.getRedirectModifier();
|
|
+ if (redirectModifier instanceof CustomModifierExecutor.ModifierAdapter<T> customModifierExecutor) {
|
|
+ customModifierExecutor.apply(originalSource, list, contextChain, chainModifiers1, ExecutionControl.create(context, frame));
|
|
+ return;
|
|
+ }
|
|
|
|
- RedirectModifier<T> redirectModifier = topContext.getRedirectModifier();
|
|
- if (redirectModifier instanceof CustomModifierExecutor.ModifierAdapter<T> customModifierExecutor) {
|
|
- customModifierExecutor.apply(originalSource, list, contextChain, chainModifiers1, ExecutionControl.create(context, frame));
|
|
- return;
|
|
- }
|
|
+ if (redirectModifier != null) {
|
|
+ context.incrementCost();
|
|
+ boolean isForked = chainModifiers1.isForked();
|
|
+ List<T> list1 = new ObjectArrayList<>();
|
|
+
|
|
+ for (T executionCommandSource : list) {
|
|
+ try {
|
|
+ Collection<T> collection = ContextChain.runModifier(
|
|
+ topContext, executionCommandSource, (commandContext, flag, i) -> {}, isForked
|
|
+ );
|
|
+ if (list1.size() + collection.size() >= forkLimit) {
|
|
+ originalSource.handleError(ERROR_FORK_LIMIT_REACHED.create(forkLimit), isForked, context.tracer());
|
|
+ return;
|
|
+ }
|
|
|
|
- if (redirectModifier != null) {
|
|
- context.incrementCost();
|
|
- boolean isForked = chainModifiers1.isForked();
|
|
- List<T> list1 = new ObjectArrayList<>();
|
|
-
|
|
- for (T executionCommandSource : list) {
|
|
- try {
|
|
- Collection<T> collection = ContextChain.runModifier(
|
|
- topContext, executionCommandSource, (commandContext, flag, i) -> {}, isForked
|
|
- );
|
|
- if (list1.size() + collection.size() >= forkLimit) {
|
|
- originalSource.handleError(ERROR_FORK_LIMIT_REACHED.create(forkLimit), isForked, context.tracer());
|
|
- return;
|
|
- }
|
|
-
|
|
- list1.addAll(collection);
|
|
- } catch (CommandSyntaxException var20) {
|
|
- executionCommandSource.handleError(var20, isForked, context.tracer());
|
|
- if (!isForked) {
|
|
- return;
|
|
- }
|
|
+ list1.addAll(collection);
|
|
+ } catch (CommandSyntaxException var20) {
|
|
+ executionCommandSource.handleError(var20, isForked, context.tracer());
|
|
+ if (!isForked) {
|
|
+ return;
|
|
}
|
|
}
|
|
-
|
|
- list = list1;
|
|
}
|
|
+
|
|
+ list = list1;
|
|
}
|
|
- } finally {
|
|
- context.profiler().pop();
|
|
}
|
|
+ // DivineMC end - Completely remove Mojang profiler
|
|
}
|
|
|
|
if (list.isEmpty()) {
|
|
diff --git a/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/net/minecraft/commands/execution/tasks/ExecuteCommand.java
|
|
index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..aa25f5ebaf7d1b22825b962b02dcae02bc35468f 100644
|
|
--- a/net/minecraft/commands/execution/tasks/ExecuteCommand.java
|
|
+++ b/net/minecraft/commands/execution/tasks/ExecuteCommand.java
|
|
@@ -23,8 +23,6 @@ public class ExecuteCommand<T extends ExecutionCommandSource<T>> implements Unbo
|
|
|
|
@Override
|
|
public void execute(T source, ExecutionContext<T> executionContext, Frame frame) {
|
|
- executionContext.profiler().push(() -> "execute " + this.commandInput);
|
|
-
|
|
try {
|
|
executionContext.incrementCost();
|
|
int i = ContextChain.runExecutable(this.executionContext, source, ExecutionCommandSource.resultConsumer(), this.modifiers.isForked());
|
|
@@ -34,8 +32,6 @@ public class ExecuteCommand<T extends ExecutionCommandSource<T>> implements Unbo
|
|
}
|
|
} catch (CommandSyntaxException var9) {
|
|
source.handleError(var9, this.modifiers.isForked(), executionContext.tracer());
|
|
- } finally {
|
|
- executionContext.profiler().pop();
|
|
}
|
|
}
|
|
}
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index f29cee41258a8220256bf6b3b5b04f79c142cc19..9180e8cdd4bfad33f8dcda0ac8785defff4a1dad 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -117,20 +117,9 @@ import net.minecraft.util.TimeUtil;
|
|
import net.minecraft.util.debug.ServerDebugSubscribers;
|
|
import net.minecraft.util.debugchart.SampleLogger;
|
|
import net.minecraft.util.debugchart.TpsDebugDimensions;
|
|
-import net.minecraft.util.profiling.EmptyProfileResults;
|
|
-import net.minecraft.util.profiling.ProfileResults;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
-import net.minecraft.util.profiling.ResultField;
|
|
-import net.minecraft.util.profiling.SingleTickProfiler;
|
|
import net.minecraft.util.profiling.jfr.Environment;
|
|
import net.minecraft.util.profiling.jfr.JvmProfiler;
|
|
import net.minecraft.util.profiling.jfr.callback.ProfiledDuration;
|
|
-import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder;
|
|
-import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder;
|
|
-import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder;
|
|
-import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider;
|
|
-import net.minecraft.util.profiling.metrics.storage.MetricsPersister;
|
|
import net.minecraft.util.thread.ReentrantBlockableEventLoop;
|
|
import net.minecraft.world.Difficulty;
|
|
import net.minecraft.world.RandomSequences;
|
|
@@ -203,13 +192,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
public LevelStorageSource.LevelStorageAccess storageSource;
|
|
public final PlayerDataStorage playerDataStorage;
|
|
private final List<Runnable> tickables = Lists.newArrayList();
|
|
- private MetricsRecorder metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
|
- private Consumer<ProfileResults> onMetricsRecordingStopped = results -> this.stopRecordingMetrics();
|
|
- private Consumer<Path> onMetricsRecordingFinished = path -> {};
|
|
- private boolean willStartRecordingMetrics;
|
|
- @Nullable
|
|
- private MinecraftServer.TimeProfiler debugCommandProfiler;
|
|
- private boolean debugCommandProfilerDelayStart;
|
|
private ServerConnectionListener connection;
|
|
// Paper - per world load listener - moved LevelLoadListener to ServerLevel
|
|
@Nullable
|
|
@@ -1018,9 +1000,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
org.spigotmc.WatchdogThread.doStop(); // Paper - Improved watchdog support
|
|
// CraftBukkit end
|
|
this.packetProcessor.close();
|
|
- if (this.metricsRecorder.isRecording()) {
|
|
- this.cancelRecordingMetrics();
|
|
- }
|
|
|
|
LOGGER.info("Stopping server");
|
|
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
|
@@ -1191,10 +1170,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
|
|
// note: To avoid possibly spinning forever, only execute tasks that are roughly available at the beginning
|
|
// of this call. Packet processing and chunk system tasks are possibly always being queued.
|
|
- final ProfilerFiller profiler = Profiler.get();
|
|
- profiler.push("moonrise:run_all_tasks");
|
|
-
|
|
- profiler.push("moonrise:run_all_server");
|
|
// avoid calling MinecraftServer#pollTask - we just want to execute queued tasks
|
|
while (super.pollTask()) {
|
|
// execute small amounts of other tasks just in case the number of tasks we are
|
|
@@ -1203,38 +1178,23 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this).moonrise$executeMidTickTasks(); // Paper - rewrite chunk system
|
|
this.packetProcessor.executeSinglePacket();
|
|
}
|
|
- profiler.popPush("moonrise:run_all_packets");
|
|
while (this.packetProcessor.executeSinglePacket()) {
|
|
// execute possibly latency sensitive chunk system tasks (see above)
|
|
((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this).moonrise$executeMidTickTasks(); // Paper - rewrite chunk system
|
|
}
|
|
- profiler.popPush("moonrise:run_all_chunk");
|
|
// Paper start - rewrite chunk system
|
|
for (final ServerLevel world : this.getAllLevels()) {
|
|
- profiler.push(world.toString() + " " + world.dimension().location()); // keep same formatting from regular tick, see tickChildren
|
|
-
|
|
// note: legacy tasks may expect a distance manager update
|
|
- profiler.push("moonrise:distance_manager_update");
|
|
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)world).moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates();
|
|
- profiler.popPush("moonrise:legacy_chunk_tasks");
|
|
world.getChunkSource().mainThreadProcessor.executeAllRecentInternalTasks();
|
|
- profiler.popPush("moonrise:chunk_system_tasks");
|
|
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)world).moonrise$getChunkTaskScheduler().executeAllRecentlyQueuedMainThreadTasks();
|
|
- profiler.pop();
|
|
-
|
|
- profiler.pop(); // world name
|
|
}
|
|
// Paper end - rewrite chunk system
|
|
- profiler.pop(); // moonrise:run_all_chunk
|
|
- profiler.pop(); // moonrise:run_all_tasks
|
|
|
|
this.finishMeasuringTaskExecutionTime();
|
|
}
|
|
|
|
private void recordTaskExecutionTimeWhileWaiting() {
|
|
- final ProfilerFiller profiler = Profiler.get();
|
|
-
|
|
- profiler.push("moonrise:execute_tasks_until_tick");
|
|
this.waitingForNextTick = true;
|
|
// implement waitForTasks
|
|
final boolean isLoggingEnabled = this.isTickTimeLoggingEnabled();
|
|
@@ -1271,7 +1231,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
} finally {
|
|
this.waitingForNextTick = false;
|
|
}
|
|
- profiler.pop();
|
|
}
|
|
// Paper end - improve tick loop
|
|
|
|
@@ -1359,44 +1318,32 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
// Paper end - improve tick loop
|
|
|
|
boolean flag = l == 0L;
|
|
- if (this.debugCommandProfilerDelayStart) {
|
|
- this.debugCommandProfilerDelayStart = false;
|
|
- this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
|
|
- }
|
|
|
|
// Paper - improve tick loop - done above
|
|
|
|
- try (Profiler.Scope scope = Profiler.use(this.createProfiler())) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("tick");
|
|
- this.tickFrame.start();
|
|
- this.runAllTasksAtTickStart(); // Paper - improve tick loop
|
|
- this.tickServer(flag ? () -> false : this::haveTime);
|
|
- // Paper start - rewrite chunk system
|
|
- final Throwable crash = this.chunkSystemCrash;
|
|
- if (crash != null) {
|
|
- this.chunkSystemCrash = null;
|
|
- throw new RuntimeException("Chunk system crash propagated to tick()", crash);
|
|
- }
|
|
- // Paper end - rewrite chunk system
|
|
- this.tickFrame.end();
|
|
- this.recordEndOfTick(); // Paper - improve tick loop
|
|
- profilerFiller.popPush("nextTickWait");
|
|
- this.mayHaveDelayedTasks = true;
|
|
- this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
|
|
- this.startMeasuringTaskExecutionTime();
|
|
- this.recordTaskExecutionTimeWhileWaiting(); // Paper - improve tick loop - record task execution here on MSPT
|
|
- this.finishMeasuringTaskExecutionTime();
|
|
- if (flag) {
|
|
- this.tickRateManager.endTickWork();
|
|
- }
|
|
-
|
|
- profilerFiller.pop();
|
|
- this.logFullTickTime();
|
|
- } finally {
|
|
- this.endMetricsRecordingTick();
|
|
+ this.tickFrame.start();
|
|
+ this.runAllTasksAtTickStart(); // Paper - improve tick loop
|
|
+ this.tickServer(flag ? () -> false : this::haveTime);
|
|
+ // Paper start - rewrite chunk system
|
|
+ final Throwable crash = this.chunkSystemCrash;
|
|
+ if (crash != null) {
|
|
+ this.chunkSystemCrash = null;
|
|
+ throw new RuntimeException("Chunk system crash propagated to tick()", crash);
|
|
+ }
|
|
+ // Paper end - rewrite chunk system
|
|
+ this.tickFrame.end();
|
|
+ this.recordEndOfTick(); // Paper - improve tick loop
|
|
+ this.mayHaveDelayedTasks = true;
|
|
+ this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
|
|
+ this.startMeasuringTaskExecutionTime();
|
|
+ this.recordTaskExecutionTimeWhileWaiting(); // Paper - improve tick loop - record task execution here on MSPT
|
|
+ this.finishMeasuringTaskExecutionTime();
|
|
+ if (flag) {
|
|
+ this.tickRateManager.endTickWork();
|
|
}
|
|
|
|
+ this.logFullTickTime();
|
|
+
|
|
this.isReady = true;
|
|
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
|
|
}
|
|
@@ -1504,7 +1451,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
protected void waitUntilNextTick() {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
// Paper - improve tick loop - moved to start of tick
|
|
this.waitingForNextTick = true;
|
|
|
|
@@ -1569,7 +1515,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
|
|
@Override
|
|
public void doRunTask(TickTask task) {
|
|
- Profiler.get().incrementCounter("runTask");
|
|
super.doRunTask(task);
|
|
}
|
|
|
|
@@ -1659,12 +1604,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
|
|
this.ticksUntilAutosave--;
|
|
// Paper start - Incremental chunk and player saving
|
|
- final ProfilerFiller profiler = Profiler.get();
|
|
int playerSaveInterval = io.papermc.paper.configuration.GlobalConfiguration.get().playerAutoSave.rate;
|
|
if (playerSaveInterval < 0) {
|
|
playerSaveInterval = autosavePeriod;
|
|
}
|
|
- profiler.push("save");
|
|
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
|
|
try {
|
|
this.isSaving = true;
|
|
@@ -1679,10 +1622,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
} finally {
|
|
this.isSaving = false;
|
|
}
|
|
- profiler.pop();
|
|
// Paper end - Incremental chunk and player saving
|
|
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
+ this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
|
|
this.server.spark.executeMainThreadTasks(); // Paper - spark
|
|
// Paper start - Server Tick Events
|
|
long endTime = System.nanoTime();
|
|
@@ -1690,7 +1632,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - this.currentTickStart) / 1000000D), remaining).callEvent();
|
|
// Paper end - Server Tick Events
|
|
this.server.spark.tickEnd(((double)(endTime - this.currentTickStart) / 1000000D)); // Paper - spark
|
|
- profilerFiller.push("tallying");
|
|
long l = Util.getNanos() - nanos;
|
|
int i1 = this.tickCount % 100;
|
|
this.aggregatedTickTimesNanos = this.aggregatedTickTimesNanos - this.tickTimesNanos[i1];
|
|
@@ -1698,16 +1639,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
this.tickTimesNanos[i1] = l;
|
|
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float)l / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
|
|
this.logTickMethodTime(nanos);
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
private void autoSave() {
|
|
this.ticksUntilAutosave = this.autosavePeriod; // CraftBukkit
|
|
LOGGER.debug("Autosave started");
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("save");
|
|
this.saveEverything(true, false, false);
|
|
- profilerFiller.pop();
|
|
LOGGER.debug("Autosave finished");
|
|
}
|
|
|
|
@@ -1775,7 +1712,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
public final io.papermc.paper.threadedregions.EntityScheduler.EntitySchedulerTickList entitySchedulerTickList = new io.papermc.paper.threadedregions.EntityScheduler.EntitySchedulerTickList(); // Paper - optimise Folia entity scheduler
|
|
|
|
protected void tickChildren(BooleanSupplier hasTimeLeft) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
this.getPlayerList().getPlayers().forEach(serverPlayer1 -> serverPlayer1.connection.suspendFlushing());
|
|
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
|
|
// Paper start - optimise Folia entity scheduler
|
|
@@ -1790,9 +1726,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
// Paper end - optimise Folia entity scheduler
|
|
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.ADVENTURE_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
|
|
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.DIALOG_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
|
|
- profilerFiller.push("commandFunctions");
|
|
this.getFunctions().tick();
|
|
- profilerFiller.popPush("levels");
|
|
this.updateEffectiveRespawnData();
|
|
|
|
// CraftBukkit start
|
|
@@ -1829,17 +1763,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
serverLevel.updateLagCompensationTick(); // Paper - lag compensation
|
|
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
|
|
serverLevel.hasRidableMoveEvent = org.purpurmc.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur - Ridables
|
|
- profilerFiller.push(() -> serverLevel + " " + serverLevel.dimension().location());
|
|
/* Drop global time updates
|
|
if (this.tickCount % 20 == 0) {
|
|
- profilerFiller.push("timeSync");
|
|
this.synchronizeTime(serverLevel);
|
|
- profilerFiller.pop();
|
|
}
|
|
// CraftBukkit end */
|
|
|
|
- profilerFiller.push("tick");
|
|
-
|
|
try {
|
|
serverLevel.tick(hasTimeLeft);
|
|
} catch (Throwable var7) {
|
|
@@ -1848,37 +1777,25 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
throw new ReportedException(crashReport);
|
|
}
|
|
|
|
- profilerFiller.pop();
|
|
- profilerFiller.pop();
|
|
serverLevel.explosionDensityCache.clear(); // Paper - Optimize explosions
|
|
}
|
|
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
|
|
|
- profilerFiller.popPush("connection");
|
|
this.tickConnection();
|
|
- profilerFiller.popPush("players");
|
|
this.playerList.tick();
|
|
- profilerFiller.popPush("debugSubscribers");
|
|
this.debugSubscribers.tick();
|
|
if (this.tickRateManager.runsNormally()) {
|
|
- profilerFiller.popPush("gameTests");
|
|
GameTestTicker.SINGLETON.tick();
|
|
}
|
|
|
|
- profilerFiller.popPush("server gui refresh");
|
|
-
|
|
for (int i = 0; i < this.tickables.size(); i++) {
|
|
this.tickables.get(i).run();
|
|
}
|
|
|
|
- profilerFiller.popPush("send chunks");
|
|
-
|
|
for (ServerPlayer serverPlayer : this.playerList.getPlayers()) {
|
|
serverPlayer.connection.chunkSender.sendNextChunks(serverPlayer);
|
|
serverPlayer.connection.resumeFlushing();
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
// Paper start - per world respawn data - read "server global" respawn data from overworld dimension reference
|
|
@@ -1903,14 +1820,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
public void forceTimeSynchronization() {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("timeSync");
|
|
-
|
|
for (ServerLevel serverLevel : this.getAllLevels()) {
|
|
this.synchronizeTime(serverLevel);
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
public boolean isAllowedToEnterPortal(Level level) {
|
|
@@ -2755,55 +2667,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
// CraftBukkit end
|
|
|
|
- private ProfilerFiller createProfiler() {
|
|
- if (this.willStartRecordingMetrics) {
|
|
- this.metricsRecorder = ActiveMetricsRecorder.createStarted(
|
|
- new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()),
|
|
- Util.timeSource,
|
|
- Util.ioPool(),
|
|
- new MetricsPersister("server"),
|
|
- this.onMetricsRecordingStopped,
|
|
- path -> {
|
|
- this.executeBlocking(() -> this.saveDebugReport(path.resolve("server")));
|
|
- this.onMetricsRecordingFinished.accept(path);
|
|
- }
|
|
- );
|
|
- this.willStartRecordingMetrics = false;
|
|
- }
|
|
-
|
|
- this.metricsRecorder.startTick();
|
|
- return SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server"));
|
|
- }
|
|
-
|
|
- public void endMetricsRecordingTick() {
|
|
- this.metricsRecorder.endTick();
|
|
- }
|
|
-
|
|
- public boolean isRecordingMetrics() {
|
|
- return this.metricsRecorder.isRecording();
|
|
- }
|
|
-
|
|
- public void startRecordingMetrics(Consumer<ProfileResults> output, Consumer<Path> onMetricsRecordingFinished) {
|
|
- this.onMetricsRecordingStopped = profileResults -> {
|
|
- this.stopRecordingMetrics();
|
|
- output.accept(profileResults);
|
|
- };
|
|
- this.onMetricsRecordingFinished = onMetricsRecordingFinished;
|
|
- this.willStartRecordingMetrics = true;
|
|
- }
|
|
-
|
|
- public void stopRecordingMetrics() {
|
|
- this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
|
- }
|
|
-
|
|
- public void finishRecordingMetrics() {
|
|
- this.metricsRecorder.end();
|
|
- }
|
|
-
|
|
- public void cancelRecordingMetrics() {
|
|
- this.metricsRecorder.cancel();
|
|
- }
|
|
-
|
|
public Path getWorldPath(LevelResource levelResource) {
|
|
return this.storageSource.getLevelPath(levelResource);
|
|
}
|
|
@@ -2853,24 +2716,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
return this.isSaving;
|
|
}
|
|
|
|
- public boolean isTimeProfilerRunning() {
|
|
- return this.debugCommandProfilerDelayStart || this.debugCommandProfiler != null;
|
|
- }
|
|
-
|
|
- public void startTimeProfiler() {
|
|
- this.debugCommandProfilerDelayStart = true;
|
|
- }
|
|
-
|
|
- public ProfileResults stopTimeProfiler() {
|
|
- if (this.debugCommandProfiler == null) {
|
|
- return EmptyProfileResults.EMPTY;
|
|
- } else {
|
|
- ProfileResults profileResults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount);
|
|
- this.debugCommandProfiler = null;
|
|
- return profileResults;
|
|
- }
|
|
- }
|
|
-
|
|
public int getMaxChainedNeighborUpdates() {
|
|
return 1000000;
|
|
}
|
|
@@ -3018,55 +2863,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
public record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
|
|
}
|
|
|
|
- static class TimeProfiler {
|
|
- final long startNanos;
|
|
- final int startTick;
|
|
-
|
|
- TimeProfiler(long startNanos, int startTick) {
|
|
- this.startNanos = startNanos;
|
|
- this.startTick = startTick;
|
|
- }
|
|
-
|
|
- ProfileResults stop(final long endTimeNano, final int endTimeTicks) {
|
|
- return new ProfileResults() {
|
|
- @Override
|
|
- public List<ResultField> getTimes(String sectionPath) {
|
|
- return Collections.emptyList();
|
|
- }
|
|
-
|
|
- @Override
|
|
- public boolean saveResults(Path path) {
|
|
- return false;
|
|
- }
|
|
-
|
|
- @Override
|
|
- public long getStartTimeNano() {
|
|
- return TimeProfiler.this.startNanos;
|
|
- }
|
|
-
|
|
- @Override
|
|
- public int getStartTimeTicks() {
|
|
- return TimeProfiler.this.startTick;
|
|
- }
|
|
-
|
|
- @Override
|
|
- public long getEndTimeNano() {
|
|
- return endTimeNano;
|
|
- }
|
|
-
|
|
- @Override
|
|
- public int getEndTimeTicks() {
|
|
- return endTimeTicks;
|
|
- }
|
|
-
|
|
- @Override
|
|
- public String getProfilerResults() {
|
|
- return "";
|
|
- }
|
|
- };
|
|
- }
|
|
- }
|
|
-
|
|
// Paper start - Add tick times API and /mspt command
|
|
public static class TickTimes {
|
|
private final long[] times;
|
|
diff --git a/net/minecraft/server/ReloadableServerResources.java b/net/minecraft/server/ReloadableServerResources.java
|
|
index c891715968193f2ab4579b4a2b4aeeae6a210070..7b0cf6cdd0eeaea228380c5960704e632d97de98 100644
|
|
--- a/net/minecraft/server/ReloadableServerResources.java
|
|
+++ b/net/minecraft/server/ReloadableServerResources.java
|
|
@@ -99,7 +99,7 @@ public class ReloadableServerResources {
|
|
backgroundExecutor,
|
|
gameExecutor,
|
|
DATA_RELOAD_INITIAL_TASK,
|
|
- LOGGER.isDebugEnabled()
|
|
+ false // DivineMC - Completely remove Mojang profiler
|
|
)
|
|
.done()
|
|
.thenApply(object -> reloadableServerResources);
|
|
diff --git a/net/minecraft/server/ServerAdvancementManager.java b/net/minecraft/server/ServerAdvancementManager.java
|
|
index a524f5b9aa082ada267c8e20df4ff4d22a76d281..339626862c33bca9cbc34acc520ba5d7831e189f 100644
|
|
--- a/net/minecraft/server/ServerAdvancementManager.java
|
|
+++ b/net/minecraft/server/ServerAdvancementManager.java
|
|
@@ -17,7 +17,6 @@ import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraft.server.packs.resources.ResourceManager;
|
|
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
|
|
import net.minecraft.util.ProblemReporter;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import org.slf4j.Logger;
|
|
|
|
public class ServerAdvancementManager extends SimpleJsonResourceReloadListener<Advancement> {
|
|
@@ -32,7 +31,7 @@ public class ServerAdvancementManager extends SimpleJsonResourceReloadListener<A
|
|
}
|
|
|
|
@Override
|
|
- protected void apply(Map<ResourceLocation, Advancement> object, ResourceManager resourceManager, ProfilerFiller profiler) {
|
|
+ protected void apply(Map<ResourceLocation, Advancement> object, ResourceManager resourceManager) {
|
|
Builder<ResourceLocation, AdvancementHolder> builder = ImmutableMap.builder();
|
|
object.forEach((resourceLocation, advancement) -> {
|
|
// Spigot start
|
|
diff --git a/net/minecraft/server/ServerFunctionManager.java b/net/minecraft/server/ServerFunctionManager.java
|
|
index e3cb5d9cd0332c32df82fa6aef37401c523e8af0..10c79570432491bfb2bbfedf0491ab2b803d0c71 100644
|
|
--- a/net/minecraft/server/ServerFunctionManager.java
|
|
+++ b/net/minecraft/server/ServerFunctionManager.java
|
|
@@ -14,8 +14,6 @@ import net.minecraft.commands.execution.ExecutionContext;
|
|
import net.minecraft.commands.functions.CommandFunction;
|
|
import net.minecraft.commands.functions.InstantiatedFunction;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import org.slf4j.Logger;
|
|
|
|
public class ServerFunctionManager {
|
|
@@ -50,19 +48,12 @@ public class ServerFunctionManager {
|
|
}
|
|
|
|
private void executeTagFunctions(Collection<CommandFunction<CommandSourceStack>> functionObjects, ResourceLocation identifier) {
|
|
- Profiler.get().push(identifier::toString);
|
|
-
|
|
for (CommandFunction<CommandSourceStack> commandFunction : functionObjects) {
|
|
this.execute(commandFunction, this.getGameLoopSender());
|
|
}
|
|
-
|
|
- Profiler.get().pop();
|
|
}
|
|
|
|
public void execute(CommandFunction<CommandSourceStack> function, CommandSourceStack source) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push(() -> "function " + function.id());
|
|
-
|
|
try {
|
|
InstantiatedFunction<CommandSourceStack> instantiatedFunction = function.instantiate(null, this.getDispatcher());
|
|
Commands.executeCommandInContext(
|
|
@@ -72,8 +63,6 @@ public class ServerFunctionManager {
|
|
} catch (FunctionInstantiationException var9) {
|
|
} catch (Exception var10) {
|
|
LOGGER.warn("Failed to execute function {}", function.id(), var10);
|
|
- } finally {
|
|
- profilerFiller.pop();
|
|
}
|
|
}
|
|
|
|
diff --git a/net/minecraft/server/commands/DebugCommand.java b/net/minecraft/server/commands/DebugCommand.java
|
|
deleted file mode 100644
|
|
index 338b39ee5c9ca1de20a24a07aa3706e0cecdcb86..0000000000000000000000000000000000000000
|
|
--- a/net/minecraft/server/commands/DebugCommand.java
|
|
+++ /dev/null
|
|
@@ -1,277 +0,0 @@
|
|
-package net.minecraft.server.commands;
|
|
-
|
|
-import com.mojang.brigadier.CommandDispatcher;
|
|
-import com.mojang.brigadier.context.CommandContext;
|
|
-import com.mojang.brigadier.context.ContextChain;
|
|
-import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
|
-import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
|
-import com.mojang.logging.LogUtils;
|
|
-import java.io.IOException;
|
|
-import java.io.PrintWriter;
|
|
-import java.io.UncheckedIOException;
|
|
-import java.io.Writer;
|
|
-import java.nio.charset.StandardCharsets;
|
|
-import java.nio.file.Files;
|
|
-import java.nio.file.Path;
|
|
-import java.util.Collection;
|
|
-import java.util.Locale;
|
|
-import net.minecraft.Util;
|
|
-import net.minecraft.commands.CommandResultCallback;
|
|
-import net.minecraft.commands.CommandSource;
|
|
-import net.minecraft.commands.CommandSourceStack;
|
|
-import net.minecraft.commands.Commands;
|
|
-import net.minecraft.commands.FunctionInstantiationException;
|
|
-import net.minecraft.commands.arguments.item.FunctionArgument;
|
|
-import net.minecraft.commands.execution.ChainModifiers;
|
|
-import net.minecraft.commands.execution.CustomCommandExecutor;
|
|
-import net.minecraft.commands.execution.ExecutionContext;
|
|
-import net.minecraft.commands.execution.ExecutionControl;
|
|
-import net.minecraft.commands.execution.Frame;
|
|
-import net.minecraft.commands.execution.TraceCallbacks;
|
|
-import net.minecraft.commands.execution.tasks.CallFunction;
|
|
-import net.minecraft.commands.functions.CommandFunction;
|
|
-import net.minecraft.commands.functions.InstantiatedFunction;
|
|
-import net.minecraft.network.chat.Component;
|
|
-import net.minecraft.resources.ResourceLocation;
|
|
-import net.minecraft.server.MinecraftServer;
|
|
-import net.minecraft.util.TimeUtil;
|
|
-import net.minecraft.util.profiling.ProfileResults;
|
|
-import org.apache.commons.io.IOUtils;
|
|
-import org.slf4j.Logger;
|
|
-
|
|
-public class DebugCommand {
|
|
- static final Logger LOGGER = LogUtils.getLogger();
|
|
- private static final SimpleCommandExceptionType ERROR_NOT_RUNNING = new SimpleCommandExceptionType(Component.translatable("commands.debug.notRunning"));
|
|
- private static final SimpleCommandExceptionType ERROR_ALREADY_RUNNING = new SimpleCommandExceptionType(
|
|
- Component.translatable("commands.debug.alreadyRunning")
|
|
- );
|
|
- static final SimpleCommandExceptionType NO_RECURSIVE_TRACES = new SimpleCommandExceptionType(Component.translatable("commands.debug.function.noRecursion"));
|
|
- static final SimpleCommandExceptionType NO_RETURN_RUN = new SimpleCommandExceptionType(Component.translatable("commands.debug.function.noReturnRun"));
|
|
-
|
|
- public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
|
- dispatcher.register(
|
|
- Commands.literal("debug")
|
|
- .requires(Commands.hasPermission(3))
|
|
- .then(Commands.literal("start").executes(commandContext -> start(commandContext.getSource())))
|
|
- .then(Commands.literal("stop").executes(context -> stop(context.getSource())))
|
|
- .then(
|
|
- Commands.literal("function")
|
|
- .requires(Commands.hasPermission(3))
|
|
- .then(
|
|
- Commands.argument("name", FunctionArgument.functions())
|
|
- .suggests(FunctionCommand.SUGGEST_FUNCTION)
|
|
- .executes(new DebugCommand.TraceCustomExecutor())
|
|
- )
|
|
- )
|
|
- );
|
|
- }
|
|
-
|
|
- private static int start(CommandSourceStack source) throws CommandSyntaxException {
|
|
- MinecraftServer server = source.getServer();
|
|
- if (server.isTimeProfilerRunning()) {
|
|
- throw ERROR_ALREADY_RUNNING.create();
|
|
- } else {
|
|
- server.startTimeProfiler();
|
|
- source.sendSuccess(() -> Component.translatable("commands.debug.started"), true);
|
|
- return 0;
|
|
- }
|
|
- }
|
|
-
|
|
- private static int stop(CommandSourceStack source) throws CommandSyntaxException {
|
|
- MinecraftServer server = source.getServer();
|
|
- if (!server.isTimeProfilerRunning()) {
|
|
- throw ERROR_NOT_RUNNING.create();
|
|
- } else {
|
|
- ProfileResults profileResults = server.stopTimeProfiler();
|
|
- double d = (double)profileResults.getNanoDuration() / TimeUtil.NANOSECONDS_PER_SECOND;
|
|
- double d1 = profileResults.getTickDuration() / d;
|
|
- source.sendSuccess(
|
|
- () -> Component.translatable(
|
|
- "commands.debug.stopped", String.format(Locale.ROOT, "%.2f", d), profileResults.getTickDuration(), String.format(Locale.ROOT, "%.2f", d1)
|
|
- ),
|
|
- true
|
|
- );
|
|
- return (int)d1;
|
|
- }
|
|
- }
|
|
-
|
|
- static class TraceCustomExecutor
|
|
- extends CustomCommandExecutor.WithErrorHandling<CommandSourceStack>
|
|
- implements CustomCommandExecutor.CommandAdapter<CommandSourceStack> {
|
|
- @Override
|
|
- public void runGuarded(
|
|
- CommandSourceStack source,
|
|
- ContextChain<CommandSourceStack> contextChain,
|
|
- ChainModifiers chainModifiers,
|
|
- ExecutionControl<CommandSourceStack> executionControl
|
|
- ) throws CommandSyntaxException {
|
|
- if (chainModifiers.isReturn()) {
|
|
- throw DebugCommand.NO_RETURN_RUN.create();
|
|
- } else if (executionControl.tracer() != null) {
|
|
- throw DebugCommand.NO_RECURSIVE_TRACES.create();
|
|
- } else {
|
|
- CommandContext<CommandSourceStack> topContext = contextChain.getTopContext();
|
|
- Collection<CommandFunction<CommandSourceStack>> functions = FunctionArgument.getFunctions(topContext, "name");
|
|
- MinecraftServer server = source.getServer();
|
|
- String string = "debug-trace-" + Util.getFilenameFormattedDateTime() + ".txt";
|
|
- CommandDispatcher<CommandSourceStack> dispatcher = source.getServer().getFunctions().getDispatcher();
|
|
- int i = 0;
|
|
-
|
|
- try {
|
|
- Path file = server.getFile("debug");
|
|
- Files.createDirectories(file);
|
|
- final PrintWriter printWriter = new PrintWriter(Files.newBufferedWriter(file.resolve(string), StandardCharsets.UTF_8));
|
|
- DebugCommand.Tracer tracer = new DebugCommand.Tracer(printWriter);
|
|
- executionControl.tracer(tracer);
|
|
-
|
|
- for (final CommandFunction<CommandSourceStack> commandFunction : functions) {
|
|
- try {
|
|
- CommandSourceStack commandSourceStack = source.withSource(tracer).withMaximumPermission(2);
|
|
- InstantiatedFunction<CommandSourceStack> instantiatedFunction = commandFunction.instantiate(null, dispatcher);
|
|
- executionControl.queueNext((new CallFunction<CommandSourceStack>(instantiatedFunction, CommandResultCallback.EMPTY, false) {
|
|
- @Override
|
|
- public void execute(CommandSourceStack source1, ExecutionContext<CommandSourceStack> executionContext, Frame frame) {
|
|
- printWriter.println(commandFunction.id());
|
|
- super.execute(source1, executionContext, frame);
|
|
- }
|
|
- }).bind(commandSourceStack));
|
|
- i += instantiatedFunction.entries().size();
|
|
- } catch (FunctionInstantiationException var18) {
|
|
- source.sendFailure(var18.messageComponent());
|
|
- }
|
|
- }
|
|
- } catch (IOException | UncheckedIOException var19) {
|
|
- DebugCommand.LOGGER.warn("Tracing failed", (Throwable)var19);
|
|
- source.sendFailure(Component.translatable("commands.debug.function.traceFailed"));
|
|
- }
|
|
-
|
|
- int i1 = i;
|
|
- executionControl.queueNext(
|
|
- (executionContext, frame) -> {
|
|
- if (functions.size() == 1) {
|
|
- source.sendSuccess(
|
|
- () -> Component.translatable(
|
|
- "commands.debug.function.success.single", i1, Component.translationArg(functions.iterator().next().id()), string
|
|
- ),
|
|
- true
|
|
- );
|
|
- } else {
|
|
- source.sendSuccess(() -> Component.translatable("commands.debug.function.success.multiple", i1, functions.size(), string), true);
|
|
- }
|
|
- }
|
|
- );
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- static class Tracer implements CommandSource, TraceCallbacks {
|
|
- public static final int INDENT_OFFSET = 1;
|
|
- private final PrintWriter output;
|
|
- private int lastIndent;
|
|
- private boolean waitingForResult;
|
|
-
|
|
- Tracer(PrintWriter output) {
|
|
- this.output = output;
|
|
- }
|
|
-
|
|
- private void indentAndSave(int indent) {
|
|
- this.printIndent(indent);
|
|
- this.lastIndent = indent;
|
|
- }
|
|
-
|
|
- private void printIndent(int indent) {
|
|
- for (int i = 0; i < indent + 1; i++) {
|
|
- this.output.write(" ");
|
|
- }
|
|
- }
|
|
-
|
|
- private void newLine() {
|
|
- if (this.waitingForResult) {
|
|
- this.output.println();
|
|
- this.waitingForResult = false;
|
|
- }
|
|
- }
|
|
-
|
|
- @Override
|
|
- public void onCommand(int depth, String command) {
|
|
- this.newLine();
|
|
- this.indentAndSave(depth);
|
|
- this.output.print("[C] ");
|
|
- this.output.print(command);
|
|
- this.waitingForResult = true;
|
|
- }
|
|
-
|
|
- @Override
|
|
- public void onReturn(int depth, String command, int returnValue) {
|
|
- if (this.waitingForResult) {
|
|
- this.output.print(" -> ");
|
|
- this.output.println(returnValue);
|
|
- this.waitingForResult = false;
|
|
- } else {
|
|
- this.indentAndSave(depth);
|
|
- this.output.print("[R = ");
|
|
- this.output.print(returnValue);
|
|
- this.output.print("] ");
|
|
- this.output.println(command);
|
|
- }
|
|
- }
|
|
-
|
|
- @Override
|
|
- public void onCall(int depth, ResourceLocation function, int commands) {
|
|
- this.newLine();
|
|
- this.indentAndSave(depth);
|
|
- this.output.print("[F] ");
|
|
- this.output.print(function);
|
|
- this.output.print(" size=");
|
|
- this.output.println(commands);
|
|
- }
|
|
-
|
|
- @Override
|
|
- public void onError(String errorMessage) {
|
|
- this.newLine();
|
|
- this.indentAndSave(this.lastIndent + 1);
|
|
- this.output.print("[E] ");
|
|
- this.output.print(errorMessage);
|
|
- }
|
|
-
|
|
- @Override
|
|
- public void sendSystemMessage(Component message) {
|
|
- this.newLine();
|
|
- this.printIndent(this.lastIndent + 1);
|
|
- this.output.print("[M] ");
|
|
- this.output.println(message.getString());
|
|
- }
|
|
-
|
|
- @Override
|
|
- public boolean acceptsSuccess() {
|
|
- return true;
|
|
- }
|
|
-
|
|
- @Override
|
|
- public boolean acceptsFailure() {
|
|
- return true;
|
|
- }
|
|
-
|
|
- @Override
|
|
- public boolean shouldInformAdmins() {
|
|
- return false;
|
|
- }
|
|
-
|
|
- @Override
|
|
- public boolean alwaysAccepts() {
|
|
- return true;
|
|
- }
|
|
-
|
|
- // Paper start
|
|
- @Override
|
|
- public org.bukkit.command.CommandSender getBukkitSender(final CommandSourceStack wrapper) {
|
|
- throw new UnsupportedOperationException();
|
|
- }
|
|
- // Paper end
|
|
-
|
|
- @Override
|
|
- public void close() {
|
|
- IOUtils.closeQuietly((Writer)this.output);
|
|
- }
|
|
- }
|
|
-}
|
|
diff --git a/net/minecraft/server/commands/PerfCommand.java b/net/minecraft/server/commands/PerfCommand.java
|
|
index b10cb4a73df58a5fe64e88868733ba41616f59e4..9f9cbe6056f8a4eeca64c40872d7403bb0ddc600 100644
|
|
--- a/net/minecraft/server/commands/PerfCommand.java
|
|
+++ b/net/minecraft/server/commands/PerfCommand.java
|
|
@@ -19,9 +19,6 @@ import net.minecraft.network.chat.Component;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.util.FileZipper;
|
|
import net.minecraft.util.TimeUtil;
|
|
-import net.minecraft.util.profiling.EmptyProfileResults;
|
|
-import net.minecraft.util.profiling.ProfileResults;
|
|
-import net.minecraft.util.profiling.metrics.storage.MetricsPersister;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.slf4j.Logger;
|
|
|
|
@@ -42,66 +39,22 @@ public class PerfCommand {
|
|
}
|
|
|
|
private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException {
|
|
- MinecraftServer server = source.getServer();
|
|
- if (server.isRecordingMetrics()) {
|
|
- throw ERROR_ALREADY_RUNNING.create();
|
|
- } else {
|
|
- Consumer<ProfileResults> consumer = profileResults -> whenStopped(source, profileResults);
|
|
- Consumer<Path> consumer1 = path -> saveResults(source, path, server);
|
|
- server.startRecordingMetrics(consumer, consumer1);
|
|
- source.sendSuccess(() -> Component.translatable("commands.perf.started"), false);
|
|
- return 0;
|
|
- }
|
|
+ return removedMessage(source); // DivineMC - Completely remove Mojang profiler
|
|
}
|
|
|
|
private static int stopProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException {
|
|
- MinecraftServer server = source.getServer();
|
|
- if (!server.isRecordingMetrics()) {
|
|
- throw ERROR_NOT_RUNNING.create();
|
|
- } else {
|
|
- server.finishRecordingMetrics();
|
|
- return 0;
|
|
- }
|
|
+ return removedMessage(source); // DivineMC - Completely remove Mojang profiler
|
|
}
|
|
|
|
- private static void saveResults(CommandSourceStack source, Path path, MinecraftServer server) {
|
|
- String string = String.format(
|
|
- Locale.ROOT, "%s-%s-%s", Util.getFilenameFormattedDateTime(), server.getWorldData().getLevelName(), SharedConstants.getCurrentVersion().id()
|
|
- );
|
|
-
|
|
- String string1;
|
|
- try {
|
|
- string1 = FileUtil.findAvailableName(MetricsPersister.PROFILING_RESULTS_DIR, string, ".zip");
|
|
- } catch (IOException var11) {
|
|
- source.sendFailure(Component.translatable("commands.perf.reportFailed"));
|
|
- LOGGER.error("Failed to create report name", (Throwable)var11);
|
|
- return;
|
|
- }
|
|
-
|
|
- try (FileZipper fileZipper = new FileZipper(MetricsPersister.PROFILING_RESULTS_DIR.resolve(string1))) {
|
|
- fileZipper.add(Paths.get("system.txt"), server.fillSystemReport(new SystemReport()).toLineSeparatedString());
|
|
- fileZipper.add(path);
|
|
- }
|
|
+ // DivineMC start - Completely remove Mojang profiler
|
|
+ private static int removedMessage(CommandSourceStack source) {
|
|
+ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage();
|
|
|
|
- try {
|
|
- FileUtils.forceDelete(path.toFile());
|
|
- } catch (IOException var9) {
|
|
- LOGGER.warn("Failed to delete temporary profiling file {}", path, var9);
|
|
- }
|
|
-
|
|
- source.sendSuccess(() -> Component.translatable("commands.perf.reportSaved", string1), false);
|
|
- }
|
|
+ source.getSender().sendMessage(mm.deserialize("<gold>Mojang's Profiler has been removed in DivineMC to save your server performance. Please use <click:suggest_command:'/spark'><grey>/spark</grey></click> instead"));
|
|
+ source.getSender().sendMessage(mm.deserialize("<gold>For more information, view its documentation at"));
|
|
+ source.getSender().sendMessage(mm.deserialize("<gold><click:open_url:'https://spark.lucko.me/docs/Command-Usage'>https://spark.lucko.me/docs/Command-Usage</click>"));
|
|
|
|
- private static void whenStopped(CommandSourceStack source, ProfileResults results) {
|
|
- if (results != EmptyProfileResults.EMPTY) {
|
|
- int tickDuration = results.getTickDuration();
|
|
- double d = (double)results.getNanoDuration() / TimeUtil.NANOSECONDS_PER_SECOND;
|
|
- source.sendSuccess(
|
|
- () -> Component.translatable(
|
|
- "commands.perf.stopped", String.format(Locale.ROOT, "%.2f", d), tickDuration, String.format(Locale.ROOT, "%.2f", tickDuration / d)
|
|
- ),
|
|
- false
|
|
- );
|
|
- }
|
|
+ return 0;
|
|
}
|
|
+ // DivineMC end - Completely remove Mojang profiler
|
|
}
|
|
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
|
index 49aa436abf89b16dc5249f37bf27b02b49d9e2e8..6a8f501883a5b5697d3ebf401f6b7aa6145479ea 100644
|
|
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -1045,12 +1045,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
return this.settings.getProperties().serverResourcePackInfo;
|
|
}
|
|
|
|
- @Override
|
|
- public void endMetricsRecordingTick() {
|
|
- super.endMetricsRecordingTick();
|
|
- this.isTickTimeLoggingEnabled = this.debugSubscribers().hasAnySubscriberFor(DebugSubscriptions.DEDICATED_SERVER_TICK_TIME);
|
|
- }
|
|
-
|
|
@Override
|
|
public SampleLogger getTickTimeLogger() {
|
|
return this.tickTimeLogger;
|
|
diff --git a/net/minecraft/server/level/ChunkGenerationTask.java b/net/minecraft/server/level/ChunkGenerationTask.java
|
|
index 4221af18f5087badb5cd8c7cf66ab3312edf0394..e9d861182439eecacfab2ac431726e8adeaab3aa 100644
|
|
--- a/net/minecraft/server/level/ChunkGenerationTask.java
|
|
+++ b/net/minecraft/server/level/ChunkGenerationTask.java
|
|
@@ -5,8 +5,6 @@ import java.util.List;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import javax.annotation.Nullable;
|
|
import net.minecraft.util.StaticCache2D;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.Zone;
|
|
import net.minecraft.world.level.ChunkPos;
|
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
|
import net.minecraft.world.level.chunk.status.ChunkDependencies;
|
|
@@ -67,7 +65,6 @@ public class ChunkGenerationTask {
|
|
chunkStatus = ChunkStatus.getStatusList().get(this.scheduledStatus.getIndex() + 1);
|
|
}
|
|
|
|
- this.scheduleLayer(chunkStatus, this.needsGeneration);
|
|
this.scheduledStatus = chunkStatus;
|
|
}
|
|
|
|
@@ -112,22 +109,6 @@ public class ChunkGenerationTask {
|
|
return this.cache.get(this.pos.x, this.pos.z);
|
|
}
|
|
|
|
- private void scheduleLayer(ChunkStatus status, boolean needsGeneration) {
|
|
- try (Zone zone = Profiler.get().zone("scheduleLayer")) {
|
|
- zone.addText(status::getName);
|
|
- int radiusForLayer = this.getRadiusForLayer(status, needsGeneration);
|
|
-
|
|
- for (int i = this.pos.x - radiusForLayer; i <= this.pos.x + radiusForLayer; i++) {
|
|
- for (int i1 = this.pos.z - radiusForLayer; i1 <= this.pos.z + radiusForLayer; i1++) {
|
|
- GenerationChunkHolder generationChunkHolder = this.cache.get(i, i1);
|
|
- if (this.markedForCancellation || !this.scheduleChunkInLayer(status, needsGeneration, generationChunkHolder)) {
|
|
- return;
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
private int getRadiusForLayer(ChunkStatus status, boolean needsGeneration) {
|
|
ChunkPyramid chunkPyramid = needsGeneration ? ChunkPyramid.GENERATION_PYRAMID : ChunkPyramid.LOADING_PYRAMID;
|
|
return chunkPyramid.getStepTo(this.targetStatus).getAccumulatedRadiusOf(status);
|
|
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
|
|
index e957ddea7c6cd9685e362a4b1adc09fdd3bfd359..188a62f00bd541f27adaaa4250b56276565f0d74 100644
|
|
--- a/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/net/minecraft/server/level/ChunkMap.java
|
|
@@ -64,8 +64,6 @@ import net.minecraft.util.CsvOutput;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.StaticCache2D;
|
|
import net.minecraft.util.TriState;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.util.thread.BlockableEventLoop;
|
|
import net.minecraft.util.thread.ConsecutiveExecutor;
|
|
import net.minecraft.world.entity.Entity;
|
|
@@ -413,15 +411,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
}
|
|
|
|
protected void tick(BooleanSupplier hasMoreTime) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("poi");
|
|
this.poiManager.tick(hasMoreTime);
|
|
- profilerFiller.popPush("chunk_unload");
|
|
if (!this.level.noSave()) {
|
|
this.processUnloads(hasMoreTime);
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
public boolean hasWork() {
|
|
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
|
|
index d4858fe6a195acd17aea098401a5ee7baa5ad4d1..3aa09ea7498fb0d790cc47c66a8e89df981671e2 100644
|
|
--- a/net/minecraft/server/level/ServerChunkCache.java
|
|
+++ b/net/minecraft/server/level/ServerChunkCache.java
|
|
@@ -27,8 +27,6 @@ import net.minecraft.network.protocol.Packet;
|
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.util.VisibleForDebug;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.util.thread.BlockableEventLoop;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.entity.MobCategory;
|
|
@@ -467,37 +465,28 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
|
// CraftBukkit start - modelled on below
|
|
public void purgeUnload() {
|
|
if (true) return; // Paper - rewrite chunk system
|
|
- ProfilerFiller gameprofilerfiller = Profiler.get();
|
|
|
|
- gameprofilerfiller.push("purge");
|
|
this.ticketStorage.purgeStaleTickets(this.chunkMap);
|
|
this.runDistanceManagerUpdates();
|
|
- gameprofilerfiller.popPush("unload");
|
|
this.chunkMap.tick(() -> true);
|
|
- gameprofilerfiller.pop();
|
|
this.clearCache();
|
|
}
|
|
// CraftBukkit end
|
|
|
|
@Override
|
|
public void tick(BooleanSupplier hasTimeLeft, boolean tickChunks) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("purge");
|
|
if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot
|
|
this.ticketStorage.purgeStaleTickets(this.chunkMap);
|
|
}
|
|
|
|
this.runDistanceManagerUpdates();
|
|
- profilerFiller.popPush("chunks");
|
|
if (tickChunks) {
|
|
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().tick(); // Paper - rewrite chunk system
|
|
this.tickChunks();
|
|
this.chunkMap.tick();
|
|
}
|
|
|
|
- profilerFiller.popPush("unload");
|
|
this.chunkMap.tick(hasTimeLeft);
|
|
- profilerFiller.pop();
|
|
this.clearCache();
|
|
}
|
|
|
|
@@ -506,22 +495,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
|
long l = gameTime - this.lastInhabitedUpdate;
|
|
this.lastInhabitedUpdate = gameTime;
|
|
if (!this.level.isDebug()) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("pollingChunks");
|
|
if (this.level.tickRateManager().runsNormally()) {
|
|
- profilerFiller.push("tickingChunks");
|
|
- this.tickChunks(profilerFiller, l);
|
|
- profilerFiller.pop();
|
|
+ this.tickChunks(l);
|
|
}
|
|
|
|
- this.broadcastChangedChunks(profilerFiller);
|
|
- profilerFiller.pop();
|
|
+ this.broadcastChangedChunks();
|
|
}
|
|
}
|
|
|
|
- private void broadcastChangedChunks(ProfilerFiller profiler) {
|
|
- profiler.push("broadcast");
|
|
-
|
|
+ private void broadcastChangedChunks() {
|
|
for (ChunkHolder chunkHolder : this.chunkHoldersToBroadcast) {
|
|
LevelChunk tickingChunk = chunkHolder.getChunkToSend(); // Paper - rewrite chunk system
|
|
if (tickingChunk != null) {
|
|
@@ -530,11 +512,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
|
}
|
|
|
|
this.chunkHoldersToBroadcast.clear();
|
|
- profiler.pop();
|
|
}
|
|
|
|
- private void tickChunks(ProfilerFiller profiler, long timeInhabited) {
|
|
- profiler.push("naturalSpawnCount");
|
|
+ private void tickChunks(long timeInhabited) {
|
|
int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount();
|
|
// Paper start - Optional per player mob spawns
|
|
NaturalSpawner.SpawnState spawnState;
|
|
@@ -580,16 +560,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
|
List<LevelChunk> list = this.spawningChunks;
|
|
|
|
try {
|
|
- profiler.popPush("filteringSpawningChunks");
|
|
this.chunkMap.collectSpawningChunks(list);
|
|
- profiler.popPush("shuffleSpawningChunks");
|
|
// Paper start - chunk tick iteration optimisation
|
|
if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
|
|
this.shuffleRandom.setSeed(this.level.random.nextLong());
|
|
Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled
|
|
}
|
|
// Paper end - chunk tick iteration optimisation
|
|
- profiler.popPush("tickSpawningChunks");
|
|
|
|
for (LevelChunk levelChunk : list) {
|
|
this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, spawnState);
|
|
@@ -598,14 +575,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
|
list.clear();
|
|
}
|
|
|
|
- profiler.popPush("tickTickingChunks");
|
|
this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimisations
|
|
if (_boolean) {
|
|
- profiler.popPush("customSpawners");
|
|
this.level.tickCustomSpawners(this.spawnEnemies);
|
|
}
|
|
-
|
|
- profiler.pop();
|
|
}
|
|
|
|
private void tickSpawningChunk(LevelChunk chunk, long timeInhabited, List<MobCategory> spawnCategories, NaturalSpawner.SpawnState spawnState) {
|
|
@@ -826,7 +799,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
|
|
|
@Override
|
|
protected void doRunTask(Runnable task) {
|
|
- Profiler.get().incrementCounter("runTask");
|
|
super.doRunTask(task);
|
|
}
|
|
|
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
|
index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb48e5a26b1 100644
|
|
--- a/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
|
@@ -77,8 +77,6 @@ import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.datafix.DataFixTypes;
|
|
import net.minecraft.util.debug.DebugSubscriptions;
|
|
import net.minecraft.util.debug.LevelDebugSynchronizers;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.util.random.WeightedList;
|
|
import net.minecraft.util.valueproviders.IntProvider;
|
|
import net.minecraft.util.valueproviders.UniformInt;
|
|
@@ -753,16 +751,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
|
|
public void tick(BooleanSupplier hasTimeLeft) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
this.handlingTick = true;
|
|
TickRateManager tickRateManager = this.tickRateManager();
|
|
boolean runsNormally = tickRateManager.runsNormally();
|
|
if (runsNormally) {
|
|
- profilerFiller.push("world border");
|
|
this.getWorldBorder().tick();
|
|
- profilerFiller.popPush("weather");
|
|
this.advanceWeatherCycle();
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
|
@@ -796,30 +790,22 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
this.tickTime();
|
|
}
|
|
|
|
- profilerFiller.push("tickPending");
|
|
if (!this.isDebug() && runsNormally) {
|
|
long l = this.getGameTime();
|
|
- profilerFiller.push("blockTicks");
|
|
this.blockTicks.tick(l, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks
|
|
- profilerFiller.popPush("fluidTicks");
|
|
this.fluidTicks.tick(l, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
- profilerFiller.popPush("raid");
|
|
if (runsNormally) {
|
|
this.raids.tick(this);
|
|
}
|
|
|
|
- profilerFiller.popPush("chunkSource");
|
|
this.getChunkSource().tick(hasTimeLeft, true);
|
|
- profilerFiller.popPush("blockEvents");
|
|
if (runsNormally) {
|
|
this.runBlockEvents();
|
|
}
|
|
|
|
this.handlingTick = false;
|
|
- profilerFiller.pop();
|
|
boolean hasActiveTickets = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || this.chunkSource.hasActiveTickets(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this
|
|
if (hasActiveTickets) {
|
|
this.resetEmptyTime();
|
|
@@ -830,11 +816,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
|
|
if (this.emptyTime < 300) {
|
|
- profilerFiller.push("entities");
|
|
if (this.dragonFight != null && runsNormally) {
|
|
- profilerFiller.push("dragonFight");
|
|
this.dragonFight.tick();
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR
|
|
@@ -843,9 +826,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
entity -> {
|
|
if (!entity.isRemoved()) {
|
|
if (!tickRateManager.isEntityFrozen(entity)) {
|
|
- profilerFiller.push("checkDespawn");
|
|
entity.checkDespawn();
|
|
- profilerFiller.pop();
|
|
if (true) { // Paper - rewrite chunk system
|
|
Entity vehicle = entity.getVehicle();
|
|
if (vehicle != null) {
|
|
@@ -856,23 +837,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
entity.stopRiding();
|
|
}
|
|
|
|
- profilerFiller.push("tick");
|
|
this.guardEntityTick(this::tickNonPassenger, entity);
|
|
- profilerFiller.pop();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
);
|
|
- profilerFiller.popPush("blockEntities");
|
|
this.tickBlockEntities();
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
- profilerFiller.push("entityManagement");
|
|
// Paper - rewrite chunk system
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("debugSynchronizers");
|
|
if (this.debugSynchronizers.hasAnySubscriberFor(DebugSubscriptions.NEIGHBOR_UPDATES)) {
|
|
this.neighborUpdater
|
|
.setDebugListener(blockPos -> this.debugSynchronizers.broadcastEventToTracking(blockPos, DebugSubscriptions.NEIGHBOR_UPDATES, blockPos));
|
|
@@ -881,7 +855,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
|
|
this.debugSynchronizers.tick(this.server.debugSubscribers());
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
@Override
|
|
@@ -896,9 +869,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
if (this.tickTime) {
|
|
long l = this.levelData.getGameTime() + 1L;
|
|
this.serverLevelData.setGameTime(l);
|
|
- Profiler.get().push("scheduledFunctions");
|
|
this.serverLevelData.getScheduledEvents().tick(this.server, l);
|
|
- Profiler.get().pop();
|
|
if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
|
|
// Purpur start - Configurable daylight cycle
|
|
int incrementTicks = isBrightOutside() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks;
|
|
@@ -998,8 +969,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
ChunkPos pos = chunk.getPos();
|
|
int minBlockX = pos.getMinBlockX();
|
|
int minBlockZ = pos.getMinBlockZ();
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("iceandsnow");
|
|
|
|
if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow
|
|
for (int i = 0; i < randomTickSpeed; i++) {
|
|
@@ -1009,12 +978,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
} // Paper - Option to disable ice and snow
|
|
|
|
- profilerFiller.popPush("tickBlocks");
|
|
if (randomTickSpeed > 0) {
|
|
this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
public void tickThunder(LevelChunk chunk) {
|
|
@@ -1022,8 +988,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
boolean isRaining = this.isRaining();
|
|
int minBlockX = pos.getMinBlockX();
|
|
int minBlockZ = pos.getMinBlockZ();
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("thunder");
|
|
if (!this.paperConfig().environment.disableThunder && isRaining && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder
|
|
BlockPos blockPos = this.findLightningTargetAround(this.getBlockRandomPos(minBlockX, 0, minBlockZ, 15));
|
|
if (this.isRainingAt(blockPos)) {
|
|
@@ -1057,8 +1021,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
}
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
@VisibleForTesting
|
|
@@ -1402,17 +1364,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
}
|
|
// Paper end - log detailed entity tick information
|
|
entity.setOldPosAndRot();
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
entity.tickCount++;
|
|
entity.totalEntityAge++; // Paper - age-like counter for all entities
|
|
- profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString());
|
|
- profilerFiller.incrementCounter("tickNonPassenger");
|
|
final boolean isActive = io.papermc.paper.entity.activation.ActivationRange.checkIfActive(entity); // Paper - EAR 2
|
|
if (isActive) { // Paper - EAR 2
|
|
entity.tick();
|
|
entity.postTick(); // CraftBukkit
|
|
} else {entity.inactiveTick();} // Paper - EAR 2
|
|
- profilerFiller.pop();
|
|
|
|
for (Entity entity1 : entity.getPassengers()) {
|
|
this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2
|
|
@@ -1433,9 +1391,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
passengerEntity.setOldPosAndRot();
|
|
passengerEntity.tickCount++;
|
|
passengerEntity.totalEntityAge++; // Paper - age-like counter for all entities
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(passengerEntity.getType()).toString());
|
|
- profilerFiller.incrementCounter("tickPassenger");
|
|
// Paper start - EAR 2
|
|
if (isActive) {
|
|
passengerEntity.rideTick();
|
|
@@ -1447,7 +1402,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
ridingEntity.positionRider(passengerEntity);
|
|
}
|
|
// Paper end - EAR 2
|
|
- profilerFiller.pop();
|
|
|
|
for (Entity entity : passengerEntity.getPassengers()) {
|
|
this.tickPassenger(passengerEntity, entity, isActive); // Paper - EAR 2
|
|
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
|
index 6fd0803b266982daf12096cfab2ee92347d72e8a..b1667ed08c417daf292e092ca0d2ab9848ac8d61 100644
|
|
--- a/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -110,8 +110,6 @@ import net.minecraft.util.Mth;
|
|
import net.minecraft.util.ProblemReporter;
|
|
import net.minecraft.util.Unit;
|
|
import net.minecraft.util.debug.DebugSubscription;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.Container;
|
|
import net.minecraft.world.Difficulty;
|
|
import net.minecraft.world.InteractionHand;
|
|
@@ -1569,20 +1567,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
|
this.portalProcess = null; // SPIGOT-7785: there is no need to carry this over as it contains the old world/location and we might run into trouble if there is a portal in the same spot in both worlds
|
|
serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
|
this.unsetRemoved();
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("moving");
|
|
if (resourceKey == net.minecraft.world.level.dimension.LevelStem.OVERWORLD && level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER) { // CraftBukkit - empty to fall through to null to event
|
|
this.enteredNetherPosition = this.position();
|
|
}
|
|
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("placing");
|
|
this.portalPos = org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(exit); // Purpur - Fix stuck in portals
|
|
this.setServerLevel(level);
|
|
this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
|
|
this.connection.resetPosition();
|
|
level.addDuringTeleport(this);
|
|
- profilerFiller.pop();
|
|
this.triggerDimensionChangeTriggers(serverLevel);
|
|
this.stopUsingItem();
|
|
this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities()));
|
|
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
index e98400719a4ab43dc0ce90cdca19ba86e4849720..4a333e87af17bd5b673b57c0fa0d3a239fb8db59 100644
|
|
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
@@ -27,7 +27,6 @@ import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.server.level.ClientInformation;
|
|
import net.minecraft.server.players.NameAndId;
|
|
import net.minecraft.util.VisibleForDebug;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
import org.slf4j.Logger;
|
|
|
|
public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener {
|
|
@@ -284,7 +283,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
|
}
|
|
|
|
protected void keepConnectionAlive() {
|
|
- Profiler.get().push("keepAlive");
|
|
long millis = Util.getMillis();
|
|
// Paper start - improve keepalives
|
|
// Purpur start - Alternative Keepalive Handling
|
|
@@ -322,8 +320,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
|
// Paper end - improve keepalives
|
|
}
|
|
}
|
|
-
|
|
- Profiler.get().pop();
|
|
}
|
|
|
|
private boolean checkIfClosed(long time) {
|
|
diff --git a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
|
|
index 76d57e89c1367c745b031c0bfcb2cf872b383af7..a3fd9fa365340455dbf000ab138a8e3c7a855e25 100644
|
|
--- a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
|
|
+++ b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java
|
|
@@ -9,8 +9,6 @@ import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
import net.minecraft.Util;
|
|
import net.minecraft.util.Unit;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import org.slf4j.Logger;
|
|
|
|
public class ProfiledReloadInstance extends SimpleReloadInstance<ProfiledReloadInstance.State> {
|
|
@@ -71,13 +69,10 @@ public class ProfiledReloadInstance extends SimpleReloadInstance<ProfiledReloadI
|
|
|
|
private static Executor profiledExecutor(Executor executor, AtomicLong timeTaken, AtomicLong timesRun, String name) {
|
|
return runnable -> executor.execute(() -> {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push(name);
|
|
long nanos = Util.getNanos();
|
|
runnable.run();
|
|
timeTaken.addAndGet(Util.getNanos() - nanos);
|
|
timesRun.incrementAndGet();
|
|
- profilerFiller.pop();
|
|
});
|
|
}
|
|
|
|
diff --git a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
|
|
index ea99b9f766dbeeb625523334fb53fb5a9e040497..a5479b67006e0f083078a7af2dde0c3dde970e8b 100644
|
|
--- a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
|
|
+++ b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
|
|
@@ -3,8 +3,6 @@ package net.minecraft.server.packs.resources;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.Executor;
|
|
import net.minecraft.util.Unit;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
|
|
public interface ResourceManagerReloadListener extends PreparableReloadListener {
|
|
@Override
|
|
@@ -13,10 +11,7 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener
|
|
) {
|
|
ResourceManager resourceManager = state.resourceManager();
|
|
return preparation.wait(Unit.INSTANCE).thenRunAsync(() -> {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("listener");
|
|
this.onResourceManagerReload(resourceManager);
|
|
- profilerFiller.pop();
|
|
}, gameExecutor);
|
|
}
|
|
|
|
diff --git a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java
|
|
index 16bab14884a5a7b8d7659379f5b7ea90aa9bd737..a2320c37e4ef495eae7a1978aa7c7dc642aefdf9 100644
|
|
--- a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java
|
|
+++ b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java
|
|
@@ -17,7 +17,6 @@ import net.minecraft.resources.FileToIdConverter;
|
|
import net.minecraft.resources.ResourceKey;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraft.util.StrictJsonParser;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import org.slf4j.Logger;
|
|
|
|
public abstract class SimpleJsonResourceReloadListener<T> extends SimplePreparableReloadListener<Map<ResourceLocation, T>> {
|
|
@@ -41,7 +40,7 @@ public abstract class SimpleJsonResourceReloadListener<T> extends SimplePreparab
|
|
}
|
|
|
|
@Override
|
|
- protected Map<ResourceLocation, T> prepare(ResourceManager resourceManager, ProfilerFiller profiler) {
|
|
+ protected Map<ResourceLocation, T> prepare(ResourceManager resourceManager) {
|
|
Map<ResourceLocation, T> map = new HashMap<>();
|
|
scanDirectory(resourceManager, this.lister, this.ops, this.codec, map);
|
|
return map;
|
|
diff --git a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
|
|
index 6e07a06234b34250087e70e18be22a526417fa80..ff5e508838340ee575d83216e33400721bdc6f05 100644
|
|
--- a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
|
|
+++ b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
|
|
@@ -2,8 +2,6 @@ package net.minecraft.server.packs.resources;
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.Executor;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
|
|
public abstract class SimplePreparableReloadListener<T> implements PreparableReloadListener {
|
|
@Override
|
|
@@ -11,12 +9,12 @@ public abstract class SimplePreparableReloadListener<T> implements PreparableRel
|
|
PreparableReloadListener.SharedState state, Executor backgroundExecutor, PreparableReloadListener.PreparationBarrier preparation, Executor gameExecutor
|
|
) {
|
|
ResourceManager resourceManager = state.resourceManager();
|
|
- return CompletableFuture.<T>supplyAsync(() -> this.prepare(resourceManager, Profiler.get()), backgroundExecutor)
|
|
+ return CompletableFuture.<T>supplyAsync(() -> this.prepare(resourceManager), backgroundExecutor)
|
|
.thenCompose(preparation::wait)
|
|
- .thenAcceptAsync(object -> this.apply((T)object, resourceManager, Profiler.get()), gameExecutor);
|
|
+ .thenAcceptAsync(object -> this.apply((T)object, resourceManager), gameExecutor);
|
|
}
|
|
|
|
- protected abstract T prepare(ResourceManager resourceManager, ProfilerFiller profiler);
|
|
+ protected abstract T prepare(ResourceManager resourceManager);
|
|
|
|
- protected abstract void apply(T object, ResourceManager resourceManager, ProfilerFiller profiler);
|
|
+ protected abstract void apply(T object, ResourceManager resourceManager);
|
|
}
|
|
diff --git a/net/minecraft/util/thread/AbstractConsecutiveExecutor.java b/net/minecraft/util/thread/AbstractConsecutiveExecutor.java
|
|
index f4aa10bbd98f514f27224346b3b9332f2218602d..ff319fa2ddea43d5b3c55897b1aaaf9fe137abbc 100644
|
|
--- a/net/minecraft/util/thread/AbstractConsecutiveExecutor.java
|
|
+++ b/net/minecraft/util/thread/AbstractConsecutiveExecutor.java
|
|
@@ -7,13 +7,9 @@ import java.util.concurrent.Executor;
|
|
import java.util.concurrent.RejectedExecutionException;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
import net.minecraft.Util;
|
|
-import net.minecraft.util.profiling.metrics.MetricCategory;
|
|
-import net.minecraft.util.profiling.metrics.MetricSampler;
|
|
-import net.minecraft.util.profiling.metrics.MetricsRegistry;
|
|
-import net.minecraft.util.profiling.metrics.ProfilerMeasured;
|
|
import org.slf4j.Logger;
|
|
|
|
-public abstract class AbstractConsecutiveExecutor<T extends Runnable> implements ProfilerMeasured, TaskScheduler<T>, Runnable {
|
|
+public abstract class AbstractConsecutiveExecutor<T extends Runnable> implements TaskScheduler<T>, Runnable {
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
private final AtomicReference<AbstractConsecutiveExecutor.Status> status = new AtomicReference<>(AbstractConsecutiveExecutor.Status.SLEEPING);
|
|
private final StrictQueue<T> queue;
|
|
@@ -24,7 +20,6 @@ public abstract class AbstractConsecutiveExecutor<T extends Runnable> implements
|
|
this.executor = executor;
|
|
this.queue = queue;
|
|
this.name = name;
|
|
- MetricsRegistry.INSTANCE.add(this);
|
|
}
|
|
|
|
private boolean canBeScheduled() {
|
|
@@ -108,11 +103,6 @@ public abstract class AbstractConsecutiveExecutor<T extends Runnable> implements
|
|
return this.name;
|
|
}
|
|
|
|
- @Override
|
|
- public List<MetricSampler> profiledMetrics() {
|
|
- return ImmutableList.of(MetricSampler.create(this.name + "-queue-size", MetricCategory.CONSECUTIVE_EXECUTORS, this::size));
|
|
- }
|
|
-
|
|
private boolean setRunning() {
|
|
return this.status.compareAndSet(AbstractConsecutiveExecutor.Status.SLEEPING, AbstractConsecutiveExecutor.Status.RUNNING);
|
|
}
|
|
diff --git a/net/minecraft/util/thread/BlockableEventLoop.java b/net/minecraft/util/thread/BlockableEventLoop.java
|
|
index ef29b33db3a665621f35a7480892c65fd9045a5a..e22b658f90d48ef59b5e7b4d0278f2ba7e05ee51 100644
|
|
--- a/net/minecraft/util/thread/BlockableEventLoop.java
|
|
+++ b/net/minecraft/util/thread/BlockableEventLoop.java
|
|
@@ -15,13 +15,9 @@ import java.util.function.Supplier;
|
|
import javax.annotation.CheckReturnValue;
|
|
import net.minecraft.ReportedException;
|
|
import net.minecraft.SharedConstants;
|
|
-import net.minecraft.util.profiling.metrics.MetricCategory;
|
|
-import net.minecraft.util.profiling.metrics.MetricSampler;
|
|
-import net.minecraft.util.profiling.metrics.MetricsRegistry;
|
|
-import net.minecraft.util.profiling.metrics.ProfilerMeasured;
|
|
import org.slf4j.Logger;
|
|
|
|
-public abstract class BlockableEventLoop<R extends Runnable> implements ProfilerMeasured, TaskScheduler<R>, Executor {
|
|
+public abstract class BlockableEventLoop<R extends Runnable> implements TaskScheduler<R>, Executor {
|
|
public static final long BLOCK_TIME_NANOS = 100000L;
|
|
private final String name;
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
@@ -30,7 +26,6 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
|
|
|
protected BlockableEventLoop(String name) {
|
|
this.name = name;
|
|
- MetricsRegistry.INSTANCE.add(this);
|
|
}
|
|
|
|
// Paper start
|
|
@@ -182,11 +177,6 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
- public List<MetricSampler> profiledMetrics() {
|
|
- return ImmutableList.of(MetricSampler.create(this.name + "-pending-tasks", MetricCategory.EVENT_LOOPS, this::getPendingTasksCount));
|
|
- }
|
|
-
|
|
public static boolean isNonRecoverable(Throwable error) {
|
|
return error instanceof ReportedException reportedException
|
|
? isNonRecoverable(reportedException.getCause())
|
|
diff --git a/net/minecraft/util/thread/PriorityConsecutiveExecutor.java b/net/minecraft/util/thread/PriorityConsecutiveExecutor.java
|
|
index 39a604c9a53930b53d959b1d2eb504aa964e9a58..0d0380e3955836ce125f777841477503bb6c0aae 100644
|
|
--- a/net/minecraft/util/thread/PriorityConsecutiveExecutor.java
|
|
+++ b/net/minecraft/util/thread/PriorityConsecutiveExecutor.java
|
|
@@ -3,12 +3,10 @@ package net.minecraft.util.thread;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.function.Consumer;
|
|
-import net.minecraft.util.profiling.metrics.MetricsRegistry;
|
|
|
|
public class PriorityConsecutiveExecutor extends AbstractConsecutiveExecutor<StrictQueue.RunnableWithPriority> {
|
|
public PriorityConsecutiveExecutor(int size, Executor executor, String name) {
|
|
super(new StrictQueue.FixedPriorityQueue(size), executor, name);
|
|
- MetricsRegistry.INSTANCE.add(this);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313083e9a57 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -82,8 +82,6 @@ import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.debug.DebugEntityBlockIntersection;
|
|
import net.minecraft.util.debug.DebugSubscriptions;
|
|
import net.minecraft.util.debug.DebugValueSource;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
import net.minecraft.world.Nameable;
|
|
@@ -879,8 +877,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
// CraftBukkit end
|
|
|
|
public void baseTick() {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("entityBaseTick");
|
|
if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups
|
|
this.inBlockState = null;
|
|
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
|
@@ -934,8 +930,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
if (this.level() instanceof ServerLevel serverLevelx && this instanceof Leashable) {
|
|
Leashable.tickLeash(serverLevelx, (Entity & Leashable)this);
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
public void setSharedFlagOnFire(boolean isOnFire) {
|
|
@@ -1161,8 +1155,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
}
|
|
}
|
|
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("move");
|
|
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) {
|
|
if (type != MoverType.PISTON) {
|
|
movement = movement.multiply(this.stuckSpeedMultiplier);
|
|
@@ -1174,7 +1166,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
// Paper start - ignore movement changes while inactive.
|
|
if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) {
|
|
setDeltaMovement(Vec3.ZERO);
|
|
- profilerFiller.pop();
|
|
return;
|
|
}
|
|
// Paper end
|
|
@@ -1199,8 +1190,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
this.setPos(vec33);
|
|
}
|
|
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("rest");
|
|
boolean flag = !Mth.equal(movement.x, vec3.x);
|
|
boolean flag1 = !Mth.equal(movement.z, vec3.z);
|
|
this.horizontalCollision = flag || flag1;
|
|
@@ -1223,7 +1212,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
}
|
|
|
|
if (this.isRemoved()) {
|
|
- profilerFiller.pop();
|
|
} else {
|
|
if (this.horizontalCollision) {
|
|
Vec3 deltaMovement = this.getDeltaMovement();
|
|
@@ -1267,7 +1255,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
|
|
float blockSpeedFactor = this.getBlockSpeedFactor();
|
|
this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor));
|
|
- profilerFiller.pop();
|
|
}
|
|
}
|
|
// Paper start - detailed watchdog information
|
|
@@ -3532,8 +3519,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
this.processPortalCooldown();
|
|
if (this.portalProcess != null) {
|
|
if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("portal");
|
|
this.setPortalCooldown();
|
|
TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this);
|
|
if (portalDestination != null) {
|
|
@@ -3543,8 +3528,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
this.teleport(portalDestination);
|
|
}
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
} else if (this.portalProcess.hasExpired()) {
|
|
this.portalProcess = null;
|
|
}
|
|
@@ -4111,15 +4094,12 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
entity.teleport(this.calculatePassengerTransition(teleportTransition, entity));
|
|
}
|
|
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("teleportSameDimension");
|
|
this.teleportSetPosition(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives());
|
|
if (!teleportTransition.asPassenger()) {
|
|
this.sendTeleportTransitionToRidingPlayers(teleportTransition);
|
|
}
|
|
|
|
teleportTransition.postTeleportTransition().onTransition(this);
|
|
- profilerFiller.pop();
|
|
return this;
|
|
}
|
|
|
|
@@ -4136,11 +4116,8 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
}
|
|
}
|
|
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("teleportCrossDimension");
|
|
Entity entityx = this.getType().create(newLevel, EntitySpawnReason.DIMENSION_TRAVEL);
|
|
if (entityx == null) {
|
|
- profilerFiller.pop();
|
|
return null;
|
|
} else {
|
|
// Paper start - Fix item duplication and teleport issues
|
|
@@ -4160,7 +4137,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
|
newLevel.resetEmptyTime();
|
|
teleportTransition.postTeleportTransition().onTransition(entityx);
|
|
this.teleportSpectators(teleportTransition, oldLevel);
|
|
- profilerFiller.pop();
|
|
return entityx;
|
|
}
|
|
}
|
|
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
|
index 9955a41d21345faad05843ee1b17321c3330f5d0..09987dac80cd031f7af0b63db50f5e719e05665a 100644
|
|
--- a/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -70,8 +70,6 @@ import net.minecraft.tags.FluidTags;
|
|
import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.tags.TagKey;
|
|
import net.minecraft.util.Mth;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.Difficulty;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.damagesource.CombatRules;
|
|
@@ -441,8 +439,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
}
|
|
|
|
super.baseTick();
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("livingEntityBaseTick");
|
|
if (this.isAlive() && this.level() instanceof ServerLevel serverLevel1) {
|
|
boolean flag = this instanceof Player;
|
|
if (this.isInWall()) {
|
|
@@ -529,7 +525,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
this.yBodyRotO = this.yBodyRot;
|
|
this.yRotO = this.getYRot();
|
|
this.xRotO = this.getXRot();
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
protected boolean shouldTakeDrowningDamage() {
|
|
@@ -3412,11 +3407,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
f1 = this.getYRot();
|
|
}
|
|
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("headTurn");
|
|
this.tickHeadTurn(f1);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("rangeChecks");
|
|
|
|
// Paper start - stop large pitch and yaw changes from crashing the server
|
|
this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F;
|
|
@@ -3428,7 +3419,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
|
|
// Paper end - stop large pitch and yaw changes from crashing the server
|
|
|
|
- profilerFiller.pop();
|
|
if (this.isFallFlying()) {
|
|
this.fallFlyTicks++;
|
|
} else {
|
|
@@ -3604,21 +3594,15 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
}
|
|
|
|
this.setDeltaMovement(d, d1, d2);
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("ai");
|
|
this.applyInput();
|
|
if (this.isImmobile()) {
|
|
this.jumping = false;
|
|
this.xxa = 0.0F;
|
|
this.zza = 0.0F;
|
|
} else if (this.isEffectiveAi() && !this.level().isClientSide()) {
|
|
- profilerFiller.push("newAi");
|
|
this.serverAiStep();
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("jump");
|
|
if (this.jumping && this.isAffectedByFluids()) {
|
|
double fluidHeight;
|
|
if (this.isInLava()) {
|
|
@@ -3647,8 +3631,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
this.noJumpDelay = 0;
|
|
}
|
|
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("travel");
|
|
if (this.isFallFlying()) {
|
|
this.updateFallFlying();
|
|
}
|
|
@@ -3673,9 +3655,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
this.calculateEntityAnimation(this instanceof FlyingAnimal);
|
|
}
|
|
|
|
- profilerFiller.pop();
|
|
if (this.level() instanceof ServerLevel serverLevel) {
|
|
- profilerFiller.push("freezing");
|
|
if ((!this.isInPowderSnow || !this.canFreeze()) && !this.freezeLocked) { // Paper - Freeze Tick Lock API
|
|
this.setTicksFrozen(Math.max(0, this.getTicksFrozen() - 2));
|
|
}
|
|
@@ -3685,18 +3665,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
if (this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) {
|
|
this.hurtServer(serverLevel, this.damageSources().freeze(), 1.0F);
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
- profilerFiller.push("push");
|
|
if (this.autoSpinAttackTicks > 0) {
|
|
this.autoSpinAttackTicks--;
|
|
this.checkAutoSpinAttack(boundingBox, this.getBoundingBox());
|
|
}
|
|
|
|
this.pushEntities();
|
|
- profilerFiller.pop();
|
|
// Paper start - Add EntityMoveEvent
|
|
// Purpur start - Ridables
|
|
if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
|
|
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
|
index 9c5336e47757879465679e27faf1f63c07952f56..b2853b6a3bca0ea04c50fedf5e2f5ff633ac2a21 100644
|
|
--- a/net/minecraft/world/entity/Mob.java
|
|
+++ b/net/minecraft/world/entity/Mob.java
|
|
@@ -31,8 +31,6 @@ import net.minecraft.util.debug.DebugGoalInfo;
|
|
import net.minecraft.util.debug.DebugPathInfo;
|
|
import net.minecraft.util.debug.DebugSubscriptions;
|
|
import net.minecraft.util.debug.DebugValueSource;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.Container;
|
|
import net.minecraft.world.Difficulty;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
@@ -332,8 +330,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
|
@Override
|
|
public void baseTick() {
|
|
super.baseTick();
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("mobBaseTick");
|
|
if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) {
|
|
this.resetAmbientSoundTime();
|
|
this.playAmbientSound();
|
|
@@ -341,7 +337,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
|
|
|
if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.fixMc183990 && this.target != null && this.target.isDeadOrDying()) this.setTarget(null); // DivineMC - Fix MC-183990
|
|
|
|
- profilerFiller.pop();
|
|
incrementTicksSinceLastInteraction(); // Purpur - Entity lifespan
|
|
}
|
|
|
|
@@ -550,8 +545,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
|
@Override
|
|
public void aiStep() {
|
|
super.aiStep();
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("looting");
|
|
if (this.level() instanceof ServerLevel serverLevel
|
|
&& this.canPickUpLoot()
|
|
&& this.isAlive()
|
|
@@ -574,8 +567,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
|
}
|
|
}
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
protected Vec3i getPickupReach() {
|
|
@@ -791,42 +782,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
|
return;
|
|
}
|
|
// Paper end - Allow nerfed mobs to jump and float
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("sensing");
|
|
this.sensing.tick();
|
|
- profilerFiller.pop();
|
|
int i = this.tickCount + this.getId();
|
|
if (i % 2 != 0 && this.tickCount > 1) {
|
|
- profilerFiller.push("targetSelector");
|
|
this.targetSelector.tickRunningGoals(false);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("goalSelector");
|
|
this.goalSelector.tickRunningGoals(false);
|
|
- profilerFiller.pop();
|
|
} else {
|
|
- profilerFiller.push("targetSelector");
|
|
this.targetSelector.tick();
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("goalSelector");
|
|
this.goalSelector.tick();
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
- profilerFiller.push("navigation");
|
|
this.navigation.tick();
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("mob tick");
|
|
this.customServerAiStep((ServerLevel)this.level());
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("controls");
|
|
- profilerFiller.push("move");
|
|
this.moveControl.tick();
|
|
- profilerFiller.popPush("look");
|
|
this.lookControl.tick();
|
|
- profilerFiller.popPush("jump");
|
|
this.jumpControl.tick();
|
|
- profilerFiller.pop();
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
|
index 859b859d29b637200cf7c9a0bd52d9f712413e3d..653c58c7637c46c8b46a5082f671324a2221d431 100644
|
|
--- a/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
|
+++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
|
@@ -6,8 +6,6 @@ import java.util.EnumSet;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.function.Predicate;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
|
|
public class GoalSelector {
|
|
private static final WrappedGoal NO_GOAL = new WrappedGoal(Integer.MAX_VALUE, new Goal() {
|
|
@@ -82,9 +80,6 @@ public class GoalSelector {
|
|
}
|
|
|
|
public void tick() {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("goalCleanup");
|
|
-
|
|
for (WrappedGoal wrappedGoal : this.availableGoals) {
|
|
if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper - Perf: optimize goal types by removing streams
|
|
wrappedGoal.stop();
|
|
@@ -92,8 +87,6 @@ public class GoalSelector {
|
|
}
|
|
|
|
this.lockedFlags.entrySet().removeIf(entry -> !entry.getValue().isRunning());
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("goalUpdate");
|
|
|
|
for (WrappedGoal wrappedGoalx : this.availableGoals) {
|
|
// Paper start
|
|
@@ -113,21 +106,15 @@ public class GoalSelector {
|
|
}
|
|
}
|
|
|
|
- profilerFiller.pop();
|
|
this.tickRunningGoals(true);
|
|
}
|
|
|
|
public void tickRunningGoals(boolean tickAllRunning) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("goalTick");
|
|
-
|
|
for (WrappedGoal wrappedGoal : this.availableGoals) {
|
|
if (wrappedGoal.isRunning() && (tickAllRunning || wrappedGoal.requiresUpdateEveryTick())) {
|
|
wrappedGoal.tick();
|
|
}
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
public Set<WrappedGoal> getAvailableGoals() {
|
|
diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
|
index 05943450baa0a04ac433c39fdbe80e7abd191363..17d2a937ab6f325295c0b5b9b0a681952d4bce85 100644
|
|
--- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
|
+++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
|
@@ -12,8 +12,6 @@ import net.minecraft.tags.BlockTags;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.debug.DebugSubscriptions;
|
|
import net.minecraft.util.debug.ServerDebugSubscribers;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.entity.Mob;
|
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
|
@@ -195,13 +193,10 @@ public abstract class PathNavigation {
|
|
}
|
|
}
|
|
// Paper end - EntityPathfindEvent
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("pathfind");
|
|
BlockPos blockPos = offsetUpward ? this.mob.blockPosition().above() : this.mob.blockPosition();
|
|
int i = (int)(followRange + regionOffset);
|
|
PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i));
|
|
Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, targets, followRange, reachRange, this.maxVisitedNodesMultiplier);
|
|
- profilerFiller.pop();
|
|
if (path != null && path.getTarget() != null) {
|
|
this.targetPos = path.getTarget();
|
|
this.reachRange = reachRange;
|
|
diff --git a/net/minecraft/world/entity/ai/sensing/Sensing.java b/net/minecraft/world/entity/ai/sensing/Sensing.java
|
|
index c569074403b1d8b443aaa98ba9cf9bbd0e98bd2d..b1aa7294f9479f45fcde77c5ea46db9f62370abf 100644
|
|
--- a/net/minecraft/world/entity/ai/sensing/Sensing.java
|
|
+++ b/net/minecraft/world/entity/ai/sensing/Sensing.java
|
|
@@ -2,8 +2,6 @@ package net.minecraft.world.entity.ai.sensing;
|
|
|
|
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.entity.Mob;
|
|
|
|
@@ -28,10 +26,7 @@ public class Sensing {
|
|
} else if (this.unseen.contains(id)) {
|
|
return false;
|
|
} else {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("hasLineOfSight");
|
|
boolean hasLineOfSight = this.mob.hasLineOfSight(entity);
|
|
- profilerFiller.pop();
|
|
if (hasLineOfSight) {
|
|
this.seen.add(id);
|
|
} else {
|
|
diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java
|
|
index e85f17f362548f13a414a41f711900add788b2f7..0506db902dab8c15e6460b5049d388f7af561628 100644
|
|
--- a/net/minecraft/world/entity/animal/HappyGhast.java
|
|
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
|
|
@@ -13,8 +13,6 @@ import net.minecraft.sounds.SoundEvents;
|
|
import net.minecraft.sounds.SoundSource;
|
|
import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.util.Mth;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
@@ -430,13 +428,8 @@ public class HappyGhast extends Animal {
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
if (this.isBaby()) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("happyGhastBrain");
|
|
((Brain<HappyGhast>)this.brain).tick(level, this);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("happyGhastActivityUpdate");
|
|
HappyGhastAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
this.checkRestriction();
|
|
diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java
|
|
index bbe59d6ab90f1b1274289ef20811f914afa55fd3..c8487029d5707d75b83aebc6fab7c65391f102f9 100644
|
|
--- a/net/minecraft/world/entity/animal/allay/Allay.java
|
|
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
|
|
@@ -24,8 +24,6 @@ import net.minecraft.tags.GameEventTags;
|
|
import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.tags.TagKey;
|
|
import net.minecraft.util.Mth;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
import net.minecraft.world.SimpleContainer;
|
|
@@ -269,14 +267,9 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("allayBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("allayActivityUpdate");
|
|
AllayAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
super.customServerAiStep(level);
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
|
index 1ad2b942b3e9ba25c75d41b4cd21a58d43002289..a1cc92829b75200d6a66b52ed6ecc58343e91102 100644
|
|
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
|
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
|
@@ -22,8 +22,6 @@ import net.minecraft.util.ByIdMap;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.StringRepresentable;
|
|
import net.minecraft.util.TimeUtil;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
@@ -162,13 +160,8 @@ public class Armadillo extends Animal {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("armadilloBrain");
|
|
((Brain<Armadillo>)this.brain).tick(level, this);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("armadilloActivityUpdate");
|
|
ArmadilloAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) {
|
|
this.forceDrops = true; // CraftBukkit
|
|
if (this.dropFromGiftLootTable(level, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) {
|
|
diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
|
index 3cc8ee115e889ced4457596b9c5fce438157e980..a952e78ac0c1fa7a2728fc3036b93e69e2fefb8d 100644
|
|
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
|
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
|
@@ -30,8 +30,6 @@ import net.minecraft.util.ByIdMap;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.StringRepresentable;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
@@ -374,14 +372,9 @@ public class Axolotl extends Animal implements Bucketable {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("axolotlBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("axolotlActivityUpdate");
|
|
AxolotlAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
if (!this.isNoAi()) {
|
|
Optional<Integer> memory = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS);
|
|
this.setPlayingDead(memory.isPresent() && memory.get() > 0);
|
|
diff --git a/net/minecraft/world/entity/animal/camel/Camel.java b/net/minecraft/world/entity/animal/camel/Camel.java
|
|
index cc71c575a8fb62c41198c6e1f27bd0e88380f5bc..efe34d1510d96f91821abb36ed2957b388dcd7bd 100644
|
|
--- a/net/minecraft/world/entity/animal/camel/Camel.java
|
|
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
|
|
@@ -17,8 +17,6 @@ import net.minecraft.tags.BlockTags;
|
|
import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.RandomSource;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
@@ -172,14 +170,9 @@ public class Camel extends AbstractHorse {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("camelBrain");
|
|
Brain<?> brain = this.getBrain();
|
|
((Brain<Camel>)brain).tick(level, this);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("camelActivityUpdate");
|
|
CamelAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
super.customServerAiStep(level);
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java b/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java
|
|
index 739deece6ae077b8fa1694eb6cc6ed9996dff09b..11b0b5fceeb503dbf5605fceddebfc9c08a629ab 100644
|
|
--- a/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java
|
|
+++ b/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java
|
|
@@ -14,8 +14,6 @@ import net.minecraft.sounds.SoundEvents;
|
|
import net.minecraft.sounds.SoundSource;
|
|
import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.util.RandomSource;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
@@ -245,14 +243,9 @@ public class CopperGolem extends AbstractGolem implements ContainerUser, Shearab
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("copperGolemBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("copperGolemActivityUpdate");
|
|
CopperGolemAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
super.customServerAiStep(level);
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java
|
|
index 78863bd593acaa46f33a49fadbd0cdb025074c11..7643e8d1b89a23354c27395509407c20e3d93b69 100644
|
|
--- a/net/minecraft/world/entity/animal/frog/Frog.java
|
|
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
|
|
@@ -27,8 +27,6 @@ import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.Unit;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.entity.AgeableMob;
|
|
@@ -260,14 +258,9 @@ public class Frog extends Animal {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("frogBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("frogActivityUpdate");
|
|
FrogAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
super.customServerAiStep(level);
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java
|
|
index 13b44b9560d46b351c4751aab189cc01c61d768d..37b1674c3f89d7ddba054b066df957f3337f4a89 100644
|
|
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
|
|
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
|
|
@@ -11,8 +11,6 @@ import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.sounds.SoundEvent;
|
|
import net.minecraft.sounds.SoundEvents;
|
|
import net.minecraft.tags.ItemTags;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
@@ -136,14 +134,9 @@ public class Tadpole extends AbstractFish {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("tadpoleBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("tadpoleActivityUpdate");
|
|
TadpoleAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
super.customServerAiStep(level);
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
|
|
index a226956bc47c5f6145c0dd4d3f957be43e60272b..674d3d69c797ef3ca5934466806831b2cbcbb93a 100644
|
|
--- a/net/minecraft/world/entity/animal/goat/Goat.java
|
|
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
|
|
@@ -19,8 +19,6 @@ import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.tags.TagKey;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.RandomSource;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
@@ -228,14 +226,9 @@ public class Goat extends Animal {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("goatBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
- profilerFiller.push("goatActivityUpdate");
|
|
GoatAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
super.customServerAiStep(level);
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
|
index 7ef3c94f63c8a25d09e69b818ecdf79795803570..6f08f08c53831dd5b68e06a4a6aee95204334a3b 100644
|
|
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
|
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
|
@@ -28,8 +28,6 @@ import net.minecraft.tags.BlockTags;
|
|
import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.util.ByIdMap;
|
|
import net.minecraft.util.Mth;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
@@ -497,13 +495,9 @@ public class Sniffer extends Animal {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("snifferBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.popPush("snifferActivityUpdate");
|
|
SnifferAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
super.customServerAiStep(level);
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/monster/Zoglin.java b/net/minecraft/world/entity/monster/Zoglin.java
|
|
index e2bf2bc45e4f8236ab47cf28c270dad748f80b50..2dac039f711d69295a749cd354128cdf8dfdc4c7 100644
|
|
--- a/net/minecraft/world/entity/monster/Zoglin.java
|
|
+++ b/net/minecraft/world/entity/monster/Zoglin.java
|
|
@@ -13,8 +13,6 @@ import net.minecraft.network.syncher.SynchedEntityData;
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.sounds.SoundEvent;
|
|
import net.minecraft.sounds.SoundEvents;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.util.valueproviders.UniformInt;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
@@ -289,11 +287,8 @@ public class Zoglin extends Monster implements HoglinBase {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("zoglinBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
this.updateActivity();
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/monster/breeze/Breeze.java b/net/minecraft/world/entity/monster/breeze/Breeze.java
|
|
index 405eb5f041bf3a611f8111fd58864ffec30ab0c0..9ef421dfbb2d8d26d4a01d130dcbf3a6708890e9 100644
|
|
--- a/net/minecraft/world/entity/monster/breeze/Breeze.java
|
|
+++ b/net/minecraft/world/entity/monster/breeze/Breeze.java
|
|
@@ -14,8 +14,6 @@ import net.minecraft.tags.EntityTypeTags;
|
|
import net.minecraft.util.debug.DebugBreezeInfo;
|
|
import net.minecraft.util.debug.DebugSubscriptions;
|
|
import net.minecraft.util.debug.DebugValueSource;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.entity.AnimationState;
|
|
import net.minecraft.world.entity.Entity;
|
|
@@ -234,13 +232,9 @@ public class Breeze extends Monster {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("breezeBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.popPush("breezeActivityUpdate");
|
|
BreezeAi.updateActivity(this);
|
|
- profilerFiller.pop();
|
|
super.customServerAiStep(level);
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/monster/creaking/Creaking.java b/net/minecraft/world/entity/monster/creaking/Creaking.java
|
|
index 6ab590b428e1a694b2538c53fabae9297b58b868..6ea2d7732eaf5eb99484834847f62858226c9879 100644
|
|
--- a/net/minecraft/world/entity/monster/creaking/Creaking.java
|
|
+++ b/net/minecraft/world/entity/monster/creaking/Creaking.java
|
|
@@ -15,8 +15,6 @@ import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.sounds.SoundEvent;
|
|
import net.minecraft.sounds.SoundEvents;
|
|
import net.minecraft.tags.DamageTypeTags;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.entity.AnimationState;
|
|
import net.minecraft.world.entity.Entity;
|
|
@@ -236,10 +234,7 @@ public class Creaking extends Monster {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("creakingBrain");
|
|
this.getBrain().tick((ServerLevel)this.level(), this);
|
|
- profilerFiller.pop();
|
|
CreakingAi.updateActivity(this);
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
|
index 72dc725b8cd6a2fca26aae376f91ab3e246a810b..1abc4d0de2ff983fc0c30bbc8a356d78f1c23897 100644
|
|
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
|
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
|
@@ -14,8 +14,6 @@ import net.minecraft.sounds.SoundEvents;
|
|
import net.minecraft.sounds.SoundSource;
|
|
import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.util.RandomSource;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
@@ -208,11 +206,8 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("hoglinBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
HoglinAi.updateActivity(this);
|
|
if (this.isConverting()) {
|
|
this.timeInOverworld++;
|
|
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
|
|
index 9a1f1b8ff394e4849301508dd82669246eeba2de..b21ca373220f80c81cadab1eda482057d6366caf 100644
|
|
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
|
|
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
|
|
@@ -16,8 +16,6 @@ import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.tags.TagKey;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.VisibleForDebug;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
@@ -352,11 +350,8 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("piglinBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
PiglinAi.updateActivity(this);
|
|
super.customServerAiStep(level);
|
|
}
|
|
diff --git a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
|
|
index ebe1b4e0b841906684561151919a5b3f6e206b60..0f1ed8ec352653089106ed8a143ab4ae3f82c3fe 100644
|
|
--- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
|
|
+++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
|
|
@@ -8,8 +8,6 @@ import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.sounds.SoundEvent;
|
|
import net.minecraft.sounds.SoundEvents;
|
|
import net.minecraft.util.RandomSource;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.entity.EntitySpawnReason;
|
|
@@ -154,11 +152,8 @@ public class PiglinBrute extends AbstractPiglin {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("piglinBruteBrain");
|
|
if (getRider() == null || this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
PiglinBruteAi.updateActivity(this);
|
|
PiglinBruteAi.maybePlayActivitySound(this);
|
|
super.customServerAiStep(level);
|
|
diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java
|
|
index dede88234fd2b0f55863021446c4c9273f3a14d8..87976d8981f72732899c57a96971e851b86d5123 100644
|
|
--- a/net/minecraft/world/entity/monster/warden/Warden.java
|
|
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
|
|
@@ -26,8 +26,6 @@ import net.minecraft.tags.TagKey;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.Unit;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.effect.MobEffectInstance;
|
|
@@ -303,11 +301,8 @@ public class Warden extends Monster implements VibrationSystem {
|
|
|
|
@Override
|
|
protected void customServerAiStep(ServerLevel level) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("wardenBrain");
|
|
if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
|
|
this.getBrain().tick(level, this);
|
|
- profilerFiller.pop();
|
|
super.customServerAiStep(level);
|
|
if ((this.tickCount + this.getId()) % 120 == 0) {
|
|
applyDarknessAround(level, this.position(), this, 20);
|
|
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
|
|
index bfff91e5e252141f887d8965ecf1dd9ff1cebfe3..d99a6ade82bbd01e25137fecfbec5dcef6765e79 100644
|
|
--- a/net/minecraft/world/entity/npc/Villager.java
|
|
+++ b/net/minecraft/world/entity/npc/Villager.java
|
|
@@ -35,8 +35,6 @@ import net.minecraft.stats.Stats;
|
|
import net.minecraft.tags.ItemTags;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.SpawnUtil;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.Difficulty;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.InteractionHand;
|
|
@@ -394,8 +392,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
|
}
|
|
protected void customServerAiStep(ServerLevel level, boolean inactive) { // Purpur - Lobotomize stuck villagers - not final
|
|
// Paper end - EAR 2
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("villagerBrain");
|
|
// Purpur start - Lobotomize stuck villagers
|
|
if (this.level().purpurConfig.villagerLobotomizeEnabled) {
|
|
// treat as inactive if lobotomized
|
|
@@ -408,7 +404,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
|
}
|
|
else if (this.isLobotomized && shouldRestock()) restock();
|
|
// Purpur end - Lobotomize stuck villagers
|
|
- profilerFiller.pop();
|
|
if (this.assignProfessionWhenSpawned) {
|
|
this.assignProfessionWhenSpawned = false;
|
|
}
|
|
diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java
|
|
index 07d7c4737635f671f33b8f73001d67928fc75782..f2c82217811712625df594667330a73f8f44e261 100644
|
|
--- a/net/minecraft/world/item/crafting/RecipeManager.java
|
|
+++ b/net/minecraft/world/item/crafting/RecipeManager.java
|
|
@@ -28,7 +28,6 @@ import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.server.packs.resources.ResourceManager;
|
|
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
|
|
import net.minecraft.server.packs.resources.SimplePreparableReloadListener;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.flag.FeatureFlagSet;
|
|
import net.minecraft.world.item.crafting.display.RecipeDisplay;
|
|
import net.minecraft.world.item.crafting.display.RecipeDisplayEntry;
|
|
@@ -67,7 +66,7 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
|
|
}
|
|
|
|
@Override
|
|
- protected RecipeMap prepare(ResourceManager resourceManager, ProfilerFiller profiler) {
|
|
+ protected RecipeMap prepare(ResourceManager resourceManager) {
|
|
SortedMap<ResourceLocation, Recipe<?>> map = new TreeMap<>();
|
|
SimpleJsonResourceReloadListener.scanDirectory(
|
|
resourceManager, RECIPE_LISTER, this.registries.createSerializationContext(JsonOps.INSTANCE), Recipe.CODEC, map
|
|
@@ -82,7 +81,7 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
|
|
}
|
|
|
|
@Override
|
|
- protected void apply(RecipeMap object, ResourceManager resourceManager, ProfilerFiller profiler) {
|
|
+ protected void apply(RecipeMap object, ResourceManager resourceManager) {
|
|
this.recipes = object;
|
|
LOGGER.info("Loaded {} recipes", object.values().size());
|
|
}
|
|
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
|
index be10e785bedb3193b1270ae2908824b2af005809..d8b6f1b853609a7fcbd9c2fe6485e5080dece43a 100644
|
|
--- a/net/minecraft/world/level/Level.java
|
|
+++ b/net/minecraft/world/level/Level.java
|
|
@@ -36,7 +36,6 @@ import net.minecraft.util.AbortableIterationConsumer;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.StringRepresentable;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
import net.minecraft.util.random.WeightedList;
|
|
import net.minecraft.world.DifficultyInstance;
|
|
import net.minecraft.world.TickRateManager;
|
|
@@ -260,7 +259,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
|
|
|
@Override
|
|
public final <T extends Entity> List<T> getEntitiesOfClass(final Class<T> entityClass, final AABB boundingBox, final Predicate<? super T> predicate) {
|
|
- Profiler.get().incrementCounter("getEntities");
|
|
final List<T> ret = new java.util.ArrayList<>();
|
|
|
|
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate);
|
|
@@ -270,7 +268,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
|
|
|
@Override
|
|
public final List<Entity> moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate<? super Entity> predicate) {
|
|
- Profiler.get().incrementCounter("getEntities");
|
|
final List<Entity> ret = new java.util.ArrayList<>();
|
|
|
|
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate);
|
|
@@ -1736,7 +1733,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
|
|
|
@Override
|
|
public List<Entity> getEntities(@Nullable Entity entity, AABB boundingBox, Predicate<? super Entity> predicate) {
|
|
- Profiler.get().incrementCounter("getEntities");
|
|
List<Entity> list = Lists.newArrayList();
|
|
|
|
// Paper start - rewrite chunk system
|
|
@@ -1765,8 +1761,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
|
public <T extends Entity> void getEntities(final EntityTypeTest<Entity, T> entityTypeTest,
|
|
final AABB boundingBox, final Predicate<? super T> predicate,
|
|
final List<? super T> into, final int maxCount) {
|
|
- Profiler.get().incrementCounter("getEntities");
|
|
-
|
|
if (entityTypeTest instanceof net.minecraft.world.entity.EntityType<T> byType) {
|
|
if (maxCount != Integer.MAX_VALUE) {
|
|
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(byType, boundingBox, into, predicate, maxCount);
|
|
@@ -1851,7 +1845,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
|
// Paper end - rewrite chunk system
|
|
|
|
public <T extends Entity> boolean hasEntities(EntityTypeTest<Entity, T> entityTypeTest, AABB bounds, Predicate<? super T> predicate) {
|
|
- Profiler.get().incrementCounter("hasEntities");
|
|
MutableBoolean mutableBoolean = new MutableBoolean();
|
|
this.getEntities().get(entityTypeTest, bounds, value -> {
|
|
if (predicate.test(value)) {
|
|
diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java
|
|
index 4c3fa61566ecabf8eccea32f10aabfa7c961e4c5..1b62bc5836fbf0ddc37d8f979b4e7aa628c4b00e 100644
|
|
--- a/net/minecraft/world/level/NaturalSpawner.java
|
|
+++ b/net/minecraft/world/level/NaturalSpawner.java
|
|
@@ -24,8 +24,6 @@ import net.minecraft.tags.BlockTags;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.util.VisibleForDebug;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.util.random.WeightedList;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.entity.EntitySpawnReason;
|
|
@@ -154,9 +152,6 @@ public final class NaturalSpawner {
|
|
}
|
|
|
|
public static void spawnForChunk(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, List<MobCategory> categories) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("spawner");
|
|
-
|
|
for (MobCategory mobCategory : categories) {
|
|
// Paper start - Optional per player mob spawns
|
|
final boolean canSpawn;
|
|
@@ -191,8 +186,6 @@ public final class NaturalSpawner {
|
|
// Paper end - Optional per player mob spawns
|
|
}
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
// Paper start - Add mobcaps commands
|
|
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
|
|
index c0c87b7c8e0b6b941fe8a63dc361504e94459d86..3c4de8b43a5658e02ddce7db9f453bfd344703e3 100644
|
|
--- a/net/minecraft/world/level/ServerExplosion.java
|
|
+++ b/net/minecraft/world/level/ServerExplosion.java
|
|
@@ -14,8 +14,6 @@ import net.minecraft.core.BlockPos;
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.tags.EntityTypeTags;
|
|
import net.minecraft.util.Mth;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.entity.EntityType;
|
|
@@ -657,10 +655,7 @@ public class ServerExplosion implements Explosion {
|
|
List<BlockPos> list = this.calculateExplodedPositions();
|
|
this.hurtEntities();
|
|
if (this.interactsWithBlocks()) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("explosion_blocks");
|
|
this.interactWithBlocks(list);
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
if (this.fire) {
|
|
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
|
|
index a403b61e0300ecfff55f10009ecd3ad57f543808..606c33d67fc7612b25ca23fe34769d3b179ebbd6 100644
|
|
--- a/net/minecraft/world/level/chunk/LevelChunk.java
|
|
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
|
|
@@ -28,8 +28,6 @@ import net.minecraft.util.ProblemReporter;
|
|
import net.minecraft.util.debug.DebugStructureInfo;
|
|
import net.minecraft.util.debug.DebugSubscriptions;
|
|
import net.minecraft.util.debug.DebugValueSource;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.level.ChunkPos;
|
|
import net.minecraft.world.level.Level;
|
|
@@ -399,12 +397,8 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot
|
|
}
|
|
|
|
if (LightEngine.hasDifferentLightProperties(blockState, state)) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("updateSkyLightSources");
|
|
// Paper - rewrite chunk system
|
|
- profilerFiller.popPush("queueCheckLight");
|
|
this.level.getChunkSource().getLightEngine().checkBlock(pos);
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
boolean flag = !blockState.is(block);
|
|
@@ -965,8 +959,6 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot
|
|
BlockPos blockPos = this.blockEntity.getBlockPos();
|
|
if (LevelChunk.this.isTicking(blockPos)) {
|
|
try {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push(this::getType);
|
|
BlockState blockState = LevelChunk.this.getBlockState(blockPos);
|
|
if (this.blockEntity.getType().isValid(blockState)) {
|
|
this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity);
|
|
@@ -980,8 +972,6 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot
|
|
}
|
|
// Paper end - Remove the Block Entity if it's invalid
|
|
}
|
|
-
|
|
- profilerFiller.pop();
|
|
} catch (Throwable var5) {
|
|
// Paper start - Prevent block entity and entity crashes
|
|
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
|
diff --git a/net/minecraft/world/level/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java
|
|
index 5894260481ea395c26a5b506e38530f7b2032b33..477446a1bf38efb1e5b5b4513dd85808a5cd8cdb 100644
|
|
--- a/net/minecraft/world/level/pathfinder/PathFinder.java
|
|
+++ b/net/minecraft/world/level/pathfinder/PathFinder.java
|
|
@@ -13,9 +13,6 @@ import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import javax.annotation.Nullable;
|
|
import net.minecraft.core.BlockPos;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
-import net.minecraft.util.profiling.metrics.MetricCategory;
|
|
import net.minecraft.world.entity.Mob;
|
|
import net.minecraft.world.level.PathNavigationRegion;
|
|
|
|
@@ -62,9 +59,6 @@ public class PathFinder {
|
|
|
|
@Nullable
|
|
private Path findPath(Node node, List<Map.Entry<Target, BlockPos>> positions, float maxRange, int reachRange, float maxVisitedNodesMultiplier) { // Paper - optimize collection
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("find_path");
|
|
- profilerFiller.markForCharting(MetricCategory.PATH_FINDING);
|
|
// Set<Target> set = targetPositions.keySet(); // Paper - unused
|
|
node.g = 0.0F;
|
|
node.h = this.getBestH(node, positions); // Paper - optimize collection
|
|
@@ -139,7 +133,6 @@ public class PathFinder {
|
|
best = path;
|
|
}
|
|
}
|
|
- profilerFiller.pop();
|
|
if(asBoolean && best != null) {
|
|
Set<Target> set = Sets.newHashSet();
|
|
for(Map.Entry<Target, BlockPos> entry : positions) {
|
|
diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java
|
|
index 7ea0273018b1a364a5e2b7bf57da840383c8ffa5..c7f9485191dc797de78e6524c5c2c737581ed838 100644
|
|
--- a/net/minecraft/world/ticks/LevelTicks.java
|
|
+++ b/net/minecraft/world/ticks/LevelTicks.java
|
|
@@ -23,8 +23,6 @@ import net.minecraft.Util;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.core.SectionPos;
|
|
import net.minecraft.core.Vec3i;
|
|
-import net.minecraft.util.profiling.Profiler;
|
|
-import net.minecraft.util.profiling.ProfilerFiller;
|
|
import net.minecraft.world.level.ChunkPos;
|
|
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
|
|
|
@@ -80,20 +78,13 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
|
|
}
|
|
|
|
public void tick(long gameTime, int maxAllowedTicks, BiConsumer<BlockPos, T> ticker) {
|
|
- ProfilerFiller profilerFiller = Profiler.get();
|
|
- profilerFiller.push("collect");
|
|
- this.collectTicks(gameTime, maxAllowedTicks, profilerFiller);
|
|
- profilerFiller.popPush("run");
|
|
- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size());
|
|
+ this.collectTicks(gameTime, maxAllowedTicks);
|
|
this.runCollectedTicks(ticker);
|
|
- profilerFiller.popPush("cleanup");
|
|
this.cleanupAfterTick();
|
|
- profilerFiller.pop();
|
|
}
|
|
|
|
- private void collectTicks(long gameTime, int maxAllowedTicks, ProfilerFiller profiler) {
|
|
+ private void collectTicks(long gameTime, int maxAllowedTicks) {
|
|
this.sortContainersToTick(gameTime);
|
|
- profiler.incrementCounter("containersToTick", this.containersToTick.size());
|
|
this.drainContainers(gameTime, maxAllowedTicks);
|
|
this.rescheduleLeftoverContainers();
|
|
}
|