diff --git a/leaf-archived-patches/unapplied/server/gale-patches/features/0001-Leaf-Commands.patch b/leaf-archived-patches/unapplied/server/gale-patches/features/0001-Leaf-Commands.patch deleted file mode 100644 index 7a96a92b..00000000 --- a/leaf-archived-patches/unapplied/server/gale-patches/features/0001-Leaf-Commands.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> -Date: Mon, 4 Nov 2024 23:07:27 -0500 -Subject: [PATCH] Leaf Commands - - -diff --git a/src/main/java/org/galemc/gale/command/GaleCommand.java b/src/main/java/org/galemc/gale/command/GaleCommand.java -index c2000206777f62592a4950d7ba96a14d15717126..a077869e1385695ac99e6ddb74aba5f4e215df08 100644 ---- a/src/main/java/org/galemc/gale/command/GaleCommand.java -+++ b/src/main/java/org/galemc/gale/command/GaleCommand.java -@@ -37,7 +37,7 @@ import static net.kyori.adventure.text.format.NamedTextColor.RED; - public final class GaleCommand extends Command { - public static final String COMMAND_LABEL = "gale"; - public static final String BASE_PERM = GaleCommands.COMMAND_BASE_PERM + "." + COMMAND_LABEL; -- private static final Permission basePermission = new Permission(BASE_PERM, PermissionDefault.TRUE); -+ private static final Permission basePermission = new Permission(BASE_PERM, PermissionDefault.OP); // Leaf - Leaf commands - // subcommand label -> subcommand - private static final GaleSubcommand RELOAD_SUBCOMMAND = new ReloadCommand(); - private static final GaleSubcommand VERSION_SUBCOMMAND = new VersionCommand(); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0002-Gale-configuration.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0002-Gale-configuration.patch new file mode 100644 index 00000000..57b0b077 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0002-Gale-configuration.patch @@ -0,0 +1,141 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 21:05:47 +0100 +Subject: [PATCH] Gale configuration + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Paper config files" +By: Jake Potrebic +As part of: Paper (https://github.com/PaperMC/Paper) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java +index 107aa863bd4448628b013d0ccd49b6a956aeffef..d7916d4d4cec9ac376c8b7b4c3432fddd55a1940 100644 +--- a/net/minecraft/server/MinecraftServer.java ++++ b/net/minecraft/server/MinecraftServer.java +@@ -300,6 +300,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping + public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation +@@ -471,6 +472,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop public + + // Paper start - add paper configuration files + public Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache) { +- this(sessionService, servicesKeySet, profileRepository, profileCache, null); ++ this(sessionService, servicesKeySet, profileRepository, profileCache, null, null); // Gale - Gale configuration + } + + @Override +@@ -25,6 +25,12 @@ public record Services( + return java.util.Objects.requireNonNull(this.paperConfigurations); + } + // Paper end - add paper configuration files ++ // Gale start - Gale configuration ++ @Override ++ public org.galemc.gale.configuration.GaleConfigurations galeConfigurations() { ++ return java.util.Objects.requireNonNull(this.galeConfigurations); ++ } ++ // Gale end - Gale configuration + + public static Services create(YggdrasilAuthenticationService authenticationService, File profileRepository, File userCacheFile, joptsimple.OptionSet optionSet) throws Exception { // Paper - add optionset to load paper config files; add userCacheFile parameter + MinecraftSessionService minecraftSessionService = authenticationService.createMinecraftSessionService(); +@@ -34,7 +40,10 @@ public record Services( + final java.nio.file.Path legacyConfigPath = ((File) optionSet.valueOf("paper-settings")).toPath(); + final java.nio.file.Path configDirPath = ((File) optionSet.valueOf("paper-settings-directory")).toPath(); + io.papermc.paper.configuration.PaperConfigurations paperConfigurations = io.papermc.paper.configuration.PaperConfigurations.setup(legacyConfigPath, configDirPath, profileRepository.toPath(), (File) optionSet.valueOf("spigot-settings")); +- return new Services(minecraftSessionService, authenticationService.getServicesKeySet(), gameProfileRepository, gameProfileCache, paperConfigurations); ++ // Gale start - Gale configuration ++ org.galemc.gale.configuration.GaleConfigurations galeConfigurations = org.galemc.gale.configuration.GaleConfigurations.setup(configDirPath); ++ return new Services(minecraftSessionService, authenticationService.getServicesKeySet(), gameProfileRepository, gameProfileCache, paperConfigurations, galeConfigurations); ++ // Gale end - Gale configuration + // Paper end - load paper config files from cli options + } + +diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java +index 97a294d2f5c1ddf0af7ffec3e1425eb329c5751b..0655b169a1cb418aacc5761680d84a8bd9aed3c9 100644 +--- a/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/net/minecraft/server/dedicated/DedicatedServer.java +@@ -212,6 +212,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); + this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); + // Paper end - initialize global and world-defaults configuration ++ // Gale start - Gale configuration ++ galeConfigurations.initializeGlobalConfiguration(this.registryAccess()); ++ galeConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); ++ // Gale end - Gale configuration + this.server.spark.enableEarlyIfRequested(); // Paper - spark + // Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save + if (this.convertOldUsers()) { +diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java +index ebeeb63c3dca505a3ce8b88feaa5d2ca20ec24a2..13db4411e5bd635315b27b92a3e97bf286d14577 100644 +--- a/net/minecraft/server/level/ServerLevel.java ++++ b/net/minecraft/server/level/ServerLevel.java +@@ -588,7 +588,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + org.bukkit.generator.BiomeProvider biomeProvider // CraftBukkit + ) { + // CraftBukkit start +- super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), dispatcher); // Paper - create paper world configs; Async-Anti-Xray: Pass executor ++ super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), spigotConfig -> server.galeConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), dispatcher); // Paper - create paper world configs; Async-Anti-Xray: Pass executor // Gale - Gale configuration + this.pvpMode = server.isPvpAllowed(); + this.levelStorageAccess = levelStorageAccess; + this.uuid = org.bukkit.craftbukkit.util.WorldUUID.getUUID(levelStorageAccess.levelDirectory.path().toFile()); +diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java +index 2bbebb4335d927f240abcac67a5b423e38dc33d7..b9c930210f750aa9594d3acae584a8d11983a210 100644 +--- a/net/minecraft/world/level/Level.java ++++ b/net/minecraft/world/level/Level.java +@@ -168,6 +168,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + return this.paperConfig; + } + // Paper end - add paper world config ++ // Gale start - Gale configuration ++ private final org.galemc.gale.configuration.GaleWorldConfiguration galeConfig; ++ public org.galemc.gale.configuration.GaleWorldConfiguration galeConfig() { ++ return this.galeConfig; ++ } ++ // Gale end - Gale configuration + + public final io.papermc.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + public static BlockPos lastPhysicsProblem; // Spigot +@@ -840,6 +846,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + org.bukkit.World.Environment env, // CraftBukkit + java.util.function.Function paperWorldConfigCreator, // Paper - create paper world config ++ java.util.function.Function galeWorldConfigCreator, // Gale - Gale configuration + java.util.concurrent.Executor executor // Paper - Anti-Xray + ) { + // Paper start - getblock optimisations - cache world height/sections +@@ -853,6 +861,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + // Paper end - getblock optimisations - cache world height/sections + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot + this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config ++ this.galeConfig = galeWorldConfigCreator.apply(this.spigotConfig); // Gale - Gale configuration + this.generator = gen; + this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0003-Gale-commands.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0003-Gale-commands.patch new file mode 100644 index 00000000..4a008711 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0003-Gale-commands.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 26 Nov 2022 10:47:56 +0100 +Subject: [PATCH] Gale commands + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Paper command" +By: Zach Brown +As part of: Paper (https://github.com/PaperMC/Paper) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java +index 0655b169a1cb418aacc5761680d84a8bd9aed3c9..f4a8c7fe830495434f06d45c1a4505e4ea536804 100644 +--- a/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/net/minecraft/server/dedicated/DedicatedServer.java +@@ -226,6 +226,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread + thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized + io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command ++ org.galemc.gale.command.GaleCommands.registerCommands(this); // Gale - Gale commands - register commands + this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark + com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics + com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0004-Remove-vanilla-profiler.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0004-Remove-vanilla-profiler.patch new file mode 100644 index 00000000..157b6f0b --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0004-Remove-vanilla-profiler.patch @@ -0,0 +1,2290 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 22 Dec 2022 22:32:18 +0100 +Subject: [PATCH] Remove vanilla profiler + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Remove Mojang Profiler" +By: BillyGalbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java +index f8969a68cd352ce4fe5109205e78f5e19ab6e020..9a25fea61abf062571d1261a0d9664d02782377a 100644 +--- a/net/minecraft/commands/Commands.java ++++ b/net/minecraft/commands/Commands.java +@@ -55,7 +55,6 @@ import net.minecraft.server.commands.CloneCommands; + import net.minecraft.server.commands.DamageCommand; + import net.minecraft.server.commands.DataPackCommand; + import net.minecraft.server.commands.DeOpCommands; +-import net.minecraft.server.commands.DebugCommand; + import net.minecraft.server.commands.DebugConfigCommand; + import net.minecraft.server.commands.DebugMobSpawningCommand; + import net.minecraft.server.commands.DebugPathCommand; +@@ -132,7 +131,6 @@ import net.minecraft.server.commands.WorldBorderCommand; + import net.minecraft.server.commands.data.DataCommands; + import net.minecraft.server.level.ServerPlayer; + import net.minecraft.tags.TagKey; +-import net.minecraft.util.profiling.Profiler; + import net.minecraft.util.profiling.jfr.JvmProfiler; + import net.minecraft.world.flag.FeatureFlagSet; + import net.minecraft.world.flag.FeatureFlags; +@@ -164,7 +162,6 @@ public class Commands { + DamageCommand.register(this.dispatcher, context); + DataCommands.register(this.dispatcher); + DataPackCommand.register(this.dispatcher); +- DebugCommand.register(this.dispatcher); + DefaultGameModeCommands.register(this.dispatcher); + DifficultyCommand.register(this.dispatcher); + EffectCommands.register(this.dispatcher, context); +@@ -349,7 +346,6 @@ public class Commands { + public void performCommand(ParseResults parseResults, String command, String label, boolean throwCommandError) { + // Paper end + CommandSourceStack commandSourceStack = parseResults.getContext().getSource(); +- Profiler.get().push(() -> "/" + command); + ContextChain contextChain = this.finishParsing(parseResults, command, commandSourceStack, label); // CraftBukkit // Paper - Add UnknownCommandEvent + + try { +@@ -386,8 +382,6 @@ public class Commands { + commandSourceStack.sendFailure(Component.literal(Util.describeError(var12))); + LOGGER.error("'/{}' threw an exception", command, var12); + } +- } finally { +- Profiler.get().pop(); + } + } + +@@ -444,7 +438,7 @@ public class Commands { + int max = Math.max(1, server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH)); + int _int = server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT); + +- try (ExecutionContext executionContext1 = new ExecutionContext<>(max, _int, Profiler.get())) { ++ try (ExecutionContext executionContext1 = new ExecutionContext<>(max, _int)) { // Gale - Purpur - remove vanilla profiler + CURRENT_EXECUTION_CONTEXT.set(executionContext1); + contextConsumer.accept(executionContext1); + executionContext1.runCommandQueue(); +diff --git a/net/minecraft/commands/execution/ExecutionContext.java b/net/minecraft/commands/execution/ExecutionContext.java +index 18c7fff36ca26a659fa8ea022c93ea65f3199181..5844db9e913ccb6a351907875aea2f37c3b4ceea 100644 +--- a/net/minecraft/commands/execution/ExecutionContext.java ++++ b/net/minecraft/commands/execution/ExecutionContext.java +@@ -20,7 +20,6 @@ public class ExecutionContext implements AutoCloseable { + private static final Logger LOGGER = LogUtils.getLogger(); + private final int commandLimit; + private final int forkLimit; +- private final ProfilerFiller profiler; + @Nullable + private TraceCallbacks tracer; + private int commandQuota; +@@ -29,10 +28,9 @@ public class ExecutionContext implements AutoCloseable { + private final List> newTopCommands = new ObjectArrayList<>(); + private int currentFrameDepth; + +- public ExecutionContext(int commandLimit, int forkLimit, ProfilerFiller profiler) { ++ public ExecutionContext(int commandLimit, int forkLimit) { // Gale - Purpur - remove vanilla profiler + this.commandLimit = commandLimit; + this.forkLimit = forkLimit; +- this.profiler = profiler; + this.commandQuota = commandLimit; + } + +@@ -132,7 +130,7 @@ public class ExecutionContext implements AutoCloseable { + } + + public ProfilerFiller profiler() { +- return this.profiler; ++ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Gale - Purpur - remove vanilla profiler + } + + public int forkLimit() { +diff --git a/net/minecraft/commands/execution/tasks/BuildContexts.java b/net/minecraft/commands/execution/tasks/BuildContexts.java +index 569abbea01f585990d2017c68580257275bbb06d..46cf0f3ab7146ba2f37eb1a3ef97eca864219eae 100644 +--- a/net/minecraft/commands/execution/tasks/BuildContexts.java ++++ b/net/minecraft/commands/execution/tasks/BuildContexts.java +@@ -42,9 +42,6 @@ public class BuildContexts> { + ChainModifiers chainModifiers1 = chainModifiers; + List list = sources; + if (contextChain.getStage() != Stage.EXECUTE) { +- context.profiler().push(() -> "prepare " + this.commandInput); +- +- try { + for (int forkLimit = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) { + CommandContext topContext = contextChain.getTopContext(); + if (topContext.isForked()) { +@@ -84,9 +81,6 @@ public class BuildContexts> { + list = list1; + } + } +- } finally { +- context.profiler().pop(); +- } + } + + if (list.isEmpty()) { +diff --git a/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/net/minecraft/commands/execution/tasks/ExecuteCommand.java +index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..e30bb9c4046200c1a6e4e917d15b205f5e0f21c3 100644 +--- a/net/minecraft/commands/execution/tasks/ExecuteCommand.java ++++ b/net/minecraft/commands/execution/tasks/ExecuteCommand.java +@@ -23,7 +23,6 @@ public class ExecuteCommand> implements Unbo + + @Override + public void execute(T source, ExecutionContext executionContext, Frame frame) { +- executionContext.profiler().push(() -> "execute " + this.commandInput); + + try { + executionContext.incrementCost(); +@@ -34,8 +33,6 @@ public class ExecuteCommand> implements Unbo + } + } catch (CommandSyntaxException var9) { + source.handleError(var9, this.modifiers.isForked(), executionContext.tracer()); +- } finally { +- executionContext.profiler().pop(); + } + } + } +diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java +index d61dcc909a04fb024df509b88dbe5cd455aad622..8b42972dde96f04ba0de53e57e192edf3f5ce054 100644 +--- a/net/minecraft/server/MinecraftServer.java ++++ b/net/minecraft/server/MinecraftServer.java +@@ -114,19 +114,8 @@ import net.minecraft.util.TimeUtil; + import net.minecraft.util.debugchart.RemoteDebugSampleType; + import net.minecraft.util.debugchart.SampleLogger; + import net.minecraft.util.debugchart.TpsDebugDimensions; +-import net.minecraft.util.profiling.EmptyProfileResults; +-import net.minecraft.util.profiling.ProfileResults; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; +-import net.minecraft.util.profiling.ResultField; +-import net.minecraft.util.profiling.SingleTickProfiler; + import net.minecraft.util.profiling.jfr.JvmProfiler; + import net.minecraft.util.profiling.jfr.callback.ProfiledDuration; +-import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; +-import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; +-import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; +-import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider; +-import net.minecraft.util.profiling.metrics.storage.MetricsPersister; + import net.minecraft.util.thread.ReentrantBlockableEventLoop; + import net.minecraft.world.Difficulty; + import net.minecraft.world.RandomSequences; +@@ -199,13 +188,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop tickables = Lists.newArrayList(); +- private MetricsRecorder metricsRecorder = InactiveMetricsRecorder.INSTANCE; +- private Consumer onMetricsRecordingStopped = results -> this.stopRecordingMetrics(); +- private Consumer onMetricsRecordingFinished = path -> {}; +- private boolean willStartRecordingMetrics; +- @Nullable +- private MinecraftServer.TimeProfiler debugCommandProfiler; +- private boolean debugCommandProfilerDelayStart; + private ServerConnectionListener connection; + public final ChunkProgressListenerFactory progressListenerFactory; + @Nullable +@@ -997,9 +979,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop false : this::haveTime); + // Paper start - rewrite chunk system +@@ -1259,7 +1231,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; + try { + this.isSaving = true; +@@ -1556,10 +1520,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop serverPlayer1.connection.suspendFlushing()); + this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit + // Paper start - Folia scheduler API +@@ -1674,9 +1630,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper - Add EntityMoveEvent + serverLevel.updateLagCompensationTick(); // Paper - lag compensation + net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers +- profilerFiller.push(() -> serverLevel + " " + serverLevel.dimension().location()); + /* Drop global time updates + if (this.tickCount % 20 == 0) { +- profilerFiller.push("timeSync"); + this.synchronizeTime(serverLevel); +- profilerFiller.pop(); + } + // CraftBukkit end */ + +- profilerFiller.push("tick"); +- + try { + serverLevel.tick(hasTimeLeft); + } catch (Throwable var7) { +@@ -1730,34 +1679,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { +- this.executeBlocking(() -> this.saveDebugReport(path.resolve("server"))); +- this.onMetricsRecordingFinished.accept(path); +- } +- ); +- this.willStartRecordingMetrics = false; +- } +- +- this.metricsRecorder.startTick(); +- return SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server")); +- } +- +- public void endMetricsRecordingTick() { +- this.metricsRecorder.endTick(); +- } +- +- public boolean isRecordingMetrics() { +- return this.metricsRecorder.isRecording(); +- } +- +- public void startRecordingMetrics(Consumer output, Consumer onMetricsRecordingFinished) { +- this.onMetricsRecordingStopped = profileResults -> { +- this.stopRecordingMetrics(); +- output.accept(profileResults); +- }; +- this.onMetricsRecordingFinished = onMetricsRecordingFinished; +- this.willStartRecordingMetrics = true; +- } +- +- public void stopRecordingMetrics() { +- this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; +- } +- +- public void finishRecordingMetrics() { +- this.metricsRecorder.end(); +- } +- +- public void cancelRecordingMetrics() { +- this.metricsRecorder.cancel(); +- } +- + public Path getWorldPath(LevelResource levelResource) { + return this.storageSource.getLevelPath(levelResource); + } +@@ -2698,24 +2583,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop getTimes(String sectionPath) { +- return Collections.emptyList(); +- } +- +- @Override +- public boolean saveResults(Path path) { +- return false; +- } +- +- @Override +- public long getStartTimeNano() { +- return TimeProfiler.this.startNanos; +- } +- +- @Override +- public int getStartTimeTicks() { +- return TimeProfiler.this.startTick; +- } +- +- @Override +- public long getEndTimeNano() { +- return endTimeNano; +- } +- +- @Override +- public int getEndTimeTicks() { +- return endTimeTicks; +- } +- +- @Override +- public String getProfilerResults() { +- return ""; +- } +- }; +- } +- } +- + // Paper start - Add tick times API and /mspt command + public static class TickTimes { + private final long[] times; +diff --git a/net/minecraft/server/ReloadableServerResources.java b/net/minecraft/server/ReloadableServerResources.java +index 84e2b940ab8301b789a01d5b739d69cb50db5bf4..f4205dca158f90450892af1223cc7912e494c05e 100644 +--- a/net/minecraft/server/ReloadableServerResources.java ++++ b/net/minecraft/server/ReloadableServerResources.java +@@ -98,7 +98,7 @@ public class ReloadableServerResources { + backgroundExecutor, + gameExecutor, + DATA_RELOAD_INITIAL_TASK, +- LOGGER.isDebugEnabled() ++ false // Gale - Purpur - remove vanilla profiler + ) + .done() + .thenApply(object -> reloadableServerResources); +diff --git a/net/minecraft/server/ServerFunctionManager.java b/net/minecraft/server/ServerFunctionManager.java +index e3cb5d9cd0332c32df82fa6aef37401c523e8af0..10c79570432491bfb2bbfedf0491ab2b803d0c71 100644 +--- a/net/minecraft/server/ServerFunctionManager.java ++++ b/net/minecraft/server/ServerFunctionManager.java +@@ -14,8 +14,6 @@ import net.minecraft.commands.execution.ExecutionContext; + import net.minecraft.commands.functions.CommandFunction; + import net.minecraft.commands.functions.InstantiatedFunction; + import net.minecraft.resources.ResourceLocation; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import org.slf4j.Logger; + + public class ServerFunctionManager { +@@ -50,19 +48,12 @@ public class ServerFunctionManager { + } + + private void executeTagFunctions(Collection> functionObjects, ResourceLocation identifier) { +- Profiler.get().push(identifier::toString); +- + for (CommandFunction commandFunction : functionObjects) { + this.execute(commandFunction, this.getGameLoopSender()); + } +- +- Profiler.get().pop(); + } + + public void execute(CommandFunction function, CommandSourceStack source) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push(() -> "function " + function.id()); +- + try { + InstantiatedFunction instantiatedFunction = function.instantiate(null, this.getDispatcher()); + Commands.executeCommandInContext( +@@ -72,8 +63,6 @@ public class ServerFunctionManager { + } catch (FunctionInstantiationException var9) { + } catch (Exception var10) { + LOGGER.warn("Failed to execute function {}", function.id(), var10); +- } finally { +- profilerFiller.pop(); + } + } + +diff --git a/net/minecraft/server/commands/DebugCommand.java b/net/minecraft/server/commands/DebugCommand.java +index b246c9885fd8c9cc0de2fd4faa53e0619dd3865c..b83d07a620d49b2c3741b73f3e41212a9f36fc6e 100644 +--- a/net/minecraft/server/commands/DebugCommand.java ++++ b/net/minecraft/server/commands/DebugCommand.java +@@ -67,6 +67,8 @@ public class DebugCommand { + } + + private static int start(CommandSourceStack source) throws CommandSyntaxException { ++ // Gale start - Purpur - remove vanilla profiler ++ /* + MinecraftServer server = source.getServer(); + if (server.isTimeProfilerRunning()) { + throw ERROR_ALREADY_RUNNING.create(); +@@ -75,9 +77,14 @@ public class DebugCommand { + source.sendSuccess(() -> Component.translatable("commands.debug.started"), true); + return 0; + } ++ */ ++ return 0; ++ // Gale end - Purpur - remove vanilla profiler + } + + private static int stop(CommandSourceStack source) throws CommandSyntaxException { ++ // Gale start - Purpur - remove vanilla profiler ++ /* + MinecraftServer server = source.getServer(); + if (!server.isTimeProfilerRunning()) { + throw ERROR_NOT_RUNNING.create(); +@@ -93,6 +100,9 @@ public class DebugCommand { + ); + return (int)d1; + } ++ */ ++ return 0; ++ // Gale end - Purpur - remove vanilla profiler + } + + static class TraceCustomExecutor +diff --git a/net/minecraft/server/commands/PerfCommand.java b/net/minecraft/server/commands/PerfCommand.java +index a3192400b37274620977e5a40d4283bfec3ab9b3..f23b17416eadc0e800ca34918ac78c031630edb4 100644 +--- a/net/minecraft/server/commands/PerfCommand.java ++++ b/net/minecraft/server/commands/PerfCommand.java +@@ -42,6 +42,9 @@ public class PerfCommand { + } + + private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { ++ // Gale start - Purpur - remove vanilla profiler ++ return removedMessage(source); ++ /* + MinecraftServer server = source.getServer(); + if (server.isRecordingMetrics()) { + throw ERROR_ALREADY_RUNNING.create(); +@@ -52,9 +55,14 @@ public class PerfCommand { + source.sendSuccess(() -> Component.translatable("commands.perf.started"), false); + return 0; + } ++ */ ++ // Gale end - Purpur - remove vanilla profiler + } + + private static int stopProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { ++ // Gale start - Purpur - remove vanilla profiler ++ return removedMessage(source); ++ /* + MinecraftServer server = source.getServer(); + if (!server.isRecordingMetrics()) { + throw ERROR_NOT_RUNNING.create(); +@@ -62,8 +70,22 @@ public class PerfCommand { + server.finishRecordingMetrics(); + return 0; + } ++ */ ++ // Gale end - Purpur - remove vanilla profiler + } + ++ // Gale start - Purpur - remove vanilla profiler ++ private static int removedMessage(CommandSourceStack source) { ++ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage(); ++ ++ source.getSender().sendMessage(mm.deserialize("Gale has removed Mojang's Profiler to save your performance. Please use /spark instead")); ++ source.getSender().sendMessage(mm.deserialize("For more information, view its documentation at")); ++ source.getSender().sendMessage(mm.deserialize("https://spark.lucko.me/docs/Command-Usage")); ++ ++ return 0; ++ } ++ // Gale end - Purpur - remove vanilla profiler ++ + private static void saveResults(CommandSourceStack source, Path path, MinecraftServer server) { + String string = String.format( + Locale.ROOT, "%s-%s-%s", Util.getFilenameFormattedDateTime(), server.getWorldData().getLevelName(), SharedConstants.getCurrentVersion().getId() +diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java +index 7b54f1842dd455ecf96aa1534b38d3b86b3bcc01..ba82d2e69d40feb834923c3d0980285d8d489359 100644 +--- a/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/net/minecraft/server/dedicated/DedicatedServer.java +@@ -800,12 +800,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + return this.settings.getProperties().serverResourcePackInfo; + } + +- @Override +- public void endMetricsRecordingTick() { +- super.endMetricsRecordingTick(); +- this.debugSampleSubscriptionTracker.tick(this.getTickCount()); +- } +- + @Override + public SampleLogger getTickTimeLogger() { + return this.tickTimeLogger; +diff --git a/net/minecraft/server/level/ChunkGenerationTask.java b/net/minecraft/server/level/ChunkGenerationTask.java +index 4221af18f5087badb5cd8c7cf66ab3312edf0394..f102afff61d5577a0f5002f2a52335bd4810f150 100644 +--- a/net/minecraft/server/level/ChunkGenerationTask.java ++++ b/net/minecraft/server/level/ChunkGenerationTask.java +@@ -5,8 +5,6 @@ import java.util.List; + import java.util.concurrent.CompletableFuture; + import javax.annotation.Nullable; + import net.minecraft.util.StaticCache2D; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.Zone; + import net.minecraft.world.level.ChunkPos; + import net.minecraft.world.level.chunk.ChunkAccess; + import net.minecraft.world.level.chunk.status.ChunkDependencies; +@@ -113,8 +111,6 @@ public class ChunkGenerationTask { + } + + private void scheduleLayer(ChunkStatus status, boolean needsGeneration) { +- try (Zone zone = Profiler.get().zone("scheduleLayer")) { +- zone.addText(status::getName); + int radiusForLayer = this.getRadiusForLayer(status, needsGeneration); + + for (int i = this.pos.x - radiusForLayer; i <= this.pos.x + radiusForLayer; i++) { +@@ -125,7 +121,6 @@ public class ChunkGenerationTask { + } + } + } +- } + } + + private int getRadiusForLayer(ChunkStatus status, boolean needsGeneration) { +diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java +index b3f498558614243cf633dcd71e3c49c2c55e6e0f..d3d9926d504fa6b3384be5ae06b2843ebb7f807c 100644 +--- a/net/minecraft/server/level/ChunkMap.java ++++ b/net/minecraft/server/level/ChunkMap.java +@@ -60,8 +60,6 @@ import net.minecraft.server.network.ServerPlayerConnection; + import net.minecraft.util.CsvOutput; + import net.minecraft.util.Mth; + import net.minecraft.util.StaticCache2D; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.util.thread.BlockableEventLoop; + import net.minecraft.util.thread.ConsecutiveExecutor; + import net.minecraft.world.entity.Entity; +@@ -410,15 +408,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + } + + protected void tick(BooleanSupplier hasMoreTime) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("poi"); + this.poiManager.tick(hasMoreTime); +- profilerFiller.popPush("chunk_unload"); + if (!this.level.noSave()) { + this.processUnloads(hasMoreTime); + } +- +- profilerFiller.pop(); + } + + public boolean hasWork() { +diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java +index 6540b2d6a1062d883811ce240c49d30d1925b291..9500fc2f841819b0d40e8a6e48353bb28b6dbe49 100644 +--- a/net/minecraft/server/level/ServerChunkCache.java ++++ b/net/minecraft/server/level/ServerChunkCache.java +@@ -25,8 +25,6 @@ import net.minecraft.network.protocol.Packet; + import net.minecraft.server.MinecraftServer; + import net.minecraft.server.level.progress.ChunkProgressListener; + import net.minecraft.util.VisibleForDebug; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.util.thread.BlockableEventLoop; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.MobCategory; +@@ -467,37 +465,28 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // CraftBukkit start - modelled on below + public void purgeUnload() { + if (true) return; // Paper - rewrite chunk system +- ProfilerFiller gameprofilerfiller = Profiler.get(); + +- gameprofilerfiller.push("purge"); + this.distanceManager.purgeStaleTickets(); + this.runDistanceManagerUpdates(); +- gameprofilerfiller.popPush("unload"); + this.chunkMap.tick(() -> true); +- gameprofilerfiller.pop(); + this.clearCache(); + } + // CraftBukkit end + + @Override + public void tick(BooleanSupplier hasTimeLeft, boolean tickChunks) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("purge"); + if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot + this.distanceManager.purgeStaleTickets(); + } + + this.runDistanceManagerUpdates(); +- profilerFiller.popPush("chunks"); + if (tickChunks) { + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().tick(); // Paper - rewrite chunk system + this.tickChunks(); + this.chunkMap.tick(); + } + +- profilerFiller.popPush("unload"); + this.chunkMap.tick(hasTimeLeft); +- profilerFiller.pop(); + this.clearCache(); + } + +@@ -506,34 +495,26 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + long l = gameTime - this.lastInhabitedUpdate; + this.lastInhabitedUpdate = gameTime; + if (!this.level.isDebug()) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("pollingChunks"); + if (this.level.tickRateManager().runsNormally()) { + List list = this.tickingChunks; + + try { +- profilerFiller.push("filteringTickingChunks"); + this.collectTickingChunks(list); +- profilerFiller.popPush("shuffleChunks"); + // Paper start - chunk tick iteration optimisation + this.shuffleRandom.setSeed(this.level.random.nextLong()); + if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled + // Paper end - chunk tick iteration optimisation +- this.tickChunks(profilerFiller, l, list); +- profilerFiller.pop(); ++ this.tickChunks(l, list); // Gale - Purpur - remove vanilla profiler + } finally { + list.clear(); + } + } + +- this.broadcastChangedChunks(profilerFiller); +- profilerFiller.pop(); ++ this.broadcastChangedChunks(); // Gale - Purpur - remove vanilla profiler + } + } + +- private void broadcastChangedChunks(ProfilerFiller profiler) { +- profiler.push("broadcast"); +- ++ private void broadcastChangedChunks() { // Gale - Purpur - remove vanilla profiler + for (ChunkHolder chunkHolder : this.chunkHoldersToBroadcast) { + LevelChunk tickingChunk = chunkHolder.getChunkToSend(); // Paper - rewrite chunk system + if (tickingChunk != null) { +@@ -542,7 +523,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + + this.chunkHoldersToBroadcast.clear(); +- profiler.pop(); + } + + private void collectTickingChunks(List output) { +@@ -568,8 +548,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper end - chunk tick iteration optimisation + } + +- private void tickChunks(ProfilerFiller profiler, long timeInhabited, List chunks) { +- profiler.popPush("naturalSpawnCount"); ++ private void tickChunks(long timeInhabited, List chunks) { // Gale - Purpur - remove vanilla profiler + int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount(); + // Paper start - Optional per player mob spawns + NaturalSpawner.SpawnState spawnState; +@@ -594,7 +573,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + // Paper end - Optional per player mob spawns + this.lastSpawnState = spawnState; +- profiler.popPush("spawnAndTick"); + boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit + int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); + List filteredSpawningCategories; +@@ -625,7 +603,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + } + +- profiler.popPush("customSpawners"); + if (_boolean) { + this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); + } +@@ -814,7 +791,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + + @Override + protected void doRunTask(Runnable task) { +- Profiler.get().incrementCounter("runTask"); + super.doRunTask(task); + } + +diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java +index 3223cbb7b6407bdd0e574688e2e5de2947af6ec9..6f568698939b5d995da0fa2cc493b5d513634318 100644 +--- a/net/minecraft/server/level/ServerLevel.java ++++ b/net/minecraft/server/level/ServerLevel.java +@@ -77,8 +77,6 @@ import net.minecraft.util.ProgressListener; + import net.minecraft.util.RandomSource; + import net.minecraft.util.Unit; + import net.minecraft.util.datafix.DataFixTypes; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.util.valueproviders.IntProvider; + import net.minecraft.util.valueproviders.UniformInt; + import net.minecraft.world.DifficultyInstance; +@@ -714,16 +712,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + + public void tick(BooleanSupplier hasTimeLeft) { +- ProfilerFiller profilerFiller = Profiler.get(); + this.handlingTick = true; + TickRateManager tickRateManager = this.tickRateManager(); + boolean runsNormally = tickRateManager.runsNormally(); + if (runsNormally) { +- profilerFiller.push("world border"); + this.getWorldBorder().tick(); +- profilerFiller.popPush("weather"); + this.advanceWeatherCycle(); +- profilerFiller.pop(); + } + + int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); +@@ -757,41 +751,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + this.tickTime(); + } + +- profilerFiller.push("tickPending"); + if (!this.isDebug() && runsNormally) { + long l = this.getGameTime(); +- profilerFiller.push("blockTicks"); + this.blockTicks.tick(l, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks +- profilerFiller.popPush("fluidTicks"); + this.fluidTicks.tick(l, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks +- profilerFiller.pop(); + } + +- profilerFiller.popPush("raid"); + if (runsNormally) { + this.raids.tick(); + } + +- profilerFiller.popPush("chunkSource"); + this.getChunkSource().tick(hasTimeLeft, true); +- profilerFiller.popPush("blockEvents"); + if (runsNormally) { + this.runBlockEvents(); + } + + this.handlingTick = false; +- profilerFiller.pop(); + boolean flag = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this + if (flag) { + this.resetEmptyTime(); + } + + if (flag || this.emptyTime++ < 300) { +- profilerFiller.push("entities"); + if (this.dragonFight != null && runsNormally) { +- profilerFiller.push("dragonFight"); + this.dragonFight.tick(); +- profilerFiller.pop(); + } + + io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR +@@ -800,9 +783,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + entity -> { + if (!entity.isRemoved()) { + if (!tickRateManager.isEntityFrozen(entity)) { +- profilerFiller.push("checkDespawn"); + entity.checkDespawn(); +- profilerFiller.pop(); + if (true) { // Paper - rewrite chunk system + Entity vehicle = entity.getVehicle(); + if (vehicle != null) { +@@ -813,21 +794,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + entity.stopRiding(); + } + +- profilerFiller.push("tick"); + this.guardEntityTick(this::tickNonPassenger, entity); +- profilerFiller.pop(); + } + } + } + } + ); +- profilerFiller.pop(); + this.tickBlockEntities(); + } + +- profilerFiller.push("entityManagement"); + // Paper - rewrite chunk system +- profilerFiller.pop(); + } + + @Override +@@ -842,9 +818,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + if (this.tickTime) { + long l = this.levelData.getGameTime() + 1L; + this.serverLevelData.setGameTime(l); +- Profiler.get().push("scheduledFunctions"); + this.serverLevelData.getScheduledEvents().tick(this.server, l); +- Profiler.get().pop(); + if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { + this.setDayTime(this.levelData.getDayTime() + 1L); + } +@@ -924,8 +898,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + boolean isRaining = this.isRaining(); + int minBlockX = pos.getMinBlockX(); + int minBlockZ = pos.getMinBlockZ(); +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("thunder"); + if (!this.paperConfig().environment.disableThunder && isRaining && this.isThundering() && this.spigotConfig.thunderChance > 0 && simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking + BlockPos blockPos = this.findLightningTargetAround(this.getBlockRandomPos(minBlockX, 0, minBlockZ, 15)); + if (this.isRainingAt(blockPos)) { +@@ -952,8 +924,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + } + +- profilerFiller.popPush("iceandsnow"); +- + if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow + for (int i = 0; i < randomTickSpeed; i++) { + if (simpleRandom.nextInt(48) == 0) { // Paper - optimise random ticking +@@ -962,12 +932,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + } // Paper - Option to disable ice and snow + +- profilerFiller.popPush("tickBlocks"); + if (randomTickSpeed > 0) { + this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking + } +- +- profilerFiller.pop(); + } + + @VisibleForTesting +@@ -1260,17 +1227,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + // Paper end - log detailed entity tick information + entity.setOldPosAndRot(); +- ProfilerFiller profilerFiller = Profiler.get(); + entity.tickCount++; + entity.totalEntityAge++; // Paper - age-like counter for all entities +- profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString()); +- profilerFiller.incrementCounter("tickNonPassenger"); + final boolean isActive = io.papermc.paper.entity.activation.ActivationRange.checkIfActive(entity); // Paper - EAR 2 + if (isActive) { // Paper - EAR 2 + entity.tick(); + entity.postTick(); // CraftBukkit + } else {entity.inactiveTick();} // Paper - EAR 2 +- profilerFiller.pop(); + + for (Entity entity1 : entity.getPassengers()) { + this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2 +@@ -1291,9 +1254,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + passengerEntity.setOldPosAndRot(); + passengerEntity.tickCount++; + passengerEntity.totalEntityAge++; // Paper - age-like counter for all entities +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(passengerEntity.getType()).toString()); +- profilerFiller.incrementCounter("tickPassenger"); + // Paper start - EAR 2 + if (isActive) { + passengerEntity.rideTick(); +@@ -1305,7 +1265,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + ridingEntity.positionRider(passengerEntity); + } + // Paper end - EAR 2 +- profilerFiller.pop(); + + for (Entity entity : passengerEntity.getPassengers()) { + this.tickPassenger(passengerEntity, entity, isActive); // Paper - EAR 2 +diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java +index 3de65c4025be91d938a350c884975cb6edc234d3..c11150dada66888e5332ec88d153dea3eca2aa3e 100644 +--- a/net/minecraft/server/level/ServerPlayer.java ++++ b/net/minecraft/server/level/ServerPlayer.java +@@ -96,8 +96,6 @@ import net.minecraft.tags.FluidTags; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.Unit; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.Container; + import net.minecraft.world.Difficulty; + import net.minecraft.world.InteractionHand; +@@ -1433,14 +1431,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + this.unsetRemoved(); + */ + // CraftBukkit end +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("moving"); + if (level != null && resourceKey == net.minecraft.world.level.dimension.LevelStem.OVERWORLD && level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER) { // CraftBukkit - empty to fall through to null to event + this.enteredNetherPosition = this.position(); + } + +- profilerFiller.pop(); +- profilerFiller.push("placing"); + // CraftBukkit start + this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds + LevelData worlddata = level.getLevelData(); +@@ -1457,7 +1451,6 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event + this.connection.resetPosition(); + level.addDuringTeleport(this); +- profilerFiller.pop(); + this.triggerDimensionChangeTriggers(serverLevel); + this.stopUsingItem(); + this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); +diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +index e71c1a564e5d4ac43460f89879ff709ee685706f..2b059bff0d24b52b106a0af4b7e79818f385596e 100644 +--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +@@ -24,7 +24,6 @@ import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket; + import net.minecraft.server.MinecraftServer; + import net.minecraft.server.level.ClientInformation; + import net.minecraft.util.VisibleForDebug; +-import net.minecraft.util.profiling.Profiler; + import org.slf4j.Logger; + + public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener, org.bukkit.craftbukkit.entity.CraftPlayer.TransferCookieConnection { // CraftBukkit +@@ -233,7 +232,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } + + protected void keepConnectionAlive() { +- Profiler.get().push("keepAlive"); + long millis = Util.getMillis(); + // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // This should effectively place the keepalive handling back to "as it was" before 1.12.2 +@@ -251,8 +249,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge)); + } + } +- +- Profiler.get().pop(); + } + + private boolean checkIfClosed(long time) { +diff --git a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java +index 71a4a0b8535a21667261fd66d41cca1216fd9933..1e9edae4708e1b2c282a13bd6a74f71ec4116895 100644 +--- a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java ++++ b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java +@@ -9,8 +9,6 @@ import java.util.concurrent.TimeUnit; + import java.util.concurrent.atomic.AtomicLong; + import net.minecraft.Util; + import net.minecraft.util.Unit; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import org.slf4j.Logger; + + public class ProfiledReloadInstance extends SimpleReloadInstance { +@@ -51,12 +49,9 @@ public class ProfiledReloadInstance extends SimpleReloadInstance executor.execute(() -> { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push(name); + long nanos = Util.getNanos(); + runnable.run(); + timeTaken.addAndGet(Util.getNanos() - nanos); +- profilerFiller.pop(); + }); + } + +diff --git a/net/minecraft/server/packs/resources/ReloadableResourceManager.java b/net/minecraft/server/packs/resources/ReloadableResourceManager.java +index 51cec338f5948b69ad1cff896ce19dc3adb74380..be7fd9e55957ba6fa70c711d1ea4d42e3bbfd752 100644 +--- a/net/minecraft/server/packs/resources/ReloadableResourceManager.java ++++ b/net/minecraft/server/packs/resources/ReloadableResourceManager.java +@@ -43,7 +43,7 @@ public class ReloadableResourceManager implements ResourceManager, AutoCloseable + LOGGER.info("Reloading ResourceManager: {}", LogUtils.defer(() -> resourcePacks.stream().map(PackResources::packId).collect(Collectors.joining(", ")))); + this.resources.close(); + this.resources = new MultiPackResourceManager(this.type, resourcePacks); +- return SimpleReloadInstance.create(this.resources, this.listeners, backgroundExecutor, gameExecutor, waitingFor, LOGGER.isDebugEnabled()); ++ return SimpleReloadInstance.create(this.resources, this.listeners, backgroundExecutor, gameExecutor, waitingFor, false); // Gale - Purpur - remove vanilla profiler + } + + @Override +diff --git a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +index 407bd4b8026869bc14ee5e79ff80e7bdd1a07bcb..6e2a3d4171dbb2a30ba18f165723691713fac0f6 100644 +--- a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java ++++ b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +@@ -3,20 +3,13 @@ package net.minecraft.server.packs.resources; + import java.util.concurrent.CompletableFuture; + import java.util.concurrent.Executor; + import net.minecraft.util.Unit; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + + public interface ResourceManagerReloadListener extends PreparableReloadListener { + @Override + default CompletableFuture reload( + PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager, Executor backgroundExecutor, Executor gameExecutor + ) { +- return barrier.wait(Unit.INSTANCE).thenRunAsync(() -> { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("listener"); +- this.onResourceManagerReload(manager); +- profilerFiller.pop(); +- }, gameExecutor); ++ return barrier.wait(Unit.INSTANCE).thenRunAsync(() -> this.onResourceManagerReload(manager), gameExecutor); // Gale - Purpur - remove vanilla profiler + } + + void onResourceManagerReload(ResourceManager resourceManager); +diff --git a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java +index 64b0508ef21952c65b0b967b756b2a4c64d96899..b6b03fbbd669e6331b30255df5419611c38e0495 100644 +--- a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java ++++ b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java +@@ -2,7 +2,6 @@ package net.minecraft.server.packs.resources; + + import java.util.concurrent.CompletableFuture; + import java.util.concurrent.Executor; +-import net.minecraft.util.profiling.Profiler; + import net.minecraft.util.profiling.ProfilerFiller; + + public abstract class SimplePreparableReloadListener implements PreparableReloadListener { +@@ -10,9 +9,9 @@ public abstract class SimplePreparableReloadListener implements PreparableRel + public final CompletableFuture reload( + PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager, Executor backgroundExecutor, Executor gameExecutor + ) { +- return CompletableFuture.supplyAsync(() -> this.prepare(manager, Profiler.get()), backgroundExecutor) ++ return CompletableFuture.supplyAsync(() -> this.prepare(manager, net.minecraft.util.profiling.InactiveProfiler.INSTANCE), backgroundExecutor) // Gale - Purpur - remove vanilla profiler + .thenCompose(barrier::wait) +- .thenAcceptAsync(object -> this.apply((T)object, manager, Profiler.get()), gameExecutor); ++ .thenAcceptAsync(object -> this.apply((T)object, manager, net.minecraft.util.profiling.InactiveProfiler.INSTANCE), gameExecutor); // Gale - Purpur - remove vanilla profiler + } + + protected abstract T prepare(ResourceManager resourceManager, ProfilerFiller profiler); +diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java +index f6a06336fa12d26ea88d1543aed8f9d41c71b949..e4ec46fdb3b3db47476cd09be767689f6f7d884f 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -78,8 +78,6 @@ import net.minecraft.tags.FluidTags; + import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.Nameable; +@@ -826,8 +824,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + // CraftBukkit end + + public void baseTick() { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("entityBaseTick"); + if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups + this.inBlockState = null; + if (this.isPassenger() && this.getVehicle().isRemoved()) { +@@ -890,8 +886,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + if (this.level() instanceof ServerLevel serverLevelx && this instanceof Leashable) { + Leashable.tickLeash(serverLevelx, (Entity & Leashable)this); + } +- +- profilerFiller.pop(); + } + + public void setSharedFlagOnFire(boolean isOnFire) { +@@ -1109,8 +1103,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("move"); + if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) { + movement = movement.multiply(this.stuckSpeedMultiplier); + this.stuckSpeedMultiplier = Vec3.ZERO; +@@ -1119,7 +1111,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + // Paper start - ignore movement changes while inactive. + if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) { + setDeltaMovement(Vec3.ZERO); +- profilerFiller.pop(); + return; + } + // Paper end +@@ -1141,8 +1132,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.setPos(this.getX() + vec3.x, this.getY() + vec3.y, this.getZ() + vec3.z); + } + +- profilerFiller.pop(); +- profilerFiller.push("rest"); + boolean flag = !Mth.equal(movement.x, vec3.x); + boolean flag1 = !Mth.equal(movement.z, vec3.z); + this.horizontalCollision = flag || flag1; +@@ -1165,7 +1154,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + + if (this.isRemoved()) { +- profilerFiller.pop(); + } else { + if (this.horizontalCollision) { + Vec3 deltaMovement = this.getDeltaMovement(); +@@ -1210,7 +1198,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + float blockSpeedFactor = this.getBlockSpeedFactor(); + this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor)); +- profilerFiller.pop(); + } + } + // Paper start - detailed watchdog information +@@ -3260,8 +3247,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.processPortalCooldown(); + if (this.portalProcess != null) { + if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("portal"); + this.setPortalCooldown(); + TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this); + if (portalDestination != null) { +@@ -3272,7 +3257,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- profilerFiller.pop(); + } else if (this.portalProcess.hasExpired()) { + this.portalProcess = null; + } +@@ -3792,15 +3776,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + entity.teleport(this.calculatePassengerTransition(teleportTransition, entity)); + } + +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("teleportSameDimension"); + this.teleportSetPosition(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); + if (!teleportTransition.asPassenger()) { + this.sendTeleportTransitionToRidingPlayers(teleportTransition); + } + + teleportTransition.postTeleportTransition().onTransition(this); +- profilerFiller.pop(); + return this; + } + +@@ -3816,11 +3797,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("teleportCrossDimension"); + Entity entityx = this.getType().create(level, EntitySpawnReason.DIMENSION_TRAVEL); + if (entityx == null) { +- profilerFiller.pop(); + return null; + } else { + // Paper start - Fix item duplication and teleport issues +@@ -3843,7 +3821,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + level.resetEmptyTime(); + teleportTransition.postTeleportTransition().onTransition(entityx); +- profilerFiller.pop(); + return entityx; + } + } +diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java +index 4546aca8e2e144ec207653c713fc49f849908827..de2ed0f7850a35a5a204ca10122ac79d0060f741 100644 +--- a/net/minecraft/world/entity/LivingEntity.java ++++ b/net/minecraft/world/entity/LivingEntity.java +@@ -72,8 +72,6 @@ import net.minecraft.tags.FluidTags; + import net.minecraft.tags.ItemTags; + import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.Difficulty; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.damagesource.CombatRules; +@@ -443,8 +441,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + super.baseTick(); +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("livingEntityBaseTick"); + if (this.fireImmune() || this.level().isClientSide) { + this.clearFire(); + } +@@ -554,7 +550,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.yHeadRotO = this.yHeadRot; + this.yRotO = this.getYRot(); + this.xRotO = this.getXRot(); +- profilerFiller.pop(); + } + + @Override +@@ -3183,11 +3178,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + this.run = this.run + (f3 - this.run) * 0.3F; +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("headTurn"); + f2 = this.tickHeadTurn(f1, f2); +- profilerFiller.pop(); +- profilerFiller.push("rangeChecks"); + + // Paper start - stop large pitch and yaw changes from crashing the server + this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; +@@ -3198,7 +3189,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + + this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; + +- profilerFiller.pop(); + this.animStep += f2; + if (this.isFallFlying()) { + this.fallFlyTicks++; +@@ -3410,20 +3400,14 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + this.setDeltaMovement(d, d1, d2); +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("ai"); + if (this.isImmobile()) { + this.jumping = false; + this.xxa = 0.0F; + this.zza = 0.0F; + } else if (this.isEffectiveAi()) { +- profilerFiller.push("newAi"); + this.serverAiStep(); +- profilerFiller.pop(); + } + +- profilerFiller.pop(); +- profilerFiller.push("jump"); + if (this.jumping && this.isAffectedByFluids()) { + double fluidHeight; + if (this.isInLava()) { +@@ -3452,8 +3436,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.noJumpDelay = 0; + } + +- profilerFiller.pop(); +- profilerFiller.push("travel"); + this.xxa *= 0.98F; + this.zza *= 0.98F; + if (this.isFallFlying()) { +@@ -3477,8 +3459,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + this.calculateEntityAnimation(this instanceof FlyingAnimal); +- profilerFiller.pop(); +- profilerFiller.push("freezing"); + if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API + int ticksFrozen = this.getTicksFrozen(); + if (this.isInPowderSnow && this.canFreeze()) { +@@ -3494,15 +3474,12 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.hurtServer(serverLevel, this.damageSources().freeze(), 1.0F); + } + +- profilerFiller.pop(); +- profilerFiller.push("push"); + if (this.autoSpinAttackTicks > 0) { + this.autoSpinAttackTicks--; + this.checkAutoSpinAttack(boundingBox, this.getBoundingBox()); + } + + this.pushEntities(); +- profilerFiller.pop(); + // Paper start - Add EntityMoveEvent + if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof Player)) { + if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { +diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java +index e330bf990e4874baed1b21cd8c9b44d66ec5b823..49f4d8d4cc36669f889d9970d1dfdf3af4a720ce 100644 +--- a/net/minecraft/world/entity/Mob.java ++++ b/net/minecraft/world/entity/Mob.java +@@ -33,8 +33,6 @@ import net.minecraft.sounds.SoundEvent; + import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.Difficulty; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; +@@ -329,14 +327,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + @Override + public void baseTick() { + super.baseTick(); +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("mobBaseTick"); + if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) { + this.resetAmbientSoundTime(); + this.playAmbientSound(); + } +- +- profilerFiller.pop(); + } + + @Override +@@ -614,8 +608,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + @Override + public void aiStep() { + super.aiStep(); +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("looting"); + if (this.level() instanceof ServerLevel serverLevel + && this.canPickUpLoot() + && this.isAlive() +@@ -638,8 +630,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + } + } + } +- +- profilerFiller.pop(); + } + + protected Vec3i getPickupReach() { +@@ -854,42 +844,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + return; + } + // Paper end - Allow nerfed mobs to jump and float +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("sensing"); + this.sensing.tick(); +- profilerFiller.pop(); + int i = this.tickCount + this.getId(); + if (i % 2 != 0 && this.tickCount > 1) { +- profilerFiller.push("targetSelector"); + this.targetSelector.tickRunningGoals(false); +- profilerFiller.pop(); +- profilerFiller.push("goalSelector"); + this.goalSelector.tickRunningGoals(false); +- profilerFiller.pop(); + } else { +- profilerFiller.push("targetSelector"); + this.targetSelector.tick(); +- profilerFiller.pop(); +- profilerFiller.push("goalSelector"); + this.goalSelector.tick(); +- profilerFiller.pop(); + } + +- profilerFiller.push("navigation"); + this.navigation.tick(); +- profilerFiller.pop(); +- profilerFiller.push("mob tick"); + this.customServerAiStep((ServerLevel)this.level()); +- profilerFiller.pop(); +- profilerFiller.push("controls"); +- profilerFiller.push("move"); + this.moveControl.tick(); +- profilerFiller.popPush("look"); + this.lookControl.tick(); +- profilerFiller.popPush("jump"); + this.jumpControl.tick(); +- profilerFiller.pop(); +- profilerFiller.pop(); + this.sendDebugPackets(); + } + +diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java +index a927c2790c8ab9ccaa7161b970e10b0b44817dd8..b816b2de8eb327060ca6ea7c4afc17373fa77ff6 100644 +--- a/net/minecraft/world/entity/ai/goal/GoalSelector.java ++++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java +@@ -7,8 +7,6 @@ import java.util.EnumSet; + import java.util.Map; + import java.util.Set; + import java.util.function.Predicate; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + + public class GoalSelector { + private static final WrappedGoal NO_GOAL = new WrappedGoal(Integer.MAX_VALUE, new Goal() { +@@ -84,9 +82,6 @@ public class GoalSelector { + } + + public void tick() { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("goalCleanup"); +- + for (WrappedGoal wrappedGoal : this.availableGoals) { + if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper - Perf: optimize goal types by removing streams + wrappedGoal.stop(); +@@ -94,8 +89,6 @@ public class GoalSelector { + } + + this.lockedFlags.entrySet().removeIf(entry -> !entry.getValue().isRunning()); +- profilerFiller.pop(); +- profilerFiller.push("goalUpdate"); + + for (WrappedGoal wrappedGoalx : this.availableGoals) { + // Paper start +@@ -115,21 +108,15 @@ public class GoalSelector { + } + } + +- profilerFiller.pop(); + this.tickRunningGoals(true); + } + + public void tickRunningGoals(boolean tickAllRunning) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("goalTick"); +- + for (WrappedGoal wrappedGoal : this.availableGoals) { + if (wrappedGoal.isRunning() && (tickAllRunning || wrappedGoal.requiresUpdateEveryTick())) { + wrappedGoal.tick(); + } + } +- +- profilerFiller.pop(); + } + + public Set getAvailableGoals() { +diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java +index b44f2c49509d847817a78e9c4fb1499fb378054b..6c8fb611943aee8cabc471c63166f9b44ef14826 100644 +--- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java ++++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java +@@ -10,8 +10,6 @@ import net.minecraft.core.Vec3i; + import net.minecraft.network.protocol.game.DebugPackets; + import net.minecraft.tags.BlockTags; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.Mob; + import net.minecraft.world.entity.ai.attributes.Attributes; +@@ -189,13 +187,10 @@ public abstract class PathNavigation { + } + } + // Paper end - EntityPathfindEvent +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("pathfind"); + BlockPos blockPos = offsetUpward ? this.mob.blockPosition().above() : this.mob.blockPosition(); + int i = (int)(followRange + regionOffset); + PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i)); + Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, targets, followRange, accuracy, this.maxVisitedNodesMultiplier); +- profilerFiller.pop(); + if (path != null && path.getTarget() != null) { + this.targetPos = path.getTarget(); + this.reachRange = accuracy; +diff --git a/net/minecraft/world/entity/ai/sensing/Sensing.java b/net/minecraft/world/entity/ai/sensing/Sensing.java +index c569074403b1d8b443aaa98ba9cf9bbd0e98bd2d..b1aa7294f9479f45fcde77c5ea46db9f62370abf 100644 +--- a/net/minecraft/world/entity/ai/sensing/Sensing.java ++++ b/net/minecraft/world/entity/ai/sensing/Sensing.java +@@ -2,8 +2,6 @@ package net.minecraft.world.entity.ai.sensing; + + import it.unimi.dsi.fastutil.ints.IntOpenHashSet; + import it.unimi.dsi.fastutil.ints.IntSet; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.Mob; + +@@ -28,10 +26,7 @@ public class Sensing { + } else if (this.unseen.contains(id)) { + return false; + } else { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("hasLineOfSight"); + boolean hasLineOfSight = this.mob.hasLineOfSight(entity); +- profilerFiller.pop(); + if (hasLineOfSight) { + this.seen.add(id); + } else { +diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java +index aafb32295d4ce239609bb62e6bdf2261739f7aa0..0c863f8b4683516916d51a0c49921c6bb5608e9f 100644 +--- a/net/minecraft/world/entity/animal/allay/Allay.java ++++ b/net/minecraft/world/entity/animal/allay/Allay.java +@@ -30,8 +30,6 @@ import net.minecraft.tags.GameEventTags; + import net.minecraft.tags.ItemTags; + import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.SimpleContainer; +@@ -245,13 +243,8 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("allayBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("allayActivityUpdate"); + AllayAi.updateActivity(this); +- profilerFiller.pop(); + super.customServerAiStep(level); + } + +diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java +index dfdbcb31458095a71c187efc2774ecc4945dd11b..86e78ce740b27f9714145a690e8b182a2ccb3fb9 100644 +--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java ++++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java +@@ -23,8 +23,6 @@ import net.minecraft.util.ByIdMap; + import net.minecraft.util.RandomSource; + import net.minecraft.util.StringRepresentable; + import net.minecraft.util.TimeUtil; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.damagesource.DamageSource; +@@ -133,13 +131,8 @@ public class Armadillo extends Animal { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("armadilloBrain"); + ((Brain)this.brain).tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("armadilloActivityUpdate"); + ArmadilloAi.updateActivity(this); +- profilerFiller.pop(); + if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { + this.forceDrops = true; // CraftBukkit + if (this.dropFromGiftLootTable(level, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) { +diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java +index 9faa929734035c167e54569ce34d841291856589..c351b0808422221b5358d6e546a206ef75e8173f 100644 +--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java ++++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java +@@ -26,8 +26,6 @@ import net.minecraft.util.ByIdMap; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.StringRepresentable; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -302,13 +300,8 @@ public class Axolotl extends Animal implements VariantHolder, B + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("axolotlBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("axolotlActivityUpdate"); + AxolotlAi.updateActivity(this); +- profilerFiller.pop(); + if (!this.isNoAi()) { + Optional memory = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS); + this.setPlayingDead(memory.isPresent() && memory.get() > 0); +diff --git a/net/minecraft/world/entity/animal/camel/Camel.java b/net/minecraft/world/entity/animal/camel/Camel.java +index 3ac169f83c5619b5c00c866354a2e066a0a738cc..1ac4b13554d2699c3e04d41946e1adfd5e854a17 100644 +--- a/net/minecraft/world/entity/animal/camel/Camel.java ++++ b/net/minecraft/world/entity/animal/camel/Camel.java +@@ -17,8 +17,6 @@ import net.minecraft.sounds.SoundSource; + import net.minecraft.tags.BlockTags; + import net.minecraft.tags.ItemTags; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -145,14 +143,9 @@ public class Camel extends AbstractHorse { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("camelBrain"); + Brain brain = this.getBrain(); + ((Brain)brain).tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("camelActivityUpdate"); + CamelAi.updateActivity(this); +- profilerFiller.pop(); + super.customServerAiStep(level); + } + +diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java +index 12c655b60087a2f6122ffa508b3224159d8777b0..67df4c0f47b2809c912f1dfb52124ca5e2c30b7b 100644 +--- a/net/minecraft/world/entity/animal/frog/Frog.java ++++ b/net/minecraft/world/entity/animal/frog/Frog.java +@@ -28,8 +28,6 @@ import net.minecraft.tags.ItemTags; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.Unit; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.AgeableMob; +@@ -186,13 +184,8 @@ public class Frog extends Animal implements VariantHolder> { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("frogBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("frogActivityUpdate"); + FrogAi.updateActivity(this); +- profilerFiller.pop(); + super.customServerAiStep(level); + } + +diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java +index 97adf8142cdd322c4873c420ed760e9dee34da23..a04d71967976731b4858d44ac138b7ac390ef7e7 100644 +--- a/net/minecraft/world/entity/animal/frog/Tadpole.java ++++ b/net/minecraft/world/entity/animal/frog/Tadpole.java +@@ -12,8 +12,6 @@ import net.minecraft.server.level.ServerLevel; + import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; + import net.minecraft.tags.ItemTags; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.damagesource.DamageSource; +@@ -97,13 +95,8 @@ public class Tadpole extends AbstractFish { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("tadpoleBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("tadpoleActivityUpdate"); + TadpoleAi.updateActivity(this); +- profilerFiller.pop(); + super.customServerAiStep(level); + } + +diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java +index c91e1f8e5fd39bcc48f9f0bf002770b2dff74404..c4c0ebb9b43018d795e02b2ab15d38bc475e4330 100644 +--- a/net/minecraft/world/entity/animal/goat/Goat.java ++++ b/net/minecraft/world/entity/animal/goat/Goat.java +@@ -21,8 +21,6 @@ import net.minecraft.tags.ItemTags; + import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -186,13 +184,8 @@ public class Goat extends Animal { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("goatBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("goatActivityUpdate"); + GoatAi.updateActivity(this); +- profilerFiller.pop(); + super.customServerAiStep(level); + } + +diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java +index 62ca7871d1e5d0fe611948ad43e44c23fdc2d3f8..5f0efcfb88bee09f1cccc53cedbef22b14c5f554 100644 +--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java ++++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java +@@ -29,8 +29,6 @@ import net.minecraft.tags.BlockTags; + import net.minecraft.tags.ItemTags; + import net.minecraft.util.ByIdMap; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.damagesource.DamageSource; +@@ -454,12 +452,8 @@ public class Sniffer extends Animal { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("snifferBrain"); + this.getBrain().tick(level, this); +- profilerFiller.popPush("snifferActivityUpdate"); + SnifferAi.updateActivity(this); +- profilerFiller.pop(); + super.customServerAiStep(level); + } + +diff --git a/net/minecraft/world/entity/monster/Zoglin.java b/net/minecraft/world/entity/monster/Zoglin.java +index 9b94e74f6317f835500225b087fe93487a7a0b22..8a7418db237553719671f3cd51f42ebed1eb7804 100644 +--- a/net/minecraft/world/entity/monster/Zoglin.java ++++ b/net/minecraft/world/entity/monster/Zoglin.java +@@ -15,8 +15,6 @@ import net.minecraft.network.syncher.SynchedEntityData; + import net.minecraft.server.level.ServerLevel; + import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.util.valueproviders.UniformInt; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.damagesource.DamageSource; +@@ -248,10 +246,7 @@ public class Zoglin extends Monster implements HoglinBase { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("zoglinBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); + this.updateActivity(); + } + +diff --git a/net/minecraft/world/entity/monster/breeze/Breeze.java b/net/minecraft/world/entity/monster/breeze/Breeze.java +index 23dff1d01387ce89b020aa93de99e6ef557c04e3..fb643596bd5fb12e4cd323706f51a479d78a5455 100644 +--- a/net/minecraft/world/entity/monster/breeze/Breeze.java ++++ b/net/minecraft/world/entity/monster/breeze/Breeze.java +@@ -12,8 +12,6 @@ import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.tags.EntityTypeTags; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.AnimationState; + import net.minecraft.world.entity.Entity; +@@ -232,12 +230,8 @@ public class Breeze extends Monster { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("breezeBrain"); + this.getBrain().tick(level, this); +- profilerFiller.popPush("breezeActivityUpdate"); + BreezeAi.updateActivity(this); +- profilerFiller.pop(); + super.customServerAiStep(level); + } + +diff --git a/net/minecraft/world/entity/monster/creaking/Creaking.java b/net/minecraft/world/entity/monster/creaking/Creaking.java +index eba1e78352f956618b2796ce7cbe5d6f7e6591b6..6cd7d0f82bd97c6adb521eda3bc84c60f87c0cda 100644 +--- a/net/minecraft/world/entity/monster/creaking/Creaking.java ++++ b/net/minecraft/world/entity/monster/creaking/Creaking.java +@@ -18,8 +18,6 @@ import net.minecraft.server.level.ServerLevel; + import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; + import net.minecraft.tags.DamageTypeTags; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.AnimationState; + import net.minecraft.world.entity.Entity; +@@ -203,10 +201,7 @@ public class Creaking extends Monster { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("creakingBrain"); + this.getBrain().tick((ServerLevel)this.level(), this); +- profilerFiller.pop(); + CreakingAi.updateActivity(this); + } + +diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java +index 0ddc0fe06a1b701f88ed8f8041ecd68f7da6c86d..fe0cd6790875631cb98a73457d53d782b369bf1d 100644 +--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java ++++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java +@@ -16,8 +16,6 @@ import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.tags.ItemTags; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -158,10 +156,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("hoglinBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); + HoglinAi.updateActivity(this); + if (this.isConverting()) { + this.timeInOverworld++; +diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java +index 0257eada48b35ea024520afe30596beae8a7ef1e..daef9043d0eacea948e39b1daa2618287aa40f14 100644 +--- a/net/minecraft/world/entity/monster/piglin/Piglin.java ++++ b/net/minecraft/world/entity/monster/piglin/Piglin.java +@@ -17,8 +17,6 @@ import net.minecraft.tags.ItemTags; + import net.minecraft.tags.TagKey; + import net.minecraft.util.RandomSource; + import net.minecraft.util.VisibleForDebug; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -344,10 +342,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("piglinBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); + PiglinAi.updateActivity(this); + super.customServerAiStep(level); + } +diff --git a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +index 0964b138e87357b7601ddfe937a2b9132afd5478..e5f91e64f61bdb7b7f7e3f101083e9bd5dbe7551 100644 +--- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java ++++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +@@ -8,8 +8,6 @@ import net.minecraft.server.level.ServerLevel; + import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.EntitySpawnReason; +@@ -115,10 +113,7 @@ public class PiglinBrute extends AbstractPiglin { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("piglinBruteBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); + PiglinBruteAi.updateActivity(this); + PiglinBruteAi.maybePlayActivitySound(this); + super.customServerAiStep(level); +diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java +index 9f476e587d7df797129e49738f101cccca7e10b7..1c56355fe9c216a7cc8afbbbe94988a0079c8244 100644 +--- a/net/minecraft/world/entity/monster/warden/Warden.java ++++ b/net/minecraft/world/entity/monster/warden/Warden.java +@@ -32,8 +32,6 @@ import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.Unit; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.effect.MobEffectInstance; +@@ -284,10 +282,7 @@ public class Warden extends Monster implements VibrationSystem { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("wardenBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); + super.customServerAiStep(level); + if ((this.tickCount + this.getId()) % 120 == 0) { + applyDarknessAround(level, this.position(), this, 20); +diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java +index 2b83262e4a13eae86df82913ce4f3121e3631a43..ee7b4080a9e1e51273f4b48f61caaa21ad7e59d9 100644 +--- a/net/minecraft/world/entity/npc/Villager.java ++++ b/net/minecraft/world/entity/npc/Villager.java +@@ -35,8 +35,6 @@ import net.minecraft.stats.Stats; + import net.minecraft.tags.ItemTags; + import net.minecraft.util.Mth; + import net.minecraft.util.SpawnUtil; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.Difficulty; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; +@@ -291,10 +289,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + } + protected void customServerAiStep(ServerLevel level, final boolean inactive) { + // Paper end - EAR 2 +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("villagerBrain"); + if (!inactive) this.getBrain().tick(level, this); // Paper - EAR 2 +- profilerFiller.pop(); + if (this.assignProfessionWhenSpawned) { + this.assignProfessionWhenSpawned = false; + } +diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java +index e993323e4010c6c07cfeade4b16970d66890941e..052d74ff170f0f6ab7acac763a4a7c3384baadad 100644 +--- a/net/minecraft/world/level/Level.java ++++ b/net/minecraft/world/level/Level.java +@@ -35,8 +35,6 @@ import net.minecraft.util.AbortableIterationConsumer; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.StringRepresentable; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.TickRateManager; + import net.minecraft.world.damagesource.DamageSource; +@@ -228,7 +226,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public final List getEntitiesOfClass(final Class entityClass, final AABB boundingBox, final Predicate predicate) { +- Profiler.get().incrementCounter("getEntities"); + final List ret = new java.util.ArrayList<>(); + + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate); +@@ -238,7 +235,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public final List moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate predicate) { +- Profiler.get().incrementCounter("getEntities"); + final List ret = new java.util.ArrayList<>(); + + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate); +@@ -1467,8 +1463,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + } + + protected void tickBlockEntities() { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("blockEntities"); + this.tickingBlockEntities = true; + if (!this.pendingBlockEntityTickers.isEmpty()) { + this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); +@@ -1499,7 +1493,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 + + this.tickingBlockEntities = false; +- profilerFiller.pop(); + this.spigotConfig.currentPrimedTnt = 0; // Spigot + } + +@@ -1758,7 +1751,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public List getEntities(@Nullable Entity entity, AABB boundingBox, Predicate predicate) { +- Profiler.get().incrementCounter("getEntities"); + List list = Lists.newArrayList(); + + // Paper start - rewrite chunk system +@@ -1787,8 +1779,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + public void getEntities(final EntityTypeTest entityTypeTest, + final AABB boundingBox, final Predicate predicate, + final List into, final int maxCount) { +- Profiler.get().incrementCounter("getEntities"); +- + if (entityTypeTest instanceof net.minecraft.world.entity.EntityType byType) { + if (maxCount != Integer.MAX_VALUE) { + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(byType, boundingBox, into, predicate, maxCount); +diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java +index 17ce115e887cbbb06ad02ab7ddb488e27342c0e4..4bee1ba137d078563cedfdd184a8b4603df17487 100644 +--- a/net/minecraft/world/level/NaturalSpawner.java ++++ b/net/minecraft/world/level/NaturalSpawner.java +@@ -23,8 +23,6 @@ import net.minecraft.tags.BlockTags; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.VisibleForDebug; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.util.random.WeightedRandomList; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntitySpawnReason; +@@ -158,9 +156,6 @@ public final class NaturalSpawner { + } + + public static void spawnForChunk(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, List categories) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("spawner"); +- + for (MobCategory mobCategory : categories) { + // Paper start - Optional per player mob spawns + final boolean canSpawn; +@@ -195,8 +190,6 @@ public final class NaturalSpawner { + // Paper end - Optional per player mob spawns + } + } +- +- profilerFiller.pop(); + } + + // Paper start - Add mobcaps commands +diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java +index c4485f28def66264846a436cfba7bddccb66b82e..4d183fb445c43621c5ce95edc1af27b6a41f0acb 100644 +--- a/net/minecraft/world/level/ServerExplosion.java ++++ b/net/minecraft/world/level/ServerExplosion.java +@@ -13,8 +13,6 @@ import net.minecraft.Util; + import net.minecraft.core.BlockPos; + import net.minecraft.server.level.ServerLevel; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityType; +@@ -665,10 +663,7 @@ public class ServerExplosion implements Explosion { + List list = this.calculateExplodedPositions(); + this.hurtEntities(); + if (this.interactsWithBlocks()) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("explosion_blocks"); + this.interactWithBlocks(list); +- profilerFiller.pop(); + } + + if (this.fire) { +diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java +index 761fdcd4a4e18f45547afd8edff44f61c6eeacb4..3a7707427691a7862499a7efa3b39ead1ef78013 100644 +--- a/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/net/minecraft/world/level/chunk/LevelChunk.java +@@ -23,8 +23,6 @@ import net.minecraft.network.FriendlyByteBuf; + import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; + import net.minecraft.server.level.FullChunkStatus; + import net.minecraft.server.level.ServerLevel; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.level.ChunkPos; + import net.minecraft.world.level.Level; +@@ -386,12 +384,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + } + + if (LightEngine.hasDifferentLightProperties(blockState, state)) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("updateSkyLightSources"); + // Paper - rewrite chunk system +- profilerFiller.popPush("queueCheckLight"); + this.level.getChunkSource().getLightEngine().checkBlock(pos); +- profilerFiller.pop(); + } + + boolean hasBlockEntity = blockState.hasBlockEntity(); +@@ -911,8 +905,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + BlockPos blockPos = this.blockEntity.getBlockPos(); + if (LevelChunk.this.isTicking(blockPos)) { + try { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push(this::getType); + BlockState blockState = LevelChunk.this.getBlockState(blockPos); + if (this.blockEntity.getType().isValid(blockState)) { + this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity); +@@ -926,8 +918,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + } + // Paper end - Remove the Block Entity if it's invalid + } +- +- profilerFiller.pop(); + } catch (Throwable var5) { + // Paper start - Prevent block entity and entity crashes + final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); +diff --git a/net/minecraft/world/level/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java +index 81de6c1bbef1cafd3036e736dd305fbedc8368c6..c2baadcdceb1df6a881d6f73aa4eb4dd264bcdfe 100644 +--- a/net/minecraft/world/level/pathfinder/PathFinder.java ++++ b/net/minecraft/world/level/pathfinder/PathFinder.java +@@ -12,9 +12,6 @@ import java.util.function.Function; + import java.util.stream.Collectors; + import javax.annotation.Nullable; + import net.minecraft.core.BlockPos; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; +-import net.minecraft.util.profiling.metrics.MetricCategory; + import net.minecraft.world.entity.Mob; + import net.minecraft.world.level.PathNavigationRegion; + +@@ -57,9 +54,6 @@ public class PathFinder { + + @Nullable + private Path findPath(Node node, List> positions, float maxRange, int accuracy, float searchDepthMultiplier) { // Paper - optimize collection +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("find_path"); +- profilerFiller.markForCharting(MetricCategory.PATH_FINDING); + // Set set = targetPositions.keySet(); // Paper + node.g = 0.0F; + node.h = this.getBestH(node, positions); // Paper - optimize collection +@@ -129,7 +123,6 @@ public class PathFinder { + best = path; + } + } +- profilerFiller.pop(); + return best; + // Paper end - Perf: remove streams and optimize collection + } +diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java +index 66abc2e7adee60fa98eed1ba36e018814fd02cad..fbf0d3b808c66e8971c747619f6acf7417af5ef7 100644 +--- a/net/minecraft/world/ticks/LevelTicks.java ++++ b/net/minecraft/world/ticks/LevelTicks.java +@@ -23,8 +23,6 @@ import net.minecraft.Util; + import net.minecraft.core.BlockPos; + import net.minecraft.core.SectionPos; + import net.minecraft.core.Vec3i; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.level.ChunkPos; + import net.minecraft.world.level.levelgen.structure.BoundingBox; + +@@ -80,20 +78,13 @@ public class LevelTicks implements LevelTickAccess { + } + + public void tick(long gameTime, int maxAllowedTicks, BiConsumer ticker) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("collect"); +- this.collectTicks(gameTime, maxAllowedTicks, profilerFiller); +- profilerFiller.popPush("run"); +- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); ++ this.collectTicks(gameTime, maxAllowedTicks); // Gale - Purpur - remove vanilla profiler + this.runCollectedTicks(ticker); +- profilerFiller.popPush("cleanup"); + this.cleanupAfterTick(); +- profilerFiller.pop(); + } + +- private void collectTicks(long gameTime, int maxAllowedTicks, ProfilerFiller profiler) { ++ private void collectTicks(long gameTime, int maxAllowedTicks) { // Gale - Purpur - remove vanilla profiler + this.sortContainersToTick(gameTime); +- profiler.incrementCounter("containersToTick", this.containersToTick.size()); + this.drainContainers(gameTime, maxAllowedTicks); + this.rescheduleLeftoverContainers(); + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0005-Use-platform-math-functions.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0005-Use-platform-math-functions.patch new file mode 100644 index 00000000..266d941d --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0005-Use-platform-math-functions.patch @@ -0,0 +1,159 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 8 Aug 2023 20:43:20 +0200 +Subject: [PATCH] Use platform math functions + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Use Math.floor instead of fastfloor" +By: Xymb +As part of: Kaiiju (https://github.com/KaiijuMC/Kaiiju) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Comparison of floor methods used in Paper * + +Measure shown is floored number of milliseconds +(nanoseconds integer-divided by 1_000_000 +taken to get the floor of 1000 randomly chosen doubles +(all in the range of [-Integer.MAX_VALUE + 10, Integer.MAX_VALUE - 10]) +100_000 times (making it 100_000_000 floor operations total) +and adding it to a total. + +We are testing the following methods: +* net.minecraft.util.Mth.floor +* java.lang.Math.floor +* java.lang.StrictMath.floor +* org.apache.commons.math3.util.FastMath.floor +* org.apache.commons.math3.util.FastMath.floor, but with a hot start (see comment in code) +* io.papermc.paper.util.MCUtil.fastFloor + +The tests performed clearly show that Math.floor is the fastest. +This is most likely due to java.lang.Math's usage of the @IntrinsicCandidate +annotation, which allows the JVM to use a more optimized implementation at runtime. +However, in the case that there is no intrinsic replacement for Math.floor, +it defers to StrictMath.floor, which relies on a number of native methods, and is +still much faster than the existing Minecraft utility functions. +Therefore, using Math.floor instead of these functions is better regardless. +In Apache Commons Math 4, FastMath.floor has also been removed in favor of Math.floor. + +The versions used: +* Windows 10 Home 21H2 19044.3086 +* OpenJDK Runtime Environment Temurin-19.0.2+7 (build 19.0.2+7) +* Paper a3c760e6af1e8c7244ef75c6da6e6df278a79e14 on Minecraft 1.20.1 +* Apache Commons Math 3.6.1 + +Results: +Total is of type int Total is of type double +---------------------------------------------------------------------------------- +Mth.floor 2113 (double) Mth.floor 2658 +(int) Math.floor 130 Math.floor 194 +(int) StrictMath.floor 835 StrictMath.floor 381 +(int) FastMath.floor 412 FastMath.floor 376 +(int) FastMath.floor with hot start 359 FastMath.floor with hot start 321 +MCUtil.fastFloor 2284 (double) MCUtil.fastFloor 2469 + +Code is below: +```java +package somepackage; + +import io.papermc.paper.util.MCUtil; +import net.minecraft.util.Mth; + +import java.util.Random; + +public class Main { + + public static void main(String[] args) { + + // IF FastMath.floor with a hot start: + // FastMath.floor(37485.5); + + var random = new Random(4889338); + int size = 1000; + var values = new double[size]; + double bound = Integer.MAX_VALUE - 10; + for (int i = 0; i < size; i++) { + values[i] = random.nextDouble(bound * 2) - bound; + } + int repeats = 100_000; + + // int total = 0; + // OR + // double total = 0; + + long start = System.nanoTime(); + for (int repeat = 0; repeat < repeats; repeat++) { + for (int index = 0; index < size; index++) { + total += insert_function_being_tested_here(values[index]); + } + } + long diff = System.nanoTime() - start; + System.out.println(total); + System.out.println(diff / 1_000_000L); + + } + +} +``` + +diff --git a/net/minecraft/util/Mth.java b/net/minecraft/util/Mth.java +index d5d8134da9423cec199cf44762460104677194d6..e0eed27cb33348fcb46858c40014b5fe5dbaf426 100644 +--- a/net/minecraft/util/Mth.java ++++ b/net/minecraft/util/Mth.java +@@ -58,18 +58,15 @@ public class Mth { + } + + public static int floor(float value) { +- int i = (int)value; +- return value < i ? i - 1 : i; ++ return (int) Math.floor(value); // Gale - use platform math functions + } + + public static int floor(double value) { +- int i = (int)value; +- return value < i ? i - 1 : i; ++ return (int) Math.floor(value); // Gale - use platform math functions + } + + public static long lfloor(double value) { +- long l = (long)value; +- return value < l ? l - 1L : l; ++ return (long) Math.floor(value); // Gale - use platform math functions + } + + public static float abs(float value) { +@@ -81,13 +78,11 @@ public class Mth { + } + + public static int ceil(float value) { +- int i = (int)value; +- return value > i ? i + 1 : i; ++ return (int) Math.ceil(value); // Gale - use platform math functions + } + + public static int ceil(double value) { +- int i = (int)value; +- return value > i ? i + 1 : i; ++ return (int) Math.ceil(value); // Gale - use platform math functions + } + + public static int clamp(int value, int min, int max) { +@@ -123,15 +118,7 @@ public class Mth { + } + + public static double absMax(double x, double y) { +- if (x < 0.0) { +- x = -x; +- } +- +- if (y < 0.0) { +- y = -y; +- } +- +- return Math.max(x, y); ++ return Math.max(Math.abs(x), Math.abs(y)); // Gale - use platform math functions + } + + public static int floorDiv(int dividend, int divisor) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0006-Faster-floating-point-positive-modulo.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0006-Faster-floating-point-positive-modulo.patch new file mode 100644 index 00000000..5a8e00e4 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0006-Faster-floating-point-positive-modulo.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 29 Aug 2023 22:29:08 +0200 +Subject: [PATCH] Faster floating-point positive modulo + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/util/Mth.java b/net/minecraft/util/Mth.java +index e0eed27cb33348fcb46858c40014b5fe5dbaf426..85c329437f27fc2fc143d2873572f8d3cf30660d 100644 +--- a/net/minecraft/util/Mth.java ++++ b/net/minecraft/util/Mth.java +@@ -149,14 +149,26 @@ public class Mth { + return Math.floorMod(x, y); + } + +- public static float positiveModulo(float numerator, float denominator) { ++ public static float positiveModuloForAnyDenominator(float numerator, float denominator) { // Gale - faster floating-point positive modulo + return (numerator % denominator + denominator) % denominator; + } + +- public static double positiveModulo(double numerator, double denominator) { ++ public static double positiveModuloForAnyDenominator(double numerator, double denominator) { // Gale - faster floating-point positive modulo + return (numerator % denominator + denominator) % denominator; + } + ++ // Gale start - faster floating-point positive modulo ++ public static float positiveModuloForPositiveIntegerDenominator(float numerator, float denominator) { ++ var modulo = numerator % denominator; ++ return modulo < 0 ? modulo + denominator : modulo; ++ } ++ ++ public static double positiveModuloForPositiveIntegerDenominator(double numerator, double denominator) { ++ var modulo = numerator % denominator; ++ return modulo < 0 ? modulo + denominator : modulo; ++ } ++ // Gale end - faster floating-point positive modulo ++ + public static boolean isMultipleOf(int number, int multiple) { + return number % multiple == 0; + } +diff --git a/net/minecraft/world/level/levelgen/blending/Blender.java b/net/minecraft/world/level/levelgen/blending/Blender.java +index 01e5b29d6e9a5c53c0e23b61ed0c1d7be1a0fe08..314a189e2099e3688fd23e7100120abea6886ccd 100644 +--- a/net/minecraft/world/level/levelgen/blending/Blender.java ++++ b/net/minecraft/world/level/levelgen/blending/Blender.java +@@ -144,7 +144,7 @@ public class Blender { + private static double heightToOffset(double height) { + double d = 1.0; + double d1 = height + 0.5; +- double d2 = Mth.positiveModulo(d1, 8.0); ++ double d2 = Mth.positiveModuloForPositiveIntegerDenominator(d1, 8.0); // Gale - faster floating-point positive modulo + return 1.0 * (32.0 * (d1 - 128.0) - 3.0 * (d1 - 120.0) * d2 + 3.0 * d2 * d2) / (128.0 * (32.0 - 3.0 * d2)); + } + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0007-Simpler-ShapelessRecipe-comparison-for-vanilla.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0007-Simpler-ShapelessRecipe-comparison-for-vanilla.patch new file mode 100644 index 00000000..c445a7a1 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0007-Simpler-ShapelessRecipe-comparison-for-vanilla.patch @@ -0,0 +1,89 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 16:22:47 +0100 +Subject: [PATCH] Simpler ShapelessRecipe comparison for vanilla + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Simpler ShapelessRecipes comparison for Vanilla" +By: Paul Sauve +As part of: Airplane (https://github.com/TECHNOVE/Airplane) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Airplane description * + +Paper added a fancy sorting comparison due to Bukkit recipes breaking +the vanilla one, however this is far more advanced than what you need +for all the vanilla recipes. + +* 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 . + +diff --git a/net/minecraft/world/item/crafting/ShapelessRecipe.java b/net/minecraft/world/item/crafting/ShapelessRecipe.java +index d601b54b1de2f2ae44fe2b20c8116c71a6340e45..6a53e97d27d746621892ced4ca5b4a56b6bc4c23 100644 +--- a/net/minecraft/world/item/crafting/ShapelessRecipe.java ++++ b/net/minecraft/world/item/crafting/ShapelessRecipe.java +@@ -23,8 +23,16 @@ public class ShapelessRecipe implements CraftingRecipe { + final List ingredients; + @Nullable + private PlacementInfo placementInfo; ++ private final boolean isBukkit; // Gale - Airplane - simpler ShapelessRecipe comparison for vanilla + + public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, List ingredients) { ++ // Gale start - Airplane - simpler ShapelessRecipe comparison for vanilla ++ this(group, category, result, ingredients, false); ++ } ++ ++ public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, List ingredients, boolean isBukkit) { ++ this.isBukkit = isBukkit; ++ // Gale end - Airplane - simpler ShapelessRecipe comparison for vanilla + this.group = group; + this.category = category; + this.result = result; +@@ -72,6 +80,29 @@ public class ShapelessRecipe implements CraftingRecipe { + + @Override + public boolean matches(CraftingInput input, Level level) { ++ // Gale start - Airplane - simpler ShapelessRecipe comparison for vanilla ++ if (!this.isBukkit) { ++ java.util.List ingredients = com.google.common.collect.Lists.newArrayList(this.ingredients.toArray(new Ingredient[0])); ++ ++ inventory: ++ for (int index = 0; index < input.size(); index++) { ++ ItemStack itemStack = input.getItem(index); ++ ++ if (!itemStack.isEmpty()) { ++ for (int i = 0; i < ingredients.size(); i++) { ++ if (ingredients.get(i).test(itemStack)) { ++ ingredients.remove(i); ++ continue inventory; ++ } ++ } ++ ++ return false; ++ } ++ } ++ ++ return ingredients.isEmpty(); ++ } ++ // Gale end - Airplane - simpler ShapelessRecipe comparison for vanilla + // Paper start - Improve exact choice recipe ingredients & unwrap ternary + if (input.ingredientCount() != this.ingredients.size()) { + return false; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0008-Reduce-projectile-chunk-loading.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0008-Reduce-projectile-chunk-loading.patch new file mode 100644 index 00000000..c125afcf --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0008-Reduce-projectile-chunk-loading.patch @@ -0,0 +1,92 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 24 Nov 2022 12:00:55 +0100 +Subject: [PATCH] Reduce projectile chunk loading + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Reduce projectile chunk loading" +By: Paul Sauve +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 . + +diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java +index ad0bb896d6ea669ce88bfe6490319e8ba7a29001..168f50523b00ab8d43cbcc5ea5675a840762be11 100644 +--- a/net/minecraft/world/entity/projectile/Projectile.java ++++ b/net/minecraft/world/entity/projectile/Projectile.java +@@ -49,6 +49,55 @@ public abstract class Projectile extends Entity implements TraceableEntity { + super(entityType, level); + } + ++ // Gale start - Airplane - reduce projectile chunk loading ++ private static int chunksLoadedThisTick = 0; ++ private static int chunksLoadedInTick; ++ private int chunksLoadedByProjectile = 0; ++ ++ @Override ++ public void setPos(double x, double y, double z) { ++ int currentTick = net.minecraft.server.MinecraftServer.currentTick; ++ ++ if (chunksLoadedInTick != currentTick) { ++ chunksLoadedInTick = currentTick; ++ chunksLoadedThisTick = 0; ++ } ++ ++ int previousX = Mth.floor(this.getX()) >> 4, previousZ = Mth.floor(this.getZ()) >> 4; ++ int newX = Mth.floor(x) >> 4, newZ = Mth.floor(z) >> 4; ++ ++ if (previousX != newX || previousZ != newZ) { ++ boolean isLoaded = ((net.minecraft.server.level.ServerChunkCache) this.level().getChunkSource()).getChunkAtIfLoadedImmediately(newX, newZ) != null; ++ ++ if (!isLoaded) { ++ var maxProjectileChunkLoadsConfig = this.level().galeConfig().smallOptimizations.maxProjectileChunkLoads; ++ int maxChunkLoadsPerTick = maxProjectileChunkLoadsConfig.perTick; ++ ++ if (maxChunkLoadsPerTick >= 0 && chunksLoadedThisTick > maxChunkLoadsPerTick) { ++ return; ++ } ++ ++ int maxChunkLoadsPerProjectile = maxProjectileChunkLoadsConfig.perProjectile.max; ++ ++ if (maxChunkLoadsPerProjectile >= 0 && this.chunksLoadedByProjectile >= maxChunkLoadsPerProjectile) { ++ if (maxProjectileChunkLoadsConfig.perProjectile.removeFromWorldAfterReachLimit) { ++ this.discard(); ++ } else if (maxProjectileChunkLoadsConfig.perProjectile.resetMovementAfterReachLimit) { ++ this.setDeltaMovement(0, this.getDeltaMovement().y, 0); ++ } ++ ++ return; ++ } ++ ++ chunksLoadedThisTick++; ++ this.chunksLoadedByProjectile++; ++ } ++ } ++ ++ super.setPos(x, y, z); ++ } ++ // Gale end - Airplane - reduce projectile chunk loading ++ + public void setOwner(@Nullable Entity owner) { + if (owner != null) { + this.ownerUUID = owner.getUUID(); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0009-Predict-Halloween.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0009-Predict-Halloween.patch new file mode 100644 index 00000000..b1357b30 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0009-Predict-Halloween.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 16:29:01 +0100 +Subject: [PATCH] Predict Halloween + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/world/entity/ambient/Bat.java b/net/minecraft/world/entity/ambient/Bat.java +index 5ebe7b1dce367d5c5e1136b97b2b9f6737595201..62085eecd2bb55721208c5fd126aaae56a50ed6b 100644 +--- a/net/minecraft/world/entity/ambient/Bat.java ++++ b/net/minecraft/world/entity/ambient/Bat.java +@@ -243,11 +243,66 @@ public class Bat extends AmbientCreature { + } + } + ++ // Gale start - predict Halloween ++ /** ++ * The 1-indexed month of the year that Halloween starts (inclusive). ++ */ ++ private static final int halloweenStartMonthOfYear = 10; ++ ++ /** ++ * The 1-indexed day of the month that Halloween starts (inclusive). ++ */ ++ private static final int halloweenStartDayOfMonth = 20; ++ ++ /** ++ * The 1-indexed month of the year that Halloween ends (exclusive). ++ */ ++ private static final int halloweenEndMonthOfYear = 11; ++ ++ /** ++ * The 1-indexed day of the month that Halloween ends (exclusive). ++ */ ++ private static final int halloweenEndDayOfMonth = 4; ++ ++ /** ++ * The next start of Halloween, given as milliseconds since the Unix epoch. ++ * Will be 0 while not computed yet. ++ */ ++ private static long nextHalloweenStart = 0; ++ ++ /** ++ * The next end of Halloween, given as milliseconds since the Unix epoch. ++ * Will be 0 while not computed yet. ++ */ ++ private static long nextHalloweenEnd = 0; ++ ++ // The Halloween begins at 10/20 0:00, and end with 11/04 0:00 ++ // Only when the current Halloween period ends, the `nextHalloweenStart` ++ // and `nextHalloweenEnd` will adjust to the epoch ms of date of next year ++ // These two fields will not change during current Halloween period. + private static boolean isHalloween() { +- LocalDate localDate = LocalDate.now(); +- int i = localDate.get(ChronoField.DAY_OF_MONTH); +- int i1 = localDate.get(ChronoField.MONTH_OF_YEAR); +- return i1 == 10 && i >= 20 || i1 == 11 && i <= 3; ++ long currentEpochMillis = System.currentTimeMillis(); ++ ++ if (currentEpochMillis > nextHalloweenEnd) { ++ // Update prediction ++ ++ java.time.OffsetDateTime currentDate = java.time.OffsetDateTime.now(); ++ int currentMonthOfYear = currentDate.getMonth().getValue(); ++ int currentDayOfMonth = currentDate.getDayOfMonth(); ++ ++ java.time.OffsetDateTime nextHalloweenStartDate = currentDate.withMonth(halloweenStartMonthOfYear).withDayOfMonth(halloweenStartDayOfMonth) ++ .withHour(0).withMinute(0).withSecond(0).withNano(0); // Adjust to directly start or end at zero o'clock ++ ++ if (currentMonthOfYear >= halloweenEndMonthOfYear && currentDayOfMonth >= halloweenEndDayOfMonth) { ++ nextHalloweenStartDate = nextHalloweenStartDate.plusYears(1); ++ } ++ ++ nextHalloweenStart = nextHalloweenStartDate.toInstant().toEpochMilli(); ++ nextHalloweenEnd = nextHalloweenStartDate.withMonth(halloweenEndMonthOfYear).withDayOfMonth(halloweenEndDayOfMonth).toInstant().toEpochMilli(); ++ } ++ ++ return currentEpochMillis >= nextHalloweenStart; ++ // Gale end - predict Halloween + } + + private void setupAnimationStates() { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0010-Move-random-tick-random.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0010-Move-random-tick-random.patch new file mode 100644 index 00000000..8091b514 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0010-Move-random-tick-random.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 16:53:40 +0100 +Subject: [PATCH] Move random tick random + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Move ThreadUnsafeRandom Initialization" +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Pufferfish description * + +ThreadUnsafeRandom is initialized too late and some of our patches +require it to be initialized earlier. By moving it to the superclass, we +initialize it earlier, ensuring that it is available sooner. + +diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java +index 93b0265e3b1ea133877682721ff28d735d9b688b..e43fa760210cb4c956b2143a65452eecf5f923f4 100644 +--- a/net/minecraft/server/level/ServerLevel.java ++++ b/net/minecraft/server/level/ServerLevel.java +@@ -841,8 +841,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + + // Paper start - optimise random ticking +- private final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed()); +- + private void optimiseRandomTick(final LevelChunk chunk, final int tickSpeed) { + final LevelChunkSection[] sections = chunk.getSections(); + final int minSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMinSection((ServerLevel)(Object)this); +diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java +index 73678ed00529af2369c66900c948de5fb46cc128..c4563e827a8333d57aabce1ff8e4c28d7e3a295b 100644 +--- a/net/minecraft/world/level/Level.java ++++ b/net/minecraft/world/level/Level.java +@@ -181,6 +181,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions + public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here + ++ public final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed()); // Gale - Pufferfish - move random tick random ++ + public CraftWorld getWorld() { + return this.world; + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0011-Optimize-random-calls-in-chunk-ticking.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0011-Optimize-random-calls-in-chunk-ticking.patch new file mode 100644 index 00000000..6bf96a73 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0011-Optimize-random-calls-in-chunk-ticking.patch @@ -0,0 +1,127 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 16:45:45 +0100 +Subject: [PATCH] Optimize random calls in chunk ticking + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Optimize random calls in chunk ticking" +By: Paul Sauve +As part of: Airplane (https://github.com/TECHNOVE/Airplane) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +The patch also received the following subsequent modification: +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Airplane description * + +Especially at over 30,000 chunks these random calls are fairly heavy. We +use a different method here for checking lightning, and for checking +ice. + +Lightning: Each chunk now keeps an int of how many ticks until the +lightning should strike. This int is a random number from 0 to 100000 * 2, +the multiplication is required to keep the probability the same. + +Ice and snow: We just generate a single random number 0-16 and increment +it, while checking if it's 0 for the current chunk. + +Depending on configuration for things that tick in a chunk, this is a +5-10% improvement. + +* 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 . + +diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java +index 9500fc2f841819b0d40e8a6e48353bb28b6dbe49..5c8d76b80c6cefd87088282e59f5f0f72a4f1611 100644 +--- a/net/minecraft/server/level/ServerChunkCache.java ++++ b/net/minecraft/server/level/ServerChunkCache.java +@@ -495,6 +495,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + long l = gameTime - this.lastInhabitedUpdate; + this.lastInhabitedUpdate = gameTime; + if (!this.level.isDebug()) { ++ this.level.resetIceAndSnowTick(); // Gale - Airplane - optimize random calls in chunk ticking - reset ice & snow tick random + if (this.level.tickRateManager().runsNormally()) { + List list = this.tickingChunks; + +diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java +index e43fa760210cb4c956b2143a65452eecf5f923f4..b35fe7112f2ad94e85e98931c403b3ffa8608382 100644 +--- a/net/minecraft/server/level/ServerLevel.java ++++ b/net/minecraft/server/level/ServerLevel.java +@@ -890,13 +890,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + // Paper end - optimise random ticking + ++ private int currentIceAndSnowTick = 0; protected void resetIceAndSnowTick() { this.currentIceAndSnowTick = this.simpleRandom.nextInt(16); } // Gale - Airplane - optimize random calls in chunk ticking ++ + public void tickChunk(LevelChunk chunk, int randomTickSpeed) { + final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = this.simpleRandom; // Paper - optimise random ticking + ChunkPos pos = chunk.getPos(); + boolean isRaining = this.isRaining(); + int minBlockX = pos.getMinBlockX(); + int minBlockZ = pos.getMinBlockZ(); +- if (!this.paperConfig().environment.disableThunder && isRaining && this.isThundering() && this.spigotConfig.thunderChance > 0 && simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking ++ if (!this.paperConfig().environment.disableThunder && isRaining && this.isThundering() && this.spigotConfig.thunderChance > 0 /*&& simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0*/ && chunk.shouldDoLightning(this.random)) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking // Gale - Airplane - optimize random calls in chunk ticking - replace random with shouldDoLightning + BlockPos blockPos = this.findLightningTargetAround(this.getBlockRandomPos(minBlockX, 0, minBlockZ, 15)); + if (this.isRainingAt(blockPos)) { + DifficultyInstance currentDifficultyAt = this.getCurrentDifficultyAt(blockPos); +@@ -922,7 +924,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + } + +- if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow ++ if (!this.paperConfig().environment.disableIceAndSnow && (this.currentIceAndSnowTick++ & 15) == 0) { // Paper - Option to disable ice and snow // Gale - Airplane - optimize random calls in chunk ticking - optimize further random ticking + for (int i = 0; i < randomTickSpeed; i++) { + if (simpleRandom.nextInt(48) == 0) { // Paper - optimise random ticking + this.tickPrecipitation(this.getBlockRandomPos(minBlockX, 0, minBlockZ, 15)); +diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java +index 3a7707427691a7862499a7efa3b39ead1ef78013..95972e7d5e0357ff5884f1cb2f7596c5029f999d 100644 +--- a/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/net/minecraft/world/level/chunk/LevelChunk.java +@@ -125,6 +125,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + } + // Paper end - get block chunk optimisation + ++ // Gale start - Airplane - optimize random calls in chunk ticking - instead of using a random every time the chunk is ticked, define when lightning strikes preemptively ++ private int lightningTick; ++ // shouldDoLightning compiles down to 29 bytes, which with the default of 35 byte inlining should guarantee an inline ++ public final boolean shouldDoLightning(net.minecraft.util.RandomSource random) { ++ if (this.lightningTick-- <= 0) { ++ this.lightningTick = random.nextInt(this.level.spigotConfig.thunderChance) << 1; ++ return true; ++ } ++ return false; ++ } ++ // Gale end - Airplane - optimize random calls in chunk ticking - instead of using a random every time the chunk is ticked, define when lightning strikes preemptively ++ + public LevelChunk(Level level, ChunkPos pos) { + this(level, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, null, null, null); + } +@@ -161,6 +173,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + this.debug = !empty && this.level.isDebug(); + this.defaultBlockState = empty ? VOID_AIR_BLOCKSTATE : AIR_BLOCKSTATE; + // Paper end - get block chunk optimisation ++ ++ this.lightningTick = this.level.simpleRandom.nextInt(100000) << 1; // Gale - Airplane - optimize random calls in chunk ticking - initialize lightning tick + } + + public LevelChunk(ServerLevel level, ProtoChunk chunk, @Nullable LevelChunk.PostLoadProcessor postLoad) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0012-Reduce-enderman-teleport-chunk-lookups.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0012-Reduce-enderman-teleport-chunk-lookups.patch new file mode 100644 index 00000000..fcd599cc --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0012-Reduce-enderman-teleport-chunk-lookups.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 19:53:35 +0100 +Subject: [PATCH] Reduce enderman teleport chunk lookups + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Reduce chunk loading & lookups" +By: Paul Sauve +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 . + +diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java +index 4b5ffd278e0e9d47100e5452949e8d757bbfece4..00c0d2432b4a0e46f85f1f422772e6c43ef5222c 100644 +--- a/net/minecraft/world/entity/monster/EnderMan.java ++++ b/net/minecraft/world/entity/monster/EnderMan.java +@@ -309,11 +309,19 @@ public class EnderMan extends Monster implements NeutralMob { + private boolean teleport(double x, double y, double z) { + BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(x, y, z); + +- while (mutableBlockPos.getY() > this.level().getMinY() && !this.level().getBlockState(mutableBlockPos).blocksMotion()) { ++ // Gale start - Airplane - single chunk lookup ++ net.minecraft.world.level.chunk.LevelChunk chunk = this.level().getChunkIfLoaded(mutableBlockPos); ++ ++ if (chunk == null) { ++ return false; ++ } ++ ++ while (mutableBlockPos.getY() > this.level().getMinY() && !chunk.getBlockState(mutableBlockPos).blocksMotion()) { ++ // Gale end - Airplane - single chunk lookup + mutableBlockPos.move(Direction.DOWN); + } + +- BlockState blockState = this.level().getBlockState(mutableBlockPos); ++ BlockState blockState = chunk.getBlockState(mutableBlockPos); // Gale - Airplane - single chunk lookup + boolean flag = blockState.blocksMotion(); + boolean isWater = blockState.getFluidState().is(FluidTags.WATER); + if (flag && !isWater) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0013-Reduce-acquire-POI-for-stuck-entities.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0013-Reduce-acquire-POI-for-stuck-entities.patch new file mode 100644 index 00000000..5ae54663 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0013-Reduce-acquire-POI-for-stuck-entities.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 20:12:48 +0100 +Subject: [PATCH] Reduce acquire POI for stuck entities + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Skip POI finding if stuck in vehicle" +By: Paul Sauve +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 . + +diff --git a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +index b9174ae7e3a3e2de2d570b95ab5012ac3c3a2eda..751e91a922b20c96f27885c3eb085ec4ae39091b 100644 +--- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java ++++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +@@ -28,6 +28,13 @@ import org.apache.commons.lang3.mutable.MutableLong; + public class AcquirePoi { + public static final int SCAN_RANGE = 48; + ++ // Gale start - Airplane - reduce acquire POI for stuck entities ++ private static void addAdditionalTimeToMutableLongIfMobIsStuck(MutableLong mutableLong, net.minecraft.server.level.ServerLevel level, PathfinderMob mob) { ++ long stuckEntityAdditionalWaitTime = level.galeConfig().smallOptimizations.reducedIntervals.acquirePoiForStuckEntity; ++ mutableLong.add(stuckEntityAdditionalWaitTime <= 0L ? 0L : mob.getNavigation().isStuck() ? stuckEntityAdditionalWaitTime : 0L); ++ } ++ // Gale end - Airplane - reduce acquire POI for stuck entities ++ + public static BehaviorControl create( + Predicate> acquirablePois, + MemoryModuleType acquiringMemory, +@@ -65,12 +72,13 @@ public class AcquirePoi { + return false; + } else if (mutableLong.getValue() == 0L) { + mutableLong.setValue(level.getGameTime() + level.random.nextInt(20)); ++ addAdditionalTimeToMutableLongIfMobIsStuck(mutableLong, level, mob); // Gale - Airplane - reduce acquire POI for stuck entities + return false; + } else if (level.getGameTime() < mutableLong.getValue()) { + return false; + } else { + mutableLong.setValue(time + 20L + level.getRandom().nextInt(20)); +- if (mob.getNavigation().isStuck()) mutableLong.add(200); // Paper - Perf: Wait an additional 10s to check again if they're stuck // TODO Modifies Vanilla behavior, add config option ++ addAdditionalTimeToMutableLongIfMobIsStuck(mutableLong, level, mob); // Paper - Perf: Wait an additional 10s to check again if they're stuck // TODO Modifies Vanilla behavior, add config option // Gale - Airplane - reduce acquire POI for stuck entities + PoiManager poiManager = level.getPoiManager(); + map.long2ObjectEntrySet().removeIf(entry -> !entry.getValue().isStillValid(time)); + Predicate predicate1 = pos -> { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0014-Check-targeting-range-before-getting-visibility.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0014-Check-targeting-range-before-getting-visibility.patch new file mode 100644 index 00000000..a182c1e0 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0014-Check-targeting-range-before-getting-visibility.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 20:21:06 +0100 +Subject: [PATCH] Check targeting range before getting visibility + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Early return optimization for target finding" +By: Paul Sauve +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 . + +diff --git a/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +index 2f8920d8ee765d057a22d76f24f7d7dc1b0b17ca..17a08a3af468093668a41f154c2beb69c6617efa 100644 +--- a/net/minecraft/world/entity/ai/targeting/TargetingConditions.java ++++ b/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +@@ -75,9 +75,18 @@ public class TargetingConditions { + } + + if (this.range > 0.0) { +- double d = this.testInvisible ? target.getVisibilityPercent(entity) : 1.0; +- double max = Math.max(this.range * d, 2.0); ++ // Gale start - Airplane - check targeting range before getting visibility ++ // d = invisibility percent, max = follow range adjusted for invisibility, d1 = distance + double d1 = entity.distanceToSqr(target.getX(), target.getY(), target.getZ()); ++ double followRangeRaw = this.range; ++ ++ if (d1 > followRangeRaw * followRangeRaw) { // the actual follow range will always be this value or smaller, so if the distance is larger then it never will return true after getting invis ++ return false; ++ } ++ ++ double d = this.testInvisible ? target.getVisibilityPercent(entity) : 1.0; ++ double max = Math.max(followRangeRaw * d, 2.0); ++ // Gale end - Airplane - check targeting range before getting visibility + if (d1 > max * max) { + return false; + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0015-Cache-on-climbable-check.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0015-Cache-on-climbable-check.patch new file mode 100644 index 00000000..f40620ef --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0015-Cache-on-climbable-check.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 20:40:40 +0100 +Subject: [PATCH] Cache on climbable check + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Cache climbing check for activation" +By: Paul Sauve +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 . + +diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java +index bd888ef719b9bfc93bace0b1d0fb771ac659f515..5d1e83658bb9646cf56885627256f0be7a84831e 100644 +--- a/io/papermc/paper/entity/activation/ActivationRange.java ++++ b/io/papermc/paper/entity/activation/ActivationRange.java +@@ -215,7 +215,7 @@ public final class ActivationRange { + } + // special cases. + if (entity instanceof final LivingEntity living) { +- if (living.onClimbable() || living.jumping || living.hurtTime > 0 || !living.activeEffects.isEmpty() || living.isFreezing()) { ++ if (living.onClimbableCached() || living.jumping || living.hurtTime > 0 || !living.activeEffects.isEmpty() || living.isFreezing()) { // Gale - Airplane - cache on climbable check - use cached + return 1; + } + if (entity instanceof final Mob mob && mob.getTarget() != null) { +diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java +index 00caebfabfc459eed86f0e6e2cc3f4b628f7ef99..181eec21013cc37dd252e3df047ad9ddda8ece19 100644 +--- a/net/minecraft/world/entity/LivingEntity.java ++++ b/net/minecraft/world/entity/LivingEntity.java +@@ -2015,6 +2015,21 @@ public abstract class LivingEntity extends Entity implements Attackable { + return this.lastClimbablePos; + } + ++ ++ // Gale start - Airplane - cache on climbable check ++ private boolean cachedOnClimbable = false; ++ private BlockPos lastClimbingPosition = null; ++ ++ public boolean onClimbableCached() { ++ if (!this.blockPosition().equals(this.lastClimbingPosition)) { ++ this.cachedOnClimbable = this.onClimbable(); ++ this.lastClimbingPosition = this.blockPosition(); ++ } ++ ++ return this.cachedOnClimbable; ++ } ++ // Gale end - Airplane - cache on climbable check ++ + public boolean onClimbable() { + if (this.isSpectator()) { + return false; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0016-Make-EntityCollisionContext-a-live-representation.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0016-Make-EntityCollisionContext-a-live-representation.patch new file mode 100644 index 00000000..b701c46c --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0016-Make-EntityCollisionContext-a-live-representation.patch @@ -0,0 +1,118 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 22:03:33 +0100 +Subject: [PATCH] Make EntityCollisionContext a live representation + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Make EntityCollisionContext a live representation" +By: Paul Sauve +As part of: Airplane (https://github.com/TECHNOVE/Airplane) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Airplane description * + +While Context is in the name, it is not used as a context. Instead it is +always created, use temporarily, then thrown away. This means having a +lot of fields to initialize and make space for is useless. I cannot find +anywhere in the codebase where this is used as a context which may be +saved for later, so this should be safe assuming plugins don't use it +for some strange reason. + +* 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 . + +diff --git a/net/minecraft/world/phys/shapes/EntityCollisionContext.java b/net/minecraft/world/phys/shapes/EntityCollisionContext.java +index dafcba6eeba62a5e35ad53c9b38605a17139d8b0..0c65addf32b09991392dcc1de8b477543fd02a81 100644 +--- a/net/minecraft/world/phys/shapes/EntityCollisionContext.java ++++ b/net/minecraft/world/phys/shapes/EntityCollisionContext.java +@@ -19,25 +19,35 @@ public class EntityCollisionContext implements CollisionContext { + return canAscend; + } + }; ++ // Gale start - Airplane - make EntityCollisionContext a live representation - remove these and pray no plugin uses them ++ /* + private final boolean descending; + private final double entityBottom; + private final ItemStack heldItem; + private final Predicate canStandOnFluid; ++ */ ++ // Gale end - Airplane - make EntityCollisionContext a live representation - remove these and pray no plugin uses them + @Nullable + private final Entity entity; + + protected EntityCollisionContext( + boolean descending, double entityBottom, ItemStack heldItem, Predicate canStandOnFluid, @Nullable Entity entity + ) { ++ // Gale start - Airplane - make EntityCollisionContext a live representation - remove these and pray no plugin uses them ++ /* + this.descending = descending; + this.entityBottom = entityBottom; + this.heldItem = heldItem; + this.canStandOnFluid = canStandOnFluid; ++ */ ++ // Gale end - Airplane - make EntityCollisionContext a live representation - remove these and pray no plugin uses them + this.entity = entity; + } + + @Deprecated + protected EntityCollisionContext(Entity entity, boolean canStandOnFluid) { ++ // Gale start - Airplane - make EntityCollisionContext a live representation - remove unneeded things ++ /* + this( + entity.isDescending(), + entity.getY(), +@@ -45,16 +55,19 @@ public class EntityCollisionContext implements CollisionContext { + canStandOnFluid ? fluidState -> true : (entity instanceof LivingEntity ? ((LivingEntity)entity)::canStandOnFluid : fluidState -> false), + entity + ); ++ */ ++ this.entity = entity; ++ // Gale end - Airplane - make EntityCollisionContext a live representation - remove unneeded things + } + + @Override + public boolean isHoldingItem(Item item) { +- return this.heldItem.is(item); ++ return this.entity instanceof LivingEntity livingEntity ? livingEntity.getMainHandItem().is(item) : ItemStack.EMPTY.is(item); // Gale - Airplane - make EntityCollisionContext a live representation + } + + @Override + public boolean canStandOnFluid(FluidState fluid1, FluidState fluid2) { +- return this.canStandOnFluid.test(fluid2) && !fluid1.getType().isSame(fluid2.getType()); ++ return this.entity instanceof LivingEntity livingEntity && livingEntity.canStandOnFluid(fluid2) && !fluid1.getType().isSame(fluid2.getType()); // Gale - Airplane - make EntityCollisionContext a live representation + } + + @Override +@@ -64,12 +77,12 @@ public class EntityCollisionContext implements CollisionContext { + + @Override + public boolean isDescending() { +- return this.descending; ++ return this.entity != null && this.entity.isDescending(); // Gale - Airplane - make EntityCollisionContext a live representation + } + + @Override + public boolean isAbove(VoxelShape shape, BlockPos pos, boolean canAscend) { +- return this.entityBottom > pos.getY() + shape.max(Direction.Axis.Y) - 1.0E-5F; ++ return (this.entity == null ? -Double.MAX_VALUE : entity.getY()) > (double) pos.getY() + shape.max(Direction.Axis.Y) - (double) 1.0E-5F; // Gale - Airplane - make EntityCollisionContext a live representation + } + + @Nullable diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0017-Better-checking-for-useless-move-packets.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0017-Better-checking-for-useless-move-packets.patch new file mode 100644 index 00000000..144a2f4e --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0017-Better-checking-for-useless-move-packets.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 22:26:37 +0100 +Subject: [PATCH] Better checking for useless move packets + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Better checking for useless move packets" +By: Paul Sauve +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 . + +diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java +index 0fb253aa55a24b56b17f524b3261c5b75c7d7e59..d985555a029d06ffc73dd10115df47b83c9afafd 100644 +--- a/net/minecraft/server/level/ServerEntity.java ++++ b/net/minecraft/server/level/ServerEntity.java +@@ -179,19 +179,25 @@ public class ServerEntity { + packet = ClientboundEntityPositionSyncPacket.of(this.entity); + flag3 = true; + flag4 = true; +- } else if ((!flag2 || !flag) && !(this.entity instanceof AbstractArrow)) { +- if (flag2) { +- packet = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short)l, (short)l1, (short)l2, this.entity.onGround()); +- flag3 = true; +- } else if (flag) { +- packet = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), b, b1, this.entity.onGround()); +- flag4 = true; +- } ++ // Gale start - Airplane - better checking for useless move packets + } else { +- packet = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short)l, (short)l1, (short)l2, b, b1, this.entity.onGround()); +- flag3 = true; +- flag4 = true; ++ if (flag2 || flag || this.entity instanceof AbstractArrow) { ++ if ((!flag2 || !flag) && !(this.entity instanceof AbstractArrow)) { ++ if (flag2) { ++ packet = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) l, (short) l1, (short) l2, this.entity.onGround()); ++ flag3 = true; ++ } else if (flag) { ++ packet = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), b, b1, this.entity.onGround()); ++ flag4 = true; ++ } ++ } else { ++ packet = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) l, (short) l1, (short) l2, b, b1, this.entity.onGround()); ++ flag3 = true; ++ flag4 = true; ++ } ++ } + } ++ // Gale end - Airplane - better checking for useless move packets + + if (this.entity.hasImpulse || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) { + Vec3 deltaMovement = this.entity.getDeltaMovement(); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0018-Block-goal-does-not-load-chunks.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0018-Block-goal-does-not-load-chunks.patch new file mode 100644 index 00000000..09985875 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0018-Block-goal-does-not-load-chunks.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 23:05:45 +0100 +Subject: [PATCH] Block goal does not load chunks + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Fix Paper#6045, block goal shouldn't load chunks" +By: Paul Sauve +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 . + +diff --git a/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +index d0ab3db7bbd2942db19f473474371b20ce822608..3f080b15543bf8c5fa0774b62d7f12e13b82511a 100644 +--- a/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java ++++ b/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +@@ -119,6 +119,7 @@ public abstract class MoveToBlockGoal extends Goal { + for (int i4 = 0; i4 <= i3; i4 = i4 > 0 ? -i4 : 1 - i4) { + for (int i5 = i4 < i3 && i4 > -i3 ? i3 : 0; i5 <= i3; i5 = i5 > 0 ? -i5 : 1 - i5) { + mutableBlockPos.setWithOffset(blockPos, i4, i2 - 1, i5); ++ if (!this.mob.level().hasChunkAt(mutableBlockPos)) continue; // Gale - Airplane - block goal does not load chunks - if this block isn't loaded, continue + if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) { + this.blockPos = mutableBlockPos; + this.mob.movingTarget = mutableBlockPos == BlockPos.ZERO ? null : mutableBlockPos.immutable(); // Paper diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0019-Reduce-entity-allocations.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0019-Reduce-entity-allocations.patch new file mode 100644 index 00000000..9226baf4 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0019-Reduce-entity-allocations.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 23:10:56 +0100 +Subject: [PATCH] Reduce entity allocations + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Reduce entity allocations" +By: Paul Sauve +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 . + +diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java +index a01491bc87d982adadd1890f72e31b893dfa7619..eee00c4d23a8b4c7e66d45d843ffc087fb183702 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -361,6 +361,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + return this.originWorld; + } + // Paper end - Entity origin API ++ + public float getBukkitYaw() { + return this.yRot; + } +diff --git a/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/net/minecraft/world/entity/ai/attributes/AttributeMap.java +index 4c808c7ef336de74048f40bd1cc8b14131a9325d..beebe81e13c99c6ddd9ffb2c7a3fdd74cb9c7afa 100644 +--- a/net/minecraft/world/entity/ai/attributes/AttributeMap.java ++++ b/net/minecraft/world/entity/ai/attributes/AttributeMap.java +@@ -23,9 +23,11 @@ public class AttributeMap { + private final Set attributesToSync = new ObjectOpenHashSet<>(); + private final Set attributesToUpdate = new ObjectOpenHashSet<>(); + private final AttributeSupplier supplier; ++ private final java.util.function.Function, AttributeInstance> createInstance; // Gale - Airplane - reduce entity allocations + + public AttributeMap(AttributeSupplier supplier) { + this.supplier = supplier; ++ this.createInstance = holder -> this.supplier.createInstance(this::onAttributeModified, holder); // Gale - Airplane - reduce entity allocations + } + + private void onAttributeModified(AttributeInstance instance) { +@@ -49,7 +51,7 @@ public class AttributeMap { + + @Nullable + public AttributeInstance getInstance(Holder attribute) { +- return this.attributes.computeIfAbsent(attribute, holder -> this.supplier.createInstance(this::onAttributeModified, (Holder)holder)); ++ return this.attributes.computeIfAbsent(attribute, this.createInstance); // Gale - Airplane - reduce entity allocations - cache lambda, as for some reason java allocates it anyways + } + + public boolean hasAttribute(Holder attribute) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0020-Remove-lambda-from-ticking-guard.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0020-Remove-lambda-from-ticking-guard.patch new file mode 100644 index 00000000..ef2aa589 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0020-Remove-lambda-from-ticking-guard.patch @@ -0,0 +1,74 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 23:13:56 +0100 +Subject: [PATCH] Remove lambda from ticking guard + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Remove lambda from ticking guard" +By: Paul Sauve +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 . + +diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java +index b35fe7112f2ad94e85e98931c403b3ffa8608382..2caeb69306a42d02b7a5c27e00fb969e392ac6ba 100644 +--- a/net/minecraft/server/level/ServerLevel.java ++++ b/net/minecraft/server/level/ServerLevel.java +@@ -794,7 +794,19 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + entity.stopRiding(); + } + +- this.guardEntityTick(this::tickNonPassenger, entity); ++ // Gale start - Airplane - remove lambda from ticking guard - copied from guardEntityTick ++ try { ++ this.tickNonPassenger(entity); // Gale - Airplane - remove lambda from ticking guard - changed ++ } catch (Throwable var6) { ++ // Paper start - Prevent block entity and entity crashes ++ final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); ++ MinecraftServer.LOGGER.error(msg, var6); ++ getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, var6))); // Paper - ServerExceptionEvent ++ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); ++ // Paper end - Prevent block entity and entity crashes ++ } ++ this.moonrise$midTickTasks(); // Paper - rewrite chunk system ++ // Gale end - Airplane - remove lambda from ticking guard - copied from guardEntityTick + } + } + } +diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java +index c4563e827a8333d57aabce1ff8e4c28d7e3a295b..51fa382b930ccbeb605064488ab4df985df94ed6 100644 +--- a/net/minecraft/world/level/Level.java ++++ b/net/minecraft/world/level/Level.java +@@ -1506,10 +1506,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); + MinecraftServer.LOGGER.error(msg, var6); + getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, var6))); // Paper - ServerExceptionEvent +- entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); ++ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Gale - Airplane - remove lambda from ticking guard - diff on change ServerLevel#tick + // Paper end - Prevent block entity and entity crashes + } +- this.moonrise$midTickTasks(); // Paper - rewrite chunk system ++ this.moonrise$midTickTasks(); // Paper - rewrite chunk system // Gale - Airplane - remove lambda from ticking guard - diff on change ServerLevel#tick + } + + // Paper start - Option to prevent armor stands from doing entity lookups diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0021-SIMD-support.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0021-SIMD-support.patch new file mode 100644 index 00000000..727855dc --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0021-SIMD-support.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 24 Nov 2022 01:19:12 +0100 +Subject: [PATCH] SIMD support + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add SIMD utilities" +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java +index baa92ab485928b2e57adb14af00f7e6120694184..3cd6e63ea6c18a26ef1aa394cf53d9e3463f8e50 100644 +--- a/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/net/minecraft/server/dedicated/DedicatedServer.java +@@ -231,6 +231,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics + com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now + ++ // Gale start - Pufferfish - SIMD support ++ // Initialize vectorization ++ try { ++ gg.pufferfish.pufferfish.simd.SIMDDetection.initialize(); ++ } catch (Throwable ignored) {} ++ // Gale end - Pufferfish - SIMD support ++ + this.setPvpAllowed(properties.pvp); + this.setFlightAllowed(properties.allowFlight); + this.setMotd(properties.motd); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0022-Make-book-writing-configurable.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0022-Make-book-writing-configurable.patch new file mode 100644 index 00000000..636898a8 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0022-Make-book-writing-configurable.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Mon, 26 Dec 2022 02:11:29 +0100 +Subject: [PATCH] Make book writing configurable + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add option to disable books" +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Pufferfish description * + +Books are commonly the target of duping-related exploits. If you +anticipate that your server will be an early target of duping attacks in +the event that new exploits are found, you may want to consider removing +the ability for non-privileged players to edit books. This patch allows +you to easily disable books, should you want to preemptively remove this +functionality before additional exploits are found. + +diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 1205307b7d2336fa6c5395a65be6643228c49d72..bac7225ea6095a746a71d5be2ba4bf147971827b 100644 +--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -1171,6 +1171,11 @@ public class ServerGamePacketListenerImpl + + @Override + public void handleEditBook(ServerboundEditBookPacket packet) { ++ // Gale start - Pufferfish - make book writing configurable ++ if (!(org.galemc.gale.configuration.GaleGlobalConfiguration.get().gameplayMechanics.enableBookWriting || this.player.getBukkitEntity().hasPermission(org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions.writeBooks) || this.player.getBukkitEntity().hasPermission("pufferfish.usebooks"))) { ++ return; ++ } ++ // Gale end - Pufferfish - make book writing configurable + // Paper start - Book size limits + final io.papermc.paper.configuration.type.number.IntOr.Disabled pageMax = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax; + if (!this.cserver.isPrimaryThread() && pageMax.enabled()) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0023-Reduce-in-wall-checks.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0023-Reduce-in-wall-checks.patch new file mode 100644 index 00000000..c66b32af --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0023-Reduce-in-wall-checks.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 24 Nov 2022 10:31:38 +0100 +Subject: [PATCH] Reduce in wall checks + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Optimize suffocation" +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Pufferfish description * + +The isInWall check to determine suffocation is quite expensive, and +often is completely unnecessary to check. We do two things here to +improve this: + +1. We only check for suffocation once per 20 ticks. The maximum +no-damage ticks value means that this change should be extremely +difficult, if not impossible, for players to notice. + +2. We additionally execute a check to see if the player can even take +damage in the first place. This check doesn't improve performance much +but is so much cheaper than the suffocation check that it's worth +keeping it. + +diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java +index 181eec21013cc37dd252e3df047ad9ddda8ece19..3a44887fa81676d4c06c10eae5d451eace7f595f 100644 +--- a/net/minecraft/world/entity/LivingEntity.java ++++ b/net/minecraft/world/entity/LivingEntity.java +@@ -448,7 +448,10 @@ public abstract class LivingEntity extends Entity implements Attackable { + if (this.isAlive()) { + boolean flag = this instanceof Player; + if (this.level() instanceof ServerLevel serverLevel1) { +- if (this.isInWall()) { ++ // Gale start - Pufferfish - reduce in wall checks ++ long checkStuckInWallInterval = this.level().galeConfig().smallOptimizations.reducedIntervals.checkStuckInWall; ++ if ((checkStuckInWallInterval <= 1 || (tickCount % checkStuckInWallInterval == 0 && couldPossiblyBeHurt(1.0F))) && this.isInWall()) { ++ // Gale end - Pufferfish - reduce in wall checks + this.hurtServer(serverLevel1, this.damageSources().inWall(), 1.0F); + } else if (flag && !this.level().getWorldBorder().isWithinBounds(this.getBoundingBox())) { + double d = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone(); +@@ -1354,6 +1357,12 @@ public abstract class LivingEntity extends Entity implements Attackable { + return this.getHealth() <= 0.0F; + } + ++ // Gale start - Pufferfish - reduce in wall checks ++ private boolean couldPossiblyBeHurt(float amount) { ++ return !((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F) || !(amount <= this.lastHurt); ++ } ++ // Gale end - Pufferfish - reduce in wall checks ++ + @Override + public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) { + if (this.isInvulnerableTo(level, damageSource)) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0024-Make-chat-order-verification-configurable.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0024-Make-chat-order-verification-configurable.patch new file mode 100644 index 00000000..39905a83 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0024-Make-chat-order-verification-configurable.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Mon, 26 Dec 2022 05:22:43 +0100 +Subject: [PATCH] Make chat order verification configurable + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add option to disable out-of-order chat" +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/network/chat/SignedMessageChain.java b/net/minecraft/network/chat/SignedMessageChain.java +index f6eed34b2fd72ab74cc9dc4b99ca184d512c0a66..23872fac07fa36f10ef090df2423c978998dcb99 100644 +--- a/net/minecraft/network/chat/SignedMessageChain.java ++++ b/net/minecraft/network/chat/SignedMessageChain.java +@@ -45,7 +45,7 @@ public class SignedMessageChain { + SignedMessageLink signedMessageLink = SignedMessageChain.this.nextLink; + if (signedMessageLink == null) { + throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.CHAIN_BROKEN); +- } else if (body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) { ++ } else if (body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp) && org.galemc.gale.configuration.GaleGlobalConfiguration.get().misc.verifyChatOrder) { // Gale - Pufferfish - make chat order verification configurable + this.setChainBroken(); + throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes + } else { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0025-Make-ender-dragon-respawn-attempt-after-placing-end-.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0025-Make-ender-dragon-respawn-attempt-after-placing-end-.patch new file mode 100644 index 00000000..a6e88afe --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0025-Make-ender-dragon-respawn-attempt-after-placing-end-.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Mon, 7 Aug 2023 21:35:57 +0200 +Subject: [PATCH] Make ender dragon respawn attempt after placing end crystals + configurable + +The original Pufferfish description has been included below for reference, +but please note that on Gale, there is no need to disable end crystal +spawning for performance: Gale already contains other performance +enhancements that make the end crystal checks very fast. + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Option to disable end crystal dragon respawning" +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Pufferfish description * + +On servers that expect end crystal fights in the end dimension, +disabling this will prevent the server from performing an expensive +search to attempt respawning the ender dragon whenever a player places +an end crystal. + +diff --git a/net/minecraft/world/item/EndCrystalItem.java b/net/minecraft/world/item/EndCrystalItem.java +index 1bc4c8be71b445f64134548a85fd81442298c0f1..a1570503d3e4dcc9f1cd0b119ab2e60f7c63b6d8 100644 +--- a/net/minecraft/world/item/EndCrystalItem.java ++++ b/net/minecraft/world/item/EndCrystalItem.java +@@ -49,10 +49,12 @@ public class EndCrystalItem extends Item { + // CraftBukkit end + level.addFreshEntity(endCrystal); + level.gameEvent(context.getPlayer(), GameEvent.ENTITY_PLACE, blockPos); ++ if (level.galeConfig().gameplayMechanics.tryRespawnEnderDragonAfterEndCrystalPlace) { // Gale - Pufferfish - make ender dragon respawn attempt after placing end crystals configurable + EndDragonFight dragonFight = ((ServerLevel)level).getDragonFight(); + if (dragonFight != null) { + dragonFight.tryRespawn(aboveBlockPosition); // Paper - Perf: Do crystal-portal proximity check before entity lookup + } ++ } // Gale - Pufferfish - make ender dragon respawn attempt after placing end crystals configurable + } + + context.getItemInHand().shrink(1); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0026-Make-saving-fireworks-configurable.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0026-Make-saving-fireworks-configurable.patch new file mode 100644 index 00000000..585254ce --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0026-Make-saving-fireworks-configurable.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Mon, 26 Dec 2022 07:30:30 +0100 +Subject: [PATCH] Make saving fireworks configurable + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Don't save Fireworks" +By: Aikar +As part of: EmpireCraft (https://github.com/starlis/empirecraft) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* EmpireCraft description * + +Fireworks can bug out and not detonate, and an automated +launcher can very easily fill a chunk. + +Prevent saving Fireworks so that chunk unloads will wipe a chunks fireworks in this case. + +diff --git a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +index 774ca9e0b56fd175ae246051de762d0c4256ca58..7f370f938d84240d763f60e51cddc705b3eaf5ea 100644 +--- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java ++++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +@@ -364,4 +364,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { + double d1 = entity.position().z - this.position().z; + return DoubleDoubleImmutablePair.of(d, d1); + } ++ ++ // Gale start - EMC - make saving fireworks configurable ++ @Override ++ public boolean shouldBeSaved() { ++ return this.level().galeConfig().smallOptimizations.saveFireworks; ++ } ++ // Gale end - EMC - make saving fireworks configurable + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0027-Reduce-hopper-item-checks.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0027-Reduce-hopper-item-checks.patch new file mode 100644 index 00000000..8309b2ac --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0027-Reduce-hopper-item-checks.patch @@ -0,0 +1,154 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 24 Nov 2022 23:03:52 +0100 +Subject: [PATCH] Reduce hopper item checks + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Improve Hopper Performance" +By: Aikar +As part of: EmpireCraft (https://github.com/starlis/empirecraft) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* EmpireCraft description * + +Only do an item "suck in" action once per second + +diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java +index 52a7ed0d991758bad0dcedcb7f97fb15ac6c6d04..8e450c9d0111c0ce44feb386cf8b2715e407bf25 100644 +--- a/net/minecraft/world/entity/item/ItemEntity.java ++++ b/net/minecraft/world/entity/item/ItemEntity.java +@@ -143,7 +143,13 @@ public class ItemEntity extends Entity implements TraceableEntity { + } + // CraftBukkit end + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause ++ return; // Gale - EMC - reduce hopper item checks + } ++ // Gale start - EMC - reduce hopper item checks ++ if (level().galeConfig().smallOptimizations.reducedIntervals.checkNearbyItem.hopper.minecart.temporaryImmunity.checkForMinecartNearItemWhileInactive) { ++ this.markNearbyHopperCartsAsImmune(); ++ } ++ // Gale end - EMC - reduce hopper item checks + } + // Paper end - EAR 2 + +@@ -227,9 +233,31 @@ public class ItemEntity extends Entity implements TraceableEntity { + } + // CraftBukkit end + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause ++ return; // Gale - EMC - reduce hopper item checks ++ } ++ this.markNearbyHopperCartsAsImmune(); // Gale - EMC - reduce hopper item checks ++ } ++ } ++ ++ // Gale start - EMC - reduce hopper item checks ++ private void markNearbyHopperCartsAsImmune() { ++ var config = this.level().galeConfig().smallOptimizations.reducedIntervals.checkNearbyItem.hopper.minecart; ++ ++ // No need to mark hopper minecarts as immune if they can pull every tick anyway ++ if (config.interval <= 1) { ++ return; ++ } ++ ++ if (config.temporaryImmunity.duration > 0 && this.isAlive() && this.onGround && !this.isRemoved() && (config.temporaryImmunity.nearbyItemMaxAge == -1 || this.age <= config.temporaryImmunity.nearbyItemMaxAge) && this.age % Math.max(1, config.temporaryImmunity.checkForMinecartNearItemInterval) == 0 && config.temporaryImmunity.maxItemHorizontalDistance >= 0 && config.temporaryImmunity.maxItemVerticalDistance >= 0) { ++ net.minecraft.world.phys.AABB aabb = this.getBoundingBox().inflate(config.temporaryImmunity.maxItemHorizontalDistance, config.temporaryImmunity.maxItemVerticalDistance, config.temporaryImmunity.maxItemHorizontalDistance); ++ for (Entity entity : this.level().getEntities(this, aabb)) { ++ if (entity instanceof net.minecraft.world.entity.vehicle.MinecartHopper hopper) { ++ hopper.pickupImmunity = net.minecraft.server.MinecraftServer.currentTick + config.temporaryImmunity.duration; ++ } + } + } + } ++ // Gale end - EMC - reduce hopper item checks + + @Override + public BlockPos getBlockPosBelowThatAffectsMyMovement() { +diff --git a/net/minecraft/world/entity/vehicle/MinecartHopper.java b/net/minecraft/world/entity/vehicle/MinecartHopper.java +index 8341e7f01606fca90e69384c16fc19bb9e20d1b7..c5a3dc3e704a9f6d67d9049e49cd1b33b6994766 100644 +--- a/net/minecraft/world/entity/vehicle/MinecartHopper.java ++++ b/net/minecraft/world/entity/vehicle/MinecartHopper.java +@@ -21,6 +21,7 @@ import net.minecraft.world.level.block.state.properties.RailShape; + public class MinecartHopper extends AbstractMinecartContainer implements Hopper { + private boolean enabled = true; + private boolean consumedItemThisFrame = false; ++ public int pickupImmunity = 0; // Gale - EMC - reduce hopper item checks + + public MinecartHopper(EntityType entityType, Level level) { + super(entityType, level); +@@ -149,4 +150,12 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper + } + // Paper end + ++ // Gale start - EMC - reduce hopper item checks ++ private long tickAttempts = 0; ++ @Override ++ public long getAndIncrementAttemptCounter() { ++ return tickAttempts++; ++ } ++ // Gale end EMC - - reduce hopper item checks ++ + } +diff --git a/net/minecraft/world/level/block/entity/Hopper.java b/net/minecraft/world/level/block/entity/Hopper.java +index 5f042e294db605827000123252b0df646968f897..e1cc15f28fe8da23b74ff4504c5b2da2236fda3f 100644 +--- a/net/minecraft/world/level/block/entity/Hopper.java ++++ b/net/minecraft/world/level/block/entity/Hopper.java +@@ -11,6 +11,8 @@ public interface Hopper extends Container { + return SUCK_AABB; + } + ++ long getAndIncrementAttemptCounter(); // Gale - EMC - reduce hopper item checks ++ + double getLevelX(); + + double getLevelY(); +diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java +index 5cd1326ad5d046c88b2b3449d610a78fa880b4cd..2549dd08b60cd81dcbf3412ed71cfc40729ae468 100644 +--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java ++++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java +@@ -540,7 +540,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + return false; + } else { + boolean flag = hopper.isGridAligned() && blockState.isCollisionShapeFullBlock(level, blockPos) && !blockState.is(BlockTags.DOES_NOT_BLOCK_HOPPERS); +- if (!flag) { ++ if (!flag && shouldSuckIn(level, hopper)) { // Gale - EMC - reduce hopper item checks + for (ItemEntity itemEntity : getItemsAtAndAbove(level, hopper)) { + if (addItem(hopper, itemEntity)) { + return true; +@@ -816,6 +816,34 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + return stack1.getCount() < stack1.getMaxStackSize() && ItemStack.isSameItemSameComponents(stack1, stack2); // Paper - Perf: Optimize Hoppers; used to return true for full itemstacks?! + } + ++ // Gale start - EMC - reduce hopper item checks ++ private long tickAttempts = 0; ++ @Override ++ public long getAndIncrementAttemptCounter() { ++ return tickAttempts++; ++ } ++ private static boolean shouldSuckIn(Level level, Hopper hopper) { ++ int suckInterval; ++ if (hopper instanceof net.minecraft.world.entity.vehicle.MinecartHopper minecartHopper) { ++ if (minecartHopper.pickupImmunity > net.minecraft.server.MinecraftServer.currentTick) { ++ return true; ++ } ++ ++ suckInterval = level.galeConfig().smallOptimizations.reducedIntervals.checkNearbyItem.hopper.minecart.interval; ++ } else { ++ suckInterval = level.galeConfig().smallOptimizations.reducedIntervals.checkNearbyItem.hopper.interval; ++ } ++ ++ if (suckInterval <= 1) { ++ return true; ++ } ++ ++ final int hopperId = (int) hopper.getLevelX() + (int) hopper.getLevelY() + (int) hopper.getLevelZ(); ++ ++ return (hopper.getAndIncrementAttemptCounter() + hopperId) % suckInterval == 0; ++ } ++ // Gale end - EMC - reduce hopper item checks ++ + @Override + public double getLevelX() { + return this.worldPosition.getX() + 0.5; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0028-Reduce-villager-item-re-pickup.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0028-Reduce-villager-item-re-pickup.patch new file mode 100644 index 00000000..90d7049f --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0028-Reduce-villager-item-re-pickup.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 24 Nov 2022 23:15:49 +0100 +Subject: [PATCH] Reduce villager item re-pickup + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Slow down villager pickup of thrown items" +By: Aikar +As part of: EmpireCraft (https://github.com/starlis/empirecraft) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* EmpireCraft description * + +Helps 1.8 Farms let hoppers pick it up before Villager +due to our hopper changes + +diff --git a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java +index 2664d72c3b6906d0505df2e63c0e5075eba9461b..e7f74b4f54069ffdf74f029639cbf0756f2db095 100644 +--- a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java ++++ b/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java +@@ -87,7 +87,17 @@ public class BehaviorUtils { + Vec3 vec3 = offset.subtract(entity.position()); + vec3 = vec3.normalize().multiply(speedMultiplier.x, speedMultiplier.y, speedMultiplier.z); + itemEntity.setDeltaMovement(vec3); +- itemEntity.setDefaultPickUpDelay(); ++ // Gale start - EMC - reduce villager item re-pickup ++ if (entity instanceof net.minecraft.world.entity.npc.Villager) { ++ int repickupDelay = entity.level().galeConfig().smallOptimizations.reducedIntervals.villagerItemRepickup; ++ ++ if (repickupDelay <= -1) { ++ itemEntity.setDefaultPickUpDelay(); ++ } else { ++ itemEntity.pickupDelay = repickupDelay; ++ } ++ } ++ // Gale end - EMC - reduce villager item re-pickup + // CraftBukkit start + org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(entity.getBukkitEntity(), (org.bukkit.entity.Item) itemEntity.getBukkitEntity()); + itemEntity.level().getCraftServer().getPluginManager().callEvent(event); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0029-Variable-entity-wake-up-duration.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0029-Variable-entity-wake-up-duration.patch new file mode 100644 index 00000000..95708a5f --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0029-Variable-entity-wake-up-duration.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 22 Mar 2023 00:18:15 +0100 +Subject: [PATCH] Variable entity wake-up duration + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java +index 5d1e83658bb9646cf56885627256f0be7a84831e..54916fe57ceeab24936ce50709402ecf1fcd9a10 100644 +--- a/io/papermc/paper/entity/activation/ActivationRange.java ++++ b/io/papermc/paper/entity/activation/ActivationRange.java +@@ -53,27 +53,41 @@ public final class ActivationRange { + if (entity.activationType == ActivationType.VILLAGER) { + if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) { + world.wakeupInactiveRemainingVillagers--; +- return config.wakeUpInactiveVillagersFor; ++ return getWakeUpDurationWithVariance(entity, config.wakeUpInactiveVillagersFor); // Gale - variable entity wake-up duration + } + } else if (entity.activationType == ActivationType.ANIMAL) { + if (inactiveFor > config.wakeUpInactiveAnimalsEvery && world.wakeupInactiveRemainingAnimals > 0) { + world.wakeupInactiveRemainingAnimals--; +- return config.wakeUpInactiveAnimalsFor; ++ return getWakeUpDurationWithVariance(entity, config.wakeUpInactiveAnimalsFor); // Gale - variable entity wake-up duration + } + } else if (entity.activationType == ActivationType.FLYING_MONSTER) { + if (inactiveFor > config.wakeUpInactiveFlyingEvery && world.wakeupInactiveRemainingFlying > 0) { + world.wakeupInactiveRemainingFlying--; +- return config.wakeUpInactiveFlyingFor; ++ return getWakeUpDurationWithVariance(entity, config.wakeUpInactiveFlyingFor); // Gale - variable entity wake-up duration + } + } else if (entity.activationType == ActivationType.MONSTER || entity.activationType == ActivationType.RAIDER) { + if (inactiveFor > config.wakeUpInactiveMonstersEvery && world.wakeupInactiveRemainingMonsters > 0) { + world.wakeupInactiveRemainingMonsters--; +- return config.wakeUpInactiveMonstersFor; ++ return getWakeUpDurationWithVariance(entity, config.wakeUpInactiveMonstersFor); // Gale - variable entity wake-up duration + } + } + return -1; + } + ++ // Gale start - variable entity wake-up duration ++ private static final java.util.Random wakeUpDurationRandom = new java.util.Random(); ++ ++ private static int getWakeUpDurationWithVariance(Entity entity, int wakeUpDuration) { ++ double deviation = entity.level().galeConfig().gameplayMechanics.entityWakeUpDurationRatioStandardDeviation; ++ ++ if (deviation <= 0) { ++ return wakeUpDuration; ++ } ++ ++ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(wakeUpDuration * wakeUpDurationRandom.nextGaussian(1, deviation)))); ++ } ++ // Gale end - variable entity wake-up duration ++ + static AABB maxBB = new AABB(0, 0, 0, 0, 0, 0); + + /** diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0030-Do-not-process-chat-commands-before-player-has-joine.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0030-Do-not-process-chat-commands-before-player-has-joine.patch new file mode 100644 index 00000000..01359841 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0030-Do-not-process-chat-commands-before-player-has-joine.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 29 Nov 2022 15:33:32 +0100 +Subject: [PATCH] Do not process chat/commands before player has joined + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Do not process chat/commands before player has joined" +By: chickeneer +As part of: EmpireCraft (https://github.com/starlis/empirecraft) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java +index c11150dada66888e5332ec88d153dea3eca2aa3e..8a20de0780dbcec5f228f549a4134fce9714d170 100644 +--- a/net/minecraft/server/level/ServerPlayer.java ++++ b/net/minecraft/server/level/ServerPlayer.java +@@ -393,6 +393,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + public boolean joining = true; + public boolean sentListPacket = false; + public boolean supressTrackerForLogin = false; // Paper - Fire PlayerJoinEvent when Player is actually ready ++ public boolean didPlayerJoinEvent = false; // Gale - EMC - do not process chat/commands before player has joined + // CraftBukkit end + public boolean isRealPlayer; // Paper + public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent +diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 5582c7045a78bd69091c3bd72d221c8cbc90da6f..fdffb9dac6bba5562f584e63d52ecf45383214ab 100644 +--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2342,7 +2342,7 @@ public class ServerGamePacketListenerImpl + this.disconnectAsync(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add proper async disconnect + } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales + this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false)); +- } else { ++ } else if (player.didPlayerJoinEvent) { // Gale - EMC - do not process chat/commands before player has joined + this.player.resetLastActionTime(); + // CraftBukkit start + if (sync) { +diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java +index d37df76d08d53374f862de400a379f8b76e9f241..6ed4b7c5315d7bbeefc94f1320f52e5189f93518 100644 +--- a/net/minecraft/server/players/PlayerList.java ++++ b/net/minecraft/server/players/PlayerList.java +@@ -330,6 +330,8 @@ public abstract class PlayerList { + return; + } + ++ player.didPlayerJoinEvent = true; // Gale - EMC - do not process chat/commands before player has joined ++ + final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage(); + + if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0031-Do-not-log-invalid-statistics.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0031-Do-not-log-invalid-statistics.patch new file mode 100644 index 00000000..6072494f --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0031-Do-not-log-invalid-statistics.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 24 Nov 2022 23:39:32 +0100 +Subject: [PATCH] Do not log invalid statistics + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Ignore statistics warnings" +By: Aikar +As part of: EmpireCraft (https://github.com/starlis/empirecraft) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/net/minecraft/stats/ServerStatsCounter.java b/net/minecraft/stats/ServerStatsCounter.java +index 6c5205fe1dc6387a77b1edbdcab748d39e775d7f..b26dbe807e5cb0a42f6c06b933397902310e5616 100644 +--- a/net/minecraft/stats/ServerStatsCounter.java ++++ b/net/minecraft/stats/ServerStatsCounter.java +@@ -113,16 +113,20 @@ public class ServerStatsCounter extends StatsCounter { + Util.ifElse( + this.getStat(type, string1), + stat -> this.stats.put(stat, compound1.getInt(string1)), +- () -> LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.file, string1) ++ () -> { ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.invalidStatistics) LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.file, string1); // Gale - EMC - do not log invalid statistics ++ } + ); + } else { +- LOGGER.warn( ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.invalidStatistics) LOGGER.warn( // Gale - EMC - do not log invalid statistics + "Invalid statistic value in {}: Don't know what {} is for key {}", this.file, compound1.get(string1), string1 + ); + } + } + }, +- () -> LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.file, string) ++ () -> { ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.invalidStatistics) LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.file, string); // Gale - EMC - do not log invalid statistics ++ } + ); + } + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0032-Do-not-log-empty-message-warnings.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0032-Do-not-log-empty-message-warnings.patch new file mode 100644 index 00000000..ed4db5c5 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0032-Do-not-log-empty-message-warnings.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 24 Nov 2022 23:45:57 +0100 +Subject: [PATCH] Do not log empty message warnings + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index aab9786db66740d281cf0be3ad921ccdfbc8c27e..52cb71a46161fd8b910b4b9afde2cb489c3a3c8b 100644 +--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2496,7 +2496,7 @@ public class ServerGamePacketListenerImpl + // CraftBukkit start + String rawMessage = message.signedContent(); + if (rawMessage.isEmpty()) { +- LOGGER.warn("{} tried to send an empty message", this.player.getScoreboardName()); ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.chat.emptyMessageWarning) LOGGER.warn("{} tried to send an empty message", this.player.getScoreboardName()); // Gale - do not log empty message warnings + } else if (this.getCraftPlayer().isConversing()) { + final String conversationInput = rawMessage; + this.server.processQueue.add(() -> ServerGamePacketListenerImpl.this.getCraftPlayer().acceptConversationInput(conversationInput)); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0033-Do-not-log-ignored-advancements.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0033-Do-not-log-ignored-advancements.patch new file mode 100644 index 00000000..57a75869 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0033-Do-not-log-ignored-advancements.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 25 Nov 2022 13:18:54 +0100 +Subject: [PATCH] Do not log ignored advancements + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Logger settings (suppressing pointless logs)" +By: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/server/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java +index 64dbee1f67eaa17c93c13bfa38fbe27de57651e4..ecb7edc1b10d23bb1979152341cd4a2b89613a65 100644 +--- a/net/minecraft/server/PlayerAdvancements.java ++++ b/net/minecraft/server/PlayerAdvancements.java +@@ -148,7 +148,7 @@ public class PlayerAdvancements { + AdvancementHolder advancementHolder = advancementManager.get(path); + if (advancementHolder == null) { + if (!path.getNamespace().equals(ResourceLocation.DEFAULT_NAMESPACE)) return; // CraftBukkit +- LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", path, this.playerSavePath); ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.ignoredAdvancements) LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", path, this.playerSavePath); // Gale - Purpur - do not log ignored advancements + } else { + this.startProgress(advancementHolder, progress); + this.progressChanged.add(advancementHolder); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0034-Do-not-log-setBlock-in-far-chunks.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0034-Do-not-log-setBlock-in-far-chunks.patch new file mode 100644 index 00000000..4a272cc3 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0034-Do-not-log-setBlock-in-far-chunks.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 25 Nov 2022 13:28:38 +0100 +Subject: [PATCH] Do not log setBlock in far chunks + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Logger settings (suppressing pointless logs)" +By: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/server/level/WorldGenRegion.java b/net/minecraft/server/level/WorldGenRegion.java +index 7fa41dea184b01891f45d8e404bc1cba19cf1bcf..c41f68a84fce082140cf1b18db328cfacae35208 100644 +--- a/net/minecraft/server/level/WorldGenRegion.java ++++ b/net/minecraft/server/level/WorldGenRegion.java +@@ -312,7 +312,7 @@ public class WorldGenRegion implements WorldGenLevel { + return true; + } else { + // Paper start - Buffer OOB setBlock calls +- if (!hasSetFarWarned) { ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.setBlockInFarChunk && !hasSetFarWarned) { // Gale - Purpur - do not log setBlock in far chunks + Util.logAndPauseIfInIde( + "Detected setBlock in a far chunk [" + + sectionPosX diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0035-Do-not-log-unrecognized-recipes.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0035-Do-not-log-unrecognized-recipes.patch new file mode 100644 index 00000000..4ddb0d3f --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0035-Do-not-log-unrecognized-recipes.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 25 Nov 2022 15:01:30 +0100 +Subject: [PATCH] Do not log unrecognized recipes + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Logger settings (suppressing pointless logs)" +By: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/stats/ServerRecipeBook.java b/net/minecraft/stats/ServerRecipeBook.java +index e3985b70cee7f7d56f179aeef8c2a6a6b312d83a..3418d7d3cf1116479f793e76e101d1c68bfe175c 100644 +--- a/net/minecraft/stats/ServerRecipeBook.java ++++ b/net/minecraft/stats/ServerRecipeBook.java +@@ -138,7 +138,7 @@ public class ServerRecipeBook extends RecipeBook { + try { + ResourceKey> resourceKey = ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(string)); + if (!isRecognized.test(resourceKey)) { +- LOGGER.error("Tried to load unrecognized recipe: {} removed now.", resourceKey); ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.unrecognizedRecipes) LOGGER.error("Tried to load unrecognized recipe: {} removed now.", resourceKey); // Gale - Purpur - do not log unrecognized recipes + } else { + output.accept(resourceKey); + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0036-Do-not-log-expired-message-warnings.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0036-Do-not-log-expired-message-warnings.patch new file mode 100644 index 00000000..7a630914 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0036-Do-not-log-expired-message-warnings.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 25 Nov 2022 15:07:55 +0100 +Subject: [PATCH] Do not log expired message warnings + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/network/chat/SignedMessageChain.java b/net/minecraft/network/chat/SignedMessageChain.java +index 23872fac07fa36f10ef090df2423c978998dcb99..44b166f5802468d7b1aefc8641496e0fefd6998f 100644 +--- a/net/minecraft/network/chat/SignedMessageChain.java ++++ b/net/minecraft/network/chat/SignedMessageChain.java +@@ -56,7 +56,7 @@ public class SignedMessageChain { + throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.INVALID_SIGNATURE); + } else { + if (playerChatMessage.hasExpiredServer(Instant.now())) { +- SignedMessageChain.LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", body.content()); ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.chat.expiredMessageWarning) SignedMessageChain.LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", body.content()); // Gale - do not log expired message warnings + } + + SignedMessageChain.this.nextLink = signedMessageLink.advance(); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0037-Do-not-log-Not-Secure-marker.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0037-Do-not-log-Not-Secure-marker.patch new file mode 100644 index 00000000..98a96a57 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0037-Do-not-log-Not-Secure-marker.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 25 Nov 2022 15:13:38 +0100 +Subject: [PATCH] Do not log Not Secure marker + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java +index 6ed4b7c5315d7bbeefc94f1320f52e5189f93518..7b8cc9e29bf021ce3b73803e820ee9b7926e05da 100644 +--- a/net/minecraft/server/players/PlayerList.java ++++ b/net/minecraft/server/players/PlayerList.java +@@ -1263,7 +1263,7 @@ public abstract class PlayerList { + public void broadcastChatMessage(PlayerChatMessage message, Predicate shouldFilterMessageTo, @Nullable ServerPlayer sender, ChatType.Bound boundChatType, @Nullable Function unsignedFunction) { + // Paper end + boolean flag = this.verifyChatTrusted(message); +- this.server.logChatMessage((unsignedFunction == null ? message.decoratedContent() : unsignedFunction.apply(this.server.console)), boundChatType, flag ? null : "Not Secure"); // Paper ++ this.server.logChatMessage((unsignedFunction == null ? message.decoratedContent() : unsignedFunction.apply(this.server.console)), boundChatType, flag || !org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.chat.notSecureMarker ? null : "Not Secure"); // Paper // Gale - do not log Not Secure marker + OutgoingChatMessage outgoingChatMessage = OutgoingChatMessage.create(message); + boolean flag1 = false; + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0038-Do-not-log-disconnections-with-null-id.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0038-Do-not-log-disconnections-with-null-id.patch new file mode 100644 index 00000000..9e9883ca --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0038-Do-not-log-disconnections-with-null-id.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 29 Jul 2023 11:20:35 +0200 +Subject: [PATCH] Do not log disconnections with null id + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add option to suppress null ID disconnections" +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Pufferfish description * + +This can help to hide annoying scanning bots from showing up in console. + +diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +index 6689aeacf50d1498e8d23cce696fb4fecbd1cf39..0fdf22af66945c1b6987e07f6c8a167110033b53 100644 +--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +@@ -146,6 +146,15 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + + public void disconnect(Component reason) { + try { ++ // Gale start - Pufferfish - do not log disconnections with null id ++ if (!org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.nullIdDisconnections && this.authenticatedProfile != null && this.authenticatedProfile.getId() == null) { ++ var reasonString = reason.getString(); ++ ++ if ("Disconnected".equals(reasonString) || Component.translatable("multiplayer.disconnect.generic").getString().equals(reasonString)) { ++ return; ++ } ++ } ++ // Gale end - Pufferfish - do not log disconnections with null id + LOGGER.info("Disconnecting {}: {}", this.getUserName(), reason.getString()); + this.connection.send(new ClientboundLoginDisconnectPacket(reason)); + this.connection.disconnect(reason); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0039-Do-not-log-run-as-root-warning.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0039-Do-not-log-run-as-root-warning.patch new file mode 100644 index 00000000..9779b7ab --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0039-Do-not-log-run-as-root-warning.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 1 Dec 2022 16:43:50 +0100 +Subject: [PATCH] Do not log run as root warning + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Options of warnings" +By: nostalgic853 +As part of: KeYi (https://github.com/MC-Multithreading-Lab/KeYi-MT) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* KeYi description * + +Let users decide if we should warn while running in a root user + +* KeYi copyright * + +MIT License + +Copyright (c) 2022 KeYiMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java +index 3cd6e63ea6c18a26ef1aa394cf53d9e3463f8e50..3c1e6320305fa41b27a78c844dcf6172b244cc9b 100644 +--- a/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/net/minecraft/server/dedicated/DedicatedServer.java +@@ -183,7 +183,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + } + + // Paper start - detect running as root +- if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) { ++ if (!"false".equalsIgnoreCase(System.getProperty("gale.log.warning.root")) && io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) { // Gale - KeYi - do not log run as root warning + LOGGER.warn("****************************"); + LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED."); + LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS."); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0040-Do-not-log-offline-mode-warning.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0040-Do-not-log-offline-mode-warning.patch new file mode 100644 index 00000000..353670c7 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0040-Do-not-log-offline-mode-warning.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 1 Dec 2022 16:52:27 +0100 +Subject: [PATCH] Do not log offline mode warning + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Options of warnings" +By: nostalgic853 +As part of: KeYi (https://github.com/MC-Multithreading-Lab/KeYi-MT) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* KeYi description * + +Let users decide if we should warn while running in offline mode + +* KeYi copyright * + +MIT License + +Copyright (c) 2022 KeYiMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java +index 3c1e6320305fa41b27a78c844dcf6172b244cc9b..f2e24d52240a84ff7ca69ad2c8ec0d1c197467c0 100644 +--- a/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/net/minecraft/server/dedicated/DedicatedServer.java +@@ -295,7 +295,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord"; + String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/"; + // Paper end - Add Velocity IP Forwarding Support +- if (!this.usesAuthentication()) { ++ if (!"false".equalsIgnoreCase(System.getProperty("gale.log.warning.offline.mode")) && !this.usesAuthentication()) { // Gale - KeYi - do not log offline mode warning + LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); + LOGGER.warn("The server will make no attempt to authenticate usernames. Beware."); + // Spigot start diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0041-Softly-log-invalid-pool-element-errors.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0041-Softly-log-invalid-pool-element-errors.patch new file mode 100644 index 00000000..242bad66 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0041-Softly-log-invalid-pool-element-errors.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 25 Nov 2022 16:26:04 +0100 +Subject: [PATCH] Softly log invalid pool element errors + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Change vanilla structure error to info log level" +By: chickeneer +As part of: EmpireCraft (https://github.com/starlis/empirecraft) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/net/minecraft/world/level/levelgen/structure/PoolElementStructurePiece.java b/net/minecraft/world/level/levelgen/structure/PoolElementStructurePiece.java +index 786fa3a33334ca6b4b43b89b6fde9de5c41a3b28..42600faa2a2393d71d93b6818ac64ab030737772 100644 +--- a/net/minecraft/world/level/levelgen/structure/PoolElementStructurePiece.java ++++ b/net/minecraft/world/level/levelgen/structure/PoolElementStructurePiece.java +@@ -80,7 +80,7 @@ public class PoolElementStructurePiece extends StructurePiece { + DynamicOps dynamicOps = context.registryAccess().createSerializationContext(NbtOps.INSTANCE); + StructurePoolElement.CODEC + .encodeStart(dynamicOps, this.element) +- .resultOrPartial(LOGGER::error) ++ .resultOrPartial(org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.invalidPoolElementErrorStringConsumer) // Gale - EMC - softly log invalid pool element errors) + .ifPresent(elementTag -> tag.put("pool_element", elementTag)); + tag.putString("rotation", this.rotation.name()); + ListTag listTag = new ListTag(); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0042-Fix-outdated-server-showing-in-ping-before-server-fu.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0042-Fix-outdated-server-showing-in-ping-before-server-fu.patch new file mode 100644 index 00000000..b1f09f66 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0042-Fix-outdated-server-showing-in-ping-before-server-fu.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 29 Nov 2022 15:50:22 +0100 +Subject: [PATCH] Fix 'outdated server' showing in ping before server fully + boots + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Fix 'outdated server' showing in ping before server fully boots" +By: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/net/minecraft/server/network/ServerStatusPacketListenerImpl.java +index 465559113071a47e706f77a5b0996597ee986b3d..74f698da88ed6432bee3105d3c35648b6f38f234 100644 +--- a/net/minecraft/server/network/ServerStatusPacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerStatusPacketListenerImpl.java +@@ -37,6 +37,7 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene + } else { + this.hasRequestedStatus = true; + // this.connection.send(new ClientboundStatusResponsePacket(this.status)); // Paper ++ if (net.minecraft.server.MinecraftServer.getServer().getStatus().version().isEmpty()) return; // Gale - Purpur - fix 'outdated server' showing in ping before server fully boots - do not respond to pings before we know the protocol version + com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(net.minecraft.server.MinecraftServer.getServer(), this.connection); // Paper - handle status request + } + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0043-Fix-MC-238526.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0043-Fix-MC-238526.patch new file mode 100644 index 00000000..a30bbaed --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0043-Fix-MC-238526.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 29 Nov 2022 16:16:35 +0100 +Subject: [PATCH] Fix MC-238526 + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"MC-238526 - Fix spawner not spawning water animals correctly" +By: BillyGalbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/world/entity/animal/WaterAnimal.java b/net/minecraft/world/entity/animal/WaterAnimal.java +index ed4f4c76a53c39c1a912fc0ff0d84f7fdb494b20..8910e2578bf8b7541a98f20ddc34255343ec4e4d 100644 +--- a/net/minecraft/world/entity/animal/WaterAnimal.java ++++ b/net/minecraft/world/entity/animal/WaterAnimal.java +@@ -74,8 +74,11 @@ public abstract class WaterAnimal extends PathfinderMob { + seaLevel = level.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(seaLevel); + i = level.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(i); + // Paper end - Make water animal spawn height configurable +- return pos.getY() >= i +- && pos.getY() <= seaLevel ++ // Gale start - Purpur - fix MC-238526 ++ boolean shouldFixMC238526 = spawnReason == EntitySpawnReason.SPAWNER && level.getMinecraftWorld().galeConfig().gameplayMechanics.fixes.mc238526; ++ boolean isAllowedHeight = pos.getY() >= i && pos.getY() <= seaLevel; ++ return (shouldFixMC238526 || isAllowedHeight) ++ // Gale end - Purpur - fix MC-238526 + && level.getFluidState(pos.below()).is(FluidTags.WATER) + && level.getBlockState(pos.above()).is(Blocks.WATER); + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0044-Fix-MC-121706.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0044-Fix-MC-121706.patch new file mode 100644 index 00000000..572bf5a3 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0044-Fix-MC-121706.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 29 Nov 2022 16:42:48 +0100 +Subject: [PATCH] Fix MC-121706 + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"MC-121706 - Fix mobs not looking up and down when strafing" +By: Krakenied +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java b/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java +index 722f378bb3726200b6fe88948bf1e1d3514a7b5c..b896f13f5aea09dafb1f1e74e1ef90dc53eae2ae 100644 +--- a/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java ++++ b/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java +@@ -103,7 +103,11 @@ public class RangedBowAttackGoal extends Go + this.strafingTime = 0; + } + +- if (this.strafingTime > -1) { ++ // Gale start - Purpur - fix MC-121706 ++ boolean hasStrafingTime = this.strafingTime > -1; ++ ++ if (hasStrafingTime) { ++ // Gale end - Purpur - fix MC-121706 + if (d > this.attackRadiusSqr * 0.75F) { + this.strafingBackwards = false; + } else if (d < this.attackRadiusSqr * 0.25F) { +@@ -116,7 +120,10 @@ public class RangedBowAttackGoal extends Go + } + + this.mob.lookAt(target, 30.0F, 30.0F); +- } else { ++ // Gale start - Purpur - fix MC-121706 ++ } ++ if (!hasStrafingTime || this.mob.level().galeConfig().gameplayMechanics.fixes.mc121706) { ++ // Gale end - Purpur - fix MC-121706 + this.mob.getLookControl().setLookAt(target, 30.0F, 30.0F); + } + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0045-Make-arrow-movement-resetting-despawn-counter-config.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0045-Make-arrow-movement-resetting-despawn-counter-config.patch new file mode 100644 index 00000000..e18bc271 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0045-Make-arrow-movement-resetting-despawn-counter-config.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 29 Nov 2022 21:37:22 +0100 +Subject: [PATCH] Make arrow movement resetting despawn counter configurable + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Arrows should not reset despawn counter" +By: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur description * + +This prevents keeping arrows alive indefinitely (such as when the block +the arrow is stuck in gets removed, like a piston head going up/down) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/world/entity/projectile/AbstractArrow.java b/net/minecraft/world/entity/projectile/AbstractArrow.java +index 541ee32182b595de7dd6717f8faea00d53c105a3..d206ac2b9cade292b0d69e9aeb0f81227ec0b49e 100644 +--- a/net/minecraft/world/entity/projectile/AbstractArrow.java ++++ b/net/minecraft/world/entity/projectile/AbstractArrow.java +@@ -347,7 +347,7 @@ public abstract class AbstractArrow extends Projectile { + this.setInGround(false); + Vec3 deltaMovement = this.getDeltaMovement(); + this.setDeltaMovement(deltaMovement.multiply(this.random.nextFloat() * 0.2F, this.random.nextFloat() * 0.2F, this.random.nextFloat() * 0.2F)); +- this.life = 0; ++ if (this.level().galeConfig().gameplayMechanics.arrowMovementResetsDespawnCounter) this.life = 0; // Gale - Purpur - make arrow movement resetting despawn counter configurable + } + + public boolean isInGround() { // Paper - protected -> public diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0046-Make-logging-login-locations-configurable.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0046-Make-logging-login-locations-configurable.patch new file mode 100644 index 00000000..d23a48c8 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0046-Make-logging-login-locations-configurable.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Mon, 26 Dec 2022 00:17:40 +0100 +Subject: [PATCH] Make logging login locations configurable + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"configurable logging of player login location" +By: Simon Gardling +As part of: JettPack (https://gitlab.com/Titaniumtown/JettPack) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java +index a0d56fcd58f943353b55821557d79c4dc0cdf46b..b4258db165b509d54b9c15a661c5b66ca984ffb3 100644 +--- a/net/minecraft/server/players/PlayerList.java ++++ b/net/minecraft/server/players/PlayerList.java +@@ -398,7 +398,13 @@ public abstract class PlayerList { + scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam); + } + // Paper end - Configurable player collision ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.playerLoginLocations) { // Gale - JettPack - make logging login location configurable + PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), loggableAddress, player.getId(), serverLevel.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ()); ++ // Gale start - JettPack - make logging login location configurable ++ } else { ++ PlayerList.LOGGER.info("{}[{}] logged in with entity id {}", player.getName().getString(), loggableAddress, player.getId()); ++ } ++ // Gale end - JettPack - make logging login location configurable + // Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead + if (player.isDeadOrDying()) { + net.minecraft.core.Holder plains = serverLevel.registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME) diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0047-Reduce-array-allocations.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0047-Reduce-array-allocations.patch new file mode 100644 index 00000000..3d1bb69c --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0047-Reduce-array-allocations.patch @@ -0,0 +1,363 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 26 Nov 2022 11:25:45 +0100 +Subject: [PATCH] Reduce array allocations + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"reduce allocs" +By: Simon Gardling +As part of: JettPack (https://gitlab.com/Titaniumtown/JettPack) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java +index d21ce54ebb5724c04eadf56a2cde701d5eeb5db2..b6af8da084c83ee38bb3ecea6a98feb0c1c74d2a 100644 +--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java ++++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java +@@ -378,7 +378,6 @@ public final class ChunkEntitySlices { + + private static final class BasicEntityList { + +- private static final Entity[] EMPTY = new Entity[0]; + private static final int DEFAULT_CAPACITY = 4; + + private E[] storage; +@@ -389,7 +388,7 @@ public final class ChunkEntitySlices { + } + + public BasicEntityList(final int cap) { +- this.storage = (E[])(cap <= 0 ? EMPTY : new Entity[cap]); ++ this.storage = (E[])(cap <= 0 ? me.titaniumtown.ArrayConstants.emptyEntityArray : new Entity[cap]); // Gale - JettPack - reduce array allocations + } + + public boolean isEmpty() { +@@ -401,7 +400,7 @@ public final class ChunkEntitySlices { + } + + private void resize() { +- if (this.storage == EMPTY) { ++ if (this.storage == me.titaniumtown.ArrayConstants.emptyEntityArray) { // Gale - JettPack - reduce array allocations + this.storage = (E[])new Entity[DEFAULT_CAPACITY]; + } else { + this.storage = Arrays.copyOf(this.storage, this.storage.length * 2); +diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java +index 26207443b1223119c03db478d7e816d9cdf8e618..bbd1c262674b42eb9ea2830acb8bf94182f971f9 100644 +--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java ++++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java +@@ -14,10 +14,8 @@ import net.minecraft.world.level.entity.LevelCallback; + + public final class ServerEntityLookup extends EntityLookup { + +- private static final Entity[] EMPTY_ENTITY_ARRAY = new Entity[0]; +- + private final ServerLevel serverWorld; +- public final ReferenceList trackerEntities = new ReferenceList<>(EMPTY_ENTITY_ARRAY); // Moonrise - entity tracker ++ public final ReferenceList trackerEntities = new ReferenceList<>(me.titaniumtown.ArrayConstants.emptyEntityArray); // Moonrise - entity tracker // Gale - JettPack - reduce array allocations + + public ServerEntityLookup(final ServerLevel world, final LevelCallback worldCallback) { + super(world, worldCallback); +diff --git a/net/minecraft/nbt/ByteArrayTag.java b/net/minecraft/nbt/ByteArrayTag.java +index 6927124a4ea1f460158bf25679104b6f9e9ccee4..dba08f2668d65ae5483f325af3a79b5a63919c50 100644 +--- a/net/minecraft/nbt/ByteArrayTag.java ++++ b/net/minecraft/nbt/ByteArrayTag.java +@@ -174,7 +174,7 @@ public class ByteArrayTag extends CollectionTag { + + @Override + public void clear() { +- this.data = new byte[0]; ++ this.data = me.titaniumtown.ArrayConstants.emptyByteArray; // Gale - JettPack - reduce array allocations + } + + @Override +diff --git a/net/minecraft/nbt/CompoundTag.java b/net/minecraft/nbt/CompoundTag.java +index 361bc458e0bb590c43da60a1cd993a2785ee45e9..3bce1e8ef90e95abd8b1111f1160f952d2493e69 100644 +--- a/net/minecraft/nbt/CompoundTag.java ++++ b/net/minecraft/nbt/CompoundTag.java +@@ -409,7 +409,7 @@ public class CompoundTag implements Tag { + throw new ReportedException(this.createReport(key, ByteArrayTag.TYPE, var3)); + } + +- return new byte[0]; ++ return me.titaniumtown.ArrayConstants.emptyByteArray; // Gale - JettPack - reduce array allocations + } + + public int[] getIntArray(String key) { +@@ -421,7 +421,7 @@ public class CompoundTag implements Tag { + throw new ReportedException(this.createReport(key, IntArrayTag.TYPE, var3)); + } + +- return new int[0]; ++ return me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations + } + + public long[] getLongArray(String key) { +@@ -433,7 +433,7 @@ public class CompoundTag implements Tag { + throw new ReportedException(this.createReport(key, LongArrayTag.TYPE, var3)); + } + +- return new long[0]; ++ return me.titaniumtown.ArrayConstants.emptyLongArray; // Gale - JettPack - reduce array allocations + } + + public CompoundTag getCompound(String key) { +diff --git a/net/minecraft/nbt/IntArrayTag.java b/net/minecraft/nbt/IntArrayTag.java +index 7e27546bcb587d03b6de2ab43244e6c61fdb55f4..c7f35f332117305bf0e34eb8b73ddfa73958e434 100644 +--- a/net/minecraft/nbt/IntArrayTag.java ++++ b/net/minecraft/nbt/IntArrayTag.java +@@ -181,7 +181,7 @@ public class IntArrayTag extends CollectionTag { + + @Override + public void clear() { +- this.data = new int[0]; ++ this.data = me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations + } + + @Override +diff --git a/net/minecraft/nbt/ListTag.java b/net/minecraft/nbt/ListTag.java +index 8bbe48a4d7d1771d17bec60b70bdf8e086bfd1c7..5ab487178544f6bc6b0c90d7a54b5c3ea1cdfbe9 100644 +--- a/net/minecraft/nbt/ListTag.java ++++ b/net/minecraft/nbt/ListTag.java +@@ -258,7 +258,7 @@ public class ListTag extends CollectionTag { + } + } + +- return new int[0]; ++ return me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations + } + + public long[] getLongArray(int index) { +@@ -269,7 +269,7 @@ public class ListTag extends CollectionTag { + } + } + +- return new long[0]; ++ return me.titaniumtown.ArrayConstants.emptyLongArray; // Gale - JettPack - reduce array allocations + } + + public double getDouble(int index) { +diff --git a/net/minecraft/nbt/LongArrayTag.java b/net/minecraft/nbt/LongArrayTag.java +index 7274aa8ccae9294dcdb718cbd4997f841eeb9eba..d33466f2ad3aa967fd2e6c0efa73805ba725b3c2 100644 +--- a/net/minecraft/nbt/LongArrayTag.java ++++ b/net/minecraft/nbt/LongArrayTag.java +@@ -185,7 +185,7 @@ public class LongArrayTag extends CollectionTag { + + @Override + public void clear() { +- this.data = new long[0]; ++ this.data = me.titaniumtown.ArrayConstants.emptyLongArray; // Gale - JettPack - reduce array allocations + } + + @Override +diff --git a/net/minecraft/network/CipherBase.java b/net/minecraft/network/CipherBase.java +index 121685cacef111fbec0057d386f748497bc3a36d..b4a4fafec1a8e279ec1e31e58fee2d5d34fb8289 100644 +--- a/net/minecraft/network/CipherBase.java ++++ b/net/minecraft/network/CipherBase.java +@@ -7,8 +7,8 @@ import javax.crypto.ShortBufferException; + + public class CipherBase { + private final Cipher cipher; +- private byte[] heapIn = new byte[0]; +- private byte[] heapOut = new byte[0]; ++ private byte[] heapIn = me.titaniumtown.ArrayConstants.emptyByteArray; // Gale - JettPack - reduce array allocations ++ private byte[] heapOut = me.titaniumtown.ArrayConstants.emptyByteArray; // Gale - JettPack - reduce array allocations + + protected CipherBase(Cipher cipher) { + this.cipher = cipher; +diff --git a/net/minecraft/network/chat/contents/TranslatableContents.java b/net/minecraft/network/chat/contents/TranslatableContents.java +index 68727deaedd55aa86e76fbc6cc2cfb67913f7add..bad5787de2034dbb0eabb9458a47a89e30dec886 100644 +--- a/net/minecraft/network/chat/contents/TranslatableContents.java ++++ b/net/minecraft/network/chat/contents/TranslatableContents.java +@@ -29,7 +29,7 @@ import net.minecraft.util.ExtraCodecs; + import net.minecraft.world.entity.Entity; + + public class TranslatableContents implements ComponentContents { +- public static final Object[] NO_ARGS = new Object[0]; ++ public static final Object[] NO_ARGS = me.titaniumtown.ArrayConstants.emptyObjectArray; // Gale - JettPack - reduce array allocations + private static final Codec PRIMITIVE_ARG_CODEC = ExtraCodecs.JAVA.validate(TranslatableContents::filterAllowedArguments); + private static final Codec ARG_CODEC = Codec.either(PRIMITIVE_ARG_CODEC, ComponentSerialization.CODEC) + .xmap( +diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java +index acb1168aba0069f9ac7f47d96f0f4945b37c3888..148be9d5e10d7a770814a10dc40bfb70b71d4021 100644 +--- a/net/minecraft/server/level/ServerLevel.java ++++ b/net/minecraft/server/level/ServerLevel.java +@@ -1224,7 +1224,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + + public static List getCurrentlyTickingEntities() { + Entity ticking = currentlyTickingEntity.get(); +- List ret = java.util.Arrays.asList(ticking == null ? new Entity[0] : new Entity[] { ticking }); ++ List ret = java.util.Arrays.asList(ticking == null ? me.titaniumtown.ArrayConstants.emptyEntityArray : new Entity[] { ticking }); // Gale - JettPack - reduce array allocations + + return ret; + } +diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 0f180795a7ab58f4376551ae6c313573696677f0..a3d0d331d367b8ddfd0ac450acd143ce7d3f7a9a 100644 +--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2786,7 +2786,7 @@ public class ServerGamePacketListenerImpl + target.refreshEntityData(ServerGamePacketListenerImpl.this.player); + // SPIGOT-7136 - Allays + if (target instanceof Allay || target instanceof net.minecraft.world.entity.animal.horse.AbstractHorse) { // Paper - Fix horse armor desync +- ServerGamePacketListenerImpl.this.send(new net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket(target.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, ((LivingEntity) target).getItemBySlot(slot).copy())).collect(Collectors.toList()), true)); // Paper - sanitize ++ ServerGamePacketListenerImpl.this.send(new net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket(target.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.VALUES_ARRAY).map((slot) -> Pair.of(slot, ((LivingEntity) target).getItemBySlot(slot).copy())).collect(Collectors.toList()), true)); // Paper - sanitize // Gale - JettPack - reduce array allocations + } + + ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote(); // Paper - fix slot desync - always refresh player inventory +diff --git a/net/minecraft/server/players/StoredUserList.java b/net/minecraft/server/players/StoredUserList.java +index d445e8f126f077d8419c52fa5436ea963a1a42a4..39483f7b453d6faedeccc1ab1eda76669395ea5a 100644 +--- a/net/minecraft/server/players/StoredUserList.java ++++ b/net/minecraft/server/players/StoredUserList.java +@@ -70,7 +70,7 @@ public abstract class StoredUserList> { + } + + public String[] getUserList() { +- return this.map.keySet().toArray(new String[0]); ++ return this.map.keySet().toArray(me.titaniumtown.ArrayConstants.emptyStringArray); // Gale - JettPack - reduce array allocations + } + + public boolean isEmpty() { +diff --git a/net/minecraft/util/ZeroBitStorage.java b/net/minecraft/util/ZeroBitStorage.java +index 09fd99c9cbd23b5f3c899bfb00c9b89651948ed8..5c1103ef028e5ffe6ce0eadc861dd3b2c8f3ed9f 100644 +--- a/net/minecraft/util/ZeroBitStorage.java ++++ b/net/minecraft/util/ZeroBitStorage.java +@@ -5,7 +5,7 @@ import java.util.function.IntConsumer; + import org.apache.commons.lang3.Validate; + + public class ZeroBitStorage implements BitStorage { +- public static final long[] RAW = new long[0]; ++ public static final long[] RAW = me.titaniumtown.ArrayConstants.emptyLongArray; // Gale - JettPack - reduce array allocations + private final int size; + + public ZeroBitStorage(int size) { +diff --git a/net/minecraft/world/entity/EquipmentSlot.java b/net/minecraft/world/entity/EquipmentSlot.java +index c65595c0a55b0aeebb2cf858da99329d2192976e..0a5611b1ece4dbe2887e7fbdef45f58e7f4d53ad 100644 +--- a/net/minecraft/world/entity/EquipmentSlot.java ++++ b/net/minecraft/world/entity/EquipmentSlot.java +@@ -19,7 +19,8 @@ public enum EquipmentSlot implements StringRepresentable { + BODY(EquipmentSlot.Type.ANIMAL_ARMOR, 0, 1, 6, "body"); + + public static final int NO_COUNT_LIMIT = 0; +- public static final List VALUES = List.of(values()); ++ public static final EquipmentSlot[] VALUES_ARRAY = values(); // Gale - JettPack - reduce array allocations ++ public static final List VALUES = List.of(VALUES_ARRAY); // Gale - JettPack - reduce array allocations + public static final IntFunction BY_ID = ByIdMap.continuous(equipmentSlot -> equipmentSlot.id, values(), ByIdMap.OutOfBoundsStrategy.ZERO); + public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(EquipmentSlot::values); + public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, equipmentSlot -> equipmentSlot.id); +diff --git a/net/minecraft/world/entity/EquipmentSlotGroup.java b/net/minecraft/world/entity/EquipmentSlotGroup.java +index 028dff862850c63d0b66902e99dd0bf685a7aa0d..b2d8b6883e2527c13794d23d27a4647ab1e255dd 100644 +--- a/net/minecraft/world/entity/EquipmentSlotGroup.java ++++ b/net/minecraft/world/entity/EquipmentSlotGroup.java +@@ -29,6 +29,7 @@ public enum EquipmentSlotGroup implements StringRepresentable { + private final int id; + private final String key; + private final Predicate predicate; ++ public static final EquipmentSlotGroup[] VALUES_ARRAY = EquipmentSlotGroup.values(); // Gale - JettPack - reduce array allocations + + private EquipmentSlotGroup(final int id, final String key, final Predicate predicate) { + this.id = id; +diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java +index 76f50437396f8f856381d0fbef52953ef7c263f6..f6c0f9275dd737c0142d6e4be07be71ad50b4732 100644 +--- a/net/minecraft/world/item/ItemStack.java ++++ b/net/minecraft/world/item/ItemStack.java +@@ -1145,7 +1145,7 @@ public final class ItemStack implements DataComponentHolder { + private void addAttributeTooltips(Consumer tooltipAdder, @Nullable Player player) { + ItemAttributeModifiers itemAttributeModifiers = this.getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY); + if (itemAttributeModifiers.showInTooltip()) { +- for (EquipmentSlotGroup equipmentSlotGroup : EquipmentSlotGroup.values()) { ++ for (EquipmentSlotGroup equipmentSlotGroup : EquipmentSlotGroup.VALUES_ARRAY) { // Gale - JettPack - reduce array allocations + MutableBoolean mutableBoolean = new MutableBoolean(true); + this.forEachModifier(equipmentSlotGroup, (attribute, modifier) -> { + if (mutableBoolean.isTrue()) { +diff --git a/net/minecraft/world/item/crafting/ShapedRecipePattern.java b/net/minecraft/world/item/crafting/ShapedRecipePattern.java +index bfda76974ea8d4397e2c2ebf5bdcb5d7e5f0bab5..cabbc93409ca99180d115e2f23419ee1824d5801 100644 +--- a/net/minecraft/world/item/crafting/ShapedRecipePattern.java ++++ b/net/minecraft/world/item/crafting/ShapedRecipePattern.java +@@ -121,7 +121,7 @@ public final class ShapedRecipePattern { + } + + if (pattern.size() == i3) { +- return new String[0]; ++ return me.titaniumtown.ArrayConstants.emptyStringArray; // Gale - JettPack - reduce array allocations + } else { + String[] strings = new String[pattern.size() - i3 - i2]; + +diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java +index 39e4a6237d105ea4a695659d5f47314184e44d75..b831f189bcee62a41a16017c2bb958aeee728984 100644 +--- a/net/minecraft/world/level/Level.java ++++ b/net/minecraft/world/level/Level.java +@@ -1849,7 +1849,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + public org.bukkit.entity.Entity[] getChunkEntities(int chunkX, int chunkZ) { + ca.spottedleaf.moonrise.patches.chunk_system.level.entity.ChunkEntitySlices slices = ((ServerLevel)this).moonrise$getEntityLookup().getChunk(chunkX, chunkZ); + if (slices == null) { +- return new org.bukkit.entity.Entity[0]; ++ return me.titaniumtown.ArrayConstants.emptyBukkitEntityArray; // Gale - JettPack - reduce array allocations + } + + List ret = new java.util.ArrayList<>(); +@@ -1860,7 +1860,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + } + } + +- return ret.toArray(new org.bukkit.entity.Entity[0]); ++ return ret.toArray(me.titaniumtown.ArrayConstants.emptyBukkitEntityArray); // Gale - JettPack - reduce array allocations + } + // Paper end - rewrite chunk system + +diff --git a/net/minecraft/world/level/block/ComposterBlock.java b/net/minecraft/world/level/block/ComposterBlock.java +index 86f9c284f434a16888beb60b89f460de2c0450a8..c8ffb634df661a6a4520731be725b51480764976 100644 +--- a/net/minecraft/world/level/block/ComposterBlock.java ++++ b/net/minecraft/world/level/block/ComposterBlock.java +@@ -410,7 +410,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { + + @Override + public int[] getSlotsForFace(Direction side) { +- return new int[0]; ++ return me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations + } + + @Override +@@ -445,7 +445,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { + + @Override + public int[] getSlotsForFace(Direction side) { +- return side == Direction.UP ? new int[]{0} : new int[0]; ++ return side == Direction.UP ? me.titaniumtown.ArrayConstants.zeroSingletonIntArray : me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations + } + + @Override +@@ -496,7 +496,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { + + @Override + public int[] getSlotsForFace(Direction side) { +- return side == Direction.DOWN ? new int[]{0} : new int[0]; ++ return side == Direction.DOWN ? me.titaniumtown.ArrayConstants.zeroSingletonIntArray : me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations + } + + @Override +diff --git a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +index cb4b8567c029e3a53aafda2755e3773ea8b95af7..ad9f009dd6c86e08c193839479b4b3285afd7dfb 100644 +--- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java ++++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +@@ -44,7 +44,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit + protected static final int SLOT_FUEL = 1; + protected static final int SLOT_RESULT = 2; + public static final int DATA_LIT_TIME = 0; +- private static final int[] SLOTS_FOR_UP = new int[]{0}; ++ private static final int[] SLOTS_FOR_UP = me.titaniumtown.ArrayConstants.zeroSingletonIntArray; // Gale - JettPack - reduce array allocations + private static final int[] SLOTS_FOR_DOWN = new int[]{2, 1}; + private static final int[] SLOTS_FOR_SIDES = new int[]{1}; + public static final int DATA_LIT_DURATION = 1; +diff --git a/net/minecraft/world/scores/Team.java b/net/minecraft/world/scores/Team.java +index 7b08f2fba99e3eef98f5b36db4081da9ab93f415..9192cb0761c6ec2ddec2c75dbc654d16951d6352 100644 +--- a/net/minecraft/world/scores/Team.java ++++ b/net/minecraft/world/scores/Team.java +@@ -70,7 +70,7 @@ public abstract class Team { + public final int id; + + public static String[] getAllNames() { +- return BY_NAME.keySet().toArray(new String[0]); ++ return BY_NAME.keySet().toArray(me.titaniumtown.ArrayConstants.emptyStringArray); // Gale - JettPack - reduce array allocations + } + + @Nullable diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0048-Optimize-sun-burn-tick.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0048-Optimize-sun-burn-tick.patch new file mode 100644 index 00000000..8be2f0db --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0048-Optimize-sun-burn-tick.patch @@ -0,0 +1,86 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 23:04:59 +0100 +Subject: [PATCH] Optimize sun burn tick + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"some entity micro opts" +By: Simon Gardling +As part of: JettPack (https://gitlab.com/Titaniumtown/JettPack) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java +index b260930b445e7621382bbe22e1e1c1c7be26e2f2..e4e32151437148f37fd370f9f88ec1bb84106c65 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -2021,10 +2021,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + @Deprecated + public float getLightLevelDependentMagicValue() { ++ return this.getLightLevelDependentMagicValue(BlockPos.containing(this.getX(), this.getEyeY(), this.getZ())); // Gale - JettPack - optimize sun burn tick - allow passing BlockPos to getLightLevelDependentMagicValue ++ } ++ ++ // Gale start - JettPack - optimize sun burn tick - allow passing BlockPos to getLightLevelDependentMagicValue ++ /** ++ * @deprecated ++ */ ++ @Deprecated ++ public float getLightLevelDependentMagicValue(BlockPos pos) { + return this.level().hasChunkAt(this.getBlockX(), this.getBlockZ()) +- ? this.level().getLightLevelDependentMagicValue(BlockPos.containing(this.getX(), this.getEyeY(), this.getZ())) ++ ? this.level.getLightLevelDependentMagicValue(pos) + : 0.0F; + } ++ // Gale end - JettPack - optimize sun burn tick - allow passing BlockPos to getLightLevelDependentMagicValue + + public void absMoveTo(double x, double y, double z, float yRot, float xRot) { + this.absMoveTo(x, y, z); +diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java +index 49f4d8d4cc36669f889d9970d1dfdf3af4a720ce..7b5d04de4e657a82f51d6f4ad287693fcaa14f1d 100644 +--- a/net/minecraft/world/entity/Mob.java ++++ b/net/minecraft/world/entity/Mob.java +@@ -1596,20 +1596,32 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + protected void playAttackSound() { + } + ++ // Gale start - JettPack - optimize sun burn tick - cache eye blockpos ++ private BlockPos cached_eye_blockpos; ++ private net.minecraft.world.phys.Vec3 cached_position; ++ // Gale end - JettPack - optimize sun burn tick - cache eye blockpos ++ + public boolean isSunBurnTick() { + if (this.level().isDay() && !this.level().isClientSide) { +- float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue(); +- BlockPos blockPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ()); +- boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow; +- if (lightLevelDependentMagicValue > 0.5F +- && this.random.nextFloat() * 30.0F < (lightLevelDependentMagicValue - 0.4F) * 2.0F +- && !flag +- && this.level().canSeeSky(blockPos)) { +- return true; ++ // Gale start - JettPack - optimize sun burn tick - optimizations and cache eye blockpos ++ if (this.cached_position != this.position) { ++ this.cached_eye_blockpos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ()); ++ this.cached_position = this.position; + } ++ ++ float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue(cached_eye_blockpos); // Pass BlockPos to getBrightness ++ ++ // Check brightness first ++ if (lightLevelDependentMagicValue <= 0.5F) return false; ++ if (this.random.nextFloat() * 30.0F >= (lightLevelDependentMagicValue - 0.4F) * 2.0F) return false; ++ // Gale end - JettPack - optimize sun burn tick - optimizations and cache eye blockpos ++ ++ boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow; ++ ++ return !flag && this.level().canSeeSky(this.cached_eye_blockpos); // Gale - JettPack - optimize sun burn tick - optimizations and cache eye blockpos + } + +- return false; ++ return false; // Gale - JettPack - optimize sun burn tick - optimizations and cache eye blockpos - diff on change + } + + @Override diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0049-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0049-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch new file mode 100644 index 00000000..3dd0e721 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0049-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 26 Nov 2022 16:28:23 +0100 +Subject: [PATCH] Reduce lambda and Optional allocation in + EntityBasedExplosionDamageCalculator + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following mixin: +"net/caffeinemc/mods/lithium/mixin/alloc/explosion_behavior/EntityBasedExplosionDamageCalculatorMixin.java" +By: 2No2Name <2No2Name@web.de> +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +diff --git a/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java b/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java +index 52cb2dcd714cf8c16f167466333eeb923e4ff183..c6fabcfd373ee74e418e24e6913b0fa7364812eb 100644 +--- a/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java ++++ b/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java +@@ -15,8 +15,20 @@ public class EntityBasedExplosionDamageCalculator extends ExplosionDamageCalcula + + @Override + public Optional getBlockExplosionResistance(Explosion explosion, BlockGetter reader, BlockPos pos, BlockState state, FluidState fluid) { +- return super.getBlockExplosionResistance(explosion, reader, pos, state, fluid) +- .map(resistance -> this.source.getBlockExplosionResistance(explosion, reader, pos, state, fluid, resistance)); ++ // Gale start - Lithium - reduce lambda and Optional allocation in EntityBasedExplosionDamageCalculator ++ Optional optionalBlastResistance = super.getBlockExplosionResistance(explosion, reader, pos, state, fluid); ++ ++ if (optionalBlastResistance.isPresent()) { ++ float blastResistance = optionalBlastResistance.get(); ++ float effectiveExplosionResistance = this.source.getBlockExplosionResistance(explosion, reader, pos, state, fluid, blastResistance); ++ ++ if (effectiveExplosionResistance != blastResistance) { ++ return Optional.of(effectiveExplosionResistance); ++ } ++ } ++ ++ return optionalBlastResistance; ++ // Gale end - Lithium - reduce lambda and Optional allocation in EntityBasedExplosionDamageCalculator + } + + @Override diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0050-Replace-game-rules-map-with-optimized-collection.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0050-Replace-game-rules-map-with-optimized-collection.patch new file mode 100644 index 00000000..7808ec56 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0050-Replace-game-rules-map-with-optimized-collection.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 17:35:06 +0100 +Subject: [PATCH] Replace game rules map with optimized collection + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following mixin: +"net/caffeinemc/mods/lithium/mixin/collections/gamerules/GameRulesMixin.java" +By: 2No2Name <2No2Name@web.de> +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +diff --git a/net/minecraft/world/level/GameRules.java b/net/minecraft/world/level/GameRules.java +index b21337d826ad33ce874301b070ad7f5361a2a493..bbd09a317d01dee709e8964329e68f176e660846 100644 +--- a/net/minecraft/world/level/GameRules.java ++++ b/net/minecraft/world/level/GameRules.java +@@ -249,7 +249,7 @@ public class GameRules { + } + + private GameRules(Map, GameRules.Value> rules, FeatureFlagSet enabledFeatures) { +- this.rules = rules; ++ this.rules = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(rules); // Gale - Lithium - replace game rules map with optimized collection + this.enabledFeatures = enabledFeatures; + + // Paper start - Perf: Use array for gamerule storage diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0051-Replace-AI-attributes-with-optimized-collections.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0051-Replace-AI-attributes-with-optimized-collections.patch new file mode 100644 index 00000000..75e4743e --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0051-Replace-AI-attributes-with-optimized-collections.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 20:54:31 +0100 +Subject: [PATCH] Replace AI attributes with optimized collections + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following mixin: +"net/caffeinemc/mods/lithium/mixin/collections/attributes/AttributeMapMixin.java" +By: 2No2Name <2No2Name@web.de> +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +diff --git a/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/net/minecraft/world/entity/ai/attributes/AttributeMap.java +index beebe81e13c99c6ddd9ffb2c7a3fdd74cb9c7afa..df3724294a3297ebdc11aef3f935bf0cf36b9c95 100644 +--- a/net/minecraft/world/entity/ai/attributes/AttributeMap.java ++++ b/net/minecraft/world/entity/ai/attributes/AttributeMap.java +@@ -19,9 +19,11 @@ import org.slf4j.Logger; + + public class AttributeMap { + private static final Logger LOGGER = LogUtils.getLogger(); +- private final Map, AttributeInstance> attributes = new Object2ObjectOpenHashMap<>(); +- private final Set attributesToSync = new ObjectOpenHashSet<>(); +- private final Set attributesToUpdate = new ObjectOpenHashSet<>(); ++ // Gale start - Lithium - replace AI attributes with optimized collections ++ private final Map, AttributeInstance> attributes = new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>(0); ++ private final Set attributesToSync = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(0); ++ private final Set attributesToUpdate = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(0); ++ // Gale end - Lithium - replace AI attributes with optimized collections + private final AttributeSupplier supplier; + private final java.util.function.Function, AttributeInstance> createInstance; // Gale - Airplane - reduce entity allocations + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0052-Replace-class-map-with-optimized-collection.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0052-Replace-class-map-with-optimized-collection.patch new file mode 100644 index 00000000..618a52ff --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0052-Replace-class-map-with-optimized-collection.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 21:02:43 +0100 +Subject: [PATCH] Replace class map with optimized collection + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following mixin: +"net/caffeinemc/mods/lithium/mixin/collections/entity_by_type/ClassInstanceMultiMapMixin.java" +By: 2No2Name <2No2Name@web.de> +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +diff --git a/net/minecraft/util/ClassInstanceMultiMap.java b/net/minecraft/util/ClassInstanceMultiMap.java +index 2a708ae0d5bb209650b525e3c56051f8b5655074..3bc4aba806e254a01ce5c71c723196ac01393192 100644 +--- a/net/minecraft/util/ClassInstanceMultiMap.java ++++ b/net/minecraft/util/ClassInstanceMultiMap.java +@@ -14,7 +14,7 @@ import java.util.Map.Entry; + import net.minecraft.Util; + + public class ClassInstanceMultiMap extends AbstractCollection { +- private final Map, List> byClass = Maps.newHashMap(); ++ private final Map, List> byClass = new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>(2); // Gale - Lithium - replace class map with optimized collection + private final Class baseClass; + private final List allInstances = Lists.newArrayList(); + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0053-Replace-instance-list-with-optimized-collection.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0053-Replace-instance-list-with-optimized-collection.patch new file mode 100644 index 00000000..3dcea8de --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0053-Replace-instance-list-with-optimized-collection.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> +Date: Sun, 18 Aug 2024 22:44:48 -0400 +Subject: [PATCH] Replace instance list with optimized collection + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following mixin: +"com/ishland/vmp/mixins/general/collections/MixinTypeFilterableList.java" +By: ishland +As part of: VMP (https://github.com/RelativityMC/VMP-fabric) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/net/minecraft/util/ClassInstanceMultiMap.java b/net/minecraft/util/ClassInstanceMultiMap.java +index 3bc4aba806e254a01ce5c71c723196ac01393192..4cd1b8ce60f7befca63a5b6396c0781ae3583dcd 100644 +--- a/net/minecraft/util/ClassInstanceMultiMap.java ++++ b/net/minecraft/util/ClassInstanceMultiMap.java +@@ -16,7 +16,7 @@ import net.minecraft.Util; + public class ClassInstanceMultiMap extends AbstractCollection { + private final Map, List> byClass = new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>(2); // Gale - Lithium - replace class map with optimized collection + private final Class baseClass; +- private final List allInstances = Lists.newArrayList(); ++ private final List allInstances = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(); // Gale - VMP - replace instance map with optimized collection + + public ClassInstanceMultiMap(Class baseClass) { + this.baseClass = baseClass; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0054-Replace-throttle-tracker-map-with-optimized-collecti.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0054-Replace-throttle-tracker-map-with-optimized-collecti.patch new file mode 100644 index 00000000..b744265c --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0054-Replace-throttle-tracker-map-with-optimized-collecti.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 23 Dec 2022 22:22:47 +0100 +Subject: [PATCH] Replace throttle tracker map with optimized collection + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Use more fastutil data structures" +By: nopjmp +As part of: Dionysus (https://github.com/nopjmp/Dionysus) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Dionysus description * + +Use them in more places. + +* Dionysus copyright * + +Copyright 2021 Kayla Thompson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +diff --git a/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +index c6e53b56c55ebf2c13b08b9896ffd545b04762d1..c166091d1b33c8f0ea57fb723e9d9b0c83bcedfb 100644 +--- a/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +@@ -25,7 +25,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL + static final java.util.regex.Pattern PROP_PATTERN = java.util.regex.Pattern.compile("\\w{0,16}"); + // Spigot end + // CraftBukkit start - add fields +- private static final HashMap throttleTracker = new HashMap<>(); ++ private static final it.unimi.dsi.fastutil.objects.Object2LongMap throttleTracker = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); // Gale - Dionysus - replace throttle tracker map with optimized collection + private static int throttleCounter = 0; + // CraftBukkit end + private static final boolean BYPASS_HOSTCHECK = Boolean.getBoolean("Paper.bypassHostCheck"); // Paper +@@ -84,7 +84,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL + InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress(); + + synchronized (ServerHandshakePacketListenerImpl.throttleTracker) { +- if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) { ++ if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.getLong(address) < connectionThrottle) { // Gale - Dionysus - replace throttle tracker map with optimized collection + ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime); + Component chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.connectionThrottle); // Paper - Configurable connection throttle kick message + this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage)); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0055-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0055-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch new file mode 100644 index 00000000..2098db63 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0055-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 21:15:33 +0100 +Subject: [PATCH] Avoid Class#isAssignableFrom call in ClassInstanceMultiMap + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following mixins: +"com/ishland/vmp/mixins/general/collections/MixinTypeFilterableList.java" +By: ishland +As part of: VMP (https://github.com/RelativityMC/VMP-fabric) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +"net/caffeinemc/mods/lithium/mixin/collections/entity_filtering/ClassInstanceMultiMapMixin.java" +By: Angeline +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +diff --git a/net/minecraft/util/ClassInstanceMultiMap.java b/net/minecraft/util/ClassInstanceMultiMap.java +index 4cd1b8ce60f7befca63a5b6396c0781ae3583dcd..c79aaf21566fe84fd45c8666230c6c5f4fe1db27 100644 +--- a/net/minecraft/util/ClassInstanceMultiMap.java ++++ b/net/minecraft/util/ClassInstanceMultiMap.java +@@ -56,18 +56,41 @@ public class ClassInstanceMultiMap extends AbstractCollection { + } + + public Collection find(Class type) { +- if (!this.baseClass.isAssignableFrom(type)) { +- throw new IllegalArgumentException("Don't know how to search for " + type); +- } else { +- List list = this.byClass +- .computeIfAbsent(type, clazz -> this.allInstances.stream().filter(clazz::isInstance).collect(Util.toMutableList())); +- return (Collection)Collections.unmodifiableCollection(list); ++ // Gale start - Lithium/VMP - avoid Class#isAssignableFrom call in ClassInstanceMultiMap ++ /* ++ Only perform the slow Class#isAssignableFrom(Class) if a list doesn't exist for the type, otherwise ++ we can assume it's already valid. The slow-path code is moved to a separate method to help the JVM inline this. ++ */ ++ Collection collection = this.byClass.get(type); ++ ++ if (collection == null) { ++ collection = this.createAllOfType(type); + } ++ ++ return (Collection) collection; ++ } ++ ++ private Collection createAllOfType(Class type) { ++ return this.byClass.computeIfAbsent( ++ type, ++ clazz -> { ++ it.unimi.dsi.fastutil.objects.ObjectArrayList ts = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(this.allInstances.size()); ++ ++ for (T _allElement : ((it.unimi.dsi.fastutil.objects.ObjectArrayList) this.allInstances).elements()) { ++ if (clazz.isInstance(_allElement)) { ++ ts.add(_allElement); ++ } ++ } ++ ++ return ts; ++ } ++ ); ++ // Gale end - Lithium/VMP - avoid Class#isAssignableFrom call in ClassInstanceMultiMap + } + + @Override + public Iterator iterator() { +- return (Iterator)(this.allInstances.isEmpty() ? Collections.emptyIterator() : Iterators.unmodifiableIterator(this.allInstances.iterator())); ++ return this.allInstances.isEmpty() ? Collections.emptyIterator() : Iterators.unmodifiableIterator(this.allInstances.iterator()); + } + + public List getAllInstances() { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0056-Cache-BlockStatePairKey-hash.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0056-Cache-BlockStatePairKey-hash.patch new file mode 100644 index 00000000..26b44b03 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0056-Cache-BlockStatePairKey-hash.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 15:51:59 +0100 +Subject: [PATCH] Cache BlockStatePairKey hash + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following mixin: +"net/caffeinemc/mods/lithium/mixin/cached_hashcode/FlowingFluid$BlockStatePairKeyMixin.java" +By: Angeline +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +diff --git a/net/minecraft/world/level/material/FlowingFluid.java b/net/minecraft/world/level/material/FlowingFluid.java +index e30499bdcd6600e5c9d4a755c1182fb6dff3735f..c47a33a989d7ffea4f0bbae39fd64869369e9bda 100644 +--- a/net/minecraft/world/level/material/FlowingFluid.java ++++ b/net/minecraft/world/level/material/FlowingFluid.java +@@ -535,7 +535,26 @@ public abstract class FlowingFluid extends Fluid { + : this.shapes.computeIfAbsent(state, fluidState -> Shapes.box(0.0, 0.0, 0.0, 1.0, fluidState.getHeight(level, pos), 1.0)); + } + +- record BlockStatePairKey(BlockState first, BlockState second, Direction direction) { ++ // Gale start - Lithium - cache BlockStatePairKey hash ++ static class BlockStatePairKey { ++ ++ private final BlockState first; ++ private final BlockState second; ++ private final Direction direction; ++ private final int hash; ++ ++ private BlockStatePairKey(BlockState first, BlockState second, Direction direction) { ++ this.first = first; ++ this.second = second; ++ this.direction = direction; ++ int hash = System.identityHashCode(this.first); ++ ++ hash = 31 * hash + System.identityHashCode(this.second); ++ hash = 31 * hash + this.direction.hashCode(); ++ this.hash = hash; ++ } ++ // Gale end - Lithium - cache BlockStatePairKey hash ++ + @Override + public boolean equals(Object object) { + return object instanceof FlowingFluid.BlockStatePairKey blockStatePairKey +@@ -546,9 +565,7 @@ public abstract class FlowingFluid extends Fluid { + + @Override + public int hashCode() { +- int i = System.identityHashCode(this.first); +- i = 31 * i + System.identityHashCode(this.second); +- return 31 * i + this.direction.hashCode(); ++ return this.hash; // Gale - Lithium - cache BlockStatePairKey hash + } + } + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0057-Cache-ShapePairKey-hash.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0057-Cache-ShapePairKey-hash.patch new file mode 100644 index 00000000..6f93e607 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0057-Cache-ShapePairKey-hash.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> +Date: Thu, 12 Dec 2024 02:58:34 -0500 +Subject: [PATCH] Cache ShapePairKey hash + + +diff --git a/net/minecraft/world/level/block/Block.java b/net/minecraft/world/level/block/Block.java +index 976de81d65b6494cdad20f4ec5125fceec86f951..79de4c558f7cbeff7e55b6d9ad2644be46d72cd9 100644 +--- a/net/minecraft/world/level/block/Block.java ++++ b/net/minecraft/world/level/block/Block.java +@@ -557,7 +557,20 @@ public class Block extends BlockBehaviour implements ItemLike { + } + // Spigot end + +- record ShapePairKey(VoxelShape first, VoxelShape second) { ++ // Gale start - cache ShapePairKey hash ++ static class ShapePairKey { ++ ++ private final VoxelShape first; ++ private final VoxelShape second; ++ private final int hash; ++ ++ private ShapePairKey(VoxelShape first, VoxelShape second) { ++ this.first = first; ++ this.second = second; ++ this.hash = System.identityHashCode(this.first) * 31 + System.identityHashCode(this.second); ++ } ++ // Gale end - cache ShapePairKey hash ++ + @Override + public boolean equals(Object other) { + return other instanceof Block.ShapePairKey shapePairKey && this.first == shapePairKey.first && this.second == shapePairKey.second; +@@ -565,7 +578,7 @@ public class Block extends BlockBehaviour implements ItemLike { + + @Override + public int hashCode() { +- return System.identityHashCode(this.first) * 31 + System.identityHashCode(this.second); ++ return this.hash; // Gale - cache ShapePairKey hash + } + } + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0058-Replace-division-by-multiplication-in-CubePointRange.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0058-Replace-division-by-multiplication-in-CubePointRange.patch new file mode 100644 index 00000000..34944fec --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0058-Replace-division-by-multiplication-in-CubePointRange.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 17:24:24 +0100 +Subject: [PATCH] Replace division by multiplication in CubePointRange + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following mixin: +"net/caffeinemc/mods/lithium/mixin/shapes/precompute_shape_arrays/CubePointRangeMixin.java" +By: 2No2Name <2No2Name@web.de> +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +diff --git a/net/minecraft/world/phys/shapes/CubePointRange.java b/net/minecraft/world/phys/shapes/CubePointRange.java +index 62aea61c5f240aa59b8489dd0bbb3d1b69b54b1c..513adb0e75fb70d26f6056d22fe2be30b1a39296 100644 +--- a/net/minecraft/world/phys/shapes/CubePointRange.java ++++ b/net/minecraft/world/phys/shapes/CubePointRange.java +@@ -4,6 +4,7 @@ import it.unimi.dsi.fastutil.doubles.AbstractDoubleList; + + public class CubePointRange extends AbstractDoubleList { + private final int parts; ++ private final double scale; // Gale - Lithium - replace division by multiplication in CubePointRange + + public CubePointRange(int parts) { + if (parts <= 0) { +@@ -11,11 +12,12 @@ public class CubePointRange extends AbstractDoubleList { + } else { + this.parts = parts; + } ++ this.scale = 1.0D / parts; // Gale - Lithium - replace division by multiplication in CubePointRange + } + + @Override + public double getDouble(int value) { +- return (double)value / this.parts; ++ return value * this.scale; // Gale - Lithium - replace division by multiplication in CubePointRange + } + + @Override diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0059-Replace-parts-by-size-in-CubePointRange.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0059-Replace-parts-by-size-in-CubePointRange.patch new file mode 100644 index 00000000..405d51a5 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0059-Replace-parts-by-size-in-CubePointRange.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 17:28:37 +0100 +Subject: [PATCH] Replace parts by size in CubePointRange + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/world/phys/shapes/CubePointRange.java b/net/minecraft/world/phys/shapes/CubePointRange.java +index 513adb0e75fb70d26f6056d22fe2be30b1a39296..9838c090a6476d9ab7b17f2556a74cba7f8b4bd9 100644 +--- a/net/minecraft/world/phys/shapes/CubePointRange.java ++++ b/net/minecraft/world/phys/shapes/CubePointRange.java +@@ -3,14 +3,14 @@ package net.minecraft.world.phys.shapes; + import it.unimi.dsi.fastutil.doubles.AbstractDoubleList; + + public class CubePointRange extends AbstractDoubleList { +- private final int parts; ++ private final int size; // Gale - replace parts by size in CubePointRange + private final double scale; // Gale - Lithium - replace division by multiplication in CubePointRange + + public CubePointRange(int parts) { + if (parts <= 0) { + throw new IllegalArgumentException("Need at least 1 part"); + } else { +- this.parts = parts; ++ this.size = parts + 1; // Gale - replace parts by size in CubePointRange + } + this.scale = 1.0D / parts; // Gale - Lithium - replace division by multiplication in CubePointRange + } +@@ -22,6 +22,6 @@ public class CubePointRange extends AbstractDoubleList { + + @Override + public int size() { +- return this.parts + 1; ++ return this.size; // Gale - replace parts by size in CubePointRange + } + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0060-Check-frozen-ticks-before-landing-block.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0060-Check-frozen-ticks-before-landing-block.patch new file mode 100644 index 00000000..99792d90 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0060-Check-frozen-ticks-before-landing-block.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 20:17:41 +0100 +Subject: [PATCH] Check frozen ticks before landing block + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following mixin: +"net/caffeinemc/mods/lithium/mixin/entity/fast_powder_snow_check/LivingEntityMixin.java" +By: 2No2Name <2No2Name@web.de> +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java +index 3a44887fa81676d4c06c10eae5d451eace7f595f..830ae2b569b533f2ded23826c48727f1d7fd0272 100644 +--- a/net/minecraft/world/entity/LivingEntity.java ++++ b/net/minecraft/world/entity/LivingEntity.java +@@ -570,10 +570,9 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + protected void tryAddFrost() { +- if (!this.getBlockStateOnLegacy().isAir()) { + int ticksFrozen = this.getTicksFrozen(); + if (ticksFrozen > 0) { +- AttributeInstance attribute = this.getAttribute(Attributes.MOVEMENT_SPEED); ++ AttributeInstance attribute = this.getBlockStateOnLegacy().isAir() ? null : this.getAttribute(Attributes.MOVEMENT_SPEED); // Gale - Lithium - check frozen ticks before landing block + if (attribute == null) { + return; + } +@@ -581,7 +580,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + float f = -0.05F * this.getPercentFrozen(); + attribute.addTransientModifier(new AttributeModifier(SPEED_MODIFIER_POWDER_SNOW_ID, f, AttributeModifier.Operation.ADD_VALUE)); + } +- } + } + + protected void onChangedBlock(ServerLevel level, BlockPos pos) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0061-Faster-chunk-serialization.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0061-Faster-chunk-serialization.patch new file mode 100644 index 00000000..feea85a2 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0061-Faster-chunk-serialization.patch @@ -0,0 +1,237 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 21:51:16 +0100 +Subject: [PATCH] Faster chunk serialization + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following mixins and classes: +* "net/caffeinemc/mods/lithium/common/world/chunk/CompactingPackedIntegerArray.java" +* "net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java" +* "net/caffeinemc/mods/lithium/mixin/chunk/serialization/SimpleBitStorageMixin.java" +* "net/caffeinemc/mods/lithium/mixin/chunk/serialization/PalettedContainerMixin.java" +By: Angeline +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +diff --git a/net/minecraft/util/BitStorage.java b/net/minecraft/util/BitStorage.java +index 02502d50f0255f5bbcc0ecb965abb48cc1a112da..e1f4ca261d106d176298b2afc016f5168abaa06b 100644 +--- a/net/minecraft/util/BitStorage.java ++++ b/net/minecraft/util/BitStorage.java +@@ -38,4 +38,6 @@ public interface BitStorage extends ca.spottedleaf.moonrise.patches.block_counti + return ret; + } + // Paper end - block counting ++ ++ void compact(net.minecraft.world.level.chunk.Palette srcPalette, net.minecraft.world.level.chunk.Palette dstPalette, short[] out); // Gale - Lithium - faster chunk serialization + } +diff --git a/net/minecraft/util/SimpleBitStorage.java b/net/minecraft/util/SimpleBitStorage.java +index e6306a68c8652d4c5d22d5ecb1416f5f931f76ee..8091f0c0a536047ead4966e70785962e87faad9a 100644 +--- a/net/minecraft/util/SimpleBitStorage.java ++++ b/net/minecraft/util/SimpleBitStorage.java +@@ -465,4 +465,45 @@ public class SimpleBitStorage implements BitStorage { + super(message); + } + } ++ ++ // Gale start - Lithium - faster chunk serialization ++ @Override ++ public void compact(net.minecraft.world.level.chunk.Palette srcPalette, net.minecraft.world.level.chunk.Palette dstPalette, short[] out) { ++ if (this.size >= Short.MAX_VALUE) { ++ throw new IllegalStateException("Array too large"); ++ } ++ ++ if (this.size != out.length) { ++ throw new IllegalStateException("Array size mismatch"); ++ } ++ ++ short[] mappings = new short[(int) (this.mask + 1)]; ++ ++ int idx = 0; ++ ++ for (long word : this.data) { ++ long bits = word; ++ ++ for (int elementIdx = 0; elementIdx < this.valuesPerLong; ++elementIdx) { ++ int value = (int) (bits & this.mask); ++ int remappedId = mappings[value]; ++ ++ if (remappedId == 0) { ++ remappedId = dstPalette.idFor(srcPalette.valueFor(value)) + 1; ++ mappings[value] = (short) remappedId; ++ } ++ ++ out[idx] = (short) (remappedId - 1); ++ bits >>= this.bits; ++ ++ ++idx; ++ ++ if (idx >= this.size) { ++ return; ++ } ++ } ++ } ++ } ++ // Gale end - Lithium - faster chunk serialization ++ + } +diff --git a/net/minecraft/util/ZeroBitStorage.java b/net/minecraft/util/ZeroBitStorage.java +index 5c1103ef028e5ffe6ce0eadc861dd3b2c8f3ed9f..828ced8aa5665c6f5d0b121947719c4e2ba591fe 100644 +--- a/net/minecraft/util/ZeroBitStorage.java ++++ b/net/minecraft/util/ZeroBitStorage.java +@@ -80,4 +80,6 @@ public class ZeroBitStorage implements BitStorage { + return ret; + } + // Paper end - block counting ++ ++ @Override public void compact(net.minecraft.world.level.chunk.Palette srcPalette, net.minecraft.world.level.chunk.Palette dstPalette, short[] out) {} // Gale - Lithium - faster chunk serialization + } +diff --git a/net/minecraft/world/level/chunk/PaletteResize.java b/net/minecraft/world/level/chunk/PaletteResize.java +index c723606fa0be811e580ba47de8c9c575583cc930..08d103577ec558e79fd0e5c53fbc4b0bc5526935 100644 +--- a/net/minecraft/world/level/chunk/PaletteResize.java ++++ b/net/minecraft/world/level/chunk/PaletteResize.java +@@ -1,5 +1,5 @@ + package net.minecraft.world.level.chunk; + +-interface PaletteResize { ++public interface PaletteResize { // Gale - Lithium - faster chunk serialization - package -> public + int onResize(int bits, T objectAdded); + } +diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java +index f5da433050fd3060e0335d4002d520ebe8cd691f..82a5d45858067f8bd6d000d2eafc13fe2cb6f834 100644 +--- a/net/minecraft/world/level/chunk/PalettedContainer.java ++++ b/net/minecraft/world/level/chunk/PalettedContainer.java +@@ -25,6 +25,22 @@ import net.minecraft.util.ThreadingDetector; + import net.minecraft.util.ZeroBitStorage; + + public class PalettedContainer implements PaletteResize, PalettedContainerRO { ++ ++ // Gale start - Lithium - faster chunk serialization ++ private static final ThreadLocal CACHED_ARRAY_4096 = ThreadLocal.withInitial(() -> new short[4096]); ++ private static final ThreadLocal CACHED_ARRAY_64 = ThreadLocal.withInitial(() -> new short[64]); ++ private Optional asOptional(long[] data) { ++ return Optional.of(Arrays.stream(data)); ++ } ++ private short[] getOrCreate(int size) { ++ return switch (size) { ++ case 64 -> CACHED_ARRAY_64.get(); ++ case 4096 -> CACHED_ARRAY_4096.get(); ++ default -> new short[size]; ++ }; ++ } ++ // Gale end - Lithium - faster chunk serialization ++ + private static final int MIN_PALETTE_BITS = 0; + private final PaletteResize dummyPaletteResize = (bits, objectAdded) -> 0; + public final IdMap registry; +@@ -344,28 +360,54 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + public synchronized PalettedContainerRO.PackedData pack(IdMap registry, PalettedContainer.Strategy strategy) { // Paper - synchronize + this.acquire(); + +- PalettedContainerRO.PackedData var12; ++ // Gale start - Lithium - faster chunk serialization ++ Optional data = Optional.empty(); ++ List elements = null; + try { +- HashMapPalette hashMapPalette = new HashMapPalette<>(registry, this.data.storage.getBits(), this.dummyPaletteResize); +- int size = strategy.size(); +- int[] ints = new int[size]; +- this.data.storage.unpack(ints); +- swapPalette(ints, id -> hashMapPalette.idFor(this.data.palette.valueFor(id))); +- int i = strategy.calculateBitsForSerialization(registry, hashMapPalette.getSize()); +- Optional optional; +- if (i != 0) { +- SimpleBitStorage simpleBitStorage = new SimpleBitStorage(i, size, ints); +- optional = Optional.of(Arrays.stream(simpleBitStorage.getRaw())); +- } else { +- optional = Optional.empty(); ++ // The palette that will be serialized ++ net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette hashPalette = null; ++ ++ final Palette palette = this.data.palette(); ++ final BitStorage storage = this.data.storage(); ++ if (storage instanceof ZeroBitStorage || palette.getSize() == 1) { ++ // If the palette only contains one entry, don't attempt to repack it. ++ elements = List.of(palette.valueFor(0)); ++ } else if (palette instanceof net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette lithiumHashPalette) { ++ hashPalette = lithiumHashPalette; + } + +- var12 = new PalettedContainerRO.PackedData<>(hashMapPalette.getEntries(), optional); ++ if (elements == null) { ++ net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette compactedPalette = new net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<>(registry, storage.getBits(), this.dummyPaletteResize); ++ short[] array = this.getOrCreate(strategy.size()); ++ ++ storage.compact(this.data.palette(), compactedPalette, array); ++ ++ // If the palette didn't change during compaction, do a simple copy of the data array ++ if (hashPalette != null && hashPalette.getSize() == compactedPalette.getSize() && storage.getBits() == strategy.calculateBitsForSerialization(registry, hashPalette.getSize())) { // paletteSize can de-sync from palette - see https://github.com/CaffeineMC/lithium-fabric/issues/279 ++ data = this.asOptional(storage.getRaw().clone()); ++ elements = hashPalette.getElements(); ++ } else { ++ int bits = strategy.calculateBitsForSerialization(registry, compactedPalette.getSize()); ++ if (bits != 0) { ++ // Re-pack the integer array as the palette has changed size ++ SimpleBitStorage copy = new SimpleBitStorage(bits, array.length); ++ for (int i = 0; i < array.length; ++i) { ++ copy.set(i, array[i]); ++ } ++ ++ // We don't need to clone the data array as we are the sole owner of it ++ data = this.asOptional(copy.getRaw()); ++ } ++ ++ elements = compactedPalette.getElements(); ++ } ++ } + } finally { + this.release(); + } + +- return var12; ++ return new PalettedContainerRO.PackedData<>(elements, data); ++ // Gale end - Lithium - faster chunk serialization + } + + private static void swapPalette(int[] bits, IntUnaryOperator operator) { +@@ -405,13 +447,33 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + + @Override + public void count(PalettedContainer.CountConsumer countConsumer) { +- if (this.data.palette.getSize() == 1) { +- countConsumer.accept(this.data.palette.valueFor(0), this.data.storage.getSize()); +- } else { +- Int2IntOpenHashMap map = new Int2IntOpenHashMap(); +- this.data.storage.getAll(id -> map.addTo(id, 1)); +- map.int2IntEntrySet().forEach(idEntry -> countConsumer.accept(this.data.palette.valueFor(idEntry.getIntKey()), idEntry.getIntValue())); ++ // Gale start - Lithium - faster chunk serialization ++ int len = this.data.palette().getSize(); ++ ++ // Do not allocate huge arrays if we're using a large palette ++ if (len > 4096) { ++ // VanillaCopy ++ if (this.data.palette.getSize() == 1) { ++ countConsumer.accept(this.data.palette.valueFor(0), this.data.storage.getSize()); ++ } else { ++ Int2IntOpenHashMap map = new Int2IntOpenHashMap(); ++ this.data.storage.getAll(id -> map.addTo(id, 1)); ++ map.int2IntEntrySet().forEach(idEntry -> countConsumer.accept(this.data.palette.valueFor(idEntry.getIntKey()), idEntry.getIntValue())); ++ } ++ } ++ ++ short[] counts = new short[len]; ++ ++ this.data.storage().getAll(i -> counts[i]++); ++ ++ for (int i = 0; i < counts.length; i++) { ++ T obj = this.data.palette().valueFor(i); ++ ++ if (obj != null) { ++ countConsumer.accept(obj, counts[i]); ++ } + } ++ // Gale end - Lithium - faster chunk serialization + } + + record Configuration(Palette.Factory factory, int bits) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0062-Update-boss-bar-within-tick.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0062-Update-boss-bar-within-tick.patch new file mode 100644 index 00000000..aa47e3a4 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0062-Update-boss-bar-within-tick.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 1 Dec 2022 00:12:14 +0100 +Subject: [PATCH] Update boss bar within tick + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following mixin: +"net/caffeinemc/mods/lithium/mixin/ai/raid/RaidMixin.java" +By: Angeline +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java +index 41b0db439b425b052bd1469daa6620a435ca852b..536c84362d3e74a5bf0e0494483da3c0e9b26f0b 100644 +--- a/net/minecraft/world/entity/raid/Raid.java ++++ b/net/minecraft/world/entity/raid/Raid.java +@@ -109,6 +109,7 @@ public class Raid { + private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry PDC_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); + public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(PDC_TYPE_REGISTRY); + // Paper end ++ private boolean isBarDirty; // Gale - Lithium - update boss bar within tick + + public Raid(int id, ServerLevel level, BlockPos center) { + this.id = id; +@@ -263,6 +264,12 @@ public class Raid { + } + + public void tick() { ++ // Gale start - Lithium - update boss bar within tick ++ if (this.isBarDirty) { ++ this.updateBossbarInternal(); ++ this.isBarDirty = false; ++ } ++ // Gale end - Lithium - update boss bar within tick + if (!this.isStopped()) { + if (this.status == Raid.RaidStatus.ONGOING) { + boolean flag = this.active; +@@ -581,6 +588,12 @@ public class Raid { + } + + public void updateBossbar() { ++ // Gale start - Lithium - update boss bar within tick ++ this.isBarDirty = true; ++ } ++ ++ private void updateBossbarInternal() { ++ // Gale end - Lithium - update boss bar within tick + this.raidEvent.setProgress(Mth.clamp(this.getHealthOfLivingRaiders() / this.totalHealth, 0.0F, 1.0F)); + } + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0063-Skip-secondary-POI-sensor-if-absent.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0063-Skip-secondary-POI-sensor-if-absent.patch new file mode 100644 index 00000000..e44c0d36 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0063-Skip-secondary-POI-sensor-if-absent.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sun, 25 Dec 2022 10:47:29 +0100 +Subject: [PATCH] Skip secondary POI sensor if absent + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following mixin: +"net/caffeinemc/mods/lithium/mixin/ai/sensor/secondary_poi/SecondaryPoiSensorMixin.java" +By: 2No2Name <2No2Name@web.de> +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +* Lithium description * + +villagers that have no secondary POI (farmland) do not search for it + +diff --git a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java +index 6b99afb4f237b5d6def98f3e03492975b795bc95..d9318a5a9eb3de89f48efa23b944c6d9e2ba37d1 100644 +--- a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java ++++ b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java +@@ -22,6 +22,14 @@ public class SecondaryPoiSensor extends Sensor { + + @Override + protected void doTick(ServerLevel level, Villager entity) { ++ // Gale start - Lithium - skip secondary POI sensor if absent ++ var secondaryPoi = entity.getVillagerData().getProfession().secondaryPoi(); ++ ++ if (secondaryPoi.isEmpty()) { ++ entity.getBrain().eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE); ++ return; ++ } ++ // Gale end - Lithium - skip secondary POI sensor if absent + ResourceKey resourceKey = level.dimension(); + BlockPos blockPos = entity.blockPosition(); + List list = Lists.newArrayList(); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0064-Skip-entity-move-if-movement-is-zero.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0064-Skip-entity-move-if-movement-is-zero.patch new file mode 100644 index 00000000..64ac354b --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0064-Skip-entity-move-if-movement-is-zero.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 14:25:58 +0100 +Subject: [PATCH] Skip entity move if movement is zero + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following mixin: +"com/ishland/vmp/mixins/entity/move_zero_velocity/MixinEntity.java" +By: ishland +As part of: VMP (https://github.com/RelativityMC/VMP-fabric) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java +index 9a5bd53aaf02cdbc0d452af3e288a6f56f116ec9..91f414d957e19bd267f1d833b91ec4132e19a8ec 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -233,6 +233,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + public float yRotO; + public float xRotO; + private AABB bb = INITIAL_AABB; ++ private boolean boundingBoxChanged = false; // Gale - VMP - skip entity move if movement is zero + public boolean onGround; + public boolean horizontalCollision; + public boolean verticalCollision; +@@ -1080,6 +1081,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + // Paper end - detailed watchdog information + + public void move(MoverType type, Vec3 movement) { ++ // Gale start - VMP - skip entity move if movement is zero ++ if (!this.boundingBoxChanged && movement.equals(Vec3.ZERO)) { ++ return; ++ } ++ // Gale end - VMP - skip entity move if movement is zero + final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity + // Paper start - detailed watchdog information + ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main"); +@@ -4171,6 +4177,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + + public final void setBoundingBox(AABB bb) { ++ // Gale start - VMP - skip entity move if movement is zero ++ if (!this.bb.equals(bb)) { ++ this.boundingBoxChanged = true; ++ } ++ // Gale end - VMP - skip entity move if movement is zero + // CraftBukkit start - block invalid bounding boxes + double minX = bb.minX, + minY = bb.minY, diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0065-Store-mob-counts-in-an-array.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0065-Store-mob-counts-in-an-array.patch new file mode 100644 index 00000000..2ca79d86 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0065-Store-mob-counts-in-an-array.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 17:46:23 +0100 +Subject: [PATCH] Store mob counts in an array + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following mixin: +"com/ishland/vmp/mixins/general/spawn_density_cap/MixinSpawnDensityCapperDensityCap.java" +By: ishland +As part of: VMP (https://github.com/RelativityMC/VMP-fabric) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/net/minecraft/world/level/LocalMobCapCalculator.java b/net/minecraft/world/level/LocalMobCapCalculator.java +index 9641219c190261dea0db5f95f040a705ba0a3ff9..635afc61ee441924e1d64dbcf6dbab057d80c740 100644 +--- a/net/minecraft/world/level/LocalMobCapCalculator.java ++++ b/net/minecraft/world/level/LocalMobCapCalculator.java +@@ -42,14 +42,14 @@ public class LocalMobCapCalculator { + } + + static class MobCounts { +- private final Object2IntMap counts = new Object2IntOpenHashMap<>(MobCategory.values().length); ++ private final int[] counts = new int[MobCategory.values().length]; // Gale - VMP - store mob counts in an array + + public void add(MobCategory category) { +- this.counts.computeInt(category, (key, value) -> value == null ? 1 : value + 1); ++ this.counts[category.ordinal()]++; // Gale - VMP - store mob counts in an array + } + + public boolean canSpawn(MobCategory category) { +- return this.counts.getOrDefault(category, 0) < category.getMaxInstancesPerChunk(); ++ return this.counts[category.ordinal()] < category.getMaxInstancesPerChunk(); // Gale - VMP - store mob counts in an array + } + } + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0066-Use-linked-map-for-entity-trackers.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0066-Use-linked-map-for-entity-trackers.patch new file mode 100644 index 00000000..cb9df0ab --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0066-Use-linked-map-for-entity-trackers.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 1 Dec 2022 14:40:03 +0100 +Subject: [PATCH] Use linked map for entity trackers + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following mixin: +"com/ishland/vmp/mixins/entitytracker/MixinThreadedAnvilChunkStorage.java" +By: ishland +As part of: VMP (https://github.com/RelativityMC/VMP-fabric) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java +index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..6a9fdb6329f177aca1274336a8e5be70ca3ce931 100644 +--- a/net/minecraft/server/level/ChunkMap.java ++++ b/net/minecraft/server/level/ChunkMap.java +@@ -127,7 +127,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + public final AtomicInteger tickingGenerated = new AtomicInteger(); // Paper - public + private final String storageName; + private final PlayerMap playerMap = new PlayerMap(); +- public final Int2ObjectMap entityMap = new Int2ObjectOpenHashMap<>(); ++ public final Int2ObjectMap entityMap = new it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap<>(); // Gale - VMP - use linked map for entity trackers - provides faster iteration + private final Long2ByteMap chunkTypeCache = new Long2ByteOpenHashMap(); + // Paper - rewrite chunk system + public int serverViewDistance; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0067-Optimize-noise-generation.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0067-Optimize-noise-generation.patch new file mode 100644 index 00000000..cd8e34dd --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0067-Optimize-noise-generation.patch @@ -0,0 +1,248 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 19:49:14 +0100 +Subject: [PATCH] Optimize noise generation + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following mixins: +* "com/ishland/c2me/opts/math/mixin/MixinOctavePerlinNoiseSampler.java" +* "com/ishland/c2me/opts/math/mixin/MixinPerlinNoiseSampler.java" +By: ishland +As part of: C2ME (https://github.com/RelativityMC/C2ME-fabric) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java +index fb11a2eea540d55e50eab59f9857ca5d99f556f8..dcc1a3f8b611c9f103b848db90b077b984b60ada 100644 +--- a/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java ++++ b/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java +@@ -11,6 +11,27 @@ public final class ImprovedNoise { + public final double yo; + public final double zo; + ++ // Gale start - C2ME - optimize noise generation ++ private static final double[] FLAT_SIMPLEX_GRAD = new double[]{ ++ 1, 1, 0, 0, ++ -1, 1, 0, 0, ++ 1, -1, 0, 0, ++ -1, -1, 0, 0, ++ 1, 0, 1, 0, ++ -1, 0, 1, 0, ++ 1, 0, -1, 0, ++ -1, 0, -1, 0, ++ 0, 1, 1, 0, ++ 0, -1, 1, 0, ++ 0, 1, -1, 0, ++ 0, -1, -1, 0, ++ 1, 1, 0, 0, ++ 0, -1, 1, 0, ++ -1, 1, 0, 0, ++ 0, -1, -1, 0, ++ }; ++ // Gale end - C2ME - optimize noise generation ++ + public ImprovedNoise(RandomSource random) { + this.xo = random.nextDouble() * 256.0; + this.yo = random.nextDouble() * 256.0; +@@ -38,9 +59,11 @@ public final class ImprovedNoise { + double d = x + this.xo; + double d1 = y + this.yo; + double d2 = z + this.zo; +- int floor = Mth.floor(d); +- int floor1 = Mth.floor(d1); +- int floor2 = Mth.floor(d2); ++ // Gale start - C2ME - optimize noise generation - optimize: remove frequent type conversions ++ double floor = Math.floor(d); ++ double floor1 = Math.floor(d1); ++ double floor2 = Math.floor(d2); ++ // Gale end - C2ME - optimize noise generation - optimize: remove frequent type conversions + double d3 = d - floor; + double d4 = d1 - floor1; + double d5 = d2 - floor2; +@@ -53,25 +76,27 @@ public final class ImprovedNoise { + d6 = d4; + } + +- d7 = Mth.floor(d6 / yScale + 1.0E-7F) * yScale; ++ d7 = Math.floor(d6 / yScale + 1.0E-7F) * yScale; // Gale - C2ME - optimize noise generation - optimize: remove frequent type conversions + } else { + d7 = 0.0; + } + +- return this.sampleAndLerp(floor, floor1, floor2, d3, d4 - d7, d5, d4); ++ return this.sampleAndLerp((int) floor, (int) floor1, (int) floor2, d3, d4 - d7, d5, d4); // Gale - C2ME - optimize noise generation - optimize: remove frequent type conversions + } + + public double noiseWithDerivative(double x, double y, double z, double[] values) { + double d = x + this.xo; + double d1 = y + this.yo; + double d2 = z + this.zo; +- int floor = Mth.floor(d); +- int floor1 = Mth.floor(d1); +- int floor2 = Mth.floor(d2); ++ // Gale start - C2ME - optimize noise generation - optimize: remove frequent type conversions ++ double floor = Math.floor(d); ++ double floor1 = Math.floor(d1); ++ double floor2 = Math.floor(d2); ++ // Gale end - C2ME - optimize noise generation - optimize: remove frequent type conversions + double d3 = d - floor; + double d4 = d1 - floor1; + double d5 = d2 - floor2; +- return this.sampleWithDerivative(floor, floor1, floor2, d3, d4, d5, values); ++ return this.sampleWithDerivative((int) floor, (int) floor1, (int) floor2, d3, d4, d5, values); // Gale - C2ME - optimize noise generation - optimize: remove frequent type conversions + } + + private static double gradDot(int gradIndex, double xFactor, double yFactor, double zFactor) { +@@ -83,24 +108,69 @@ public final class ImprovedNoise { + } + + private double sampleAndLerp(int gridX, int gridY, int gridZ, double deltaX, double weirdDeltaY, double deltaZ, double deltaY) { +- int i = this.p(gridX); +- int i1 = this.p(gridX + 1); +- int i2 = this.p(i + gridY); +- int i3 = this.p(i + gridY + 1); +- int i4 = this.p(i1 + gridY); +- int i5 = this.p(i1 + gridY + 1); +- double d = gradDot(this.p(i2 + gridZ), deltaX, weirdDeltaY, deltaZ); +- double d1 = gradDot(this.p(i4 + gridZ), deltaX - 1.0, weirdDeltaY, deltaZ); +- double d2 = gradDot(this.p(i3 + gridZ), deltaX, weirdDeltaY - 1.0, deltaZ); +- double d3 = gradDot(this.p(i5 + gridZ), deltaX - 1.0, weirdDeltaY - 1.0, deltaZ); +- double d4 = gradDot(this.p(i2 + gridZ + 1), deltaX, weirdDeltaY, deltaZ - 1.0); +- double d5 = gradDot(this.p(i4 + gridZ + 1), deltaX - 1.0, weirdDeltaY, deltaZ - 1.0); +- double d6 = gradDot(this.p(i3 + gridZ + 1), deltaX, weirdDeltaY - 1.0, deltaZ - 1.0); +- double d7 = gradDot(this.p(i5 + gridZ + 1), deltaX - 1.0, weirdDeltaY - 1.0, deltaZ - 1.0); +- double d8 = Mth.smoothstep(deltaX); +- double d9 = Mth.smoothstep(deltaY); +- double d10 = Mth.smoothstep(deltaZ); +- return Mth.lerp3(d8, d9, d10, d, d1, d2, d3, d4, d5, d6, d7); ++ // Gale start - C2ME - optimize noise generation - inline math & small optimization: remove frequent type conversions and redundant ops ++ final int var0 = gridX & 0xFF; ++ final int var1 = (gridX + 1) & 0xFF; ++ final int var2 = this.p[var0] & 0xFF; ++ final int var3 = this.p[var1] & 0xFF; ++ final int var4 = (var2 + gridY) & 0xFF; ++ final int var5 = (var3 + gridY) & 0xFF; ++ final int var6 = (var2 + gridY + 1) & 0xFF; ++ final int var7 = (var3 + gridY + 1) & 0xFF; ++ final int var8 = this.p[var4] & 0xFF; ++ final int var9 = this.p[var5] & 0xFF; ++ final int var10 = this.p[var6] & 0xFF; ++ final int var11 = this.p[var7] & 0xFF; ++ ++ final int var12 = (var8 + gridZ) & 0xFF; ++ final int var13 = (var9 + gridZ) & 0xFF; ++ final int var14 = (var10 + gridZ) & 0xFF; ++ final int var15 = (var11 + gridZ) & 0xFF; ++ final int var16 = (var8 + gridZ + 1) & 0xFF; ++ final int var17 = (var9 + gridZ + 1) & 0xFF; ++ final int var18 = (var10 + gridZ + 1) & 0xFF; ++ final int var19 = (var11 + gridZ + 1) & 0xFF; ++ final int var20 = (this.p[var12] & 15) << 2; ++ final int var21 = (this.p[var13] & 15) << 2; ++ final int var22 = (this.p[var14] & 15) << 2; ++ final int var23 = (this.p[var15] & 15) << 2; ++ final int var24 = (this.p[var16] & 15) << 2; ++ final int var25 = (this.p[var17] & 15) << 2; ++ final int var26 = (this.p[var18] & 15) << 2; ++ final int var27 = (this.p[var19] & 15) << 2; ++ final double var60 = deltaX - 1.0; ++ final double var61 = weirdDeltaY - 1.0; ++ final double var62 = deltaZ - 1.0; ++ final double var87 = FLAT_SIMPLEX_GRAD[(var20) | 0] * deltaX + FLAT_SIMPLEX_GRAD[(var20) | 1] * weirdDeltaY + FLAT_SIMPLEX_GRAD[(var20) | 2] * deltaZ; ++ final double var88 = FLAT_SIMPLEX_GRAD[(var21) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var21) | 1] * weirdDeltaY + FLAT_SIMPLEX_GRAD[(var21) | 2] * deltaZ; ++ final double var89 = FLAT_SIMPLEX_GRAD[(var22) | 0] * deltaX + FLAT_SIMPLEX_GRAD[(var22) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var22) | 2] * deltaZ; ++ final double var90 = FLAT_SIMPLEX_GRAD[(var23) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var23) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var23) | 2] * deltaZ; ++ final double var91 = FLAT_SIMPLEX_GRAD[(var24) | 0] * deltaX + FLAT_SIMPLEX_GRAD[(var24) | 1] * weirdDeltaY + FLAT_SIMPLEX_GRAD[(var24) | 2] * var62; ++ final double var92 = FLAT_SIMPLEX_GRAD[(var25) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var25) | 1] * weirdDeltaY + FLAT_SIMPLEX_GRAD[(var25) | 2] * var62; ++ final double var93 = FLAT_SIMPLEX_GRAD[(var26) | 0] * deltaX + FLAT_SIMPLEX_GRAD[(var26) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var26) | 2] * var62; ++ final double var94 = FLAT_SIMPLEX_GRAD[(var27) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var27) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var27) | 2] * var62; ++ ++ final double var95 = deltaX * 6.0 - 15.0; ++ final double var96 = deltaY * 6.0 - 15.0; ++ final double var97 = deltaZ * 6.0 - 15.0; ++ final double var98 = deltaX * var95 + 10.0; ++ final double var99 = deltaY * var96 + 10.0; ++ final double var100 = deltaZ * var97 + 10.0; ++ final double var101 = deltaX * deltaX * deltaX * var98; ++ final double var102 = deltaY * deltaY * deltaY * var99; ++ final double var103 = deltaZ * deltaZ * deltaZ * var100; ++ ++ final double var113 = var87 + var101 * (var88 - var87); ++ final double var114 = var93 + var101 * (var94 - var93); ++ final double var115 = var91 + var101 * (var92 - var91); ++ final double var116 = var89 + var101 * (var90 - var89); ++ final double var117 = var114 - var115; ++ final double var118 = var102 * (var116 - var113); ++ final double var119 = var102 * var117; ++ final double var120 = var113 + var118; ++ final double var121 = var115 + var119; ++ return var120 + (var103 * (var121 - var120)); ++ // Gale end - C2ME - optimize noise generation - inline math & small optimization: remove frequent type conversions and redundant ops + } + + private double sampleWithDerivative(int gridX, int gridY, int gridZ, double deltaX, double deltaY, double deltaZ, double[] noiseValues) { +diff --git a/net/minecraft/world/level/levelgen/synth/PerlinNoise.java b/net/minecraft/world/level/levelgen/synth/PerlinNoise.java +index da3c26fbad32d75d71f7e59c8c3341316a754756..797368070540d78981cfeef82f9820ae6ef4b676 100644 +--- a/net/minecraft/world/level/levelgen/synth/PerlinNoise.java ++++ b/net/minecraft/world/level/levelgen/synth/PerlinNoise.java +@@ -26,6 +26,10 @@ public class PerlinNoise { + private final double lowestFreqValueFactor; + private final double lowestFreqInputFactor; + private final double maxValue; ++ // Gale start - C2ME - optimize noise generation ++ private final int octaveSamplersCount; ++ private final double [] amplitudesArray; ++ // Gale end - C2ME - optimize noise generation + + @Deprecated + public static PerlinNoise createLegacyForBlendedNoise(RandomSource random, IntStream octaves) { +@@ -127,6 +131,10 @@ public class PerlinNoise { + this.lowestFreqInputFactor = Math.pow(2.0, -i); + this.lowestFreqValueFactor = Math.pow(2.0, size - 1) / (Math.pow(2.0, size) - 1.0); + this.maxValue = this.edgeValue(2.0); ++ // Gale start - C2ME - optimize noise generation ++ this.octaveSamplersCount = this.noiseLevels.length; ++ this.amplitudesArray = this.amplitudes.toDoubleArray(); ++ // Gale end - C2ME - optimize noise generation + } + + protected double maxValue() { +@@ -138,7 +146,27 @@ public class PerlinNoise { + } + + public double getValue(double x, double y, double z) { +- return this.getValue(x, y, z, 0.0, 0.0, false); ++ // Gale start - C2ME - optimize noise generation - optimize for common cases ++ double d = 0.0; ++ double e = this.lowestFreqInputFactor; ++ double f = this.lowestFreqValueFactor; ++ ++ for (int i = 0; i < this.octaveSamplersCount; ++i) { ++ ImprovedNoise perlinNoiseSampler = this.noiseLevels[i]; ++ if (perlinNoiseSampler != null) { ++ @SuppressWarnings("deprecation") ++ double g = perlinNoiseSampler.noise( ++ wrap(x * e), wrap(y * e), wrap(z * e), 0.0, 0.0 ++ ); ++ d += this.amplitudesArray[i] * g * f; ++ } ++ ++ e *= 2.0; ++ f /= 2.0; ++ } ++ ++ return d; ++ // Gale end - C2ME - optimize noise generation - optimize for common cases + } + + @Deprecated +@@ -187,7 +215,7 @@ public class PerlinNoise { + } + + public static double wrap(double value) { +- return value - Mth.lfloor(value / 3.3554432E7 + 0.5) * 3.3554432E7; ++ return value - Math.floor(value / 3.3554432E7 + 0.5) * 3.3554432E7; // Gale - C2ME - optimize noise generation + } + + protected int firstOctave() { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0068-Optimize-sheep-offspring-color.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0068-Optimize-sheep-offspring-color.patch new file mode 100644 index 00000000..30261adf --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0068-Optimize-sheep-offspring-color.patch @@ -0,0 +1,149 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 23 Dec 2022 22:47:38 +0100 +Subject: [PATCH] Optimize sheep offspring color + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following mixins and classes: +* "carpetfixes/helpers/Utils.java" +* "carpetfixes/mixins/optimizations/SheepEntity_childColorMixin.java" +By: fxmorin <28154542+fxmorin@users.noreply.github.com> +As part of: carpet-fixes (https://github.com/fxmorin/carpet-fixes) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* carpet-fixes description * + +The game determines the child sheep's color by getting a wool block from the parents, putting them in a crafting +recipe, getting the output wool and getting the color from that. +I don't know in what world we would consider a data-driven method with that much overhead as a smart idea. Instead, +we used a prebaked list of all the possible colors and combinations, however this means that you can't use a +datapack to change it. + +* carpet-fixes copyright * + +MIT License + +Copyright (c) 2020 Fx Morin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/world/item/DyeColor.java b/net/minecraft/world/item/DyeColor.java +index f1b9fa4b39c7e13a4cf3e7947bda96c3cf523e82..028bb51c6753d44cbae76890412aa55b070f8054 100644 +--- a/net/minecraft/world/item/DyeColor.java ++++ b/net/minecraft/world/item/DyeColor.java +@@ -108,7 +108,97 @@ public enum DyeColor implements StringRepresentable { + return this.name; + } + ++ // Gale start - carpet-fixes - optimize sheep offspring color ++ private static DyeColor properDye(DyeColor firstColor, DyeColor secondColor) { ++ if (firstColor.equals(secondColor)) return firstColor; ++ ++ switch (firstColor) { ++ case WHITE -> { ++ switch (secondColor) { ++ case BLUE -> { ++ return DyeColor.LIGHT_BLUE; ++ } ++ case GRAY -> { ++ return DyeColor.LIGHT_GRAY; ++ } ++ case BLACK -> { ++ return DyeColor.GRAY; ++ } ++ case GREEN -> { ++ return DyeColor.LIME; ++ } ++ case RED -> { ++ return DyeColor.PINK; ++ } ++ } ++ } ++ case BLUE -> { ++ switch (secondColor) { ++ case WHITE -> { ++ return DyeColor.LIGHT_BLUE; ++ } ++ case GREEN -> { ++ return DyeColor.CYAN; ++ } ++ case RED -> { ++ return DyeColor.PURPLE; ++ } ++ } ++ } ++ case RED -> { ++ switch (secondColor) { ++ case YELLOW -> { ++ return DyeColor.ORANGE; ++ } ++ case WHITE -> { ++ return DyeColor.PINK; ++ } ++ case BLUE -> { ++ return DyeColor.PURPLE; ++ } ++ } ++ } ++ case GREEN -> { ++ switch (secondColor) { ++ case BLUE -> { ++ return DyeColor.CYAN; ++ } ++ case WHITE -> { ++ return DyeColor.LIME; ++ } ++ } ++ } ++ case YELLOW -> { ++ if (secondColor.equals(DyeColor.RED)) return DyeColor.ORANGE; ++ } ++ case PURPLE -> { ++ if (secondColor.equals(DyeColor.PINK)) return DyeColor.MAGENTA; ++ } ++ case PINK -> { ++ if (secondColor.equals(DyeColor.PURPLE)) return DyeColor.MAGENTA; ++ } ++ case GRAY -> { ++ if (secondColor.equals(DyeColor.WHITE)) return DyeColor.LIGHT_GRAY; ++ } ++ case BLACK -> { ++ if (secondColor.equals(DyeColor.WHITE)) return DyeColor.GRAY; ++ } ++ } ++ ++ return null; ++ } ++ // Gale end - carpet-fixes - optimize sheep offspring color ++ + public static DyeColor getMixedColor(ServerLevel level, DyeColor first, DyeColor second) { ++ // Gale start - carpet-fixes - optimize sheep offspring color ++ if (level.galeConfig().smallOptimizations.useOptimizedSheepOffspringColor) { ++ DyeColor col = properDye(first, second); ++ ++ if (col == null) col = level.random.nextBoolean() ? first : second; ++ ++ return col; ++ } ++ // Gale end - carpet-fixes - optimize sheep offspring color + CraftingInput craftingInput = makeCraftColorInput(first, second); + return level.recipeAccess() + .getRecipeFor(RecipeType.CRAFTING, craftingInput, level) diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0069-Hide-flames-on-entities-with-fire-resistance.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0069-Hide-flames-on-entities-with-fire-resistance.patch new file mode 100644 index 00000000..1060ed49 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0069-Hide-flames-on-entities-with-fire-resistance.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 14:39:27 +0100 +Subject: [PATCH] Hide flames on entities with fire resistance + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Don't send fire packets if player has Fire Resistance" +By: Cryptite +As part of: Slice (https://github.com/Cryptite/Slice) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java +index 91f414d957e19bd267f1d833b91ec4132e19a8ec..479e6162f9e9783b9e20fac238b3d8a9fc583c44 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -881,7 +881,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + this.checkBelowWorld(); + if (!this.level().isClientSide) { ++ // Gale start - Slice - hide flames on entities with fire resistance ++ if (this instanceof net.minecraft.world.entity.LivingEntity livingEntity) { ++ this.setSharedFlagOnFire(this.remainingFireTicks > 0 && (!this.level.galeConfig().gameplayMechanics.hideFlamesOnEntitiesWithFireResistance || !livingEntity.hasEffect(net.minecraft.world.effect.MobEffects.FIRE_RESISTANCE))); ++ } else { ++ // Gale end - Slice - hide flames on entities with fire resistance + this.setSharedFlagOnFire(this.remainingFireTicks > 0); ++ } // Gale - Slice - hide flames on entities with fire resistance + } + + this.firstTick = false; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0070-Skip-cloning-advancement-criteria.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0070-Skip-cloning-advancement-criteria.patch new file mode 100644 index 00000000..e355724f --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0070-Skip-cloning-advancement-criteria.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 16:54:28 +0100 +Subject: [PATCH] Skip cloning advancement criteria + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Skip cloning loot parameters" [sic] +By: etil2jz <81570777+etil2jz@users.noreply.github.com> +As part of: Mirai (https://github.com/etil2jz/Mirai) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/advancements/Advancement.java b/net/minecraft/advancements/Advancement.java +index d5c824eabf321a2c7600c7081b8d4f3057cfae2e..ccc9ca901fc8bec44f0e2717a51104caf759a1b4 100644 +--- a/net/minecraft/advancements/Advancement.java ++++ b/net/minecraft/advancements/Advancement.java +@@ -60,7 +60,7 @@ public record Advancement( + AdvancementRequirements requirements, + boolean sendsTelemetryEvent + ) { +- this(parent, display, rewards, Map.copyOf(criteria), requirements, sendsTelemetryEvent, display.map(Advancement::decorateName)); ++ this(parent, display, rewards, criteria, requirements, sendsTelemetryEvent, display.map(Advancement::decorateName)); // Gale - Mirai - skip cloning advancement criteria + } + + private static DataResult validate(Advancement advancement) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0071-Reduce-block-destruction-packet-allocations.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0071-Reduce-block-destruction-packet-allocations.patch new file mode 100644 index 00000000..459842e2 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0071-Reduce-block-destruction-packet-allocations.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 23 Dec 2022 20:42:50 +0100 +Subject: [PATCH] Reduce block destruction packet allocations + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Cache block break animation packet" +By: VytskaLT +As part of: SportPaper (https://github.com/Electroid/SportPaper) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java +index a437fa14e7bb9c66823c741fa579f763afeb4cd9..9fe9ce0488be5eeb4f5da2f2716accc2093f6a4e 100644 +--- a/net/minecraft/server/level/ServerLevel.java ++++ b/net/minecraft/server/level/ServerLevel.java +@@ -1561,6 +1561,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + + @Override + public void destroyBlockProgress(int breakerId, BlockPos pos, int progress) { ++ // Gale start - SportPaper - reduce block destruction packet allocations ++ var players = this.server.getPlayerList().getPlayers(); ++ ++ if (players.isEmpty()) { ++ return; ++ } ++ ++ ClientboundBlockDestructionPacket packet = new ClientboundBlockDestructionPacket(breakerId, pos, progress); ++ // Gale end - SportPaper - reduce block destruction packet allocations + // CraftBukkit start + Player breakerPlayer = null; + Entity entity = this.getEntity(breakerId); +@@ -1577,7 +1586,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + .callEvent(); + } + // Paper end - Add BlockBreakProgressUpdateEvent +- for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) { ++ for (ServerPlayer serverPlayer : players) { // Gale - SportPaper - reduce block destruction packet allocations + if (serverPlayer != null && serverPlayer.level() == this && serverPlayer.getId() != breakerId) { + double d = pos.getX() - serverPlayer.getX(); + double d1 = pos.getY() - serverPlayer.getY(); +@@ -1588,7 +1597,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + // CraftBukkit end + if (d * d + d1 * d1 + d2 * d2 < 1024.0) { +- serverPlayer.connection.send(new ClientboundBlockDestructionPacket(breakerId, pos, progress)); ++ serverPlayer.connection.send(packet); // Gale - SportPaper - reduce block destruction packet allocations + } + } + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0072-Spread-out-sending-all-player-info.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0072-Spread-out-sending-all-player-info.patch new file mode 100644 index 00000000..6cea9561 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0072-Spread-out-sending-all-player-info.patch @@ -0,0 +1,163 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 29 Nov 2022 23:18:57 +0100 +Subject: [PATCH] Spread out sending all player info + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Spread out and optimise player list ticksSpread out and optimise player list ticks" +By: James Lyne +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java +index 7d0bbbe0f902a27940bde1cbd0f2a8dbfcd22202..2b4431fd68054bfe8d216fd5461b1c56c692f48b 100644 +--- a/net/minecraft/server/players/PlayerList.java ++++ b/net/minecraft/server/players/PlayerList.java +@@ -114,6 +114,7 @@ public abstract class PlayerList { + private final MinecraftServer server; + public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety + private final Map playersByUUID = Maps.newHashMap(); ++ private final ServerPlayer[][] sendAllPlayerInfoBuckets = new ServerPlayer[SEND_PLAYER_INFO_INTERVAL][]; // Gale - Purpur - spread out sending all player info + private final UserBanList bans = new UserBanList(USERBANLIST_FILE); + private final IpBanList ipBans = new IpBanList(IPBANLIST_FILE); + private final ServerOpList ops = new ServerOpList(OPLIST_FILE); +@@ -309,6 +310,7 @@ public abstract class PlayerList { + this.players.add(player); + this.playersByName.put(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT), player); // Spigot + this.playersByUUID.put(player.getUUID(), player); ++ this.addToSendAllPlayerInfoBuckets(player); // Gale - Purpur - spread out sending all player info + // this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); // CraftBukkit - replaced with loop below + // Paper start - Fire PlayerJoinEvent when Player is actually ready; correctly register player BEFORE PlayerJoinEvent, so the entity is valid and doesn't require tick delay hacks + player.supressTrackerForLogin = true; +@@ -578,6 +580,7 @@ public abstract class PlayerList { + player.getAdvancements().stopListening(); + this.players.remove(player); + this.playersByName.remove(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot ++ this.removeFromSendAllPlayerInfoBuckets(player); // Gale - Purpur - spread out sending all player info + this.server.getCustomBossEvents().onPlayerDisconnect(player); + UUID uuid = player.getUUID(); + ServerPlayer serverPlayer = this.playersByUUID.get(uuid); +@@ -725,6 +728,7 @@ public abstract class PlayerList { + player.stopRiding(); // CraftBukkit + this.players.remove(player); + this.playersByName.remove(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot ++ this.removeFromSendAllPlayerInfoBuckets(player); // Gale - Purpur - spread out sending all player info + player.serverLevel().removePlayerImmediately(player, reason); + // TeleportTransition teleportTransition = player.findRespawnPositionAndUseSpawnBlock(!keepInventory, TeleportTransition.DO_NOTHING); + // ServerLevel level = teleportTransition.newLevel(); +@@ -802,6 +806,7 @@ public abstract class PlayerList { + this.players.add(serverPlayer); + this.playersByName.put(serverPlayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT), serverPlayer); // Spigot + this.playersByUUID.put(serverPlayer.getUUID(), serverPlayer); ++ this.addToSendAllPlayerInfoBuckets(serverPlayer); // Gale - Purpur - spread out sending all player info + } + // serverPlayer.initInventoryMenu(); + serverPlayer.setHealth(serverPlayer.getHealth()); +@@ -890,18 +895,58 @@ public abstract class PlayerList { + } + + public void tick() { +- if (++this.sendAllPlayerInfoIn > 600) { +- // CraftBukkit start +- for (int i = 0; i < this.players.size(); ++i) { +- final ServerPlayer target = this.players.get(i); ++ // Gale start - Purpur - spread out sending all player info ++ ServerPlayer[] sendAllPlayerInfoBucket = this.sendAllPlayerInfoBuckets[this.sendAllPlayerInfoIn]; ++ ++ if (sendAllPlayerInfoBucket != null) { ++ for (ServerPlayer target : sendAllPlayerInfoBucket) { ++ // Gale end - Purpur - spread out sending all player info + + target.connection.send(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY), com.google.common.collect.Collections2.filter(this.players, t -> target.getBukkitEntity().canSee(t.getBukkitEntity())))); + } +- // CraftBukkit end ++ // Gale start - Purpur - spread out sending all player info ++ } ++ ++ if (++this.sendAllPlayerInfoIn >= SEND_PLAYER_INFO_INTERVAL) { ++ // Gale end - Purpur - spread out sending all player info + this.sendAllPlayerInfoIn = 0; + } + } + ++ // Gale start - Purpur - spread out sending all player info ++ private void addToSendAllPlayerInfoBuckets(ServerPlayer player) { ++ ServerPlayer[] sendAllPlayerInfoBucket = this.sendAllPlayerInfoBuckets[player.sendAllPlayerInfoBucketIndex]; ++ ++ if (sendAllPlayerInfoBucket == null) { ++ this.sendAllPlayerInfoBuckets[player.sendAllPlayerInfoBucketIndex] = new ServerPlayer[]{player}; ++ } else { ++ this.sendAllPlayerInfoBuckets[player.sendAllPlayerInfoBucketIndex] = sendAllPlayerInfoBucket = java.util.Arrays.copyOf(sendAllPlayerInfoBucket, sendAllPlayerInfoBucket.length + 1); ++ sendAllPlayerInfoBucket[sendAllPlayerInfoBucket.length - 1] = player; ++ } ++ } ++ ++ private void removeFromSendAllPlayerInfoBuckets(ServerPlayer player) { ++ ServerPlayer[] sendAllPlayerInfoBucket = this.sendAllPlayerInfoBuckets[player.sendAllPlayerInfoBucketIndex]; ++ ++ if (sendAllPlayerInfoBucket != null) { ++ if (sendAllPlayerInfoBucket.length == 1) { ++ if (sendAllPlayerInfoBucket[0] == player) { ++ this.sendAllPlayerInfoBuckets[player.sendAllPlayerInfoBucketIndex] = null; ++ } ++ ++ return; ++ } ++ ++ for (int i = 0; i < sendAllPlayerInfoBucket.length; i++) { ++ if (sendAllPlayerInfoBucket[i] == player) { ++ sendAllPlayerInfoBucket[i] = sendAllPlayerInfoBucket[sendAllPlayerInfoBucket.length - 1]; ++ this.sendAllPlayerInfoBuckets[player.sendAllPlayerInfoBucketIndex] = java.util.Arrays.copyOf(sendAllPlayerInfoBucket, sendAllPlayerInfoBucket.length - 1); ++ } ++ } ++ } ++ } ++ // Gale end - Purpur - spread out sending all player info ++ + // CraftBukkit start - add a world/entity limited version + public void broadcastAll(Packet packet, net.minecraft.world.entity.player.Player entityhuman) { + for (int i = 0; i < this.players.size(); ++i) { +diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java +index 3ae542153bf1538d17e7c0fe6acc9e7f8605750c..57b11cd0eee3c2661070cc591b4bbef2f50ef009 100644 +--- a/net/minecraft/world/entity/player/Player.java ++++ b/net/minecraft/world/entity/player/Player.java +@@ -211,9 +211,12 @@ public abstract class Player extends LivingEntity { + } + // CraftBukkit end + ++ public final int sendAllPlayerInfoBucketIndex; // Gale - Purpur - spread out sending all player info ++ + public Player(Level level, BlockPos pos, float yRot, GameProfile gameProfile) { + super(EntityType.PLAYER, level); + this.setUUID(gameProfile.getId()); ++ this.sendAllPlayerInfoBucketIndex = Math.floorMod(this.uuid.hashCode(), net.minecraft.server.players.PlayerList.SEND_PLAYER_INFO_INTERVAL); // Gale - Purpur - spread out sending all player info + this.gameProfile = gameProfile; + this.inventoryMenu = new InventoryMenu(this.inventory, !level.isClientSide, this); + this.containerMenu = this.inventoryMenu; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0073-Optimize-player-list-for-sending-player-info.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0073-Optimize-player-list-for-sending-player-info.patch new file mode 100644 index 00000000..3ecab180 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0073-Optimize-player-list-for-sending-player-info.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 29 Nov 2022 23:30:38 +0100 +Subject: [PATCH] Optimize player list for sending player info + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Spread out and optimise player list ticksSpread out and optimise player list ticks" +By: James Lyne +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java +index 2b4431fd68054bfe8d216fd5461b1c56c692f48b..e03a0a350fd95406d2a5e3d220c9839326a8e1b6 100644 +--- a/net/minecraft/server/players/PlayerList.java ++++ b/net/minecraft/server/players/PlayerList.java +@@ -899,10 +899,19 @@ public abstract class PlayerList { + ServerPlayer[] sendAllPlayerInfoBucket = this.sendAllPlayerInfoBuckets[this.sendAllPlayerInfoIn]; + + if (sendAllPlayerInfoBucket != null) { +- for (ServerPlayer target : sendAllPlayerInfoBucket) { ++ for (ServerPlayer targetPlayer : sendAllPlayerInfoBucket) { // Gale - Purpur - optimize player list for sending player info + // Gale end - Purpur - spread out sending all player info ++ // Gale start - Purpur - optimize player list for sending player info ++ var target = targetPlayer.getBukkitEntity(); ++ final List list = new java.util.ArrayList<>(this.players.size()); ++ for (ServerPlayer player : this.players) { ++ if (target.canSeePlayer(player.getUUID())) { ++ list.add(player); ++ } ++ } + +- target.connection.send(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY), com.google.common.collect.Collections2.filter(this.players, t -> target.getBukkitEntity().canSee(t.getBukkitEntity())))); ++ targetPlayer.connection.send(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY), list)); ++ // Gale end - Purpur - optimize player list for sending player info + } + // Gale start - Purpur - spread out sending all player info + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0074-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0074-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch new file mode 100644 index 00000000..8cf6bee6 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0074-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 00:07:46 +0100 +Subject: [PATCH] Skip PlayerCommandSendEvent if there are no listeners + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Skip events if there's no listeners" +By: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java +index 9a25fea61abf062571d1261a0d9664d02782377a..66839bc2ac5746e355713cb006f249f71230a361 100644 +--- a/net/minecraft/commands/Commands.java ++++ b/net/minecraft/commands/Commands.java +@@ -497,6 +497,7 @@ public class Commands { + private void runSync(ServerPlayer player, java.util.Collection bukkit, RootCommandNode rootCommandNode) { + // Paper end - Perf: Async command map building + new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent(player.getBukkitEntity(), (RootCommandNode) rootCommandNode, true).callEvent(); // Paper - Brigadier API ++ if (org.bukkit.event.player.PlayerCommandSendEvent.getHandlerList().getRegisteredListeners().length > 0) { // Gale - Purpur - skip PlayerCommandSendEvent if there are no listeners + org.bukkit.event.player.PlayerCommandSendEvent event = new org.bukkit.event.player.PlayerCommandSendEvent(player.getBukkitEntity(), new java.util.LinkedHashSet<>(bukkit)); + event.getPlayer().getServer().getPluginManager().callEvent(event); + +@@ -507,6 +508,7 @@ public class Commands { + } + } + // CraftBukkit end ++ } // Gale - Purpur - skip PlayerCommandSendEvent if there are no listeners + + player.connection.send(new ClientboundCommandsPacket(rootCommandNode)); + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0075-Send-multiple-keep-alive-packets.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0075-Send-multiple-keep-alive-packets.patch new file mode 100644 index 00000000..a8564c75 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0075-Send-multiple-keep-alive-packets.patch @@ -0,0 +1,117 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 00:43:42 +0100 +Subject: [PATCH] Send multiple keep-alive packets + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Alternative Keepalive Handling" +By: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +index 2b059bff0d24b52b106a0af4b7e79818f385596e..ea34bb4913e7357f5b76a64443f7e744abdf7b5e 100644 +--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +@@ -40,6 +40,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + private long keepAliveChallenge; + private long closedListenerTime; + private boolean closed = false; ++ private it.unimi.dsi.fastutil.longs.LongList keepAlives = new it.unimi.dsi.fastutil.longs.LongArrayList(); // Gale - Purpur - send multiple keep-alive packets + private int latency; + private volatile boolean suspendFlushingOnServerThread = false; + // CraftBukkit start +@@ -48,7 +49,10 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + public boolean processedDisconnect; + // CraftBukkit end + public final java.util.Map packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks +- private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit ++ // Gale start - Purpur - send multiple keep-alive packets ++ private static final long KEEPALIVE_LIMIT_IN_SECONDS = Long.getLong("paper.playerconnection.keepalive", 30); // Paper - provide property to set keepalive limit ++ private static final long KEEPALIVE_LIMIT = KEEPALIVE_LIMIT_IN_SECONDS * 1000; ++ // Gale end - Purpur - send multiple keep-alive packets + protected static final net.minecraft.resources.ResourceLocation MINECRAFT_BRAND = net.minecraft.resources.ResourceLocation.withDefaultNamespace("brand"); // Paper - Brand support + + public ServerCommonPacketListenerImpl(MinecraftServer server, Connection connection, CommonListenerCookie cookie, net.minecraft.server.level.ServerPlayer player) { // CraftBukkit +@@ -117,6 +121,16 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + + @Override + public void handleKeepAlive(ServerboundKeepAlivePacket packet) { ++ // Gale start - Purpur - send multiple keep-alive packets ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().misc.keepalive.sendMultiple) { ++ if (this.keepAlivePending && !keepAlives.isEmpty() && keepAlives.contains(packet.getId())) { ++ int ping = (int) (Util.getMillis() - packet.getId()); ++ this.latency = (this.latency * 3 + ping) / 4; ++ this.keepAlivePending = false; ++ this.keepAlives.clear(); // We got a valid response, let's roll with it and forget the rest ++ } ++ } else { ++ // Gale end - Purpur - send multiple keep-alive packets + if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) { + int i = (int)(Util.getMillis() - this.keepAliveTime); + this.latency = (this.latency * 3 + i) / 4; +@@ -124,6 +138,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } else if (!this.isSingleplayerOwner()) { + this.disconnectAsync(TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - add proper async disconnect + } ++ } // Gale - Purpur - send multiple keep-alive packets + } + + @Override +@@ -236,6 +251,21 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // This should effectively place the keepalive handling back to "as it was" before 1.12.2 + final long elapsedTime = millis - this.keepAliveTime; ++ // Gale start - Purpur - send multiple keep-alive packets ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().misc.keepalive.sendMultiple) { ++ if (elapsedTime >= 1000L) { // 1 second ++ if (this.keepAlivePending && !this.processedDisconnect && this.keepAlives.size() >= KEEPALIVE_LIMIT_IN_SECONDS) { ++ LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); ++ this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); ++ } else if (this.checkIfClosed(millis)) { ++ this.keepAlivePending = true; ++ this.keepAliveTime = millis; // hijack this field for 1 second intervals ++ this.keepAlives.add(millis); // millis is ID ++ this.send(new ClientboundKeepAlivePacket(millis)); ++ } ++ } ++ } else { ++ // Gale end - Purpur - send multiple keep-alive packets + if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // use vanilla's 15000L between keep alive packets + if (this.keepAlivePending) { + if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected +@@ -249,6 +279,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge)); + } + } ++ } // Gale - Purpur - send multiple keep-alive packets + } + + private boolean checkIfClosed(long time) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0076-Make-slow-login-timeout-configurable.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0076-Make-slow-login-timeout-configurable.patch new file mode 100644 index 00000000..2fa3b774 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0076-Make-slow-login-timeout-configurable.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 24 Dec 2022 22:50:13 +0100 +Subject: [PATCH] Make slow login timeout configurable + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +index 0fdf22af66945c1b6987e07f6c8a167110033b53..e802cecf30a2bfa4390ca70c45a9840032c8c046 100644 +--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +@@ -127,7 +127,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + this.finishLoginAndWaitForClient(this.authenticatedProfile); + } + +- if (this.tick++ == 600) { ++ // Gale start - make slow login timeout configurable ++ int slowLoginTimeout = org.galemc.gale.configuration.GaleGlobalConfiguration.get().misc.premiumAccountSlowLoginTimeout; ++ ++ if (this.tick++ >= (slowLoginTimeout < 1 ? MAX_TICKS_BEFORE_LOGIN : slowLoginTimeout)) { ++ // Gale end - make slow login timeout configurable + this.disconnect(Component.translatable("multiplayer.disconnect.slow_login")); + } + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0077-Don-t-load-chunks-to-spawn-phantoms.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0077-Don-t-load-chunks-to-spawn-phantoms.patch new file mode 100644 index 00000000..bdabf44a --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0077-Don-t-load-chunks-to-spawn-phantoms.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sun, 25 Dec 2022 19:31:09 +0100 +Subject: [PATCH] Don't load chunks to spawn phantoms + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Don't load chunks when spawning phantoms" +By: PureGero +As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/world/level/levelgen/PhantomSpawner.java b/net/minecraft/world/level/levelgen/PhantomSpawner.java +index 11d25e64349b27bf54dc1620e4cce444c79f581c..c792483860d31ce663e7de34e9f79ff46de75b8c 100644 +--- a/net/minecraft/world/level/levelgen/PhantomSpawner.java ++++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java +@@ -61,7 +61,15 @@ public class PhantomSpawner implements CustomSpawner { + BlockPos blockPos1 = blockPos.above(20 + randomSource.nextInt(15)) + .east(-10 + randomSource.nextInt(21)) + .south(-10 + randomSource.nextInt(21)); +- BlockState blockState = level.getBlockState(blockPos1); ++ // Gale start - MultiPaper - don't load chunks to spawn phantoms ++ BlockState blockState; ++ if (level.galeConfig().smallOptimizations.loadChunks.toSpawnPhantoms) { ++ blockState = level.getBlockState(blockPos1); ++ } else { ++ blockState = level.getBlockStateIfLoaded(blockPos1); ++ if (blockState == null) continue; ++ } ++ // Gale end - MultiPaper - don't load chunks to spawn phantoms + FluidState fluidState = level.getFluidState(blockPos1); + if (NaturalSpawner.isValidEmptySpawnBlock(level, blockPos1, blockState, fluidState, EntityType.PHANTOM)) { + SpawnGroupData spawnGroupData = null; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0078-Don-t-load-chunks-to-activate-climbing-entities.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0078-Don-t-load-chunks-to-activate-climbing-entities.patch new file mode 100644 index 00000000..5fa305ea --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0078-Don-t-load-chunks-to-activate-climbing-entities.patch @@ -0,0 +1,82 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sun, 25 Dec 2022 19:39:38 +0100 +Subject: [PATCH] Don't load chunks to activate climbing entities + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java +index 479e6162f9e9783b9e20fac238b3d8a9fc583c44..6bb24d659e1b325337da82c649a9b4b641851b62 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -4676,6 +4676,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + return this.inBlockState; + } + ++ // Gale start - don't load chunks to activate climbing entities ++ public @Nullable BlockState getInBlockStateIfLoaded() { ++ if (this.inBlockState == null) { ++ this.inBlockState = this.level.getBlockStateIfLoaded(this.blockPosition()); ++ } ++ ++ return this.inBlockState; ++ } ++ // Gale end - don't load chunks to activate climbing entities ++ + public ChunkPos chunkPosition() { + return this.chunkPosition; + } +diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java +index 538183d980de59b010fadacf9bf902bd4e9d1ec5..368f1c1028f92bcf6c03bdc6a7435fe25f63f288 100644 +--- a/net/minecraft/world/entity/LivingEntity.java ++++ b/net/minecraft/world/entity/LivingEntity.java +@@ -2029,8 +2029,17 @@ public abstract class LivingEntity extends Entity implements Attackable { + + public boolean onClimbableCached() { + if (!this.blockPosition().equals(this.lastClimbingPosition)) { +- this.cachedOnClimbable = this.onClimbable(); +- this.lastClimbingPosition = this.blockPosition(); ++ // Gale start - don't load chunks to activate climbing entities ++ Boolean onClimbableIfLoaded = this.onClimbable(this.level().galeConfig().smallOptimizations.loadChunks.toActivateClimbingEntities); ++ ++ if (onClimbableIfLoaded != null) { ++ this.cachedOnClimbable = onClimbableIfLoaded; ++ this.lastClimbingPosition = this.blockPosition(); ++ } else { ++ this.cachedOnClimbable = false; ++ this.lastClimbingPosition = null; ++ } ++ // Gale end - don't load chunks to activate climbing entities + } + + return this.cachedOnClimbable; +@@ -2038,11 +2047,28 @@ public abstract class LivingEntity extends Entity implements Attackable { + // Gale end - Airplane - cache on climbable check + + public boolean onClimbable() { ++ // Gale start - don't load chunks to activate climbing entities ++ return onClimbable(true); ++ } ++ ++ public Boolean onClimbable(boolean loadChunk) { ++ // Gale end - don't load chunks to activate climbing entities + if (this.isSpectator()) { + return false; + } else { + BlockPos blockPos = this.blockPosition(); + BlockState inBlockState = this.getInBlockState(); ++ // Gale start - don't load chunks to activate climbing entities ++ if (loadChunk) { ++ inBlockState = this.getInBlockState(); ++ } else { ++ inBlockState = this.getInBlockStateIfLoaded(); ++ ++ if (inBlockState == null) { ++ return null; ++ } ++ } ++ // Gale end - don't load chunks to activate climbing entities + if (inBlockState.is(BlockTags.CLIMBABLE)) { + this.lastClimbablePos = Optional.of(blockPos); + return true; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0079-Broadcast-crit-animations-as-the-entity-being-critte.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0079-Broadcast-crit-animations-as-the-entity-being-critte.patch new file mode 100644 index 00000000..9604768d --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0079-Broadcast-crit-animations-as-the-entity-being-critte.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sun, 25 Dec 2022 23:33:28 +0100 +Subject: [PATCH] Broadcast crit animations as the entity being critted + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Send crit animations as the entity being critted" +By: PureGero +As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java +index 8a20de0780dbcec5f228f549a4134fce9714d170..b44cb6db29668767d0f092ddb6382f4b2baf72b8 100644 +--- a/net/minecraft/server/level/ServerPlayer.java ++++ b/net/minecraft/server/level/ServerPlayer.java +@@ -2157,12 +2157,18 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + + @Override + public void crit(Entity entityHit) { +- this.serverLevel().getChunkSource().broadcastAndSend(this, new ClientboundAnimatePacket(entityHit, 4)); ++ // Gale start - MultiPaper - broadcast crit animations as the entity being critted ++ var level = this.serverLevel(); ++ level.getChunkSource().broadcastAndSend(level.galeConfig().gameplayMechanics.fixes.broadcastCritAnimationsAsTheEntityBeingCritted ? entityHit : this, new ClientboundAnimatePacket(entityHit, 4)); ++ // Gale end - MultiPaper - broadcast crit animations as the entity being critted + } + + @Override + public void magicCrit(Entity entityHit) { +- this.serverLevel().getChunkSource().broadcastAndSend(this, new ClientboundAnimatePacket(entityHit, 5)); ++ // Gale start - MultiPaper - broadcast crit animations as the entity being critted ++ var level = this.serverLevel(); ++ level.getChunkSource().broadcastAndSend(level.galeConfig().gameplayMechanics.fixes.broadcastCritAnimationsAsTheEntityBeingCritted ? entityHit : this, new ClientboundAnimatePacket(entityHit, 5)); ++ // Gale end - MultiPaper - broadcast crit animations as the entity being critted + } + + @Override diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0080-Ignore-null-legacy-structure-data.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0080-Ignore-null-legacy-structure-data.patch new file mode 100644 index 00000000..b219a8f5 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0080-Ignore-null-legacy-structure-data.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sun, 25 Dec 2022 23:39:05 +0100 +Subject: [PATCH] Ignore null legacy structure data + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add null check in LegacyStructureDataHandler" +By: PureGero +As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java b/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java +index 28872f70ac27aacc8848cf5659cfd2c55e4cd19a..d928157507dd70645425c51e766783eab17486a0 100644 +--- a/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java ++++ b/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java +@@ -171,13 +171,20 @@ public class LegacyStructureDataHandler { + + private void populateCaches(@Nullable DimensionDataStorage storage) { + if (storage != null) { ++ boolean ignoreNullLegacyStructureData = org.galemc.gale.configuration.GaleGlobalConfiguration.get().misc.ignoreNullLegacyStructureData; // Gale - MultiPaper - ignore null legacy structure data + for (String string : this.legacyKeys) { + CompoundTag compoundTag = new CompoundTag(); + + try { +- compoundTag = storage.readTagFromDisk(string, DataFixTypes.SAVED_DATA_STRUCTURE_FEATURE_INDICES, 1493) ++ // Gale start - MultiPaper - ignore null legacy structure data ++ CompoundTag tag = storage.readTagFromDisk(string, DataFixTypes.SAVED_DATA_STRUCTURE_FEATURE_INDICES, 1493); ++ ++ if (ignoreNullLegacyStructureData && tag == null) continue; ++ ++ compoundTag = tag + .getCompound("data") + .getCompound("Features"); ++ // Gale end - MultiPaper - ignore null legacy structure data + if (compoundTag.isEmpty()) { + continue; + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0081-Skip-unnecessary-mob-spawning-computations.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0081-Skip-unnecessary-mob-spawning-computations.patch new file mode 100644 index 00000000..63945ef5 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0081-Skip-unnecessary-mob-spawning-computations.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sun, 25 Dec 2022 20:29:03 +0100 +Subject: [PATCH] Skip unnecessary mob spawning computations + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Only create a spawner state when we are actually spawning mobs" +By: PureGero +As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java +index 5c8d76b80c6cefd87088282e59f5f0f72a4f1611..7a18b11782b2524280fddf20e6b1cabdddf07c49 100644 +--- a/net/minecraft/server/level/ServerChunkCache.java ++++ b/net/minecraft/server/level/ServerChunkCache.java +@@ -550,9 +550,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + + private void tickChunks(long timeInhabited, List chunks) { // Gale - Purpur - remove vanilla profiler ++ // Gale start - MultiPaper - skip unnecessary mob spawning computations ++ NaturalSpawner.SpawnState spawnState; // moved down ++ final boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit ++ boolean flagAndHasNaturalSpawn = _boolean && this.anySpawnCategoryIsSpawnedThisTick(); ++ ++ if (flagAndHasNaturalSpawn) { ++ // Gale end - MultiPaper - skip unnecessary mob spawning computations + int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount(); + // Paper start - Optional per player mob spawns +- NaturalSpawner.SpawnState spawnState; + if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled + // re-set mob counts + for (ServerPlayer player : this.level.players) { +@@ -574,10 +580,14 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + // Paper end - Optional per player mob spawns + this.lastSpawnState = spawnState; +- boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit ++ // Gale start - MultiPaper - skip unnecessary mob spawning computations ++ } else { ++ spawnState = null; ++ } ++ // Gale end - MultiPaper - skip unnecessary mob spawning computations + int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); + List filteredSpawningCategories; +- if (_boolean && (this.spawnEnemies || this.spawnFriendlies)) { ++ if (flagAndHasNaturalSpawn && (this.spawnEnemies || this.spawnFriendlies)) { // Gale - MultiPaper - skip unnecessary mob spawning computations + // Paper start - PlayerNaturallySpawnCreaturesEvent + for (ServerPlayer entityPlayer : this.level.players()) { + int chunkRange = Math.min(level.spigotConfig.mobSpawnRange, entityPlayer.getBukkitEntity().getViewDistance()); +@@ -604,11 +614,25 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + } + +- if (_boolean) { ++ if (flagAndHasNaturalSpawn) { // Gale - MultiPaper - skip unnecessary mob spawning computations + this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); + } + } + ++ // Gale start - MultiPaper - skip unnecessary mob spawning computations ++ private boolean anySpawnCategoryIsSpawnedThisTick() { ++ long gameTime = this.level.getLevelData().getGameTime(); ++ ++ for (long ticksForSpawnCategory : this.level.ticksPerSpawnCategory.values()) { ++ if (ticksForSpawnCategory != 0L && gameTime % ticksForSpawnCategory == 0L) { ++ return true; ++ } ++ } ++ ++ return false; ++ } ++ // Gale end - MultiPaper - skip unnecessary mob spawning computations ++ + private void getFullChunk(long chunkPos, Consumer fullChunkGetter) { + // Paper start - rewrite chunk system + // note: bypass currentlyLoaded from getChunkNow diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0082-Prevent-entities-random-strolling-into-non-ticking-c.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0082-Prevent-entities-random-strolling-into-non-ticking-c.patch new file mode 100644 index 00000000..77c61468 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0082-Prevent-entities-random-strolling-into-non-ticking-c.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 20:38:15 +0100 +Subject: [PATCH] Prevent entities random strolling into non-ticking chunks + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Don't wander into non-ticking chunks" +By: PureGero +As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java b/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java +index bad57b0017c78d4d1d32c239fae5bc2ea20bc3c3..28f770d40f5ada6d547e91cd3147969702e1ae75 100644 +--- a/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java ++++ b/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java +@@ -49,7 +49,7 @@ public class RandomStrollGoal extends Goal { + } + + Vec3 position = this.getPosition(); +- if (position == null) { ++ if (position == null || (!this.mob.level().galeConfig().gameplayMechanics.entitiesCanRandomStrollIntoNonTickingChunks && !((net.minecraft.server.level.ServerLevel) this.mob.level()).isPositionEntityTicking(net.minecraft.core.BlockPos.containing(position)))) { // Gale - MultiPaper - prevent entities random strolling into non-ticking chunks + return false; + } else { + this.wantedX = position.x; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0083-Do-not-place-player-in-world-if-kicked-before-being-.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0083-Do-not-place-player-in-world-if-kicked-before-being-.patch new file mode 100644 index 00000000..44916f9e --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0083-Do-not-place-player-in-world-if-kicked-before-being-.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sun, 25 Dec 2022 23:14:40 +0100 +Subject: [PATCH] Do not place player in world if kicked before being spawned + in + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Check if player is still connected after PlayerSpawnLocationEvent" +By: PureGero +As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java +index 70f3dea61eca3639a4e0cc6a45c1d35fbc4e3e5a..61d7d50d2a2e566d2f955b22c95908c6e4ef5274 100644 +--- a/net/minecraft/server/players/PlayerList.java ++++ b/net/minecraft/server/players/PlayerList.java +@@ -234,6 +234,13 @@ public abstract class PlayerList { + org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new org.spigotmc.event.player.PlayerSpawnLocationEvent(spawnPlayer, spawnPlayer.getLocation()); + this.cserver.getPluginManager().callEvent(ev); + ++ // Gale start - MultiPaper - do not place player in world if kicked before being spawned in ++ if (!connection.isConnected() || player.quitReason != null) { ++ /*pendingPlayers.remove(player.getUUID(), player);*/ // Gale - MultiPaper - do not place player in world if kicked before being spawned in - this patch was removed from Paper but might be useful later ++ return; ++ } ++ // Gale end - MultiPaper - do not place player in world if kicked before being spawned in ++ + org.bukkit.Location loc = ev.getSpawnLocation(); + serverLevel = ((org.bukkit.craftbukkit.CraftWorld) loc.getWorld()).getHandle(); + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0084-Global-EULA-file.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0084-Global-EULA-file.patch new file mode 100644 index 00000000..f1b3882a --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0084-Global-EULA-file.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Mon, 26 Dec 2022 00:34:43 +0100 +Subject: [PATCH] Global EULA file + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Global Eula file" +By: tr7zw +As part of: YAPFA (https://github.com/tr7zw/YAPFA) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* YAPFA copyright * + +Copyright 2020 tr7zw + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +diff --git a/net/minecraft/server/Eula.java b/net/minecraft/server/Eula.java +index 1f0413214f54e9a47f53c623484d6882c85f54c9..2ffd2ee5846c35b0394230116334518ba95ed409 100644 +--- a/net/minecraft/server/Eula.java ++++ b/net/minecraft/server/Eula.java +@@ -17,13 +17,31 @@ public class Eula { + + public Eula(Path file) { + this.file = file; +- this.agreed = SharedConstants.IS_RUNNING_IN_IDE || this.readFile(); ++ this.agreed = SharedConstants.IS_RUNNING_IN_IDE || this.readGlobalFile() || this.readFile(); // Gale - YAPFA - global EULA file + } + + private boolean readFile() { ++ // Gale start - YAPFA - global EULA file ++ return readFile(this.file); ++ } ++ ++ private boolean readGlobalFile() { ++ try { ++ Path globalFile = Path.of(System.getProperty("user.home"), "eula.txt"); ++ ++ if (globalFile.toFile().exists()) { ++ return readFile(globalFile); ++ } ++ } catch (Throwable ignored) {} ++ ++ return false; ++ } ++ ++ private boolean readFile(Path file) { ++ // Gale end - YAPFA - global EULA file + try { + boolean var3; +- try (InputStream inputStream = Files.newInputStream(this.file)) { ++ try (InputStream inputStream = Files.newInputStream(file)) { // Gale - YAPFA - global EULA file + Properties map = new Properties(); + map.load(inputStream); + var3 = Boolean.parseBoolean(map.getProperty("eula", "false")); +@@ -31,8 +49,10 @@ public class Eula { + + return var3; + } catch (Exception var6) { ++ if (file == this.file) { // Gale - YAPFA - global EULA file + LOGGER.warn("Failed to load {}", this.file); + this.saveDefaults(); ++ } // Gale - YAPFA - global EULA file + return false; + } + } diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0085-5-second-TPS-average.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0085-5-second-TPS-average.patch new file mode 100644 index 00000000..ad9f2502 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0085-5-second-TPS-average.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 12:42:32 +0100 +Subject: [PATCH] 5 second TPS average + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add 5 second tps average in /tps" +By: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java +index 8b42972dde96f04ba0de53e57e192edf3f5ce054..de1ba431c4bac41a9e79340a4f0211b438640f28 100644 +--- a/net/minecraft/server/MinecraftServer.java ++++ b/net/minecraft/server/MinecraftServer.java +@@ -1093,6 +1093,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop +Date: Sat, 26 Nov 2022 16:54:05 +0100 +Subject: [PATCH] Measure last tick time + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add getLastTickMs api" +By: tr7zw +As part of: YAPFA (https://github.com/tr7zw/YAPFA) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* YAPFA copyright * + +Copyright 2020 tr7zw + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java +index de1ba431c4bac41a9e79340a4f0211b438640f28..f33fb9b30863dd8ff7207db905fcfb7547b09383 100644 +--- a/net/minecraft/server/MinecraftServer.java ++++ b/net/minecraft/server/MinecraftServer.java +@@ -1140,6 +1140,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop false : this::haveTime); ++ lastTickProperTime = (System.nanoTime() - tickProperStart) / 1000000L; // Gale - YAPFA - last tick time + // Paper start - rewrite chunk system + final Throwable crash = this.chunkSystemCrash; + if (crash != null) { +@@ -1353,11 +1360,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop !this.haveTime()); + } finally { + this.waitingForNextTick = false; ++ lastTickOversleepTime = (System.nanoTime() - tickOversleepStart) / 1000000L; // Gale - YAPFA - last tick time + } + } + diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0087-Increase-time-statistics-in-intervals.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0087-Increase-time-statistics-in-intervals.patch new file mode 100644 index 00000000..bb085cf4 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0087-Increase-time-statistics-in-intervals.patch @@ -0,0 +1,87 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 22:50:57 +0100 +Subject: [PATCH] Increase time statistics in intervals + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Smarter statistics ticking" +By: Mykyta Komarnytskyy +As part of: Hydrinity (https://github.com/duplexsystem/Hydrinity) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Hydrinity description * + +In vanilla, statistics that count time spent for an action (i.e. time played or sneak time) are incremented every tick. This is retarded. With this patch and a configured interval of 20, the statistics are only ticked every 20th tick and are incremented by 20 ticks at a time. This means a lot less ticking with the same accurate counting. + +With an interval of 20, this patch saves roughly 3ms per tick on a server w/ 80 players online. + +* Hydrinity copyright * + +This patch was created for the Hydrinity project by Mykyta Komarnytskyy under the MIT license. + +MIT License + +Copyright (c) 2020 Mykyta Komarnytskyy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java +index 57b11cd0eee3c2661070cc591b4bbef2f50ef009..4a0f9626bb82ea885661b1827c99a4baf3892cf7 100644 +--- a/net/minecraft/world/entity/player/Player.java ++++ b/net/minecraft/world/entity/player/Player.java +@@ -156,6 +156,7 @@ public abstract class Player extends LivingEntity { + protected static final EntityDataAccessor DATA_PLAYER_MAIN_HAND = SynchedEntityData.defineId(Player.class, EntityDataSerializers.BYTE); + protected static final EntityDataAccessor DATA_SHOULDER_LEFT = SynchedEntityData.defineId(Player.class, EntityDataSerializers.COMPOUND_TAG); + protected static final EntityDataAccessor DATA_SHOULDER_RIGHT = SynchedEntityData.defineId(Player.class, EntityDataSerializers.COMPOUND_TAG); ++ public static int increaseTimeStatisticsInterval; // Gale - Hydrinity - increase time statistics in intervals - store as static field for fast access + public static final int CLIENT_LOADED_TIMEOUT_TIME = 60; + private long timeEntitySatOnShoulder; + final Inventory inventory = new Inventory(this); +@@ -307,19 +308,23 @@ public abstract class Player extends LivingEntity { + this.moveCloak(); + if (this instanceof ServerPlayer serverPlayer) { + this.foodData.tick(serverPlayer); +- this.awardStat(Stats.PLAY_TIME); +- this.awardStat(Stats.TOTAL_WORLD_TIME); ++ // Gale start - Hydrinity - increase time statistics in intervals ++ if (increaseTimeStatisticsInterval == 1 || this.tickCount % increaseTimeStatisticsInterval == 0) { ++ this.awardStat(Stats.PLAY_TIME, increaseTimeStatisticsInterval); ++ this.awardStat(Stats.TOTAL_WORLD_TIME, increaseTimeStatisticsInterval); ++ // Gale end - Hydrinity - increase time statistics in intervals + if (this.isAlive()) { +- this.awardStat(Stats.TIME_SINCE_DEATH); ++ this.awardStat(Stats.TIME_SINCE_DEATH, increaseTimeStatisticsInterval); // Gale - Hydrinity - increase time statistics in intervals + } + + if (this.isDiscrete()) { +- this.awardStat(Stats.CROUCH_TIME); ++ this.awardStat(Stats.CROUCH_TIME, increaseTimeStatisticsInterval); // Gale - Hydrinity - increase time statistics in intervals + } + + if (!this.isSleeping()) { +- this.awardStat(Stats.TIME_SINCE_REST); ++ this.awardStat(Stats.TIME_SINCE_REST, increaseTimeStatisticsInterval); // Gale - Hydrinity - increase time statistics in intervals + } ++ } // Gale - Hydrinity - increase time statistics in intervals + } + + int i = 29999999; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0088-For-collision-check-has-physics-before-same-vehicle.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0088-For-collision-check-has-physics-before-same-vehicle.patch new file mode 100644 index 00000000..52dfc218 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0088-For-collision-check-has-physics-before-same-vehicle.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 29 Nov 2022 00:30:17 +0100 +Subject: [PATCH] For collision check has physics before same vehicle +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Swaps the predicate order of collision" +By: ã„—ã„ Ë‹ ã„‘ã„§ËŠ +As part of: Akarin (https://github.com/Akarin-project/Akarin) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java +index 6bb24d659e1b325337da82c649a9b4b641851b62..8e2471593442ef3d14b9479e91d341c364a91c18 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -2165,8 +2165,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + + public void push(Entity entity) { ++ if (!entity.noPhysics && !this.noPhysics) { // Gale - Akarin - collision physics check before vehicle check + if (!this.isPassengerOfSameVehicle(entity)) { +- if (!entity.noPhysics && !this.noPhysics) { + if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant + double d = entity.getX() - this.getX(); + double d1 = entity.getZ() - this.getZ(); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0089-Skip-negligible-planar-movement-multiplication.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0089-Skip-negligible-planar-movement-multiplication.patch new file mode 100644 index 00000000..4c6b3b8b --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0089-Skip-negligible-planar-movement-multiplication.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 23:44:41 +0100 +Subject: [PATCH] Skip negligible planar movement multiplication + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java +index 8e2471593442ef3d14b9479e91d341c364a91c18..050bd4a9b11e416bd4b3ff5ccd0f9563d2d05dcf 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -1209,8 +1209,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + ++ // Gale start - skip negligible planar movement multiplication ++ Vec3 oldDeltaMovement = this.getDeltaMovement(); ++ ++ if (oldDeltaMovement.x < -1e-6 || oldDeltaMovement.x > 1e-6 || oldDeltaMovement.z < -1e-6 || oldDeltaMovement.z > 1e-6) { ++ // Gale end - skip negligible planar movement multiplication + float blockSpeedFactor = this.getBlockSpeedFactor(); +- this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor)); ++ // Gale start - skip negligible planar movement multiplication ++ if (blockSpeedFactor < 1 - 1e-6 || blockSpeedFactor > 1 + 1e-6) { ++ this.setDeltaMovement(oldDeltaMovement.multiply(blockSpeedFactor, 1.0, blockSpeedFactor)); ++ } ++ } ++ // Gale end - skip negligible planar movement multiplication + } + } + // Paper start - detailed watchdog information diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0090-Optimize-matching-item-checks.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0090-Optimize-matching-item-checks.patch new file mode 100644 index 00000000..ba196457 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0090-Optimize-matching-item-checks.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sun, 25 Dec 2022 20:51:32 +0100 +Subject: [PATCH] Optimize matching item checks + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java +index f6c0f9275dd737c0142d6e4be07be71ad50b4732..7fbfbe7777cc66170cc616565a8b94f2081da50f 100644 +--- a/net/minecraft/world/item/ItemStack.java ++++ b/net/minecraft/world/item/ItemStack.java +@@ -884,11 +884,11 @@ public final class ItemStack implements DataComponentHolder { + } + + public static boolean isSameItem(ItemStack stack, ItemStack other) { +- return stack.is(other.getItem()); ++ return stack == other || stack.is(other.getItem()); // Gale - optimize identical item checks + } + + public static boolean isSameItemSameComponents(ItemStack stack, ItemStack other) { +- return stack.is(other.getItem()) && (stack.isEmpty() && other.isEmpty() || Objects.equals(stack.components, other.components)); ++ return stack == other || stack.is(other.getItem()) && (stack.isEmpty() && other.isEmpty() || Objects.equals(stack.components, other.components)); // Gale - optimize identical item checks + } + + public static MapCodec lenientOptionalFieldOf(String fieldName) { diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0091-Pre-compute-VarLong-sizes.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0091-Pre-compute-VarLong-sizes.patch new file mode 100644 index 00000000..2acd2252 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0091-Pre-compute-VarLong-sizes.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Mon, 21 Aug 2023 21:46:10 +0200 +Subject: [PATCH] Pre-compute VarLong sizes + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following commit: +"Reapply "Optimize varint writing"" +By: Andrew Steinborn +As part of: Velocity (https://github.com/PaperMC/Velocity) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Velocity description * + +Inspired by the approach described at the bottom of https://richardstartin.github.io/posts/dont-use-protobuf-for-telemetry + +Given that we do a lot of varint writing as well, this should provide a small performance boost for larger/complex packets whilst not regressing hard on smaller packets. + +This includes a test to ensure that the behavior is as expected and fixes the initialization loop so that the correct results will be given. Much thanks to @octylFractal for acting as my duck while trying to figure this out. + +diff --git a/net/minecraft/network/VarLong.java b/net/minecraft/network/VarLong.java +index df9a85b19a9767c85f02837af6835f7ddb6c7dc3..ff9d84bf761797a8f695926c3cbb12c07609365d 100644 +--- a/net/minecraft/network/VarLong.java ++++ b/net/minecraft/network/VarLong.java +@@ -9,6 +9,18 @@ public class VarLong { + private static final int DATA_BITS_PER_BYTE = 7; + + public static int getByteSize(long data) { ++ // Gale start - Velocity - pre-compute VarInt and VarLong sizes ++ return VARLONG_EXACT_BYTE_LENGTHS[Long.numberOfLeadingZeros(data)]; ++ } ++ private static final int[] VARLONG_EXACT_BYTE_LENGTHS = new int[65]; ++ static { ++ for (int i = 0; i < 64; ++i) { ++ VARLONG_EXACT_BYTE_LENGTHS[i] = (int) Math.ceil((63d - (i - 1)) / 7d); ++ } ++ VARLONG_EXACT_BYTE_LENGTHS[64] = 1; // Special case for the number 0 ++ } ++ static int getByteSizeOld(long data) { // public -> package-private ++ // Gale end - Velocity - pre-compute VarInt and VarLong sizes + for (int i = 1; i < 10; i++) { + if ((data & -1L << i * 7) == 0L) { + return i; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0092-Optimize-VarInt-write-and-VarLong-write.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0092-Optimize-VarInt-write-and-VarLong-write.patch new file mode 100644 index 00000000..ca4c2851 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0092-Optimize-VarInt-write-and-VarLong-write.patch @@ -0,0 +1,214 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 22 Aug 2023 21:38:37 +0200 +Subject: [PATCH] Optimize VarInt#write and VarLong#write + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following commit: +"Reapply "Optimize varint writing"" +By: Andrew Steinborn +As part of: Velocity (https://github.com/PaperMC/Velocity) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Velocity description * + +Inspired by the approach described at the bottom of https://richardstartin.github.io/posts/dont-use-protobuf-for-telemetry + +Given that we do a lot of varint writing as well, this should provide a small performance boost for larger/complex packets whilst not regressing hard on smaller packets. + +This includes a test to ensure that the behavior is as expected and fixes the initialization loop so that the correct results will be given. Much thanks to @octylFractal for acting as my duck while trying to figure this out. + +diff --git a/net/minecraft/network/VarInt.java b/net/minecraft/network/VarInt.java +index 4897ff4648083ebe737ae5b32bae344af27357e4..6f8dd31582f0e1d3a71acc7a142c1f4ec0539d9e 100644 +--- a/net/minecraft/network/VarInt.java ++++ b/net/minecraft/network/VarInt.java +@@ -51,6 +51,41 @@ public class VarInt { + } + + public static ByteBuf write(ByteBuf buffer, int value) { ++ // Gale start - Velocity - optimized VarInt#write ++ if ((value & 0xFFFFFF80) == 0) { ++ buffer.writeByte(value); ++ } else if ((value & 0xFFFFC000) == 0) { ++ int w = (value & 0x7F) << 8 ++ | (value >>> 7) ++ | 0x00008000; ++ buffer.writeShort(w); ++ } else if ((value & 0xFFE00000) == 0) { ++ int w = (value & 0x7F) << 16 ++ | (value & 0x3F80) << 1 ++ | (value >>> 14) ++ | 0x00808000; ++ buffer.writeMedium(w); ++ } else if ((value & 0xF0000000) == 0) { ++ int w = (value & 0x7F) << 24 ++ | ((value & 0x3F80) << 9) ++ | (value & 0x1FC000) >> 6 ++ | (value >>> 21) ++ | 0x80808000; ++ buffer.writeInt(w); ++ } else { ++ int w = (value & 0x7F) << 24 ++ | (value & 0x3F80) << 9 ++ | (value & 0x1FC000) >> 6 ++ | ((value >>> 21) & 0x7F) ++ | 0x80808080; ++ buffer.writeInt(w); ++ buffer.writeByte(value >>> 28); ++ } ++ return buffer; ++ } ++ ++ static ByteBuf writeOld(ByteBuf buffer, int value) { // public -> package-private ++ // Gale end - Velocity - optimized VarInt#write + // Paper start - Optimize VarInts + // Peel the one and two byte count cases explicitly as they are the most common VarInt sizes + // that the proxy will write, to improve inlining. +@@ -60,11 +95,11 @@ public class VarInt { + int w = (value & 0x7F | 0x80) << 8 | (value >>> 7); + buffer.writeShort(w); + } else { +- writeOld(buffer, value); ++ writeOld2(buffer, value); // rename + } + return buffer; + } +- public static ByteBuf writeOld(ByteBuf buffer, int value) { ++ public static ByteBuf writeOld2(ByteBuf buffer, int value) { // rename + // Paper end - Optimize VarInts + while ((value & -128) != 0) { + buffer.writeByte(value & 127 | 128); +diff --git a/net/minecraft/network/VarLong.java b/net/minecraft/network/VarLong.java +index ff9d84bf761797a8f695926c3cbb12c07609365d..244f8c06c6410541056a989815faf43f0fee9111 100644 +--- a/net/minecraft/network/VarLong.java ++++ b/net/minecraft/network/VarLong.java +@@ -51,6 +51,127 @@ public class VarLong { + } + + public static ByteBuf write(ByteBuf buffer, long value) { ++ // Gale start - Velocity - optimized VarLong#write ++ if ((value & 0xFFFFFFFFFFFFFF80L) == 0) { ++ buffer.writeByte((int) value); ++ } else if (value < 0) { ++ // The case of writing arbitrary longs is common ++ // Here, the number is negative, which has probability 1/2 for arbitrary numbers ++ int least7bits = (int) (value & 0xFFFFFFFL); ++ int w = (least7bits & 0x7F) << 24 ++ | (least7bits & 0x3F80) << 9 ++ | (least7bits & 0x1FC000) >> 6 ++ | ((least7bits >>> 21) & 0x7F) ++ | 0x80808080; ++ long nonLeast7Bits = value >>> 28; ++ int secondLeast7bits = (int) (nonLeast7Bits & 0xFFFFFFFL); ++ int w2 = (secondLeast7bits & 0x7F) << 24 ++ | ((secondLeast7bits & 0x3F80) << 9) ++ | (secondLeast7bits & 0x1FC000) >> 6 ++ | (secondLeast7bits >>> 21) ++ | 0x80808080; ++ int thirdLeast7Bits = (int) (nonLeast7Bits >>> 28); ++ int w3 = (thirdLeast7Bits & 0x7F) << 8 ++ | (thirdLeast7Bits >>> 7) ++ | 0x00008000; ++ buffer.writeInt(w); ++ buffer.writeInt(w2); ++ buffer.writeShort(w3); ++ } else if ((value & 0xFFFFFFFFFFFFC000L) == 0) { ++ int least7bits = (int) value; ++ int w = (least7bits & 0x7F) << 8 ++ | (least7bits >>> 7) ++ | 0x00008000; ++ buffer.writeShort(w); ++ } else if ((value & 0xFFFFFFFFFFE00000L) == 0) { ++ int least7bits = (int) value; ++ int w = (least7bits & 0x7F) << 16 ++ | (least7bits & 0x3F80) << 1 ++ | (least7bits >>> 14) ++ | 0x00808000; ++ buffer.writeMedium(w); ++ } else if ((value & 0xFFFFFFFFF0000000L) == 0) { ++ int least7bits = (int) value; ++ int w = (least7bits & 0x7F) << 24 ++ | ((least7bits & 0x3F80) << 9) ++ | (least7bits & 0x1FC000) >> 6 ++ | (least7bits >>> 21) ++ | 0x80808000; ++ buffer.writeInt(w); ++ } else if ((value & 0xFFFFFFF800000000L) == 0) { ++ int least7bits = (int) (value & 0xFFFFFFFL); ++ int w = (least7bits & 0x7F) << 24 ++ | (least7bits & 0x3F80) << 9 ++ | (least7bits & 0x1FC000) >> 6 ++ | ((least7bits >>> 21) & 0x7F) ++ | 0x80808080; ++ buffer.writeInt(w); ++ buffer.writeByte((int) (value >>> 28)); ++ } else if ((value & 0xFFFFFC0000000000L) == 0) { ++ int least7bits = (int) (value & 0xFFFFFFFL); ++ int w = (least7bits & 0x7F) << 24 ++ | (least7bits & 0x3F80) << 9 ++ | (least7bits & 0x1FC000) >> 6 ++ | ((least7bits >>> 21) & 0x7F) ++ | 0x80808080; ++ int secondLeast7bits = (int) (value >>> 28); ++ int w2 = (secondLeast7bits & 0x7F) << 8 ++ | (secondLeast7bits >>> 7) ++ | 0x00008000; ++ buffer.writeInt(w); ++ buffer.writeShort(w2); ++ } else if ((value & 0xFFFE000000000000L) == 0) { ++ int least7bits = (int) (value & 0xFFFFFFFL); ++ int w = (least7bits & 0x7F) << 24 ++ | (least7bits & 0x3F80) << 9 ++ | (least7bits & 0x1FC000) >> 6 ++ | ((least7bits >>> 21) & 0x7F) ++ | 0x80808080; ++ int secondLeast7bits = (int) (value >>> 28); ++ int w2 = (secondLeast7bits & 0x7F) << 16 ++ | (secondLeast7bits & 0x3F80) << 1 ++ | (secondLeast7bits >>> 14) ++ | 0x00808000; ++ buffer.writeInt(w); ++ buffer.writeMedium(w2); ++ } else if ((value & 0xFF00000000000000L) == 0) { ++ int least7bits = (int) (value & 0xFFFFFFFL); ++ int w = (least7bits & 0x7F) << 24 ++ | (least7bits & 0x3F80) << 9 ++ | (least7bits & 0x1FC000) >> 6 ++ | ((least7bits >>> 21) & 0x7F) ++ | 0x80808080; ++ int secondLeast7bits = (int) (value >>> 28); ++ int w2 = (secondLeast7bits & 0x7F) << 24 ++ | ((secondLeast7bits & 0x3F80) << 9) ++ | (secondLeast7bits & 0x1FC000) >> 6 ++ | (secondLeast7bits >>> 21) ++ | 0x80808000; ++ buffer.writeInt(w); ++ buffer.writeInt(w2); ++ } else { ++ int least7bits = (int) (value & 0xFFFFFFFL); ++ int w = (least7bits & 0x7F) << 24 ++ | (least7bits & 0x3F80) << 9 ++ | (least7bits & 0x1FC000) >> 6 ++ | ((least7bits >>> 21) & 0x7F) ++ | 0x80808080; ++ long nonLeast7Bits = value >>> 28; ++ int secondLeast7bits = (int) (nonLeast7Bits & 0xFFFFFFFL); ++ int w2 = (secondLeast7bits & 0x7F) << 24 ++ | ((secondLeast7bits & 0x3F80) << 9) ++ | (secondLeast7bits & 0x1FC000) >> 6 ++ | (secondLeast7bits >>> 21) ++ | 0x80808080; ++ buffer.writeInt(w); ++ buffer.writeInt(w2); ++ buffer.writeByte((int) (nonLeast7Bits >>> 28)); ++ } ++ return buffer; ++ } ++ ++ static ByteBuf writeOld(ByteBuf buffer, long value) { // public -> package-private ++ // Gale end - Velocity - optimized VarLong#write + while ((value & -128L) != 0L) { + buffer.writeByte((int)(value & 127L) | 128); + value >>>= 7; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0093-Reduce-RandomSource-instances.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0093-Reduce-RandomSource-instances.patch new file mode 100644 index 00000000..1ae1b7c8 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0093-Reduce-RandomSource-instances.patch @@ -0,0 +1,138 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 29 Nov 2022 00:45:45 +0100 +Subject: [PATCH] Reduce RandomSource instances + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"don't create new random instance" +By: foss-mc <69294560+foss-mc@users.noreply.github.com> +As part of: Patina (https://github.com/PatinaMC/Patina) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/net/minecraft/server/commands/SpreadPlayersCommand.java b/net/minecraft/server/commands/SpreadPlayersCommand.java +index d381800ad054be6b054dcca43fbe80d3f0c0c771..5904b9d985487ff8bd1f330667c43096aa298b98 100644 +--- a/net/minecraft/server/commands/SpreadPlayersCommand.java ++++ b/net/minecraft/server/commands/SpreadPlayersCommand.java +@@ -107,7 +107,7 @@ public class SpreadPlayersCommand { + if (maxHeight < minY) { + throw ERROR_INVALID_MAX_HEIGHT.create(maxHeight, minY); + } else { +- RandomSource randomSource = RandomSource.create(); ++ RandomSource randomSource = source.getLevel().random; // Gale - Patina - reduce RandomSource instances + double d = center.x - maxRange; + double d1 = center.y - maxRange; + double d2 = center.x + maxRange; +diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java +index b44cb6db29668767d0f092ddb6382f4b2baf72b8..f51d699461f5aef81e1187a4068c78f844e83878 100644 +--- a/net/minecraft/server/level/ServerPlayer.java ++++ b/net/minecraft/server/level/ServerPlayer.java +@@ -468,7 +468,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + long l1 = l * l; + int i = l1 > 2147483647L ? Integer.MAX_VALUE : (int)l1; + int coprime = this.getCoprime(i); +- int randomInt = RandomSource.create().nextInt(i); ++ int randomInt = level.random.nextInt(i); // Gale - Patina - reduce RandomSource instances + + for (int i1 = 0; i1 < i; i1++) { + int i2 = (randomInt + coprime * i1) % i; +diff --git a/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/net/minecraft/server/rcon/thread/QueryThreadGs4.java +index 0b8d279a53196f3998b1f6901738ca8e02ef7311..9add567d2ec2f5e9cd5bee84423c5a44433fe188 100644 +--- a/net/minecraft/server/rcon/thread/QueryThreadGs4.java ++++ b/net/minecraft/server/rcon/thread/QueryThreadGs4.java +@@ -341,7 +341,7 @@ public class QueryThreadGs4 extends GenericThread { + this.identBytes[2] = data[5]; + this.identBytes[3] = data[6]; + this.ident = new String(this.identBytes, StandardCharsets.UTF_8); +- this.challenge = RandomSource.create().nextInt(16777216); ++ this.challenge = java.util.concurrent.ThreadLocalRandom.current().nextInt(16777216); // Gale - Patina - reduce RandomSource instances + this.challengeBytes = String.format(Locale.ROOT, "\t%s%d\u0000", this.ident, this.challenge).getBytes(StandardCharsets.UTF_8); + } + +diff --git a/net/minecraft/world/entity/projectile/FishingHook.java b/net/minecraft/world/entity/projectile/FishingHook.java +index 1e012c7ef699a64ff3f1b00f897bb893ab25ecbd..800db05c1d2f2452a9e8ab7532f5ec10a924b0ce 100644 +--- a/net/minecraft/world/entity/projectile/FishingHook.java ++++ b/net/minecraft/world/entity/projectile/FishingHook.java +@@ -48,7 +48,7 @@ import org.slf4j.Logger; + + public class FishingHook extends Projectile { + private static final Logger LOGGER = LogUtils.getLogger(); +- private final RandomSource syncronizedRandom = RandomSource.create(); ++ private final RandomSource syncronizedRandom; // Gale - Patina - reduce RandomSource instances + private boolean biting; + public int outOfWaterTime; + private static final int MAX_OUT_OF_WATER_TIME = 10; +@@ -86,6 +86,7 @@ public class FishingHook extends Projectile { + this.minWaitTime = level.paperConfig().fishingTimeRange.minimum; + this.maxWaitTime = level.paperConfig().fishingTimeRange.maximum; + // Paper end - Configurable fishing time ranges ++ this.syncronizedRandom = level.random; // Gale - Patina - reduce RandomSource instances + } + + public FishingHook(EntityType entityType, Level level) { +diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java +index 536c84362d3e74a5bf0e0494483da3c0e9b26f0b..b83fbdb3093dbd56a9e707a652074d0b6033a761 100644 +--- a/net/minecraft/world/entity/raid/Raid.java ++++ b/net/minecraft/world/entity/raid/Raid.java +@@ -99,7 +99,7 @@ public class Raid { + public final ServerBossEvent raidEvent = new ServerBossEvent(RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10); + private int postRaidTicks; + private int raidCooldownTicks; +- private final RandomSource random = RandomSource.create(); ++ private final RandomSource random; // Gale - Patina - reduce RandomSource instances + public final int numGroups; + private Raid.RaidStatus status; + private int celebrationTicks; +@@ -120,6 +120,7 @@ public class Raid { + this.center = center; + this.numGroups = this.getNumGroups(level.getDifficulty()); + this.status = Raid.RaidStatus.ONGOING; ++ this.random = level.random; // Gale - Patina - reduce RandomSource instances + } + + public Raid(ServerLevel level, CompoundTag compound) { +@@ -147,6 +148,7 @@ public class Raid { + this.persistentDataContainer.putAll(compound.getCompound(PDC_NBT_KEY)); + } + // Paper end ++ this.random = level.random; // Gale - Patina - reduce RandomSource instances + } + + public boolean isOver() { +diff --git a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +index 5bf39c542757bf97da8909b65c22786a8a30385a..9333db899f86f91a667273f23f24a1c2eca9ad64 100644 +--- a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java ++++ b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +@@ -248,7 +248,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { + } + + private static void spawnGatewayPortal(ServerLevel level, BlockPos pos, EndGatewayConfiguration config) { +- Feature.END_GATEWAY.place(config, level, level.getChunkSource().getGenerator(), RandomSource.create(), pos); ++ Feature.END_GATEWAY.place(config, level, level.getChunkSource().getGenerator(), level.random, pos); // Gale - Patina - reduce RandomSource instances + } + + @Override +diff --git a/net/minecraft/world/level/dimension/end/EndDragonFight.java b/net/minecraft/world/level/dimension/end/EndDragonFight.java +index 6e7e87c32734b3aae354bc34459e5f207da5c78f..b933038ce88cdf285c8b4a901c3493ae7605f57e 100644 +--- a/net/minecraft/world/level/dimension/end/EndDragonFight.java ++++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java +@@ -434,7 +434,7 @@ public class EndDragonFight { + .registryAccess() + .lookup(Registries.CONFIGURED_FEATURE) + .flatMap(registry -> registry.get(EndFeatures.END_GATEWAY_DELAYED)) +- .ifPresent(endGatewayFeature -> endGatewayFeature.value().place(this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), pos)); ++ .ifPresent(endGatewayFeature -> endGatewayFeature.value().place(this.level, this.level.getChunkSource().getGenerator(), this.level.random, pos)); // Gale - Patina - reduce RandomSource instances + } + + public void spawnExitPortal(boolean active) { +@@ -453,7 +453,7 @@ public class EndDragonFight { + } + // Paper end - Prevent "softlocked" exit portal generation + if (endPodiumFeature.place( +- FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation ++ FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), this.level.random, this.portalLocation // Gale - Patina - reduce RandomSource instances + )) { + int i = Mth.positiveCeilDiv(4, 16); + this.level.getChunkSource().chunkMap.waitForLightBeforeSending(new ChunkPos(this.portalLocation), i); diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0094-Reduce-skull-ItemStack-lookups-for-reduced-visibilit.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0094-Reduce-skull-ItemStack-lookups-for-reduced-visibilit.patch new file mode 100644 index 00000000..78235be9 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0094-Reduce-skull-ItemStack-lookups-for-reduced-visibilit.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Aug 2023 20:17:20 +0200 +Subject: [PATCH] Reduce skull ItemStack lookups for reduced visibility + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"feat: reduce sensor work" +By: peaches94 +As part of: Petal (https://github.com/Bloom-host/Petal) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Petal description * + +this patch is focused around the sensors used for ai +delete the line of sight cache less often and use a faster nearby comparison + +diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java +index b242b9b6c1f798c2656fa77b1d04e57b2caec5dc..774aa4c2d4d2ba4e9fab6bcca20e7d07bd7fc17f 100644 +--- a/net/minecraft/world/entity/LivingEntity.java ++++ b/net/minecraft/world/entity/LivingEntity.java +@@ -1003,15 +1003,16 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + if (lookingEntity != null) { +- ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD); ++ // Gale start - Petal - reduce skull ItemStack lookups for reduced visibility + EntityType type = lookingEntity.getType(); +- if (type == EntityType.SKELETON && itemBySlot.is(Items.SKELETON_SKULL) +- || type == EntityType.ZOMBIE && itemBySlot.is(Items.ZOMBIE_HEAD) +- || type == EntityType.PIGLIN && itemBySlot.is(Items.PIGLIN_HEAD) +- || type == EntityType.PIGLIN_BRUTE && itemBySlot.is(Items.PIGLIN_HEAD) +- || type == EntityType.CREEPER && itemBySlot.is(Items.CREEPER_HEAD)) { ++ if (type == EntityType.SKELETON && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.SKELETON_SKULL) ++ || type == EntityType.ZOMBIE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.ZOMBIE_HEAD) ++ || type == EntityType.PIGLIN && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD) ++ || type == EntityType.PIGLIN_BRUTE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD) ++ || type == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) { + d *= 0.5; + } ++ // Gale end - Petal - reduce skull ItemStack lookups for reduced visibility + } + + return d; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0095-Initialize-line-of-sight-cache-with-low-capacity.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0095-Initialize-line-of-sight-cache-with-low-capacity.patch new file mode 100644 index 00000000..d64d4c8e --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0095-Initialize-line-of-sight-cache-with-low-capacity.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Aug 2023 19:01:50 +0200 +Subject: [PATCH] Initialize line of sight cache with low capacity + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/net/minecraft/world/entity/ai/sensing/Sensing.java b/net/minecraft/world/entity/ai/sensing/Sensing.java +index b1aa7294f9479f45fcde77c5ea46db9f62370abf..e17b1a2a95975d1eae5adaa679e027b9181dddbd 100644 +--- a/net/minecraft/world/entity/ai/sensing/Sensing.java ++++ b/net/minecraft/world/entity/ai/sensing/Sensing.java +@@ -7,8 +7,10 @@ import net.minecraft.world.entity.Mob; + + public class Sensing { + private final Mob mob; +- private final IntSet seen = new IntOpenHashSet(); +- private final IntSet unseen = new IntOpenHashSet(); ++ // Gale start - initialize line of sight cache with low capacity ++ private final IntSet seen = new IntOpenHashSet(2); ++ private final IntSet unseen = new IntOpenHashSet(2); ++ // Gale end - initialize line of sight cache with low capacity + + public Sensing(Mob mob) { + this.mob = mob; diff --git a/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0096-Reduce-line-of-sight-updates-and-cache-lookups.patch b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0096-Reduce-line-of-sight-updates-and-cache-lookups.patch new file mode 100644 index 00000000..a925c9c0 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/minecraft-patches/gale-features/0096-Reduce-line-of-sight-updates-and-cache-lookups.patch @@ -0,0 +1,112 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Aug 2023 20:01:31 +0200 +Subject: [PATCH] Reduce line of sight updates and cache lookups + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"feat: reduce sensor work" +By: peaches94 +As part of: Petal (https://github.com/Bloom-host/Petal) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Petal description * + +this patch is focused around the sensors used for ai +delete the line of sight cache less often and use a faster nearby comparison + +diff --git a/net/minecraft/world/entity/ai/sensing/Sensing.java b/net/minecraft/world/entity/ai/sensing/Sensing.java +index e17b1a2a95975d1eae5adaa679e027b9181dddbd..cc25f5838aec5ed9fca2fb8b0322fafad9397a46 100644 +--- a/net/minecraft/world/entity/ai/sensing/Sensing.java ++++ b/net/minecraft/world/entity/ai/sensing/Sensing.java +@@ -7,33 +7,79 @@ import net.minecraft.world.entity.Mob; + + public class Sensing { + private final Mob mob; +- // Gale start - initialize line of sight cache with low capacity +- private final IntSet seen = new IntOpenHashSet(2); +- private final IntSet unseen = new IntOpenHashSet(2); +- // Gale end - initialize line of sight cache with low capacity ++ private final it.unimi.dsi.fastutil.ints.Int2IntMap seen = new it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap(2); // Gale end - initialize line of sight cache with low capacity // Gale - Petal - reduce line of sight cache lookups - merge sets ++ ++ // Gale start - Petal - reduce line of sight updates - expiring entity id lists ++ private final @org.jetbrains.annotations.NotNull it.unimi.dsi.fastutil.ints.IntList @org.jetbrains.annotations.Nullable [] expiring; ++ private int currentCacheAddIndex = 0; ++ private int nextToExpireIndex = 1; ++ // Gale end - Petal - reduce line of sight updates - expiring entity id lists + + public Sensing(Mob mob) { + this.mob = mob; ++ // Gale start - Petal - reduce line of sight updates - expiring entity id lists ++ int updateLineOfSightInterval = org.galemc.gale.configuration.GaleGlobalConfiguration.get().smallOptimizations.reducedIntervals.updateEntityLineOfSight; ++ ++ if (updateLineOfSightInterval <= 1) { ++ this.expiring = null; ++ } else { ++ this.expiring = new it.unimi.dsi.fastutil.ints.IntList[updateLineOfSightInterval]; ++ ++ for (int i = 0; i < updateLineOfSightInterval; i++) { ++ this.expiring[i] = new it.unimi.dsi.fastutil.ints.IntArrayList(0); ++ } ++ } ++ // Gale end - Petal - reduce line of sight updates - expiring entity id lists + } + + public void tick() { ++ if (this.expiring == null) { // Gale - Petal - reduce line of sight updates + this.seen.clear(); +- this.unseen.clear(); ++ // Gale start - Petal - reduce line of sight updates ++ } else { ++ var expiringNow = this.expiring[this.nextToExpireIndex]; ++ ++ expiringNow.forEach(this.seen::remove); ++ expiringNow.clear(); ++ ++ this.currentCacheAddIndex++; ++ ++ if (this.currentCacheAddIndex == this.expiring.length) { ++ this.currentCacheAddIndex = 0; ++ } ++ ++ this.nextToExpireIndex++; ++ ++ if (this.nextToExpireIndex == this.expiring.length) { ++ this.nextToExpireIndex = 0; ++ } ++ } ++ // Gale end - Petal - reduce line of sight updates + } + + public boolean hasLineOfSight(Entity entity) { + int id = entity.getId(); +- if (this.seen.contains(id)) { ++ // Gale start - Petal - reduce line of sight cache lookups - merge sets ++ int cached = this.seen.get(id); ++ ++ if (cached == 1) { ++ // Gale end - Petal - reduce line of sight cache lookups - merge sets + return true; +- } else if (this.unseen.contains(id)) { ++ } else if (cached == 2) { // Gale - Petal - reduce line of sight cache lookups - merge sets + return false; + } else { + boolean hasLineOfSight = this.mob.hasLineOfSight(entity); + if (hasLineOfSight) { +- this.seen.add(id); ++ this.seen.put(id, 1); // Gale - Petal - reduce line of sight cache lookups - merge sets + } else { +- this.unseen.add(id); ++ this.seen.put(id, 2); // Gale - Petal - reduce line of sight cache lookups - merge sets ++ } ++ ++ // Gale start - Petal - reduce line of sight updates ++ if (this.expiring != null) { ++ this.expiring[this.currentCacheAddIndex].add(id); + } ++ // Gale end - Petal - reduce line of sight updates + + return hasLineOfSight; + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0002-Gale-metrics.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0002-Gale-metrics.patch new file mode 100644 index 00000000..be909e80 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0002-Gale-metrics.patch @@ -0,0 +1,350 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Mon, 26 Dec 2022 13:47:57 +0100 +Subject: [PATCH] Gale metrics + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java b/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java +index 632920e04686d8a0fd0a60e87348be1fe7862a3c..ba0dd850f90564fab3a5b922bb28d24490180417 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java +@@ -11,6 +11,10 @@ import java.util.function.Consumer; + public final class MoonriseCommon { + + private static final Logger LOGGER = LogUtils.getClassLogger(); ++ // Gale start - metrics - chunk system IO threads ++ public static int chunkSystemIOThreads; ++ public static int chunkSystemWorkerThreads; ++ // Gale end - metrics - chunk system IO threads + + public static final PrioritisedThreadPool WORKER_POOL = new PrioritisedThreadPool( + new Consumer<>() { +@@ -54,6 +58,11 @@ public final class MoonriseCommon { + + final int ioThreads = Math.max(1, configIoThreads); + ++ // Gale start - metrics - chunk system IO threads ++ chunkSystemIOThreads = ioThreads; ++ chunkSystemWorkerThreads = workerThreads; ++ // Gale end - metrics - chunk system IO threads ++ + WORKER_POOL.adjustThreadCount(workerThreads); + IO_POOL.adjustThreadCount(ioThreads); + +diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java +index 8f62879582195d8ae4f64bd23f752fa133b1c973..8f50cbe29b36e7b73c8c9db491f4dd21a886f45d 100644 +--- a/src/main/java/com/destroystokyo/paper/Metrics.java ++++ b/src/main/java/com/destroystokyo/paper/Metrics.java +@@ -592,7 +592,7 @@ public class Metrics { + boolean logFailedRequests = config.getBoolean("logFailedRequests", false); + // Only start Metrics, if it's enabled in the config + if (config.getBoolean("enabled", true)) { +- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger()); ++ Metrics metrics = new Metrics("Gale", serverUUID, logFailedRequests, Bukkit.getLogger()); // Gale - branding changes - metrics + + metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> { + String minecraftVersion = Bukkit.getVersion(); +@@ -602,20 +602,20 @@ public class Metrics { + + metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size())); + metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : "offline")); +- final String paperVersion; ++ final String galeVersion; // Gale - branding changes - metrics + final String implVersion = org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion(); + if (implVersion != null) { + final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1); +- paperVersion = "git-Paper-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); ++ galeVersion = "git-Gale-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Gale - branding changes - metrics + } else { +- paperVersion = "unknown"; ++ galeVersion = "unknown"; // Gale - branding changes - metrics + } +- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> paperVersion)); ++ metrics.addCustomChart(new Metrics.SimplePie("gale_version", () -> galeVersion)); // Gale - branding changes - metrics + + metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> { +- Map> map = new HashMap<>(); ++ Map> map = new HashMap<>(2); // Gale - metrics - reduce HashMap capacity + String javaVersion = System.getProperty("java.version"); +- Map entry = new HashMap<>(); ++ Map entry = new HashMap<>(2); // Gale - metrics - reduce HashMap capacity + entry.put(javaVersion, 1); + + // http://openjdk.java.net/jeps/223 +@@ -644,7 +644,7 @@ public class Metrics { + })); + + metrics.addCustomChart(new Metrics.DrilldownPie("legacy_plugins", () -> { +- Map> map = new HashMap<>(); ++ Map> map = new HashMap<>(2); // Gale - metrics - reduce HashMap capacity + + // count legacy plugins + int legacy = 0; +@@ -655,7 +655,7 @@ public class Metrics { + } + + // insert real value as lower dimension +- Map entry = new HashMap<>(); ++ Map entry = new HashMap<>(2); // Gale - metrics - reduce HashMap capacity + entry.put(String.valueOf(legacy), 1); + + // create buckets as higher dimension +@@ -675,6 +675,256 @@ public class Metrics { + + return map; + })); ++ ++ // Gale start - metrics - proxy ++ metrics.addCustomChart(new Metrics.DrilldownPie("proxy", () -> { ++ String type; ++ boolean onlineMode; ++ var proxiesConfig = io.papermc.paper.configuration.GlobalConfiguration.get().proxies; ++ if (proxiesConfig.velocity.enabled) { ++ type = "Velocity"; ++ onlineMode = proxiesConfig.velocity.onlineMode; ++ } else if (org.spigotmc.SpigotConfig.bungee) { ++ type = "BungeeCord"; ++ onlineMode = proxiesConfig.bungeeCord.onlineMode; ++ } else { ++ type = "none"; ++ onlineMode = Bukkit.getOnlineMode(); ++ } ++ ++ Map> map = new HashMap<>(2); ++ ++ // insert type and online mode as lower dimension ++ Map entry = new HashMap<>(2); ++ entry.put(type + " (" + (onlineMode ? "online" : "offline") + ")", 1); ++ ++ // create type as higher dimension ++ map.put(type, entry); ++ ++ return map; ++ })); ++ // Gale end - metrics - proxy ++ ++ // Gale start - metrics - Java VM ++ Map> javaVirtualMachineMap = new HashMap<>(2); ++ { ++ Map entry = new HashMap<>(2); ++ String vmVendor = null; ++ try { ++ vmVendor = System.getProperty("java.vm.vendor"); ++ } catch (Exception ignored) {} ++ entry.put(vmVendor == null ? "Unknown" : vmVendor, 1); ++ String vmName = null; ++ try { ++ vmName = System.getProperty("java.vm.name"); ++ } catch (Exception ignored) {} ++ javaVirtualMachineMap.put(vmName == null ? "Unknown" : vmName, entry); ++ } ++ metrics.addCustomChart(new Metrics.DrilldownPie("java_virtual_machine", () -> javaVirtualMachineMap)); ++ // Gale end - metrics - Java VM ++ ++ // Gale start - metrics - per-server player count ++ metrics.addCustomChart(new Metrics.DrilldownPie("per_server_player_count", () -> { ++ Map> map = new HashMap<>(2); ++ ++ // count players ++ int playerCount = Bukkit.getOnlinePlayers().size(); ++ ++ // insert real value as lower dimension ++ Map entry = new HashMap<>(2); ++ entry.put(String.valueOf(playerCount), 1); ++ ++ // create buckets as higher dimension ++ if (playerCount <= 5) { ++ map.put(String.valueOf(playerCount), entry); ++ } else if (playerCount > 1000) { ++ map.put("> 1000", entry); ++ } else { ++ int divisor; ++ if (playerCount <= 50) { ++ divisor = 5; ++ } else if (playerCount <= 100) { ++ divisor = 10; ++ } else if (playerCount <= 250) { ++ divisor = 25; ++ } else if (playerCount <= 500) { ++ divisor = 50; ++ } else { ++ divisor = 100; ++ } ++ int start = (playerCount - 1) / divisor * divisor + 1; ++ int end = start + divisor - 1; ++ map.put(start + "-" + end, entry); ++ } ++ ++ return map; ++ })); ++ // Gale end - metrics - per-server player count ++ ++ // Gale start - metrics - plugin count ++ metrics.addCustomChart(new Metrics.DrilldownPie("plugin_count", () -> { ++ Map> map = new HashMap<>(2); ++ ++ // count plugins ++ int pluginCount = Bukkit.getPluginManager().getPlugins().length; ++ ++ // insert real value as lower dimension ++ Map entry = new HashMap<>(2); ++ entry.put(String.valueOf(pluginCount), 1); ++ ++ // create buckets as higher dimension ++ if (pluginCount <= 5) { ++ map.put(String.valueOf(pluginCount), entry); ++ } else if (pluginCount > 1000) { ++ map.put("> 1000", entry); ++ } else { ++ int divisor; ++ if (pluginCount <= 50) { ++ divisor = 5; ++ } else if (pluginCount <= 100) { ++ divisor = 10; ++ } else if (pluginCount <= 250) { ++ divisor = 25; ++ } else if (pluginCount <= 500) { ++ divisor = 50; ++ } else { ++ divisor = 100; ++ } ++ int start = (pluginCount - 1) / divisor * divisor + 1; ++ int end = start + divisor - 1; ++ map.put(start + "-" + end, entry); ++ } ++ ++ return map; ++ })); ++ // Gale end - metrics - plugin count ++ ++ // Gale start - metrics - netty threads ++ metrics.addCustomChart(new Metrics.SimplePie("netty_thread_count", () -> { ++ // Try to get the number of Netty threads from the system property ++ try { ++ return System.getProperty("io.netty.eventLoopThreads"); ++ } catch (Exception ignored) {} ++ // Otherwise, we fall back to nothing currently (reading from the Spigot configuration causes a re-read which is undesirable) ++ return null; ++ })); ++ // Gale end - metrics - netty threads ++ ++ // Gale start - metrics - chunk system threads ++ metrics.addCustomChart(new Metrics.SimplePie("chunk_system_io_thread_count", () -> String.valueOf(ca.spottedleaf.moonrise.common.util.MoonriseCommon.chunkSystemIOThreads))); ++ metrics.addCustomChart(new Metrics.SimplePie("chunk_system_worker_thread_count", () -> String.valueOf(ca.spottedleaf.moonrise.common.util.MoonriseCommon.chunkSystemWorkerThreads))); ++ // Gale end - metrics - chunk system threads ++ ++ // Gale start - metrics - physical cores ++ metrics.addCustomChart(new Metrics.SimplePie("physical_core_count", () -> { ++ try { ++ int physicalProcessorCount = new oshi.SystemInfo().getHardware().getProcessor().getPhysicalProcessorCount(); ++ if (physicalProcessorCount > 0) { ++ return String.valueOf(physicalProcessorCount); ++ } ++ } catch (Exception ignored) {} ++ return null; ++ })); ++ // Gale end - metrics - physical cores ++ ++ // Gale start - metrics - processor frequency ++ metrics.addCustomChart(new Metrics.DrilldownPie("processor_frequency", () -> { ++ try { ++ long processorFrequency = new oshi.SystemInfo().getHardware().getProcessor().getProcessorIdentifier().getVendorFreq(); ++ if (processorFrequency > 0) { ++ ++ Map> map = new HashMap<>(2); ++ ++ // use MHz as lower dimension ++ var flooredMHz = processorFrequency / 1_000_000L; ++ Map entry = new HashMap<>(2); ++ if (flooredMHz < 1) { ++ entry.put("< 1 MHz", 1); ++ } else if (flooredMHz < 1000) { ++ entry.put(flooredMHz + " MHz", 1); ++ } else { ++ // Add a comma ++ StringBuilder flooredMHzAfterComma = new StringBuilder(String.valueOf(flooredMHz % 1000)); ++ while (flooredMHzAfterComma.length() < 3) { ++ flooredMHzAfterComma.insert(0, "0"); ++ } ++ entry.put((flooredMHz / 1000) + "," + flooredMHzAfterComma + " MHz", 1); ++ } ++ ++ // use tenth of GHz as higher dimension ++ long flooredTenthGHz = processorFrequency / 100_000_000L; ++ if (flooredTenthGHz < 1) { ++ map.put("< 0.1 GHz", entry); ++ } else { ++ // Add a dot ++ map.put((flooredTenthGHz / 10) + "." + (flooredTenthGHz % 10) + " GHz", entry); ++ } ++ ++ return map; ++ ++ } ++ } catch (Exception ignored) {} ++ return null; ++ })); ++ // Gale end - metrics - processor frequency ++ ++ // Gale start - metrics - physical memory ++ metrics.addCustomChart(new Metrics.DrilldownPie("physical_memory_total", () -> { ++ try { ++ long physicalMemory = new oshi.SystemInfo().getHardware().getMemory().getTotal(); ++ if (physicalMemory > 0) { ++ ++ Map> map = new HashMap<>(2); ++ ++ // use floored MB as lower dimension ++ var flooredMB = physicalMemory / (1L << 20); ++ Map entry = new HashMap<>(2); ++ entry.put(flooredMB < 1 ? "< 1 MB" : flooredMB + " MB", 1); ++ ++ // use floored GB as higher dimension ++ var flooredGB = physicalMemory / (1L << 30); ++ map.put(flooredGB < 1 ? "< 1 GB" : flooredGB + " GB", entry); ++ ++ return map; ++ ++ } ++ } catch (Exception ignored) {} ++ return null; ++ })); ++ // Gale end - metrics - physical memory ++ ++ // Gale start - metrics - runtime max memory ++ metrics.addCustomChart(new Metrics.DrilldownPie("runtime_max_memory", () -> { ++ ++ // get memory limit ++ long maxMemory = Runtime.getRuntime().maxMemory(); ++ if (maxMemory <= 0) { ++ return null; ++ } ++ ++ Map> map = new HashMap<>(2); ++ ++ // in the case of no limit ++ if (maxMemory == Long.MAX_VALUE) { ++ Map entry = new HashMap<>(2); ++ entry.put("no limit", 1); ++ map.put("no limit", entry); ++ return map; ++ } ++ ++ // use floored MB as lower dimension ++ var flooredMB = maxMemory / (1L << 20); ++ Map entry = new HashMap<>(2); ++ entry.put(flooredMB < 1 ? "< 1 MB" : flooredMB + " MB", 1); ++ ++ // use floored GB as higher dimension ++ var flooredGB = maxMemory / (1L << 30); ++ map.put(flooredGB < 1 ? "< 1 GB" : flooredGB + " GB", entry); ++ ++ return map; ++ })); ++ // Gale end - metrics - runtime max memory ++ + } + + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0003-Gale-semantic-version.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0003-Gale-semantic-version.patch new file mode 100644 index 00000000..8862cba2 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0003-Gale-semantic-version.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 9 Aug 2023 19:04:22 +0200 +Subject: [PATCH] Gale semantic version + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java +index 8f50cbe29b36e7b73c8c9db491f4dd21a886f45d..59e4ea913ee34d133e74be50ad3f35606354db43 100644 +--- a/src/main/java/com/destroystokyo/paper/Metrics.java ++++ b/src/main/java/com/destroystokyo/paper/Metrics.java +@@ -925,6 +925,16 @@ public class Metrics { + })); + // Gale end - metrics - runtime max memory + ++ // Gale start - semantic version - include in metrics ++ Map> semanticVersionMap = new HashMap<>(2); ++ { ++ Map entry = new HashMap<>(2); ++ entry.put(org.galemc.gale.version.GaleSemanticVersion.version, 1); ++ semanticVersionMap.put(org.galemc.gale.version.GaleSemanticVersion.majorMinorVersion, entry); ++ } ++ metrics.addCustomChart(new Metrics.DrilldownPie("gale_semantic_version", () -> semanticVersionMap)); ++ // Gale end - semantic version - include in metrics ++ + } + + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0004-Gale-configuration.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0004-Gale-configuration.patch new file mode 100644 index 00000000..5a6c5e0e --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0004-Gale-configuration.patch @@ -0,0 +1,172 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 21:05:47 +0100 +Subject: [PATCH] Gale configuration + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Paper config files" +By: Jake Potrebic +As part of: Paper (https://github.com/PaperMC/Paper) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java +index 4a9258b62db3a9d1150f0dfbe916fa549b596686..7c2f3b46f94989e532694ce3fbba90489caceb7f 100644 +--- a/src/main/java/io/papermc/paper/configuration/Configurations.java ++++ b/src/main/java/io/papermc/paper/configuration/Configurations.java +@@ -94,7 +94,7 @@ public abstract class Configurations { + }; + } + +- static CheckedFunction reloader(Class type, T instance) { ++ public static CheckedFunction reloader(Class type, T instance) { // Gale - Gale configuration + return node -> { + ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type)); + ObjectMapper.Mutable mutable = (ObjectMapper.Mutable) factory.get(type); +@@ -168,7 +168,7 @@ public abstract class Configurations { + final YamlConfigurationLoader loader = result.loader(); + final ConfigurationNode node = loader.load(); + if (result.isNewFile()) { // add version to new files +- node.node(Configuration.VERSION_FIELD).raw(this.worldConfigVersion()); ++ node.node(Configuration.VERSION_FIELD).raw(getWorldConfigurationCurrentVersion()); // Gale - Gale configuration + } else { + this.verifyWorldConfigVersion(contextMap, node); + } +@@ -230,7 +230,7 @@ public abstract class Configurations { + .build(); + final ConfigurationNode worldNode = worldLoader.load(); + if (newFile) { // set the version field if new file +- worldNode.node(Configuration.VERSION_FIELD).set(this.worldConfigVersion()); ++ worldNode.node(Configuration.VERSION_FIELD).set(getWorldConfigurationCurrentVersion()); // Gale - Gale configuration + } else { + this.verifyWorldConfigVersion(contextMap, worldNode); + } +@@ -356,4 +356,25 @@ public abstract class Configurations { + return "ContextKey{" + this.name + "}"; + } + } ++ ++ // Gale start - Gale configuration ++ ++ public static final String legacyWorldsSectionKey = "__________WORLDS__________"; ++ public static final String legacyWorldDefaultsSectionKey = "__defaults__"; ++ ++ @Deprecated ++ public org.bukkit.configuration.file.YamlConfiguration createLegacyObject(final net.minecraft.server.MinecraftServer server) { ++ org.bukkit.configuration.file.YamlConfiguration global = org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(this.globalFolder.resolve(this.globalConfigFileName).toFile()); ++ org.bukkit.configuration.ConfigurationSection worlds = global.createSection(legacyWorldsSectionKey); ++ worlds.set(legacyWorldDefaultsSectionKey, org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(this.globalFolder.resolve(this.defaultWorldConfigFileName).toFile())); ++ for (ServerLevel level : server.getAllLevels()) { ++ worlds.set(level.getWorld().getName(), org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(getWorldConfigFile(level).toFile())); ++ } ++ return global; ++ } ++ ++ public abstract int getWorldConfigurationCurrentVersion(); ++ ++ // Gale end - Gale configuration ++ + } +diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +index e48fa405d92fab221fa8331b65c8f324e801d439..352d62385e56d5805510596ec9424e5d14336861 100644 +--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java ++++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +@@ -330,7 +330,7 @@ public class PaperConfigurations extends Configurations globalConfig() { ++ // Gale start - Gale configuration ++ public static FieldDiscoverer galeWorldConfig(io.papermc.paper.configuration.Configurations.ContextMap contextMap) { ++ final Map, Object> overrides = Map.of( ++ org.galemc.gale.configuration.GaleWorldConfiguration.class, new org.galemc.gale.configuration.GaleWorldConfiguration( ++ contextMap.require(io.papermc.paper.configuration.PaperConfigurations.SPIGOT_WORLD_CONFIG_CONTEXT_KEY).get(), ++ contextMap.require(io.papermc.paper.configuration.Configurations.WORLD_KEY) ++ ) ++ ); ++ return new InnerClassFieldDiscoverer(overrides); ++ } ++ // Gale end - Gale configuration ++ ++ public static FieldDiscoverer globalConfig() { // Gale - Gale configuration + return new InnerClassFieldDiscoverer(Collections.emptyMap()); + } + } +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index dfce118ec8b91eae219855a0b01392ef20b7d50c..b747b83d9b8967566d3b64ea29dd06e3ca709637 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -1088,6 +1088,7 @@ public final class CraftServer implements Server { + + org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot + this.console.paperConfigurations.reloadConfigs(this.console); ++ this.console.galeConfigurations.reloadConfigs(this.console); // Gale - Gale configuration + for (ServerLevel world : this.console.getAllLevels()) { + // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty + world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) +@@ -3047,6 +3048,14 @@ public final class CraftServer implements Server { + return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); + } + ++ // Gale start - Gale configuration - API ++ @Override ++ public YamlConfiguration getGaleConfig() ++ { ++ return CraftServer.this.console.galeConfigurations.createLegacyObject(CraftServer.this.console); ++ } ++ // Gale end - Gale configuration - API ++ + @Override + public void restart() { + CraftServer.this.restart(); diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0005-Gale-commands.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0005-Gale-commands.patch new file mode 100644 index 00000000..450fb1ff --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0005-Gale-commands.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 26 Nov 2022 10:47:56 +0100 +Subject: [PATCH] Gale commands + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Paper command" +By: Zach Brown +As part of: Paper (https://github.com/PaperMC/Paper) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 9094b8e3ff1d6d07e8a39d379e40a6da7e9888ed..32ac42ec69810470941c29f7add34d03e46b4712 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -1120,6 +1120,7 @@ public final class CraftServer implements Server { + this.reloadData(); + org.spigotmc.SpigotConfig.registerCommands(); // Spigot + io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper ++ org.galemc.gale.command.GaleCommands.registerCommands(this.console); // Gale - Gale commands - register commands + this.spark.registerCommandBeforePlugins(this); // Paper - spark + this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); + this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0006-Set-Gale-permissions-root.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0006-Set-Gale-permissions-root.patch new file mode 100644 index 00000000..fa854b1b --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0006-Set-Gale-permissions-root.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 25 Nov 2022 18:42:45 +0100 +Subject: [PATCH] Set Gale permissions root + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java +index e0e61115ada9a49d4c528c5d4e02a1ca571d9531..0a808c5d242b2d9bea82d9d219227fbaf5741bf4 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java +@@ -5,6 +5,7 @@ import org.bukkit.util.permissions.DefaultPermissions; + + public final class CraftDefaultPermissions { + private static final String ROOT = "minecraft"; ++ public static final String GALE_ROOT = "gale"; // Gale - set Gale permissions root + + private CraftDefaultPermissions() {} + diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0007-Simpler-ShapelessRecipe-comparison-for-vanilla.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0007-Simpler-ShapelessRecipe-comparison-for-vanilla.patch new file mode 100644 index 00000000..7677a7c1 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0007-Simpler-ShapelessRecipe-comparison-for-vanilla.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 16:22:47 +0100 +Subject: [PATCH] Simpler ShapelessRecipe comparison for vanilla + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Simpler ShapelessRecipes comparison for Vanilla" +By: Paul Sauve +As part of: Airplane (https://github.com/TECHNOVE/Airplane) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Airplane description * + +Paper added a fancy sorting comparison due to Bukkit recipes breaking +the vanilla one, however this is far more advanced than what you need +for all the vanilla recipes. + +* 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 . + +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java +index 7c989318dc7ad89bb0d9143fcaac1e4bba6f5907..a90b294a99072ab576e61ddacb60a036cb7f0f5a 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java +@@ -44,6 +44,6 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe + data.add(this.toNMS(i, true)); + } + +- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.ShapelessRecipe(this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data))); ++ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.ShapelessRecipe(this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data, true))); // Gale - Airplane - simpler ShapelessRecipe comparison for vanilla + } + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0008-Print-stack-trace-for-plugins-not-shutting-down-task.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0008-Print-stack-trace-for-plugins-not-shutting-down-task.patch new file mode 100644 index 00000000..0fb0c5b5 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0008-Print-stack-trace-for-plugins-not-shutting-down-task.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 20:28:07 +0100 +Subject: [PATCH] Print stack trace for plugins not shutting down tasks + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"More debug for plugins not shutting down tasks" +By: Paul Sauve +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 . + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 32ac42ec69810470941c29f7add34d03e46b4712..ae90120eab182fcb975a13c84eed1425dc09da46 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -1183,6 +1183,13 @@ public final class CraftServer implements Server { + plugin.getPluginMeta().getDisplayName(), + "This plugin is not properly shutting down its async tasks when it is being shut down. This task may throw errors during the final shutdown logs and might not complete before process dies." + )); ++ // Gale start - Airplane - print stack trace for plugins not shutting down tasks ++ getLogger().log(Level.SEVERE, String.format("%s Stacktrace", worker.getThread().getName())); ++ ++ for (StackTraceElement element : worker.getThread().getStackTrace()) { ++ getLogger().log(Level.SEVERE, " " + element); ++ } ++ // Gale end - Airplane - print stack trace for plugins not shutting down tasks + if (console.isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread(worker.getThread(), "still running"); // Paper - Debugging + } + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0009-SIMD-support.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0009-SIMD-support.patch new file mode 100644 index 00000000..42b5f9c6 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0009-SIMD-support.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Thu, 24 Nov 2022 01:19:12 +0100 +Subject: [PATCH] SIMD support + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add SIMD utilities" +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java +index 59e4ea913ee34d133e74be50ad3f35606354db43..dbe3d8748c1e6fbad7ee4ccf39dfc0422b0ce50b 100644 +--- a/src/main/java/com/destroystokyo/paper/Metrics.java ++++ b/src/main/java/com/destroystokyo/paper/Metrics.java +@@ -935,6 +935,46 @@ public class Metrics { + metrics.addCustomChart(new Metrics.DrilldownPie("gale_semantic_version", () -> semanticVersionMap)); + // Gale end - semantic version - include in metrics + ++ // Gale start - SIMD support - include in metrics ++ Map> simdSupportMap = new HashMap<>(2); // Empty until initialized ++ metrics.addCustomChart(new Metrics.DrilldownPie("simd_support", () -> { ++ if (!gg.pufferfish.pufferfish.simd.SIMDDetection.isInitialized()) { ++ return null; ++ } ++ if (simdSupportMap.isEmpty()) { ++ // Initialize ++ boolean isEnabled = gg.pufferfish.pufferfish.simd.SIMDDetection.isEnabled(); ++ ++ // use details as lower dimension ++ Map entry = new HashMap<>(2); ++ String details; ++ if (isEnabled) { ++ details = "int " + gg.pufferfish.pufferfish.simd.SIMDDetection.intVectorBitSize() + "*" + gg.pufferfish.pufferfish.simd.SIMDDetection.intElementSize() + ", float " + gg.pufferfish.pufferfish.simd.SIMDDetection.floatVectorBitSize() + "*" + gg.pufferfish.pufferfish.simd.SIMDDetection.floatElementSize(); ++ } else { ++ if (!gg.pufferfish.pufferfish.simd.SIMDDetection.supportingJavaVersion()) { ++ details = "unsupported Java"; ++ try { ++ var javaVersion = gg.pufferfish.pufferfish.simd.SIMDDetection.getJavaVersion(); ++ details += " (" + javaVersion + ")"; ++ } catch (Throwable ignored) {} ++ } else if (!gg.pufferfish.pufferfish.simd.SIMDDetection.testRunCompleted()) { ++ details = "test failed"; ++ } else if (gg.pufferfish.pufferfish.simd.SIMDDetection.unsupportingLaneSize()) { ++ details = "no supporting lane size"; ++ } else { ++ details = "other reason"; ++ } ++ } ++ entry.put(details, 1); ++ ++ // use enabled or not as higher dimension ++ simdSupportMap.put(String.valueOf(isEnabled), entry); ++ ++ } ++ return simdSupportMap; ++ })); ++ // Gale end - SIMD support - include in metrics ++ + } + + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0010-Make-book-writing-configurable.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0010-Make-book-writing-configurable.patch new file mode 100644 index 00000000..51f555b4 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0010-Make-book-writing-configurable.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Mon, 26 Dec 2022 02:11:29 +0100 +Subject: [PATCH] Make book writing configurable + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add option to disable books" +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Pufferfish description * + +Books are commonly the target of duping-related exploits. If you +anticipate that your server will be an early target of duping attacks in +the event that new exploits are found, you may want to consider removing +the ability for non-privileged players to edit books. This patch allows +you to easily disable books, should you want to preemptively remove this +functionality before additional exploits are found. + +diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java +index 0a808c5d242b2d9bea82d9d219227fbaf5741bf4..7d66126c1f5957c109a2426d53f5d0072886309b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java +@@ -7,6 +7,8 @@ public final class CraftDefaultPermissions { + private static final String ROOT = "minecraft"; + public static final String GALE_ROOT = "gale"; // Gale - set Gale permissions root + ++ public static final String writeBooks = GALE_ROOT + ".writebooks"; // Gale - Pufferfish - make book writing configurable ++ + private CraftDefaultPermissions() {} + + public static void registerCorePermissions() { +@@ -19,6 +21,7 @@ public final class CraftDefaultPermissions { + DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".debugstick.always", "Gives the user the ability to use the debug stick in all game modes", org.bukkit.permissions.PermissionDefault.FALSE/* , parent */); // Paper - should not have this parent, as it's not a "vanilla" utility + DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".commandblock", "Gives the user the ability to use command blocks.", org.bukkit.permissions.PermissionDefault.OP, parent); // Paper + // Spigot end ++ DefaultPermissions.registerPermission(writeBooks, "Gives the user the ability to write books even when writing books is disabled in the Gale configuration", org.bukkit.permissions.PermissionDefault.OP); // Gale - Pufferfish - make book writing configurable + parent.recalculatePermissibles(); + } + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0011-Optimize-entity-coordinate-key.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0011-Optimize-entity-coordinate-key.patch new file mode 100644 index 00000000..34ed20f0 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0011-Optimize-entity-coordinate-key.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 23 Nov 2022 23:32:51 +0100 +Subject: [PATCH] Optimize entity coordinate key + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Optimize entity coordinate key" +By: Kevin Raneri +As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Pufferfish description * + +When executing getCoordinateKey for entities (a hotpath), the JVM is +required to repeatedly cast doubles to longs. The performance impact of +this depends on the CPU architecture, but generally switching between +FPU and ALU incurs a significant performance hit. The casted/rounded +data is already available in the blockPosition struct, so we use that +instead of re-doing the casting. + +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/CoordinateUtils.java b/src/main/java/ca/spottedleaf/moonrise/common/util/CoordinateUtils.java +index 31b92bd48828cbea25b44a9f0f96886347aa1ae6..036c1a287db04c0191e5f84b027ea68d31447cbc 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/util/CoordinateUtils.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/util/CoordinateUtils.java +@@ -16,7 +16,7 @@ public final class CoordinateUtils { + } + + public static long getChunkKey(final Entity entity) { +- return ((Mth.lfloor(entity.getZ()) >> 4) << 32) | ((Mth.lfloor(entity.getX()) >> 4) & 0xFFFFFFFFL); ++ return ((long) (entity.blockPosition.getZ() >> 4) << 32) | ((entity.blockPosition.getX() >> 4) & 0xFFFFFFFFL); // Gale - Pufferfish - optimize entity coordinate key - eliminate double->long cast in hotpath + } + + public static long getChunkKey(final ChunkPos pos) { diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0012-Do-not-log-legacy-Material-initialization.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0012-Do-not-log-legacy-Material-initialization.patch new file mode 100644 index 00000000..e243b5d6 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0012-Do-not-log-legacy-Material-initialization.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 25 Nov 2022 15:03:50 +0100 +Subject: [PATCH] Do not log legacy Material initialization + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Logger settings (suppressing pointless logs)" +By: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java +index 51ae8eddadc87b143b93521a3cef374f1e3a24dc..eed2d01c4f884c3aafdef21741fc1a2e2d610199 100644 +--- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java ++++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java +@@ -265,7 +265,7 @@ public final class CraftLegacy { + } + + static { +- LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - Improve logging and errors; doesn't need to be an error ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.legacyMaterialInitialization) LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - Improve logging and errors; doesn't need to be an error // Gale - Purpur - do not log legacy Material initialization + if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) { + new Exception().printStackTrace(); + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0013-Do-not-log-Not-Secure-marker.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0013-Do-not-log-Not-Secure-marker.patch new file mode 100644 index 00000000..dd6abc00 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0013-Do-not-log-Not-Secure-marker.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 25 Nov 2022 15:13:38 +0100 +Subject: [PATCH] Do not log Not Secure marker + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +index 14e412ebf75b0e06ab53a1c8f9dd1be6ad1e2680..506c746980cfca170efd249d035a572361b667c4 100644 +--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java ++++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +@@ -317,7 +317,7 @@ public final class ChatProcessor { + + private void sendToServer(final ChatType.Bound chatType, final @Nullable Function msgFunction) { + final PlayerChatMessage toConsoleMessage = msgFunction == null ? ChatProcessor.this.message : ChatProcessor.this.message.withUnsignedContent(msgFunction.apply(ChatProcessor.this.server.console)); +- ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) ? null : "Not Secure"); ++ ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, !org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.chat.notSecureMarker || ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) ? null : "Not Secure"); // Gale - do not log Not Secure marker + } + } + diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0014-Reduce-array-allocations.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0014-Reduce-array-allocations.patch new file mode 100644 index 00000000..c76e4e37 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0014-Reduce-array-allocations.patch @@ -0,0 +1,168 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 26 Nov 2022 11:25:45 +0100 +Subject: [PATCH] Reduce array allocations + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"reduce allocs" +By: Simon Gardling +As part of: JettPack (https://gitlab.com/Titaniumtown/JettPack) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/list/EntityList.java b/src/main/java/ca/spottedleaf/moonrise/common/list/EntityList.java +index 7fed43a1e7bcf35c4d7fd3224837a47fedd59860..adc47f1ca3580a6968d145239ae830734a0ebe4a 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/list/EntityList.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/list/EntityList.java +@@ -18,9 +18,7 @@ public final class EntityList implements Iterable { + this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE); + } + +- private static final Entity[] EMPTY_LIST = new Entity[0]; +- +- private Entity[] entities = EMPTY_LIST; ++ private Entity[] entities = me.titaniumtown.ArrayConstants.emptyEntityArray; // Gale - JettPack - reduce array allocations + private int count; + + public int size() { +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/list/IntList.java b/src/main/java/ca/spottedleaf/moonrise/common/list/IntList.java +index 9f3b25bb2439f283f878db93973a02fcdcd14eed..4eb7bf187276f07f807fe181b303dda8e1b9196d 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/list/IntList.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/list/IntList.java +@@ -10,9 +10,7 @@ public final class IntList { + this.map.defaultReturnValue(Integer.MIN_VALUE); + } + +- private static final int[] EMPTY_LIST = new int[0]; +- +- private int[] byIndex = EMPTY_LIST; ++ private int[] byIndex = me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations + private int count; + + public int size() { +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/list/ReferenceList.java b/src/main/java/ca/spottedleaf/moonrise/common/list/ReferenceList.java +index 2e876b918672e8ef3b5197b7e6b1597247fdeaa1..8df9406b77eb3c225ebf88bf76a7adb666452f3b 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/list/ReferenceList.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/list/ReferenceList.java +@@ -7,14 +7,12 @@ import java.util.NoSuchElementException; + + public final class ReferenceList implements Iterable { + +- private static final Object[] EMPTY_LIST = new Object[0]; +- + private final Reference2IntOpenHashMap referenceToIndex; + private E[] references; + private int count; + + public ReferenceList() { +- this((E[])EMPTY_LIST); ++ this((E[]) me.titaniumtown.ArrayConstants.emptyObjectArray); // Gale - JettPack - reduce array allocations + } + + public ReferenceList(final E[] referenceArray) { +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/list/ShortList.java b/src/main/java/ca/spottedleaf/moonrise/common/list/ShortList.java +index 2bae9949ef325d0001aa638150fbbdf968367e75..a72d5db6f6a8667c5c839016033bba4d0f16cf13 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/list/ShortList.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/list/ShortList.java +@@ -10,9 +10,7 @@ public final class ShortList { + this.map.defaultReturnValue(Short.MIN_VALUE); + } + +- private static final short[] EMPTY_LIST = new short[0]; +- +- private short[] byIndex = EMPTY_LIST; ++ private short[] byIndex = me.titaniumtown.ArrayConstants.emptyShortArray; // Gale - JettPack - reduce array allocations + private short count; + + public int size() { +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/list/SortedList.java b/src/main/java/ca/spottedleaf/moonrise/common/list/SortedList.java +index db92261a6cb3758391108361096417c61bc82cdc..1a14fddb36ca3c14d243304db629d0c5aac3906c 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/list/SortedList.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/list/SortedList.java +@@ -6,14 +6,12 @@ import java.util.Comparator; + + public final class SortedList { + +- private static final Object[] EMPTY_LIST = new Object[0]; +- + private Comparator comparator; + private E[] elements; + private int count; + + public SortedList(final Comparator comparator) { +- this((E[])EMPTY_LIST, comparator); ++ this((E[]) me.titaniumtown.ArrayConstants.emptyObjectArray, comparator); // Gale - JettPack - reduce array allocations + } + + public SortedList(final E[] elements, final Comparator comparator) { +diff --git a/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java b/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java +index 4b6d845423ca845cb8780499757d627773c688da..9c2864675bc0b13ba088ba699be3c5692c2fa0a4 100644 +--- a/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java ++++ b/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java +@@ -175,7 +175,7 @@ public class PaperCommands implements Commands, PaperRegistrar { +- basicCommand.execute(stack.getSource(), new String[0]); ++ basicCommand.execute(stack.getSource(), me.titaniumtown.ArrayConstants.emptyStringArray); // Gale - JettPack - reduce array allocations + return com.mojang.brigadier.Command.SINGLE_SUCCESS; + }); + +diff --git a/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java b/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java +index ae60bd96b5284d54676d8e7e4dd5d170b526ec1e..89562a86cd33ea2b55b284f77dc5d903ee21a49b 100644 +--- a/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java ++++ b/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java +@@ -14,7 +14,7 @@ public final class VersionCommand implements PaperSubcommand { + public boolean execute(final CommandSender sender, final String subCommand, final String[] args) { + final @Nullable Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version"); + if (ver != null) { +- ver.execute(sender, "paper", new String[0]); ++ ver.execute(sender, "paper", me.titaniumtown.ArrayConstants.emptyStringArray); // Gale - JettPack - reduce array allocations + } + return true; + } +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java b/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java +index ae86c45c1d49c7646c721991910592091e7333f8..1368191d6f76d1b4246b1bae7d5afdda44050965 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java +@@ -7,8 +7,10 @@ import org.bukkit.inventory.EquipmentSlot; + + public class CraftEquipmentSlot { + +- private static final net.minecraft.world.entity.EquipmentSlot[] slots = new net.minecraft.world.entity.EquipmentSlot[EquipmentSlot.values().length]; +- private static final EquipmentSlot[] enums = new EquipmentSlot[net.minecraft.world.entity.EquipmentSlot.values().length]; ++ // Gale start - JettPack - reduce array allocations ++ private static final net.minecraft.world.entity.EquipmentSlot[] slots = net.minecraft.world.entity.EquipmentSlot.VALUES_ARRAY; ++ private static final EquipmentSlot[] enums = new EquipmentSlot[net.minecraft.world.entity.EquipmentSlot.VALUES.size()]; ++ // Gale end - JettPack - reduce array allocations + + static { + set(EquipmentSlot.HAND, net.minecraft.world.entity.EquipmentSlot.MAINHAND); +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java +index fdcc414f4fa246082ad0732133c870d915ae3084..33ed515d6e79c4135f3e7bbc25fd0e3d83d08540 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java +@@ -165,7 +165,7 @@ public class CraftEntityEquipment implements EntityEquipment { + + @Override + public void clear() { +- for (net.minecraft.world.entity.EquipmentSlot slot : net.minecraft.world.entity.EquipmentSlot.values()) { ++ for (net.minecraft.world.entity.EquipmentSlot slot : net.minecraft.world.entity.EquipmentSlot.VALUES) { // Gale - JettPack - reduce array allocations + this.setEquipment(slot, null, false); + } + } +diff --git a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java +index b25dc23b81687dd4d4e70b3615ffb91f8c03c68b..59ff2801592c98e7471404c70dbbdf3db1b7716b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java +@@ -164,7 +164,7 @@ public final class WeakCollection implements Collection { + + @Override + public Object[] toArray() { +- return this.toArray(new Object[0]); ++ return this.toArray(me.titaniumtown.ArrayConstants.emptyObjectArray); // Gale - JettPack - reduce array allocations + } + + @Override diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0015-CraftBukkit-UUID-to-world-map.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0015-CraftBukkit-UUID-to-world-map.patch new file mode 100644 index 00000000..36033044 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0015-CraftBukkit-UUID-to-world-map.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 24 Dec 2022 13:09:34 +0100 +Subject: [PATCH] CraftBukkit UUID to world map + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following patch: +"Optimize CraftServer.getWorld(UUID)" +By: PureGero +As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index ae90120eab182fcb975a13c84eed1425dc09da46..67afa3b0cf9295690461e2be49249fb6f80d7082 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -286,6 +286,7 @@ public final class CraftServer implements Server { + protected final DedicatedServer console; + protected final DedicatedPlayerList playerList; + private final Map worlds = new LinkedHashMap(); ++ private final it.unimi.dsi.fastutil.objects.Object2ObjectMap worldsByUUID = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); // Gale - MultiPaper - CraftBukkit UUID to world map + // private final Map, Registry> registries = new HashMap<>(); // Paper - replace with RegistryAccess + private YamlConfiguration configuration; + private YamlConfiguration commandsConfiguration; +@@ -1529,6 +1530,7 @@ public final class CraftServer implements Server { + this.getLogger().log(Level.SEVERE, null, ex); + } + ++ this.worldsByUUID.remove(world.getUID()); // Gale - MultiPaper - CraftBukkit UUID to world map + this.worlds.remove(world.getName().toLowerCase(Locale.ROOT)); + this.console.removeLevel(handle); + return true; +@@ -1547,12 +1549,7 @@ public final class CraftServer implements Server { + + @Override + public World getWorld(UUID uid) { +- for (World world : this.worlds.values()) { +- if (world.getUID().equals(uid)) { +- return world; +- } +- } +- return null; ++ return this.worldsByUUID.get(uid); // Gale - MultiPaper - CraftBukkit UUID to world map + } + + // Paper start +@@ -1570,6 +1567,7 @@ public final class CraftServer implements Server { + System.out.println("World " + world.getName() + " is a duplicate of another world and has been prevented from loading. Please delete the uid.dat file from " + world.getName() + "'s world directory if you want to be able to load the duplicate world."); + return; + } ++ this.worldsByUUID.put(world.getUID(), world); // Gale - MultiPaper - CraftBukkit UUID to world map + this.worlds.put(world.getName().toLowerCase(Locale.ROOT), world); + } + diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0016-Specific-interval-TPS-API.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0016-Specific-interval-TPS-API.patch new file mode 100644 index 00000000..bd02f391 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0016-Specific-interval-TPS-API.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 12:56:43 +0100 +Subject: [PATCH] Specific interval TPS API + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 5df7c8133a8c982e6ffe9c57c58cfb22ccd874f4..05821d59d043a116e3fd779ed7be2624055ec886 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -3102,6 +3102,23 @@ public final class CraftServer implements Server { + }; + } + ++ // Gale start - specific interval TPS API ++ @Override ++ public double get1MinuteTPSAverage() { ++ return net.minecraft.server.MinecraftServer.getServer().tps1.getAverage(); ++ } ++ ++ @Override ++ public double get5MinuteTPSAverage() { ++ return net.minecraft.server.MinecraftServer.getServer().tps5.getAverage(); ++ } ++ ++ @Override ++ public double get15MinuteTPSAverage() { ++ return net.minecraft.server.MinecraftServer.getServer().tps15.getAverage(); ++ } ++ // Gale end - specific interval TPS API ++ + // Paper start - adventure sounds + @Override + public void playSound(final net.kyori.adventure.sound.Sound sound) { diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0017-5-second-TPS-average.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0017-5-second-TPS-average.patch new file mode 100644 index 00000000..98a3761e --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0017-5-second-TPS-average.patch @@ -0,0 +1,112 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 30 Nov 2022 12:42:32 +0100 +Subject: [PATCH] 5 second TPS average + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add 5 second tps average in /tps" +By: William Blake Galbreath +As part of: Purpur (https://github.com/PurpurMC/Purpur) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Purpur copyright * + +MIT License + +Copyright (c) 2019-2022 PurpurMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java +index 12b327eea95e0de9e9c39b7d039badee8ec46508..6178f0212214a2a075cea60c758dca793a61951b 100644 +--- a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java ++++ b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java +@@ -61,6 +61,7 @@ public class RAMDetails extends JList { + + // Follows CraftServer#getTPS + double[] tps = new double[] { ++ server.tps5s.getAverage(), // Gale - Purpur - 5 second TPS average + server.tps1.getAverage(), + server.tps5.getAverage(), + server.tps15.getAverage() +@@ -73,7 +74,7 @@ public class RAMDetails extends JList { + vector.add("Memory use: " + (data.getUsedMem() / 1024L / 1024L) + " mb (" + (data.getFree() * 100L / data.getMax()) + "% free)"); + vector.add("Heap: " + (data.getTotal() / 1024L / 1024L) + " / " + (data.getMax() / 1024L / 1024L) + " mb"); + vector.add("Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double) TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms"); +- vector.add("TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg)); ++ vector.add("TPS from last 5s, 1m, 5m, 15m: " + String.join(", ", tpsAvg)); // Gale - Purpur - 5 second TPS average + setListData(vector); + } + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 05821d59d043a116e3fd779ed7be2624055ec886..50ff4a923291a06a52e91059b02194a15f87d6d6 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -3102,7 +3102,26 @@ public final class CraftServer implements Server { + }; + } + ++ // Gale start - Purpur - 5 second TPS average ++ @Override ++ public double[] getTPSIncluding5SecondAverage() { ++ return new double[] { ++ net.minecraft.server.MinecraftServer.getServer().tps5s.getAverage(), ++ net.minecraft.server.MinecraftServer.getServer().tps1.getAverage(), ++ net.minecraft.server.MinecraftServer.getServer().tps5.getAverage(), ++ net.minecraft.server.MinecraftServer.getServer().tps15.getAverage() ++ }; ++ } ++ // Gale end - Purpur - 5 second TPS average ++ + // Gale start - specific interval TPS API ++ // Gale start - Purpur - 5 second TPS average ++ @Override ++ public double get5SecondTPSAverage() { ++ return net.minecraft.server.MinecraftServer.getServer().tps5s.getAverage(); ++ } ++ // Gale end - Purpur - 5 second TPS average ++ + @Override + public double get1MinuteTPSAverage() { + return net.minecraft.server.MinecraftServer.getServer().tps1.getAverage(); +diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java +index 6d4851aa8c53793bfaf650f399fc5e2a98dbbb24..d336b27ee314366fe44760db6fdb68370ab3995a 100644 +--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java ++++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java +@@ -35,7 +35,7 @@ public class TicksPerSecondCommand extends Command { + } + + // Paper start - Further improve tick handling +- double[] tps = org.bukkit.Bukkit.getTPS(); ++ double[] tps = org.bukkit.Bukkit.getTPSIncluding5SecondAverage(); // Gale - Purpur - 5 second TPS average + Component[] tpsAvg = new Component[tps.length]; + + for (int i = 0; i < tps.length; i++) { +@@ -43,7 +43,7 @@ public class TicksPerSecondCommand extends Command { + } + + TextComponent.Builder builder = text(); +- builder.append(text("TPS from last 1m, 5m, 15m: ", NamedTextColor.GOLD)); ++ builder.append(text("TPS from last 5s, 1m, 5m, 15m: ", NamedTextColor.GOLD)); // Gale - Purpur - 5 second TPS average + builder.append(Component.join(JoinConfiguration.commas(true), tpsAvg)); + sender.sendMessage(builder.asComponent()); + if (args.length > 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) { diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0018-Last-tick-time-API.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0018-Last-tick-time-API.patch new file mode 100644 index 00000000..ccabbb8a --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0018-Last-tick-time-API.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 26 Nov 2022 17:12:08 +0100 +Subject: [PATCH] Last tick time API + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add getLastTickMs api" +By: tr7zw +As part of: YAPFA (https://github.com/tr7zw/YAPFA) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* YAPFA copyright * + +Copyright 2020 tr7zw + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 50ff4a923291a06a52e91059b02194a15f87d6d6..1b1720343d3b07a73490f66520c7df12005adbcc 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -3342,4 +3342,21 @@ public final class CraftServer implements Server { + this.console.addPluginAllowingSleep(plugin.getName(), value); + } + // Paper end - API to check if the server is sleeping ++ ++ // Gale start - YAPFA - last tick time - API ++ @Override ++ public long getLastTickTotalTime() { ++ return MinecraftServer.lastTickProperTime + MinecraftServer.lastTickOversleepTime; ++ } ++ ++ @Override ++ public long getLastTickProperTime() { ++ return MinecraftServer.lastTickProperTime; ++ } ++ ++ @Override ++ public long getLastTickOversleepTime() { ++ return MinecraftServer.lastTickOversleepTime; ++ } ++ // Gale end - YAPFA - last tick time - API + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0019-Show-last-tick-time-in-tps-command.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0019-Show-last-tick-time-in-tps-command.patch new file mode 100644 index 00000000..11e83b54 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0019-Show-last-tick-time-in-tps-command.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Sat, 26 Nov 2022 21:02:58 +0100 +Subject: [PATCH] Show last tick time in /tps command + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Add getLastTickMs api" +By: tr7zw +As part of: YAPFA (https://github.com/tr7zw/YAPFA) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* YAPFA copyright * + +Copyright 2020 tr7zw + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java +index d336b27ee314366fe44760db6fdb68370ab3995a..e1532490b14d15fd5687f242137d470d5b82ea12 100644 +--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java ++++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java +@@ -46,6 +46,24 @@ public class TicksPerSecondCommand extends Command { + builder.append(text("TPS from last 5s, 1m, 5m, 15m: ", NamedTextColor.GOLD)); // Gale - Purpur - 5 second TPS average + builder.append(Component.join(JoinConfiguration.commas(true), tpsAvg)); + sender.sendMessage(builder.asComponent()); ++ // Gale start - YAPFA - last tick time - in TPS command ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().misc.lastTickTimeInTpsCommand.enabled) { ++ long lastTickProperTime = net.minecraft.server.MinecraftServer.lastTickProperTime; ++ long lastTickOversleepTime = net.minecraft.server.MinecraftServer.lastTickOversleepTime; ++ var lastTickTimeMessage = text("Last tick: ") ++ .append(formatTickTimeDuration(lastTickProperTime, 44, 50, 51)); ++ ++ if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().misc.lastTickTimeInTpsCommand.addOversleep) { ++ lastTickTimeMessage = lastTickTimeMessage.append(text(" self + ")) ++ .append(formatTickTimeDuration(lastTickOversleepTime, Math.max(1, 51 - lastTickProperTime), Math.max(2, 52 - lastTickProperTime), Math.max(3, 53 - lastTickProperTime))) ++ .append(text(" oversleep = ")) ++ .append(formatTickTimeDuration(lastTickProperTime + lastTickOversleepTime, 51, 52, 53)); ++ } ++ ++ lastTickTimeMessage = lastTickTimeMessage.color(NamedTextColor.GOLD); ++ sender.sendMessage(lastTickTimeMessage); ++ } ++ // Gale end - YAPFA - last tick time - in TPS command + if (args.length > 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) { + sender.sendMessage(text() + .append(text("Current Memory Usage: ", NamedTextColor.GOLD)) +@@ -68,4 +86,16 @@ public class TicksPerSecondCommand extends Command { + return text(amount, color); + // Paper end + } ++ ++ // Gale start - YAPFA - last tick time - in TPS command ++ private static final TextColor safeColor = NamedTextColor.GREEN; ++ private static final TextColor closeColor = NamedTextColor.YELLOW; ++ private static final TextColor problematicColor = TextColor.color(0xf77c1e); ++ private static final TextColor severeColor = NamedTextColor.RED; ++ ++ private static Component formatTickTimeDuration(long ms, long safeLimit, long closeLimit, long nonSevereLimit) { ++ return text(ms + " ", ms <= safeLimit ? safeColor : ms <= closeLimit ? closeColor : ms <= nonSevereLimit ? problematicColor : severeColor) ++ .append(text("ms", NamedTextColor.GOLD)); ++ } ++ // Gale end - YAPFA - last tick time - in TPS command + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0020-Pre-compute-VarLong-sizes.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0020-Pre-compute-VarLong-sizes.patch new file mode 100644 index 00000000..9ed13cbf --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0020-Pre-compute-VarLong-sizes.patch @@ -0,0 +1,187 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Mon, 21 Aug 2023 21:46:10 +0200 +Subject: [PATCH] Pre-compute VarLong sizes + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following commit: +"Reapply "Optimize varint writing"" +By: Andrew Steinborn +As part of: Velocity (https://github.com/PaperMC/Velocity) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Velocity description * + +Inspired by the approach described at the bottom of https://richardstartin.github.io/posts/dont-use-protobuf-for-telemetry + +Given that we do a lot of varint writing as well, this should provide a small performance boost for larger/complex packets whilst not regressing hard on smaller packets. + +This includes a test to ensure that the behavior is as expected and fixes the initialization loop so that the correct results will be given. Much thanks to @octylFractal for acting as my duck while trying to figure this out. + +diff --git a/src/test/java/net/minecraft/network/VarIntLongTest.java b/src/test/java/net/minecraft/network/VarIntLongTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..bbea09ffc2180c3c62e15d7dff51f8c220425bfe +--- /dev/null ++++ b/src/test/java/net/minecraft/network/VarIntLongTest.java +@@ -0,0 +1,159 @@ ++// Gale - Velocity - VarInt and VarLong optimizations ++ ++package net.minecraft.network; ++ ++import it.unimi.dsi.fastutil.ints.IntOpenHashSet; ++import it.unimi.dsi.fastutil.ints.IntSet; ++import it.unimi.dsi.fastutil.longs.LongOpenHashSet; ++import it.unimi.dsi.fastutil.longs.LongSet; ++import org.junit.jupiter.api.Assertions; ++import org.junit.jupiter.api.Test; ++ ++public class VarIntLongTest { ++ ++ private static String padStringWithLeadingZeros(String string, int length) { ++ if (string.length() >= length) { ++ return string; ++ } ++ return "0".repeat(length - string.length()) + string; ++ } ++ ++ private static final IntSet integerCases; ++ static { ++ integerCases = new IntOpenHashSet(); ++ { ++ integerCases.add(0); ++ integerCases.add(-1); ++ } ++ { ++ for (int i = 0; i < 32; i++) { ++ integerCases.add(1 << i); ++ } ++ } ++ { ++ for (int factor = 1; factor <= 7; factor++) { ++ int all = 0; ++ for (int i = 0; i <= 4; i++) { ++ int shifted = 1 << (i * factor); ++ all |= shifted; ++ integerCases.add(shifted); ++ integerCases.add(shifted - 1); ++ integerCases.add(~shifted); ++ integerCases.add(-shifted); ++ integerCases.add((~shifted) & (0x80000000)); ++ integerCases.add(all); ++ integerCases.add(all - 1); ++ integerCases.add(~all); ++ integerCases.add(-all); ++ integerCases.add((~all) & (0x80000000)); ++ } ++ } ++ } ++ { ++ var newCases = new IntOpenHashSet(); ++ for (int shiftSize = 2; shiftSize <= 6; shiftSize++) { ++ for (int offset = 0; offset < shiftSize; offset++) { ++ int striped = 0; ++ for (int i = offset; i < 32; i += shiftSize) { ++ striped |= 1 << i; ++ } ++ final var finalStriped = striped; ++ integerCases.forEach(existing -> { ++ newCases.add(existing | finalStriped); ++ newCases.add(existing | (~finalStriped)); ++ newCases.add(existing & finalStriped); ++ newCases.add(existing & (~finalStriped)); ++ newCases.add(existing - finalStriped); ++ newCases.add(existing - (~finalStriped)); ++ }); ++ } ++ } ++ integerCases.addAll(newCases); ++ } ++ } ++ ++ private static final LongSet longCases; ++ static { ++ longCases = new LongOpenHashSet(); ++ { ++ longCases.add(0); ++ longCases.add(-1); ++ } ++ { ++ for (int i = 0; i < 64; i++) { ++ longCases.add(1L << i); ++ } ++ } ++ { ++ for (int factor = 1; factor <= 7; factor++) { ++ long all = 0; ++ for (int i = 0; i <= 9; i++) { ++ long shifted = 1L << (i * factor); ++ all |= shifted; ++ longCases.add(shifted); ++ longCases.add(shifted - 1); ++ longCases.add(~shifted); ++ longCases.add(-shifted); ++ longCases.add((~shifted) & (0x8000000000000000L)); ++ longCases.add(all); ++ longCases.add(all - 1); ++ longCases.add(~all); ++ longCases.add(-all); ++ longCases.add((~all) & (0x8000000000000000L)); ++ } ++ } ++ } ++ { ++ var newCases = new LongOpenHashSet(); ++ for (int shiftSize = 2; shiftSize <= 6; shiftSize++) { ++ for (int offset = 0; offset < shiftSize; offset++) { ++ long striped = 0; ++ for (int i = offset; i < 64; i += shiftSize) { ++ striped |= 1L << i; ++ } ++ final var finalStriped = striped; ++ longCases.forEach(existing -> { ++ newCases.add(existing | finalStriped); ++ newCases.add(existing | (~finalStriped)); ++ newCases.add(existing & finalStriped); ++ newCases.add(existing & (~finalStriped)); ++ newCases.add(existing - finalStriped); ++ newCases.add(existing - (~finalStriped)); ++ }); ++ } ++ } ++ longCases.addAll(newCases); ++ } ++ } ++ ++ // Gale start - Velocity - pre-compute VarInt and VarLong sizes ++ @Test ++ public void testGetVarIntSizeComparedToOld() { ++ integerCases.forEach(value -> { ++ // given ++ int originalSize = VarInt.getByteSizeOld(value); ++ ++ // when ++ int size = VarInt.getByteSize(value); ++ ++ // then ++ Assertions.assertEquals(originalSize, size, "Optimized size (" + size + ") is not equal to original size (" + originalSize + ") for test case value " + value + " (binary: " + padStringWithLeadingZeros(Integer.toBinaryString(value), 32) + ")"); ++ }); ++ } ++ ++ @Test ++ public void testGetVarLongSizeComparedToOld() { ++ longCases.forEach(value -> { ++ // given ++ int originalSize = VarLong.getByteSizeOld(value); ++ ++ // when ++ int size = VarLong.getByteSize(value); ++ ++ // then ++ Assertions.assertEquals(originalSize, size, "Optimized size (" + size + ") is not equal to original size (" + originalSize + ") for test case value " + value + " (binary: " + padStringWithLeadingZeros(Long.toBinaryString(value), 64) + ")"); ++ }); ++ } ++ // Gale end - Velocity - pre-compute VarInt and VarLong sizes ++ ++} diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0021-Optimize-VarInt-write-and-VarLong-write.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0021-Optimize-VarInt-write-and-VarLong-write.patch new file mode 100644 index 00000000..03e7a4fe --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0021-Optimize-VarInt-write-and-VarLong-write.patch @@ -0,0 +1,81 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Tue, 22 Aug 2023 21:38:37 +0200 +Subject: [PATCH] Optimize VarInt#write and VarLong#write + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +This patch is based on the following commit: +"Reapply "Optimize varint writing"" +By: Andrew Steinborn +As part of: Velocity (https://github.com/PaperMC/Velocity) +Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) + +* Velocity description * + +Inspired by the approach described at the bottom of https://richardstartin.github.io/posts/dont-use-protobuf-for-telemetry + +Given that we do a lot of varint writing as well, this should provide a small performance boost for larger/complex packets whilst not regressing hard on smaller packets. + +This includes a test to ensure that the behavior is as expected and fixes the initialization loop so that the correct results will be given. Much thanks to @octylFractal for acting as my duck while trying to figure this out. + +diff --git a/src/test/java/net/minecraft/network/VarIntLongTest.java b/src/test/java/net/minecraft/network/VarIntLongTest.java +index bbea09ffc2180c3c62e15d7dff51f8c220425bfe..0c11670d8d7307307a7cd12be5d0dca40155829d 100644 +--- a/src/test/java/net/minecraft/network/VarIntLongTest.java ++++ b/src/test/java/net/minecraft/network/VarIntLongTest.java +@@ -2,6 +2,7 @@ + + package net.minecraft.network; + ++import io.netty.buffer.Unpooled; + import it.unimi.dsi.fastutil.ints.IntOpenHashSet; + import it.unimi.dsi.fastutil.ints.IntSet; + import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +@@ -156,4 +157,46 @@ public class VarIntLongTest { + } + // Gale end - Velocity - pre-compute VarInt and VarLong sizes + ++ // Gale - Velocity - optimized VarInt#write and VarLong#write ++ @Test ++ public void testWriteVarIntComparedToOld() { ++ integerCases.forEach(value -> { ++ // given ++ int capacity = 5; ++ FriendlyByteBuf buf1 = new FriendlyByteBuf(Unpooled.buffer(capacity)); ++ FriendlyByteBuf buf2 = new FriendlyByteBuf(Unpooled.buffer(capacity)); ++ VarInt.writeOld(buf1, value); ++ ++ // when ++ buf2.writeVarInt(value); ++ ++ // then ++ Assertions.assertEquals(buf1.writerIndex(), buf2.writerIndex(), "Writer index of optimized buffer (" + buf2.writerIndex() + ") is not equal to writer index of original buffer (" + buf1.writerIndex() + ") for test case value " + value + " (binary: " + padStringWithLeadingZeros(Integer.toBinaryString(value), 32) + ")"); ++ for (int i = 0; i < capacity; i++) { ++ Assertions.assertEquals(buf1.getByte(i), buf2.getByte(i), "Buffer byte (at index " + i + ") in optimized buffer (" + buf2.getByte(i) + " (binary: " + padStringWithLeadingZeros(Integer.toBinaryString(Byte.toUnsignedInt(buf2.getByte(i))), 8) + ")) is not equal to the same byte in original buffer (" + buf1.getByte(i) + " (binary: " + padStringWithLeadingZeros(Integer.toBinaryString(Byte.toUnsignedInt(buf1.getByte(i))), 8) + ")) for test case value " + value + " (binary: " + padStringWithLeadingZeros(Integer.toBinaryString(value), 32) + ")"); ++ } ++ }); ++ } ++ ++ @Test ++ public void testWriteVarLongComparedToOld() { ++ longCases.forEach(value -> { ++ // given ++ int capacity = 10; ++ FriendlyByteBuf buf1 = new FriendlyByteBuf(Unpooled.buffer(capacity)); ++ FriendlyByteBuf buf2 = new FriendlyByteBuf(Unpooled.buffer(capacity)); ++ VarLong.writeOld(buf1, value); ++ ++ // when ++ buf2.writeVarLong(value); ++ ++ // then ++ Assertions.assertEquals(buf1.writerIndex(), buf2.writerIndex(), "Writer index of optimized buffer (" + buf2.writerIndex() + ") is not equal to writer index of original buffer (" + buf1.writerIndex() + ") for test case value " + value + " (binary: " + padStringWithLeadingZeros(Long.toBinaryString(value), 64) + ")"); ++ for (int i = 0; i < capacity; i++) { ++ Assertions.assertEquals(buf1.getByte(i), buf2.getByte(i), "Buffer byte (at index " + i + ") in optimized buffer (" + buf2.getByte(i) + " (binary: " + padStringWithLeadingZeros(Integer.toBinaryString(Byte.toUnsignedInt(buf2.getByte(i))), 8) + ")) is not equal to the same byte in original buffer (" + buf1.getByte(i) + " (binary: " + padStringWithLeadingZeros(Integer.toBinaryString(Byte.toUnsignedInt(buf1.getByte(i))), 8) + ")) for test case value " + value + " (binary: " + padStringWithLeadingZeros(Long.toBinaryString(value), 64) + ")"); ++ } ++ }); ++ } ++ // Gale end - Velocity - optimized VarInt#write and VarLong#write ++ + } diff --git a/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0022-Virtual-thread-support.patch b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0022-Virtual-thread-support.patch new file mode 100644 index 00000000..87c56e97 --- /dev/null +++ b/leaf-archived-patches/unapplied/server/paper-patches/gale-features/0022-Virtual-thread-support.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Wed, 9 Aug 2023 15:04:56 +0200 +Subject: [PATCH] Virtual thread support + +License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) +Gale - https://galemc.org + +diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java +index dbe3d8748c1e6fbad7ee4ccf39dfc0422b0ce50b..3d8ed4ff9a5a30d123508aeb485250271b528a6e 100644 +--- a/src/main/java/com/destroystokyo/paper/Metrics.java ++++ b/src/main/java/com/destroystokyo/paper/Metrics.java +@@ -975,6 +975,22 @@ public class Metrics { + })); + // Gale end - SIMD support - include in metrics + ++ // Gale start - virtual thread support - include in metrics ++ Map> virtualThreadSupportMap = new HashMap<>(2); ++ { ++ Map entry = new HashMap<>(2); ++ boolean isSupported = org.galemc.gale.virtualthread.VirtualThreadService.isSupported(); ++ try { ++ int javaMajorVersion = org.galemc.gale.virtualthread.VirtualThreadService.getJavaMajorVersion(); ++ entry.put(isSupported + " (Java " + javaMajorVersion + ")", 1); ++ } catch (Exception ignored) { ++ entry.put(String.valueOf(isSupported), 1); ++ } ++ virtualThreadSupportMap.put(String.valueOf(isSupported), entry); ++ } ++ metrics.addCustomChart(new Metrics.DrilldownPie("virtual_thread_support", () -> virtualThreadSupportMap)); ++ // Gale end - virtual thread support - include in metrics ++ + } + + } diff --git a/leaf-server/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java b/leaf-archived-patches/unapplied/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java similarity index 100% rename from leaf-server/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java rename to leaf-archived-patches/unapplied/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java diff --git a/leaf-server/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java b/leaf-archived-patches/unapplied/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java similarity index 100% rename from leaf-server/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java rename to leaf-archived-patches/unapplied/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java diff --git a/leaf-server/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java b/leaf-archived-patches/unapplied/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java similarity index 100% rename from leaf-server/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java rename to leaf-archived-patches/unapplied/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java diff --git a/leaf-server/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java b/leaf-archived-patches/unapplied/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java similarity index 100% rename from leaf-server/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java rename to leaf-archived-patches/unapplied/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java diff --git a/leaf-server/src/main/java/me/titaniumtown/ArrayConstants.java b/leaf-archived-patches/unapplied/src/main/java/me/titaniumtown/ArrayConstants.java similarity index 100% rename from leaf-server/src/main/java/me/titaniumtown/ArrayConstants.java rename to leaf-archived-patches/unapplied/src/main/java/me/titaniumtown/ArrayConstants.java diff --git a/leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentEntity.java b/leaf-archived-patches/unapplied/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentEntity.java similarity index 100% rename from leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentEntity.java rename to leaf-archived-patches/unapplied/src/main/java/net/caffeinemc/mods/lithium/common/entity/EquipmentEntity.java diff --git a/leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/util/change_tracking/ChangePublisher.java b/leaf-archived-patches/unapplied/src/main/java/net/caffeinemc/mods/lithium/common/util/change_tracking/ChangePublisher.java similarity index 100% rename from leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/util/change_tracking/ChangePublisher.java rename to leaf-archived-patches/unapplied/src/main/java/net/caffeinemc/mods/lithium/common/util/change_tracking/ChangePublisher.java diff --git a/leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/util/change_tracking/ChangeSubscriber.java b/leaf-archived-patches/unapplied/src/main/java/net/caffeinemc/mods/lithium/common/util/change_tracking/ChangeSubscriber.java similarity index 100% rename from leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/util/change_tracking/ChangeSubscriber.java rename to leaf-archived-patches/unapplied/src/main/java/net/caffeinemc/mods/lithium/common/util/change_tracking/ChangeSubscriber.java diff --git a/leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java b/leaf-archived-patches/unapplied/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java similarity index 100% rename from leaf-server/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java rename to leaf-archived-patches/unapplied/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/LeafBootstrap.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/LeafBootstrap.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/LeafBootstrap.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/LeafBootstrap.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/AsyncChunkSending.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/AsyncChunkSending.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/AsyncChunkSending.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/AsyncChunkSending.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/locate/AsyncLocator.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/locate/AsyncLocator.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/locate/AsyncLocator.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/locate/AsyncLocator.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPath.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/AsyncPath.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPath.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/AsyncPath.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorCache.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorCache.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorCache.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorCache.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorFeatures.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorFeatures.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorFeatures.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorFeatures.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorGenerator.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorGenerator.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorGenerator.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorGenerator.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorType.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorType.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorType.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorType.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/PathProcessState.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/PathProcessState.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/path/PathProcessState.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/PathProcessState.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/PathfindTaskRejectPolicy.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/PathfindTaskRejectPolicy.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/path/PathfindTaskRejectPolicy.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/path/PathfindTaskRejectPolicy.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/world/SparklyPaperServerLevelTickExecutorThreadFactory.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/world/SparklyPaperServerLevelTickExecutorThreadFactory.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/async/world/SparklyPaperServerLevelTickExecutorThreadFactory.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/async/world/SparklyPaperServerLevelTickExecutorThreadFactory.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/command/LeafCommand.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/LeafCommand.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/command/LeafCommand.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/LeafCommand.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/command/LeafCommands.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/LeafCommands.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/command/LeafCommands.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/LeafCommands.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/command/LeafSubcommand.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/LeafSubcommand.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/command/LeafSubcommand.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/LeafSubcommand.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/command/PermissionedLeafSubcommand.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/PermissionedLeafSubcommand.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/command/PermissionedLeafSubcommand.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/PermissionedLeafSubcommand.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/command/subcommands/MSPTCommand.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/subcommands/MSPTCommand.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/command/subcommands/MSPTCommand.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/subcommands/MSPTCommand.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/command/subcommands/ReloadCommand.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/subcommands/ReloadCommand.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/command/subcommands/ReloadCommand.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/subcommands/ReloadCommand.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/command/subcommands/VersionCommand.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/subcommands/VersionCommand.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/command/subcommands/VersionCommand.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/command/subcommands/VersionCommand.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/ConfigModules.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/ConfigModules.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/ConfigModules.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/ConfigModules.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/EnumConfigCategory.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/EnumConfigCategory.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/EnumConfigCategory.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/EnumConfigCategory.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/LeafConfig.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/LeafConfig.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/LeafGlobalConfig.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/LeafGlobalConfig.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/LeafGlobalConfig.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/LeafGlobalConfig.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/annotations/DoNotLoad.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/annotations/DoNotLoad.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/annotations/DoNotLoad.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/annotations/DoNotLoad.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/annotations/Experimental.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/annotations/Experimental.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/annotations/Experimental.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/annotations/Experimental.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/annotations/HotReloadUnsupported.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/annotations/HotReloadUnsupported.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/annotations/HotReloadUnsupported.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/annotations/HotReloadUnsupported.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncBlockFinding.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncBlockFinding.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncBlockFinding.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncBlockFinding.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncChunkSend.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncChunkSend.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncChunkSend.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncChunkSend.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncLocator.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncLocator.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncLocator.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncLocator.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncMobSpawning.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncMobSpawning.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncMobSpawning.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncMobSpawning.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPathfinding.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPathfinding.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPathfinding.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPathfinding.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPlayerDataSave.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPlayerDataSave.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPlayerDataSave.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPlayerDataSave.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/MultithreadedTracker.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/MultithreadedTracker.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/MultithreadedTracker.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/MultithreadedTracker.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/SparklyPaperParallelWorldTicking.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/SparklyPaperParallelWorldTicking.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/SparklyPaperParallelWorldTicking.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/async/SparklyPaperParallelWorldTicking.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/fixes/DontPlacePlayerIfFull.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/fixes/DontPlacePlayerIfFull.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/fixes/DontPlacePlayerIfFull.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/fixes/DontPlacePlayerIfFull.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/AfkCommand.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/AfkCommand.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/AfkCommand.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/AfkCommand.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableMaxUseItemDistance.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableMaxUseItemDistance.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableMaxUseItemDistance.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableMaxUseItemDistance.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableTripWireDupe.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableTripWireDupe.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableTripWireDupe.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableTripWireDupe.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/HideItemComponent.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/HideItemComponent.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/HideItemComponent.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/HideItemComponent.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/Knockback.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/Knockback.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/Knockback.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/Knockback.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/OnlyPlayerPushable.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/OnlyPlayerPushable.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/OnlyPlayerPushable.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/OnlyPlayerPushable.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/SmoothTeleport.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/SmoothTeleport.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/SmoothTeleport.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/SmoothTeleport.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/SpawnerSettings.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/SpawnerSettings.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/SpawnerSettings.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/SpawnerSettings.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/UseSpigotItemMergingMech.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/UseSpigotItemMergingMech.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/UseSpigotItemMergingMech.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/gameplay/UseSpigotItemMergingMech.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/Cache.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/Cache.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/Cache.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/Cache.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/ConnectionMessage.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/ConnectionMessage.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/ConnectionMessage.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/ConnectionMessage.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/Including5sIngetTPS.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/Including5sIngetTPS.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/Including5sIngetTPS.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/Including5sIngetTPS.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/LagCompensation.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/LagCompensation.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/LagCompensation.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/LagCompensation.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/RegionFormatConfig.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/RegionFormatConfig.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/RegionFormatConfig.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/RegionFormatConfig.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveChangeNonEditableSignWarning.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveChangeNonEditableSignWarning.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveChangeNonEditableSignWarning.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveChangeNonEditableSignWarning.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveSpigotCheckBungee.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveSpigotCheckBungee.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveSpigotCheckBungee.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveSpigotCheckBungee.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveVanillaUsernameCheck.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveVanillaUsernameCheck.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveVanillaUsernameCheck.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveVanillaUsernameCheck.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/SecureSeed.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/SecureSeed.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/SecureSeed.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/SecureSeed.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/SentryDSN.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/SentryDSN.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/SentryDSN.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/SentryDSN.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/ServerBrand.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/ServerBrand.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/ServerBrand.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/ServerBrand.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/UnknownCommandMessage.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/UnknownCommandMessage.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/misc/UnknownCommandMessage.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/misc/UnknownCommandMessage.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/network/ChatMessageSignature.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/network/ChatMessageSignature.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/network/ChatMessageSignature.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/network/ChatMessageSignature.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/network/ConnectionFlushQueueRewrite.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/network/ConnectionFlushQueueRewrite.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/network/ConnectionFlushQueueRewrite.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/network/ConnectionFlushQueueRewrite.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/BrainRunningBehaviorCacheUpdate.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/BrainRunningBehaviorCacheUpdate.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/BrainRunningBehaviorCacheUpdate.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/BrainRunningBehaviorCacheUpdate.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/DontSaveEntity.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/DontSaveEntity.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/DontSaveEntity.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/DontSaveEntity.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/DynamicActivationofBrain.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/DynamicActivationofBrain.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/DynamicActivationofBrain.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/DynamicActivationofBrain.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/EnableCachedMTBEntityTypeConvert.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/EnableCachedMTBEntityTypeConvert.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/EnableCachedMTBEntityTypeConvert.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/EnableCachedMTBEntityTypeConvert.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/FastRNG.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/FastRNG.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/FastRNG.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/FastRNG.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/FasterStructureGenFutureSequencing.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/FasterStructureGenFutureSequencing.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/FasterStructureGenFutureSequencing.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/FasterStructureGenFutureSequencing.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/ReduceUselessPackets.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/ReduceUselessPackets.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/ReduceUselessPackets.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/ReduceUselessPackets.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/SkipAIForNonAwareMob.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/SkipAIForNonAwareMob.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/SkipAIForNonAwareMob.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/SkipAIForNonAwareMob.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/SkipMapItemDataUpdates.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/SkipMapItemDataUpdates.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/SkipMapItemDataUpdates.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/SkipMapItemDataUpdates.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleHopperWhenFull.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleHopperWhenFull.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleHopperWhenFull.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleHopperWhenFull.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleInactiveGoalSelectorTick.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleInactiveGoalSelectorTick.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleInactiveGoalSelectorTick.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleInactiveGoalSelectorTick.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/TileEntitySnapshotCreation.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/TileEntitySnapshotCreation.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/TileEntitySnapshotCreation.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/TileEntitySnapshotCreation.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/VT4BukkitScheduler.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/VT4BukkitScheduler.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/VT4BukkitScheduler.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/VT4BukkitScheduler.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/VT4ChatExecutor.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/VT4ChatExecutor.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/VT4ChatExecutor.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/VT4ChatExecutor.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/VT4UserAuthenticator.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/VT4UserAuthenticator.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/VT4UserAuthenticator.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/config/modules/opt/VT4UserAuthenticator.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/misc/LagCompensation.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/misc/LagCompensation.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/misc/LagCompensation.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/misc/LagCompensation.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/biome/PositionalBiomeGetter.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/biome/PositionalBiomeGetter.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/util/biome/PositionalBiomeGetter.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/biome/PositionalBiomeGetter.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/cache/CachedOrNewBitsGetter.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/cache/CachedOrNewBitsGetter.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/util/cache/CachedOrNewBitsGetter.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/cache/CachedOrNewBitsGetter.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/cache/IterateOutwardsCache.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/cache/IterateOutwardsCache.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/util/cache/IterateOutwardsCache.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/cache/IterateOutwardsCache.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/cache/LongList2BlockPosMutableIterable.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/cache/LongList2BlockPosMutableIterable.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/util/cache/LongList2BlockPosMutableIterable.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/cache/LongList2BlockPosMutableIterable.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/item/ItemStackStripper.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/item/ItemStackStripper.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/util/item/ItemStackStripper.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/item/ItemStackStripper.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/list/BlockEntityTickersList.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/list/BlockEntityTickersList.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/util/list/BlockEntityTickersList.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/list/BlockEntityTickersList.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/map/ConcurrentLongHashSet.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/map/ConcurrentLongHashSet.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/util/map/ConcurrentLongHashSet.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/map/ConcurrentLongHashSet.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/map/StringCanonizingOpenHashMap.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/map/StringCanonizingOpenHashMap.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/util/map/StringCanonizingOpenHashMap.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/map/StringCanonizingOpenHashMap.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/math/random/FasterRandomSource.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/math/random/FasterRandomSource.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/util/math/random/FasterRandomSource.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/util/math/random/FasterRandomSource.java diff --git a/leaf-server/src/main/java/org/dreeam/leaf/version/LeafVersionFetcher.java b/leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/version/LeafVersionFetcher.java similarity index 100% rename from leaf-server/src/main/java/org/dreeam/leaf/version/LeafVersionFetcher.java rename to leaf-archived-patches/unapplied/src/main/java/org/dreeam/leaf/version/LeafVersionFetcher.java diff --git a/leaf-server/src/main/java/org/galemc/gale/configuration/GaleConfigurations.java b/leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/configuration/GaleConfigurations.java similarity index 100% rename from leaf-server/src/main/java/org/galemc/gale/configuration/GaleConfigurations.java rename to leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/configuration/GaleConfigurations.java diff --git a/leaf-server/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java similarity index 100% rename from leaf-server/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java rename to leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java diff --git a/leaf-server/src/main/java/org/galemc/gale/configuration/GaleRemovedConfigurations.java b/leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/configuration/GaleRemovedConfigurations.java similarity index 100% rename from leaf-server/src/main/java/org/galemc/gale/configuration/GaleRemovedConfigurations.java rename to leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/configuration/GaleRemovedConfigurations.java diff --git a/leaf-server/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java similarity index 100% rename from leaf-server/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java rename to leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java diff --git a/leaf-server/src/main/java/org/galemc/gale/version/AbstractPaperVersionFetcher.java b/leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/version/AbstractPaperVersionFetcher.java similarity index 100% rename from leaf-server/src/main/java/org/galemc/gale/version/AbstractPaperVersionFetcher.java rename to leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/version/AbstractPaperVersionFetcher.java diff --git a/leaf-server/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java b/leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java similarity index 100% rename from leaf-server/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java rename to leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java diff --git a/leaf-server/src/main/java/org/galemc/gale/version/GaleVersionFetcher.java b/leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/version/GaleVersionFetcher.java similarity index 100% rename from leaf-server/src/main/java/org/galemc/gale/version/GaleVersionFetcher.java rename to leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/version/GaleVersionFetcher.java diff --git a/leaf-server/src/main/java/org/galemc/gale/virtualthread/DirectVirtualThreadService.java b/leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/virtualthread/DirectVirtualThreadService.java similarity index 100% rename from leaf-server/src/main/java/org/galemc/gale/virtualthread/DirectVirtualThreadService.java rename to leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/virtualthread/DirectVirtualThreadService.java diff --git a/leaf-server/src/main/java/org/galemc/gale/virtualthread/ReflectionVirtualThreadService.java b/leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/virtualthread/ReflectionVirtualThreadService.java similarity index 100% rename from leaf-server/src/main/java/org/galemc/gale/virtualthread/ReflectionVirtualThreadService.java rename to leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/virtualthread/ReflectionVirtualThreadService.java diff --git a/leaf-server/src/main/java/org/galemc/gale/virtualthread/VirtualThreadService.java b/leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/virtualthread/VirtualThreadService.java similarity index 100% rename from leaf-server/src/main/java/org/galemc/gale/virtualthread/VirtualThreadService.java rename to leaf-archived-patches/unapplied/src/main/java/org/galemc/gale/virtualthread/VirtualThreadService.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/LeavesLogger.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/LeavesLogger.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/LeavesLogger.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/LeavesLogger.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/bot/BotStatsCounter.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/bot/BotStatsCounter.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/bot/BotStatsCounter.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/bot/BotStatsCounter.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/entity/CraftPhotographer.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/entity/CraftPhotographer.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/entity/CraftPhotographer.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/entity/CraftPhotographer.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/entity/CraftPhotographerManager.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/entity/CraftPhotographerManager.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/entity/CraftPhotographerManager.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/entity/CraftPhotographerManager.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/AsteorBarProtocol.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/AsteorBarProtocol.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/AsteorBarProtocol.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/AsteorBarProtocol.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/chatimage/ChatImageIndex.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/chatimage/ChatImageIndex.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/chatimage/ChatImageIndex.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/chatimage/ChatImageIndex.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocol.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocol.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocol.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocol.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolHandler.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolHandler.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolHandler.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolHandler.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/Accessor.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/Accessor.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/Accessor.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/Accessor.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/AccessorImpl.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/AccessorImpl.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/AccessorImpl.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/AccessorImpl.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/BlockAccessor.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/BlockAccessor.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/BlockAccessor.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/BlockAccessor.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/BlockAccessorImpl.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/BlockAccessorImpl.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/BlockAccessorImpl.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/BlockAccessorImpl.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/EntityAccessor.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/EntityAccessor.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/EntityAccessor.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/EntityAccessor.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/EntityAccessorImpl.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/EntityAccessorImpl.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/EntityAccessorImpl.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/accessor/EntityAccessorImpl.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ClientHandshakePayload.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ClientHandshakePayload.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ClientHandshakePayload.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ClientHandshakePayload.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ReceiveDataPayload.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ReceiveDataPayload.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ReceiveDataPayload.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ReceiveDataPayload.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestBlockPayload.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestBlockPayload.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestBlockPayload.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestBlockPayload.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestEntityPayload.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestEntityPayload.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestEntityPayload.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestEntityPayload.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ServerHandshakePayload.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ServerHandshakePayload.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ServerHandshakePayload.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ServerHandshakePayload.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IJadeProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IJadeProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IJadeProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IJadeProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IServerDataProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IServerDataProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IServerDataProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IServerDataProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IServerExtensionProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IServerExtensionProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IServerExtensionProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IServerExtensionProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageExtensionProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageExtensionProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageExtensionProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageExtensionProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/StreamServerDataProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/StreamServerDataProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/StreamServerDataProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/StreamServerDataProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BeehiveProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BeehiveProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BeehiveProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BeehiveProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BrewingStandProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BrewingStandProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BrewingStandProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BrewingStandProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CampfireProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CampfireProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CampfireProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CampfireProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/ChiseledBookshelfProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/ChiseledBookshelfProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/ChiseledBookshelfProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/ChiseledBookshelfProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CommandBlockProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CommandBlockProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CommandBlockProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CommandBlockProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/FurnaceProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/FurnaceProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/FurnaceProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/FurnaceProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/HopperLockProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/HopperLockProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/HopperLockProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/HopperLockProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/JukeboxProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/JukeboxProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/JukeboxProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/JukeboxProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/LecternProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/LecternProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/LecternProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/LecternProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/MobSpawnerCooldownProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/MobSpawnerCooldownProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/MobSpawnerCooldownProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/MobSpawnerCooldownProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/ObjectNameProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/ObjectNameProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/ObjectNameProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/ObjectNameProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/RedstoneProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/RedstoneProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/RedstoneProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/RedstoneProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/AnimalOwnerProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/AnimalOwnerProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/AnimalOwnerProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/AnimalOwnerProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/MobBreedingProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/MobBreedingProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/MobBreedingProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/MobBreedingProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/MobGrowthProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/MobGrowthProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/MobGrowthProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/MobGrowthProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/NextEntityDropProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/NextEntityDropProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/NextEntityDropProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/NextEntityDropProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/PetArmorProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/PetArmorProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/PetArmorProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/PetArmorProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/StatusEffectsProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/StatusEffectsProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/StatusEffectsProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/StatusEffectsProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/ZombieVillagerProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/ZombieVillagerProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/ZombieVillagerProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/ZombieVillagerProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/tool/ShearsToolHandler.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/tool/ShearsToolHandler.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/tool/ShearsToolHandler.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/tool/ShearsToolHandler.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/tool/SimpleToolHandler.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/tool/SimpleToolHandler.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/tool/SimpleToolHandler.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/tool/SimpleToolHandler.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/tool/ToolHandler.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/tool/ToolHandler.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/tool/ToolHandler.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/tool/ToolHandler.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/CommonUtil.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/CommonUtil.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/CommonUtil.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/CommonUtil.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/HierarchyLookup.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/HierarchyLookup.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/HierarchyLookup.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/HierarchyLookup.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/IHierarchyLookup.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/IHierarchyLookup.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/IHierarchyLookup.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/IHierarchyLookup.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/ItemCollector.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/ItemCollector.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/ItemCollector.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/ItemCollector.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/ItemIterator.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/ItemIterator.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/ItemIterator.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/ItemIterator.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/JadeCodec.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/JadeCodec.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/JadeCodec.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/JadeCodec.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/LootTableMineableCollector.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/LootTableMineableCollector.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/LootTableMineableCollector.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/LootTableMineableCollector.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/PairHierarchyLookup.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/PairHierarchyLookup.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/PairHierarchyLookup.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/PairHierarchyLookup.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/PriorityStore.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/PriorityStore.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/PriorityStore.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/PriorityStore.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/ViewGroup.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/ViewGroup.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/ViewGroup.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/ViewGroup.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/WrappedHierarchyLookup.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/WrappedHierarchyLookup.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/WrappedHierarchyLookup.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/jade/util/WrappedHierarchyLookup.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/Feature.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/Feature.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/Feature.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/Feature.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/FeatureSet.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/FeatureSet.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/FeatureSet.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/FeatureSet.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/FileStorage.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/FileStorage.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/FileStorage.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/FileStorage.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/LocalLitematicState.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/LocalLitematicState.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/LocalLitematicState.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/LocalLitematicState.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/MessageType.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/MessageType.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/MessageType.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/MessageType.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PacketType.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PacketType.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PacketType.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PacketType.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PlayerIdentifier.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PlayerIdentifier.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PlayerIdentifier.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PlayerIdentifier.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PlayerIdentifierProvider.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PlayerIdentifierProvider.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PlayerIdentifierProvider.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/PlayerIdentifierProvider.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPlacement.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPlacement.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPlacement.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPlacement.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPosition.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPosition.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPosition.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPosition.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SubRegionData.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SubRegionData.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SubRegionData.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SubRegionData.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SubRegionPlacementModification.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SubRegionPlacementModification.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SubRegionPlacementModification.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SubRegionPlacementModification.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticManager.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticManager.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticManager.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticManager.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaPayload.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaPayload.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaPayload.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaPayload.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/AbstractExchange.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/AbstractExchange.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/AbstractExchange.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/AbstractExchange.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/DownloadExchange.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/DownloadExchange.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/DownloadExchange.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/DownloadExchange.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/Exchange.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/Exchange.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/Exchange.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/Exchange.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ExchangeTarget.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ExchangeTarget.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ExchangeTarget.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ExchangeTarget.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/FeatureExchange.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/FeatureExchange.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/FeatureExchange.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/FeatureExchange.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ModifyExchangeServer.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ModifyExchangeServer.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ModifyExchangeServer.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ModifyExchangeServer.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/UploadExchange.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/UploadExchange.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/UploadExchange.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/UploadExchange.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/VersionHandshakeServer.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/VersionHandshakeServer.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/VersionHandshakeServer.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/VersionHandshakeServer.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/replay/DigestOutputStream.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/DigestOutputStream.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/replay/DigestOutputStream.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/DigestOutputStream.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/replay/RecordMetaData.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/RecordMetaData.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/replay/RecordMetaData.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/RecordMetaData.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/replay/Recorder.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/Recorder.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/replay/Recorder.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/Recorder.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/replay/RecorderOption.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/RecorderOption.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/replay/RecorderOption.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/RecorderOption.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/replay/ReplayFile.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/ReplayFile.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/replay/ReplayFile.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/ReplayFile.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/replay/ReplayMarker.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/ReplayMarker.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/replay/ReplayMarker.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/ReplayMarker.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/replay/ServerPhotographer.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/ServerPhotographer.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/replay/ServerPhotographer.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/ServerPhotographer.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/replay/ServerPhotographerGameMode.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/ServerPhotographerGameMode.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/replay/ServerPhotographerGameMode.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/replay/ServerPhotographerGameMode.java diff --git a/leaf-server/src/main/java/org/leavesmc/leaves/util/UUIDSerializer.java b/leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/util/UUIDSerializer.java similarity index 100% rename from leaf-server/src/main/java/org/leavesmc/leaves/util/UUIDSerializer.java rename to leaf-archived-patches/unapplied/src/main/java/org/leavesmc/leaves/util/UUIDSerializer.java diff --git a/leaf-server/src/main/java/org/purpurmc/purpur/command/AFKCommand.java b/leaf-archived-patches/unapplied/src/main/java/org/purpurmc/purpur/command/AFKCommand.java similarity index 100% rename from leaf-server/src/main/java/org/purpurmc/purpur/command/AFKCommand.java rename to leaf-archived-patches/unapplied/src/main/java/org/purpurmc/purpur/command/AFKCommand.java diff --git a/leaf-server/src/main/java/org/stupidcraft/linearpaper/region/EnumRegionFileExtension.java b/leaf-archived-patches/unapplied/src/main/java/org/stupidcraft/linearpaper/region/EnumRegionFileExtension.java similarity index 100% rename from leaf-server/src/main/java/org/stupidcraft/linearpaper/region/EnumRegionFileExtension.java rename to leaf-archived-patches/unapplied/src/main/java/org/stupidcraft/linearpaper/region/EnumRegionFileExtension.java diff --git a/leaf-server/src/main/java/org/stupidcraft/linearpaper/region/IRegionFile.java b/leaf-archived-patches/unapplied/src/main/java/org/stupidcraft/linearpaper/region/IRegionFile.java similarity index 100% rename from leaf-server/src/main/java/org/stupidcraft/linearpaper/region/IRegionFile.java rename to leaf-archived-patches/unapplied/src/main/java/org/stupidcraft/linearpaper/region/IRegionFile.java diff --git a/leaf-server/src/main/java/org/stupidcraft/linearpaper/region/IRegionFileFactory.java b/leaf-archived-patches/unapplied/src/main/java/org/stupidcraft/linearpaper/region/IRegionFileFactory.java similarity index 100% rename from leaf-server/src/main/java/org/stupidcraft/linearpaper/region/IRegionFileFactory.java rename to leaf-archived-patches/unapplied/src/main/java/org/stupidcraft/linearpaper/region/IRegionFileFactory.java diff --git a/leaf-server/src/main/java/org/stupidcraft/linearpaper/region/LinearRegionFile.java b/leaf-archived-patches/unapplied/src/main/java/org/stupidcraft/linearpaper/region/LinearRegionFile.java similarity index 100% rename from leaf-server/src/main/java/org/stupidcraft/linearpaper/region/LinearRegionFile.java rename to leaf-archived-patches/unapplied/src/main/java/org/stupidcraft/linearpaper/region/LinearRegionFile.java diff --git a/leaf-server/src/main/java/su/plo/matter/Globals.java b/leaf-archived-patches/unapplied/src/main/java/su/plo/matter/Globals.java similarity index 100% rename from leaf-server/src/main/java/su/plo/matter/Globals.java rename to leaf-archived-patches/unapplied/src/main/java/su/plo/matter/Globals.java diff --git a/leaf-server/src/main/java/su/plo/matter/Hashing.java b/leaf-archived-patches/unapplied/src/main/java/su/plo/matter/Hashing.java similarity index 100% rename from leaf-server/src/main/java/su/plo/matter/Hashing.java rename to leaf-archived-patches/unapplied/src/main/java/su/plo/matter/Hashing.java diff --git a/leaf-server/src/main/java/su/plo/matter/WorldgenCryptoRandom.java b/leaf-archived-patches/unapplied/src/main/java/su/plo/matter/WorldgenCryptoRandom.java similarity index 100% rename from leaf-server/src/main/java/su/plo/matter/WorldgenCryptoRandom.java rename to leaf-archived-patches/unapplied/src/main/java/su/plo/matter/WorldgenCryptoRandom.java diff --git a/leaf-server/src/main/java/org/galemc/gale/command/GaleCommand.java b/leaf-server/src/main/java/org/galemc/gale/command/GaleCommand.java deleted file mode 100644 index c2000206..00000000 --- a/leaf-server/src/main/java/org/galemc/gale/command/GaleCommand.java +++ /dev/null @@ -1,179 +0,0 @@ -// Gale - Gale commands - /gale command - -package org.galemc.gale.command; - -import io.papermc.paper.command.CommandUtil; -import it.unimi.dsi.fastutil.Pair; -import net.minecraft.Util; -import org.galemc.gale.command.subcommands.InfoCommand; -import org.galemc.gale.command.subcommands.ReloadCommand; -import org.galemc.gale.command.subcommands.VersionCommand; -import org.jetbrains.annotations.Nullable; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionDefault; -import org.bukkit.plugin.PluginManager; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -import static net.kyori.adventure.text.Component.newline; -import static net.kyori.adventure.text.Component.text; -import static net.kyori.adventure.text.format.NamedTextColor.GRAY; -import static net.kyori.adventure.text.format.NamedTextColor.RED; - -public final class GaleCommand extends Command { - public static final String COMMAND_LABEL = "gale"; - public static final String BASE_PERM = GaleCommands.COMMAND_BASE_PERM + "." + COMMAND_LABEL; - private static final Permission basePermission = new Permission(BASE_PERM, PermissionDefault.TRUE); - // subcommand label -> subcommand - private static final GaleSubcommand RELOAD_SUBCOMMAND = new ReloadCommand(); - private static final GaleSubcommand VERSION_SUBCOMMAND = new VersionCommand(); - private static final GaleSubcommand INFO_SUBCOMMAND = new InfoCommand(); - private static final Map SUBCOMMANDS = Util.make(() -> { - final Map, GaleSubcommand> commands = new HashMap<>(); - - commands.put(Set.of(ReloadCommand.LITERAL_ARGUMENT), RELOAD_SUBCOMMAND); - commands.put(Set.of(VersionCommand.LITERAL_ARGUMENT), VERSION_SUBCOMMAND); - commands.put(Set.of(InfoCommand.LITERAL_ARGUMENT), INFO_SUBCOMMAND); - - return commands.entrySet().stream() - .flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue()))) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - }); - // alias -> subcommand label - private static final Map ALIASES = Util.make(() -> { - final Map> aliases = new HashMap<>(); - - aliases.put(VersionCommand.LITERAL_ARGUMENT, Set.of("ver")); - aliases.put(InfoCommand.LITERAL_ARGUMENT, Set.of("about")); - - return aliases.entrySet().stream() - .flatMap(entry -> entry.getValue().stream().map(s -> Map.entry(s, entry.getKey()))) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - }); - - private String createUsageMessage(Collection arguments) { - return "/" + COMMAND_LABEL + " [" + String.join(" | ", arguments) + "]"; - } - - public GaleCommand() { - super(COMMAND_LABEL); - this.description = "Gale related commands"; - this.usageMessage = this.createUsageMessage(SUBCOMMANDS.keySet()); - final List permissions = SUBCOMMANDS.values().stream().map(GaleSubcommand::getPermission).filter(Objects::nonNull).toList(); - this.setPermission(BASE_PERM); - final PluginManager pluginManager = Bukkit.getServer().getPluginManager(); - pluginManager.addPermission(basePermission); - for (final Permission permission : permissions) { - pluginManager.addPermission(permission); - } - } - - @Override - public List tabComplete( - final CommandSender sender, - final String alias, - final String[] args, - final @Nullable Location location - ) throws IllegalArgumentException { - if (args.length <= 1) { - List subCommandArguments = new ArrayList<>(SUBCOMMANDS.size()); - for (Map.Entry subCommandEntry : SUBCOMMANDS.entrySet()) { - if (subCommandEntry.getValue().testPermission(sender)) { - subCommandArguments.add(subCommandEntry.getKey()); - } - } - return CommandUtil.getListMatchingLast(sender, args, subCommandArguments); - } - - final @Nullable Pair subCommand = resolveCommand(args[0]); - if (subCommand != null && subCommand.second().testPermission(sender)) { - return subCommand.second().tabComplete(sender, subCommand.first(), Arrays.copyOfRange(args, 1, args.length)); - } - - return Collections.emptyList(); - } - - private boolean testHasOnePermission(CommandSender sender) { - for (Map.Entry subCommandEntry : SUBCOMMANDS.entrySet()) { - if (subCommandEntry.getValue().testPermission(sender)) { - return true; - } - } - return false; - } - - @Override - public boolean execute( - final CommandSender sender, - final String commandLabel, - final String[] args - ) { - - // Check if the sender has the base permission and at least one specific permission - if (!sender.hasPermission(basePermission) || !this.testHasOnePermission(sender)) { - sender.sendMessage(Bukkit.permissionMessage()); - return true; - } - - // Determine the usage message with the subcommands they can perform - List subCommandArguments = new ArrayList<>(SUBCOMMANDS.size()); - for (Map.Entry subCommandEntry : SUBCOMMANDS.entrySet()) { - if (subCommandEntry.getValue().testPermission(sender)) { - subCommandArguments.add(subCommandEntry.getKey()); - } - } - String specificUsageMessage = this.createUsageMessage(subCommandArguments); - - // If they did not give a subcommand - if (args.length == 0) { - INFO_SUBCOMMAND.execute(sender, InfoCommand.LITERAL_ARGUMENT, me.titaniumtown.ArrayConstants.emptyStringArray); // Gale - JettPack - reduce array allocations - sender.sendMessage(newline().append(text("Command usage: " + specificUsageMessage, GRAY))); - return false; - } - - // If they do not have permission for the subcommand they gave, or the argument is not a valid subcommand - final @Nullable Pair subCommand = resolveCommand(args[0]); - if (subCommand == null || !subCommand.second().testPermission(sender)) { - sender.sendMessage(text("Usage: " + specificUsageMessage, RED)); - return false; - } - - // Execute the subcommand - final String[] choppedArgs = Arrays.copyOfRange(args, 1, args.length); - return subCommand.second().execute(sender, subCommand.first(), choppedArgs); - - } - - private static @Nullable Pair resolveCommand(String label) { - label = label.toLowerCase(Locale.ENGLISH); - @Nullable GaleSubcommand subCommand = SUBCOMMANDS.get(label); - if (subCommand == null) { - final @Nullable String command = ALIASES.get(label); - if (command != null) { - label = command; - subCommand = SUBCOMMANDS.get(command); - } - } - - if (subCommand != null) { - return Pair.of(label, subCommand); - } - - return null; - } - -} diff --git a/leaf-server/src/main/java/org/galemc/gale/command/GaleCommands.java b/leaf-server/src/main/java/org/galemc/gale/command/GaleCommands.java deleted file mode 100644 index fbbc6f6a..00000000 --- a/leaf-server/src/main/java/org/galemc/gale/command/GaleCommands.java +++ /dev/null @@ -1,33 +0,0 @@ -// Gale - Gale commands - -package org.galemc.gale.command; - -import net.minecraft.server.MinecraftServer; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.bukkit.command.Command; -import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions; - -import java.util.HashMap; -import java.util.Map; - -@DefaultQualifier(NonNull.class) -public final class GaleCommands { - - public static final String COMMAND_BASE_PERM = CraftDefaultPermissions.GALE_ROOT + ".command"; - - private GaleCommands() { - } - - private static final Map COMMANDS = new HashMap<>(); - - static { - COMMANDS.put(GaleCommand.COMMAND_LABEL, new GaleCommand()); - } - - public static void registerCommands(final MinecraftServer server) { - COMMANDS.forEach((s, command) -> - server.server.getCommandMap().register(s, "Gale", command) - ); - } -} diff --git a/leaf-server/src/main/java/org/galemc/gale/command/GaleSubcommand.java b/leaf-server/src/main/java/org/galemc/gale/command/GaleSubcommand.java deleted file mode 100644 index d2b32a4d..00000000 --- a/leaf-server/src/main/java/org/galemc/gale/command/GaleSubcommand.java +++ /dev/null @@ -1,27 +0,0 @@ -// Gale - Gale commands - -package org.galemc.gale.command; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.jetbrains.annotations.Nullable; -import org.bukkit.command.CommandSender; -import org.bukkit.permissions.Permission; - -import java.util.Collections; -import java.util.List; - -@DefaultQualifier(NonNull.class) -public interface GaleSubcommand { - - boolean execute(CommandSender sender, String subCommand, String[] args); - - default List tabComplete(final CommandSender sender, final String subCommand, final String[] args) { - return Collections.emptyList(); - } - - boolean testPermission(CommandSender sender); - - @Nullable Permission getPermission(); - -} diff --git a/leaf-server/src/main/java/org/galemc/gale/command/PermissionedGaleSubcommand.java b/leaf-server/src/main/java/org/galemc/gale/command/PermissionedGaleSubcommand.java deleted file mode 100644 index 40d84d0d..00000000 --- a/leaf-server/src/main/java/org/galemc/gale/command/PermissionedGaleSubcommand.java +++ /dev/null @@ -1,32 +0,0 @@ -// Gale - Gale commands - -package org.galemc.gale.command; - -import org.jetbrains.annotations.Nullable; -import org.bukkit.command.CommandSender; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionDefault; - -public abstract class PermissionedGaleSubcommand implements GaleSubcommand { - - public final Permission permission; - - protected PermissionedGaleSubcommand(Permission permission) { - this.permission = permission; - } - - protected PermissionedGaleSubcommand(String permission, PermissionDefault permissionDefault) { - this(new Permission(permission, permissionDefault)); - } - - @Override - public boolean testPermission(CommandSender sender) { - return sender.hasPermission(this.permission); - } - - @Override - public @Nullable Permission getPermission() { - return this.permission; - } - -} diff --git a/leaf-server/src/main/java/org/galemc/gale/command/subcommands/InfoCommand.java b/leaf-server/src/main/java/org/galemc/gale/command/subcommands/InfoCommand.java deleted file mode 100644 index 268ab2d6..00000000 --- a/leaf-server/src/main/java/org/galemc/gale/command/subcommands/InfoCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -// Gale - Gale commands - /gale info command - -package org.galemc.gale.command.subcommands; - -import net.kyori.adventure.text.event.ClickEvent; -import net.kyori.adventure.text.format.TextDecoration; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.galemc.gale.command.GaleSubcommand; -import org.jetbrains.annotations.Nullable; -import org.bukkit.command.CommandSender; -import org.bukkit.permissions.Permission; - -import static net.kyori.adventure.text.Component.text; - -@DefaultQualifier(NonNull.class) -public final class InfoCommand implements GaleSubcommand { - - public final static String LITERAL_ARGUMENT = "info"; - - @Override - public boolean execute(final CommandSender sender, final String subCommand, final String[] args) { - sender.sendMessage( - text("Gale is a performant Minecraft server system. Find us on: ") - .append(text("https://github.com/GaleMC/Gale") - .decorate(TextDecoration.UNDERLINED) - .clickEvent(ClickEvent.openUrl("https://github.com/GaleMC/Gale"))) - ); - return true; - } - - @Override - public boolean testPermission(CommandSender sender) { - return true; - } - - @Override - public @Nullable Permission getPermission() { - return null; - } - -} diff --git a/leaf-server/src/main/java/org/galemc/gale/command/subcommands/ReloadCommand.java b/leaf-server/src/main/java/org/galemc/gale/command/subcommands/ReloadCommand.java deleted file mode 100644 index 94f39d5b..00000000 --- a/leaf-server/src/main/java/org/galemc/gale/command/subcommands/ReloadCommand.java +++ /dev/null @@ -1,46 +0,0 @@ -// Gale - Gale commands - /gale reload command - -package org.galemc.gale.command.subcommands; - -import net.minecraft.server.MinecraftServer; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.galemc.gale.command.GaleCommand; -import org.galemc.gale.command.PermissionedGaleSubcommand; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.permissions.PermissionDefault; - -import static net.kyori.adventure.text.Component.text; -import static net.kyori.adventure.text.format.NamedTextColor.GREEN; -import static net.kyori.adventure.text.format.NamedTextColor.RED; - -@DefaultQualifier(NonNull.class) -public final class ReloadCommand extends PermissionedGaleSubcommand { - - public final static String LITERAL_ARGUMENT = "reload"; - public static final String PERM = GaleCommand.BASE_PERM + "." + LITERAL_ARGUMENT; - - public ReloadCommand() { - super(PERM, PermissionDefault.OP); - } - - @Override - public boolean execute(final CommandSender sender, final String subCommand, final String[] args) { - this.doReload(sender); - return true; - } - - private void doReload(final CommandSender sender) { - Command.broadcastCommandMessage(sender, text("Please note that this command is not supported and may cause issues.", RED)); - Command.broadcastCommandMessage(sender, text("If you encounter any issues please use the /stop command to restart your server.", RED)); - - MinecraftServer server = ((CraftServer) sender.getServer()).getServer(); - server.galeConfigurations.reloadConfigs(server); - server.server.reloadCount++; - - Command.broadcastCommandMessage(sender, text("Gale config reload complete.", GREEN)); - } - -} diff --git a/leaf-server/src/main/java/org/galemc/gale/command/subcommands/VersionCommand.java b/leaf-server/src/main/java/org/galemc/gale/command/subcommands/VersionCommand.java deleted file mode 100644 index 38c49703..00000000 --- a/leaf-server/src/main/java/org/galemc/gale/command/subcommands/VersionCommand.java +++ /dev/null @@ -1,39 +0,0 @@ -// Gale - Gale commands - /gale version command - -package org.galemc.gale.command.subcommands; - -import net.minecraft.server.MinecraftServer; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.galemc.gale.command.GaleCommand; -import org.galemc.gale.command.PermissionedGaleSubcommand; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.permissions.PermissionDefault; - -@DefaultQualifier(NonNull.class) -public final class VersionCommand extends PermissionedGaleSubcommand { - - public final static String LITERAL_ARGUMENT = "version"; - public static final String PERM = GaleCommand.BASE_PERM + "." + LITERAL_ARGUMENT; - - public VersionCommand() { - super(PERM, PermissionDefault.TRUE); - } - - @Override - public boolean execute(final CommandSender sender, final String subCommand, final String[] args) { - final @Nullable Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version"); - if (ver != null) { - ver.execute(sender, GaleCommand.COMMAND_LABEL, me.titaniumtown.ArrayConstants.emptyStringArray); // Gale - JettPack - reduce array allocations - } - return true; - } - - @Override - public boolean testPermission(CommandSender sender) { - return super.testPermission(sender) && sender.hasPermission("bukkit.command.version"); - } - -} diff --git a/todos.md b/todos.md index 22e3b6eb..f6fb9eda 100644 --- a/todos.md +++ b/todos.md @@ -11,3 +11,4 @@ - [ ] Add server full join config explanation to docs - [ ] Add purpur config changes to docs moved config - [ ] check Dont send useless entity packets +- [ ] Use different state to separate config reload