Open Loader

Open Loader

21M Downloads

[SUGGESTION] Add a way to *enable* but not *force-enable* packs

dhouck opened this issue · 5 comments

commented

Minecraft Version

1.20.2

Mod Loader

Quilt

Feedback

Sometimes I want a pack to be available but not required. This is more common with resource packs, where I might want a pack enabled by default but not required, but there are some cases where I might want to disable normally-enabled datapacks too.

There should be three different options for a pack: required, optional but default to enabled, and optional but default to disabled.

commented

You do not need the mod to do this. If you truely want to do manually then do this.

Download the data pack. It should be a .zip file or directory.
Open your server folder, then open the folder of the world you wish to install the data pack in (default: world).
Put the data pack into a folder named datapacks.
Type /reload from the console or as a level 3 operator if the server was running during the installation.
If the data pack has a correct format, it would be enabled on the server. You can verify by typing /datapack list enabled from the console or as a level 3 operator and find an entry named [file/your data pack file/directory name].

commented

@CharZinta Yes, of course you can move the files around manually. The point of OpenLoader is to do this automatically, especially for modpacks which can not distribute automatically enabled packs or users who want to install packs globally across multiple worlds like they do with mods.

commented

@dhouck Apologies for not replying to your feedback sooner. We had features similar to these on older versions, however they were defined in the pack.mcmeta file. This caused several issues as this file can't always be modified by the user. Mojang also changed how the pack.mcmeta file is read, requiring us to know these options before the file is read leading to a circular dependency in the logic. I've spent the last few hours looking into how this could be re-implement and I think I've come up with a decent solution. I've already released this for 1.20.4 and will backport it to 1.20.2 soon. The 1.20.4 update is version 22.0.3.

Packs can now be configured using a packmeta file that is located in the same directory as the pack itself. For example if you have openloader/data/My-Pack.zip you would define a openloader/data/My-Pack.zip.packmeta file. This also works for folder packs. If you have openloader/data/my_pack you would define a openloader/data/my_pack.packmeta file.

The packmeta file is a JSON file with the following properties.

Property Type Default Description
enabled boolean true Disabling a pack will cause OpenLoader to completely ignore it. This option is primarily for debugging and should only be used if you know you need it.
required boolean true Required packs are automatically enabled. Setting this to false will make the pack optional, requiring the player to apply the pack themselves.
position string top Defines how the pack should be applied. "top" will apply it to the top of the list, overriding all previously loaded entries. "bottom" will apply it to the end of the list, allowing everything else to override it. Keep in mind that pack order is only established the first time a pack is loaded. This means any mods or packs installed after your pack has already been applied will be above your pack. This can be changed by renaming your pack after the update or manually changing the load order in game.
pack_name Text null Defines a custom display name in the pack list. If this is not set the default name will be used.
description Text null Defines a custom description in the pack list. While there is no hard limit to the length of a description the GUI only displays roughly 60 characters across two lines. If this is not set the default description will be used.
description_includes_source boolean true By default all packs loaded by OpenLoader will have the name of the mod at the end of the description. When set to false this will not be included.

And here is a json file with all of the default values.

{
    "enabled": true,
    "required": true,
    "position": "top",
    "pack_name": null,
    "description": null,
    "description_includes_source": true
}
commented

I canʼt test right now, will look into it later today, but it looks like this has “required” control both whether it can be removed and whether it starts enabled. Is there a way to make something optional but default enabled?

commented

Half of that seems to be the true in https://github.com/Darkhax-Minecraft/Open-Loader/blob/c2a5eacf48bca5f37ef9ce4e58aae1b2491c6a21/common/src/main/java/net/darkhax/openloader/packs/OpenLoaderRepositorySource.java#L79C89-L79C93. My Java build tools are borked at the moment so I canʼt try variants; I donʼt know if setting that to false will make the pack default disabled or default enabled, but it should be possible to change either way.

Whichever way it defaults I donʼt know how Iʼd make it default the other way, but even just force enabled/not force enabled would be useful.