9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-19 14:59:29 +00:00
Files
Gale/patches/server/0019-Config-to-disable-vanilla-profiler.patch
2022-11-25 18:43:23 +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 121495135676a7de4d1e6b06cb6c77e5523a2b0d..134c8b2acfaa2a8d7cd9a26a85ee4d0227f1a2cd 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 76a6e5d1230e2f68f7ff9c0e3f54762050f24f03..3e4f2b6a5c269df2bb64f879dd75731c2af227e7 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 af4883f8939d017866a9b057491a8400b11fe009..5bf0c4d9cf136cd19d87ee04a834413240eec339 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
+
}
}