Cotton

Cotton

148k Downloads

Allow a global datapack to be enabled by default

Martmists-GH opened this issue ยท 10 comments

commented

Is your feature request related to a problem? Please describe.
For my modpack, I need to load a custom structure for a mod to work (specifically, ProtoSky). This structure has been added to a custom global datapack through cotton, but is disabled by default, meaning worldgen can't see it.

Describe the solution you'd like
Add a config option or pack.mcmeta key that can be used to mark a datapack as loaded by default, or even forcibly loaded.

commented

Looks like this was fixed in c6006d0, any idea when this will be on CF?

commented

The global datapack function is not work. Must use /reload to reload datapacks
cotton 1.0.6
I do not know why the datapack function not load. The datapack is not disabled.

commented

still not with 1.0.6?

commented

Cotton v1.0.6
Global datapack is different than vanilla datapack. The global datapack can load,but function is not work, I must use /reload command to load function from global datapack.

commented

Oh god, this is gonna be a nightmare for me to fix, isn't it. I'll try and look at this when I have time.

commented

I can confirm this as a developer for 1.16. My mod needs to dynamically create datapacks during game load, and I was using the global folder. My best guess is the new changes to how datapacks work in 1.16 caused this issue. Maybe a mixin to ResourcePackManager, similar to how fabric-resource-loader works? It might also be worthwhile changing the mixin to inject at the head or at a different method, because currently, in the non-safe-mode case, resourcePackManager.setEnabledProfiles, which you're using for the injection target, is called right before the return, after the datapack set has been assembled, so until the datapacks are reloaded the changes your mixin makes aren't applied.

commented

Yep, I switched your Inject to use target = "Lnet/minecraft/resource/ResourcePackManager;scanPacks()V" and it seems to work great. I'm not sure what other weird effects this might have, but I didn't notice any obvious crashes or anything.

commented

No problem! Hope it doesn't have any weird side effects.

commented

Ooh, thank you so much! I'll take a look at making this change soon.

commented

if this doesn't do it I might have to look into adding a fabric api hook for it ๐Ÿ™ƒ