9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/patches/server/0031-Config-to-disable-method-profiler.patch
2023-03-19 17:30:46 +08:00

56 lines
2.7 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 4296153b171c827aadd0a3b70f1f13b8ba41cc65..3dc75d267340fdda50668ec0cc7270867dd96117 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2276,6 +2276,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public ProfilerFiller getProfiler() {
+ // Leaves start - disable method profiler
+ if (top.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 844ebd772c1c0b9856069356e451084a1b771324..847d1cb27da0ee06f208acec93ee6758ae04d6f9 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1549,6 +1549,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
public ProfilerFiller getProfiler() {
+ // Leaves start - disable method profiler
+ if (top.leavesmc.leaves.LeavesConfig.disableMethodProfiler) {
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
+ }
+ // Leaves end - disable method profiler
return (ProfilerFiller) this.profiler.get();
}
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index ba58171708fd3362fe76af608d657e94fd2b3c01..ff9b8b801d923e0402456987c5d71a46080982fa 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -304,6 +304,11 @@ public final class LeavesConfig {
useMoreThreadUnsafeRandom = getBoolean("settings.performance.use-more-thread-unsafe-random", useMoreThreadUnsafeRandom);
}
+ public static boolean disableMethodProfiler = true;
+ private static void disableMethodProfiler() {
+ disableMethodProfiler = getBoolean("settings.misc.disable-method-profiler", disableMethodProfiler);
+ }
+
public static final class WorldConfig {
public final String worldName;