lichenaut / DatapackLoader

Automatically add datapacks to your Minecraft server.
GNU General Public License v2.0
6 stars 0 forks source link

Applying datapacks to multiple world folders #5

Closed nhasdarjian closed 7 months ago

nhasdarjian commented 11 months ago

DatapackLoader is very effective at modifying and maintaining datapacks for level.dat in /world.

On my server, I use the MyWorlds plugin to manage custom dimensions. As far as I have seen, DatapackLoader only looks at /world on server startup.

As a result, the datapacks applied on a given custom world are equivalent to the datapacks enabled on the default world at the time the custom world was created.

To propagate datapack changes to custom worlds, I propose a simple solution:

Add a list of directories containing level.dat files in the generated config.yml. This could look like:

world-directories:
  - world
  - world_creative
  - world_vanilla_skyblock

Users can define custom worlds to let the plugin manage, and the plugin will treat the level.dat files in each folder the same way that it does level.dat in /world and keep it consistent with sourceList.txt.

If you wanted to expand on this, you could add extra options for granular control. This could look like a worlds.yml file with the contents:

world:
    sync-all: true
    exceptions:
        - creative-datapack
        - vanilla-skyblock-datapack
world_creative:
    sync-all: true
    exceptions:
        - vanilla-skyblock-datapack
world_vanilla_skyblock:
    sync-all: false
    exceptions:
        - vanilla-skyblock-datapack

When sync-all is true, then DatapackLoader will sync that world's level.dat with the contents of sourceList.txt, excluding any datapack files listed in exceptions.

When sync-all is false, then DatapackLoader will only sync that world's level.dat with the files listed in exceptions.

Thanks for your time in reviewing my suggestion.

lichenaut commented 9 months ago

May I ask why propagating datapack changes to custom worlds is useful? When developing datapacks, I assume you have developer mode turned on, which wipes the server of its worlds every server start-up. In other words, why use custom worlds when updating datapacks?

nhasdarjian commented 9 months ago

My intention was not actually datapack development, sorry I wasn't clear. I don't have developer mode enabled.

I intend to run multiple worlds on my server, with different datapacks enabled on each one.

Since DatapackLoader keeps its own folder of datapacks to apply to world/level.dat, I was hoping to apply a subset of datapacks to custom_world_a/level.dat, custom_world_b/level.dat, etc. with some level of customizability.

I want to preserve those worlds between server starts, as they are persistent with player builds.

nhasdarjian commented 9 months ago

Clarification, what I meant by "datapack changes" was "changes to the contents of DatapackLoader/datapacks".

lichenaut commented 8 months ago

I played around with different worlds having different datapacks, both with manual creation and creation via MyWorlds, and it confirmed my suspicion that the server only recognizes datapacks inside the automatically-generated 'datapacks' folder in the main world folder. Unless you know of a way to make per-world datapacks possible, I recommend connecting multiple servers (ex. Waterfall) to simulate the experience of different worlds having different datapacks.