9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0002-Gale-configuration.patch
Dreeam 5ddabb083e Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@88a3a870 Configurable xp orb merge group count (#12503)
PaperMC/Paper@53d1d04e Disable Item Obfuscation for entity related stacks (#12297)
PaperMC/Paper@c98cd658 Add configuration interface to expose certain config values (#12273)
PaperMC/Paper@42a2a6c2 Supports the ability for commands to be registered internally (#12520)
PaperMC/Paper@753cff7c Improvements for Dump paper commands (#12512)
PaperMC/Paper@e2da5d2f Registry API for supported Mob Variants (#12417)
PaperMC/Paper@ab0253fe Expand PlayerDeathEvent API (#12221)
PaperMC/Paper@cbcf75a5 Update visual fire handling with TriState support (#12303)
PaperMC/Paper@6c3964d2 Properly save level data async (#12530)
PaperMC/Paper@d2ad2e66 Add missing EntityLookup#getAllMapped from Moonrise
PaperMC/Paper@358e72ec Remove simplify remote item matching stuff for now
PaperMC/Paper@04ffca0b Also remove CraftPlayer methods
PaperMC/Paper@a2525819 Update mache
PaperMC/Paper@d683970d Add FishHookStateChangeEvent (#12165)
PaperMC/Paper@369ad170 Cached tag parser for itemstack reading (#12547)
PaperMC/Paper@841d6342 Fix ItemStack#addUnsafeEnchantment ignored for missing enchantment component (#12549)
PaperMC/Paper@c000b352 fix(bukkit-brig-forwarding-map): Invert isEmpty method (#12555)
PaperMC/Paper@28d7df75 Backport HeroesOfTheVillage datafixer fix
PaperMC/Paper@f1dbed07 Implement BlocksAttack DamageReduction and ItemDamage (#12538)
PaperMC/Paper@cc38032b Deprecate TeleportCause CHORUS_FRUIT for CONSUMABLE_EFFECT (#12546)
PaperMC/Paper@35878677 [ci/skip] Fix format and mentions for ItemDamageFunction (#12560)
PaperMC/Paper@7171d299 [ci/skip] Mention CAN_PLACE/CAN_BREAK component in ItemMeta (#12559)
PaperMC/Paper@6f73e62e Add getPickItemStack (#12552)
PaperMC/Paper@ce0fa4c4 Replace old version command with brigadier equivalent (#12502)
PaperMC/Paper@fa360aa8 Add some missing annotations and an incorrect one (#12204)
PaperMC/Paper@113b18ee Update paperweight and Gradle wrapper (#12573)
PaperMC/Paper@f303a076 fix: Don't hardcode checks for translation registries (#12571)
PaperMC/Paper@87349c31 Fix CombatTracker stale on death (#12562)
PaperMC/Paper@b70bca6b Revert "fix: Don't hardcode checks for translation registries (#12571)"

Purpur Changes:
PurpurMC/Purpur@93011bc1 Add configuration setting to re-add End void rings (#1656)
PurpurMC/Purpur@c2f48591 [ci/skip] only set default world config values once
PurpurMC/Purpur@6f5bbae5 [ci/skip] move some code around
PurpurMC/Purpur@5c1a9835 fix issue with `shift-right-click-repairs-mending-points`
PurpurMC/Purpur@3156e446 check damage value of tool correctly
PurpurMC/Purpur@a9fe4f25 Updated Upstream (Paper)
PurpurMC/Purpur@9d0aa8eb Updated Upstream (Paper)
PurpurMC/Purpur@603c7557 Updated Upstream (Paper)
PurpurMC/Purpur@eca78060 Updated Upstream (Paper)
PurpurMC/Purpur@e4e9cfdf Updated Upstream (Paper)
PurpurMC/Purpur@3de2fc7d Updated Upstream (Paper)
PurpurMC/Purpur@09f547de add `mob-griefing-override` config options (#1661)
PurpurMC/Purpur@1dd9bd0c Updated Upstream (Paper)
PurpurMC/Purpur@7a8aa86a finish updating gradle
PurpurMC/Purpur@fd78b90f bandaid fix: increase the daemon heap for now
2025-05-24 22:06:41 +08:00

142 lines
11 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
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 <jake.m.potrebic@gmail.com>
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 f1373fd5fdebb9f4600ba7f32a5df6188de3a0e9..96d34149b1009b1522335784bc1858f61bb59cd1 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -299,6 +299,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public volatile boolean abnormalExit; // Paper - Improved watchdog support
public volatile Thread shutdownThread; // Paper - Improved watchdog support
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
+ public final org.galemc.gale.configuration.GaleConfigurations galeConfigurations; // Gale - Gale configuration
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
@@ -469,6 +470,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
+ this.galeConfigurations = services.galeConfigurations(); // Gale - Gale configuration
}
private void readScoreboard(DimensionDataStorage dataStorage) {
diff --git a/net/minecraft/server/Services.java b/net/minecraft/server/Services.java
index 015e3ff8d856a7722def4448d8c68792cc3a32a2..e7c3d84d64cc62989c01019b71c499ae39ea3a41 100644
--- a/net/minecraft/server/Services.java
+++ b/net/minecraft/server/Services.java
@@ -11,13 +11,13 @@ import net.minecraft.server.players.GameProfileCache;
import net.minecraft.util.SignatureValidator;
public record Services(
- MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations // Paper - add paper configuration files
+ MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations, @javax.annotation.Nullable org.galemc.gale.configuration.GaleConfigurations galeConfigurations // Paper - add paper configuration files // Gale - Gale configuration
) {
public static final String USERID_CACHE_FILE = "usercache.json";
// 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 31e02f50edd46220dac81500dbb273f1ccdbe0b9..aa44476e7d732a51d226533ccf6fb55013faf003 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -171,6 +171,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 bfbfbaa9660d21071c420b60b10be0a02a1bc87e..f66aca0b506390ca5c2f95aacb9495417de325e7 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -580,7 +580,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.getOrCreate(levelStorageAccess.levelDirectory.path().toFile());
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 418d3958b7510d469142178f9427c829b6387d83..4c31b039eb697ba84598dd1fdded707a2f155ce5 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -159,6 +159,12 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
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 static @Nullable BlockPos lastPhysicsProblem; // Spigot
private int tileTickPosition;
@@ -827,6 +833,8 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
org.bukkit.World.Environment environment, // Paper
java.util.function.Function<org.spigotmc.SpigotWorldConfig, // Spigot - create per world config
io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, // Paper - create paper world config
+ java.util.function.Function<org.spigotmc.SpigotWorldConfig, // Gale - Gale configuration
+ org.galemc.gale.configuration.GaleWorldConfiguration> galeWorldConfigCreator, // Gale - Gale configuration
java.util.concurrent.Executor executor // Paper - Anti-Xray
) {
// Paper start - getblock optimisations - cache world height/sections
@@ -840,6 +848,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
// 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 = generator;
this.world = new CraftWorld((ServerLevel) this, generator, biomeProvider, environment);