64 lines
4.1 KiB
Diff
64 lines
4.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
|
Date: Wed, 2 Jul 2025 23:36:25 +0800
|
|
Subject: [PATCH] Add back read-only datapack command & Fix datapack command
|
|
save function
|
|
|
|
|
|
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
|
index 9b1dcfadd6d5ae868b087a18983d03e8bb86b56a..21f2b9866e1cf36421e10a945fb6fbaa251009ed 100644
|
|
--- a/net/minecraft/commands/Commands.java
|
|
+++ b/net/minecraft/commands/Commands.java
|
|
@@ -205,7 +205,7 @@ public class Commands {
|
|
if(me.earthme.luminol.config.modules.experiment.CommandConfig.data) { // Luminol - Config for data command
|
|
DataCommands.register(this.dispatcher); // Folia - region threading - TODO // Luminol - Config for data command
|
|
} // Luminol - Config for data command
|
|
- //DataPackCommand.register(this.dispatcher, context); // Folia - region threading - TODO
|
|
+ DataPackCommand.register(this.dispatcher, context); // Folia - region threading - TODO // Luminol - Add back read-only datapack command
|
|
//DebugCommand.register(this.dispatcher); // Folia - region threading - TODO
|
|
DefaultGameModeCommands.register(this.dispatcher);
|
|
//DialogCommand.register(this.dispatcher, context); // Folia - region threading - TODO
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index d4e31bb829451a687bf567fd0357f46fd7d46902..4f292468194baae343eeb077362e51dcfb6c0df1 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -2415,6 +2415,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
return this.reloadResources(packsToEnable, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN);
|
|
}
|
|
|
|
+ // Lophine start - region thread skip reload // TODO - add reload support
|
|
+ public void saveDatapacks(Collection<String> selectedPacks) {
|
|
+ this.packRepository.setSelected(selectedPacks, false); // Paper - add pendingReload flag to determine required pack loading - false as this is *after* a reload (see above)
|
|
+ WorldDataConfiguration worldDataConfiguration = new WorldDataConfiguration(
|
|
+ getSelectedPacks(this.packRepository, true), this.worldData.enabledFeatures()
|
|
+ );
|
|
+ this.worldData.setDataConfiguration(worldDataConfiguration);
|
|
+ }
|
|
+ // Lophine end - region thread skip reload // TODO - add reload support
|
|
+
|
|
public CompletableFuture<Void> reloadResources(
|
|
final Collection<String> packsToEnable, final io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause
|
|
) {
|
|
diff --git a/net/minecraft/server/commands/ReloadCommand.java b/net/minecraft/server/commands/ReloadCommand.java
|
|
index 80fef4277b9e986c17a4cb895e130726bdb63229..4bed8d0432508cbe5c0d1fc7d68052ec2af7260f 100644
|
|
--- a/net/minecraft/server/commands/ReloadCommand.java
|
|
+++ b/net/minecraft/server/commands/ReloadCommand.java
|
|
@@ -16,11 +16,17 @@ public class ReloadCommand {
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
|
|
public static void reloadPacks(final Collection<String> selectedPacks, final CommandSourceStack source) {
|
|
+ // Lophine start - region thread skip reload // TODO - add reload support
|
|
+ source.getServer().saveDatapacks(selectedPacks);
|
|
+ source.getSender().sendMessage("You need to restart server to load datapacks update.");
|
|
+ if (false) {
|
|
source.getServer().reloadResources(selectedPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally(throwable -> { // Paper - Add ServerResourcesReloadedEvent
|
|
LOGGER.warn("Failed to execute reload", throwable);
|
|
source.sendFailure(Component.translatable("commands.reload.failure"));
|
|
return null;
|
|
});
|
|
+ }
|
|
+ // Lophine end - region thread skip reload // TODO - add reload support
|
|
}
|
|
|
|
private static Collection<String> discoverNewPacks(final PackRepository packRepository, final WorldData worldData, final Collection<String> currentPacks) {
|