Yatopia/patches/Airplane/patches/server/0029-Config-to-disable-meth...

61 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paul Sauve <paul@technove.co>
Date: Mon, 26 Apr 2021 11:34:29 -0500
Subject: [PATCH] Config to disable method profiler
diff --git a/src/main/java/gg/airplane/AirplaneConfig.java b/src/main/java/gg/airplane/AirplaneConfig.java
index a673eaad4cd80287e8a357f8c45b2add156ff0b9..6fc23a85ddd66a69b83684cdb602b6a312e9d72b 100644
--- a/src/main/java/gg/airplane/AirplaneConfig.java
+++ b/src/main/java/gg/airplane/AirplaneConfig.java
@@ -112,4 +112,13 @@ public class AirplaneConfig {
}
+ public static boolean disableMethodProfiler;
+
+ private static void miscSettings() {
+ config.setComment("misc", "Settings for things that don't belong elsewhere");
+
+ disableMethodProfiler = config.getBoolean("misc.disable-method-profiler", true);
+ }
+
+
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6f90a4182e008b49a4b3328e569311382e4bec0d..1472bbdac9b545c97368df03672b975abf2dbcb4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2200,7 +2200,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
}
+ // Airplane start
+ private final GameProfilerFiller disabledProfiler = net.minecraft.util.profiling.GameProfilerDisabled.a;
public GameProfilerFiller getMethodProfiler() {
+ if (gg.airplane.AirplaneConfig.disableMethodProfiler) return disabledProfiler;
+ // Airplane end
return this.methodProfiler;
}
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 334281d4cbdb2d82ca93e862498af961d9abfd31..d1591f8d0b45126acef5d24ddb41d76293f5b42d 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -18,6 +18,7 @@ import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;
import javax.annotation.Nullable;
+
import net.minecraft.CrashReport;
import net.minecraft.CrashReportSystemDetails;
import net.minecraft.ReportedException;
@@ -1813,6 +1814,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
public GameProfilerFiller getMethodProfiler() {
+ if (gg.airplane.AirplaneConfig.disableMethodProfiler) return net.minecraft.util.profiling.GameProfilerDisabled.a; // Airplane
return (GameProfilerFiller) this.methodProfiler.get();
}