9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-22 08:29:22 +00:00
Files
LeavesMC/patches/server/0031-Config-to-disable-method-profiler.patch
2023-06-10 12:47:52 +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 badc618da91f554d11331e43524ac9ce59267175..100ea32bc60e5c052007bb75b35eba16564eadff 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2265,6 +2265,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 11d362ce8043966a7fce6c64849b7c080133fcbd..71836aa0e2f5d397c0b02c9662d1b11454c0388b 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1474,6 +1474,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 b41c9504a1c09c239b8e8a12efe6e63f9dfc591f..ceb2432d4271beb82f260e52b54d5661f992927c 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -311,6 +311,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;