9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/patches/server/0023-Config-to-disable-method-profiler.patch
2024-09-23 02:51:56 +08:00

40 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Mon, 15 Aug 2022 10:18:36 +0800
Subject: [PATCH] Config to disable method profiler
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cb863f07d00e96b92e73dc312606110c259b4d5c..4c8cf72e44e991920ed6a6110d811530c77adbbe 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2557,6 +2557,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public ProfilerFiller getProfiler() {
+ // Leaves start - disable method profiler
+ if (org.leavesmc.leaves.LeavesConfig.disableMethodProfiler) {
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
+ }
+ // Leaves end - disable method profiler
return this.profiler;
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 33a5137b1057fe6203e10f9e7e0cb7c4251466e9..e935903d918f12e5e1617ebf2d74399b9cd4f79c 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1937,6 +1937,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
}
public ProfilerFiller getProfiler() {
+ // Leaves start - disable method profiler
+ if (org.leavesmc.leaves.LeavesConfig.disableMethodProfiler) {
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
+ }
+ // Leaves end - disable method profiler
return (ProfilerFiller) this.profiler.get();
}