9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-24 01:19:19 +00:00
Files
LeavesMC/patches/server/0032-Config-to-disable-method-profiler.patch
violetc 5c776b8a25 Update 1.19.2
fixed some bake bug left by 1.18.1
2022-09-13 17:26:43 +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 440ed7cce7ce8cc99e8d39ac36fed0c9f8f8948e..249bd5e4d74e384a43b8278b737c7326377b0205 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2258,6 +2258,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 32ad2282a78f913c16a94ed06a81b3bdf6de0760..c656e6dcdaff59ff5131690b5a719b26e69f7d13 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1484,6 +1484,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 7935bb83c360fb8d194c57e6f0b5a989a60f24db..4196fc65d8f11a3f9be3f67d0d227e0b95a8ec18 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -295,6 +295,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;