9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-22 16:29:26 +00:00
Files
Gale/patches/server/0018-Config-to-disable-vanilla-profiler.patch
2022-11-24 21:54:02 +01:00

93 lines
4.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MartijnMuijsers <martijnmuijsers@live.nl>
Date: Wed, 23 Nov 2022 21:45:42 +0100
Subject: [PATCH] Config to disable vanilla profiler
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
This patch is based on the following patch:
"Config to disable method profiler"
By: Paul Sauve <paul@technove.co>
As part of: Airplane (https://github.com/TECHNOVE/Airplane)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
* Airplane copyright *
Airplane
Copyright (C) 2020 Technove LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index afd22d4446b29e83fea9c84b97ef96798d7e6895..da83060f671bee830ea65fe4e4303d22c1c5fa99 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -149,6 +149,7 @@ import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3;
import org.apache.commons.lang3.Validate;
import org.galemc.gale.configuration.GaleConfigurations;
+import org.galemc.gale.configuration.GaleGlobalConfiguration;
import org.slf4j.Logger;
// CraftBukkit start
@@ -2230,6 +2231,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public ProfilerFiller getProfiler() {
+ // Gale start - Airplane - config to disable vanilla profiler
+ if (GaleGlobalConfiguration.get().smallOptimizations.disableVanillaProfiler) {
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
+ }
+ // Gale end - Airplane - config to disable vanilla 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 7c782e642b7489981d55012d16d9107ae6a0be03..4c38c9d6eef8186bd4b1725520047cd7ee78ce28 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -92,6 +92,7 @@ import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.util.CraftSpawnCategory;
import org.bukkit.entity.SpawnCategory;
import org.bukkit.event.block.BlockPhysicsEvent;
+import org.galemc.gale.configuration.GaleGlobalConfiguration;
import org.galemc.gale.configuration.GaleWorldConfiguration;
// CraftBukkit end
@@ -1474,6 +1475,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
public ProfilerFiller getProfiler() {
+ // Gale start - Airplane - config to disable vanilla profiler
+ if (GaleGlobalConfiguration.get().smallOptimizations.disableVanillaProfiler) {
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
+ }
+ // Gale end - Airplane - config to disable vanilla profiler
return (ProfilerFiller) this.profiler.get();
}
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index 1ed2275e3e630c1f0dfa29676a239a4af8264332..5bb57e160b446d96147fe1f8b2cfa8e26eb8e651 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -41,6 +41,8 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
}
+ public boolean disableVanillaProfiler = true; // Gale - Airplane - config to disable vanilla profiler
+
}
}