diff --git a/patches/server/0109-Server-thread-priority-environment-variable.patch b/patches/server/0109-Server-thread-priority-environment-variable.patch new file mode 100644 index 0000000..81e9fdb --- /dev/null +++ b/patches/server/0109-Server-thread-priority-environment-variable.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 22 Dec 2022 15:47:39 +0100 +Subject: [PATCH] Server thread priority environment variable + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 609d57dd7373531d35295152e543261e3b0fbe09..d3210128894a8e70919972e60c62bf34338e5fa2 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -195,6 +195,8 @@ import co.aikar.timings.MinecraftTimings; // Paper + + public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements CommandSource, AutoCloseable { + ++ public static final int SERVER_THREAD_PRIORITY = Integer.getInteger("gale.thread.priority.server", 8); // Gale - server thread priority environment variable ++ + private static MinecraftServer SERVER; // Paper + public static final Logger LOGGER = LogUtils.getLogger(); + public static final String VANILLA_BRAND = "vanilla"; +@@ -326,7 +328,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements CommandSource, AutoCloseable { +public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop implements CommandSource, AutoCloseable { // Gale - base thread pools + public static final int SERVER_THREAD_PRIORITY = Integer.getInteger("gale.thread.priority.server", 8); // Gale - server thread priority environment variable + - private static MinecraftServer SERVER; // Paper + // Gale start - base thread pools + public static MinecraftServer SERVER; // Paper // Gale - base thread pools - private -> public @@ -541,7 +543,7 @@ index 609d57dd7373531d35295152e543261e3b0fbe09..ea3516cbc28fac0620bcb71d3872c50d public static final Logger LOGGER = LogUtils.getLogger(); public static final String VANILLA_BRAND = "vanilla"; private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F; -@@ -233,6 +247,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop registries; private Map, ServerLevel> levels; @@ -552,7 +554,7 @@ index 609d57dd7373531d35295152e543261e3b0fbe09..ea3516cbc28fac0620bcb71d3872c50d private PlayerList playerList; private volatile boolean running; private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart -@@ -262,10 +280,115 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; public Commands vanillaCommandDispatcher; @@ -681,7 +683,7 @@ index 609d57dd7373531d35295152e543261e3b0fbe09..ea3516cbc28fac0620bcb71d3872c50d // CraftBukkit end // Spigot start public static final int TPS = 20; -@@ -310,9 +433,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -@@ -347,7 +473,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop holdergetter = this.registries.compositeAccess().registryOrThrow(Registries.BLOCK).asLookup().filterFeatures(this.worldData.enabledFeatures()); this.structureTemplateManager = new StructureTemplateManager(worldstem.resourceManager(), convertable_conversionsession, datafixer, holdergetter); @@ -729,7 +731,7 @@ index 609d57dd7373531d35295152e543261e3b0fbe09..ea3516cbc28fac0620bcb71d3872c50d this.executor = Util.backgroundExecutor(); } // CraftBukkit start -@@ -613,7 +742,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop optional = Optional.of(this.getFile("server-icon.png")).filter(File::isFile); -@@ -1406,14 +1535,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= 5000000000L) { this.lastServerStatus = i; -@@ -1449,7 +1583,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0) { this.playerList.saveAll(playerSaveInterval); } @@ -1077,7 +1079,7 @@ index 609d57dd7373531d35295152e543261e3b0fbe09..ea3516cbc28fac0620bcb71d3872c50d if (level.paperConfig().chunks.autoSaveInterval.value() > 0) { level.saveIncrementally(fullSave); } -@@ -1462,7 +1596,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper -@@ -1616,7 +1748,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, ServerLevel> newLevels = Maps.newLinkedHashMap(oldLevels); newLevels.put(level.dimension(), level); this.levels = Collections.unmodifiableMap(newLevels); @@ -1143,7 +1145,7 @@ index 609d57dd7373531d35295152e543261e3b0fbe09..ea3516cbc28fac0620bcb71d3872c50d } public void removeLevel(ServerLevel level) { -@@ -1645,6 +1789,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, ServerLevel> newLevels = Maps.newLinkedHashMap(oldLevels); newLevels.remove(level.dimension()); this.levels = Collections.unmodifiableMap(newLevels); @@ -1158,7 +1160,7 @@ index 609d57dd7373531d35295152e543261e3b0fbe09..ea3516cbc28fac0620bcb71d3872c50d } // CraftBukkit end -@@ -1652,8 +1804,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop