neoforged / NeoForge

Neo Modding API for Minecraft, based on Forge
https://projects.neoforged.net/neoforged/neoforge
Other
1.1k stars 161 forks source link

Allow modders to opt in to have their config be loaded early #723

Closed TelepathicGrunt closed 2 months ago

TelepathicGrunt commented 5 months ago

Long story short, there's use cases beyond the frowned-upon conditional registration that modders need to have early configs for.

Myself, I had use cases where I was using EntityAttributeModificationEvent to modify another mod's entity's health and attack damage. And I wanted those values to be configurable. But I needed to load the config early to actually make it work.

Another use case I had was I had an entity that uses vanilla's model but with my own renderer that extends the vanilla renderer. So that my entity would inherit any modification that other mods do to the vanilla entity model such as adding hat models for bees or whatnot. This breaks with model changing resourcepacks that change the entire model. So I am using a config to allow users to have my entity use it's own hard copy/paste model/renderer but to register the model/renderer (specifically the model mesh), I need the config loaded early.

This si what I am currently doing. Not great and ugly if many mods does it. image

A built in way to specify that a mod's config should be loaded early as an opt-in thing would be ideal. For people that know what they are doing. Neoforge currently throws in dev when accessing config too early. But if a modder is determined, this throw won't stop them from forcing the config to load or rolling out their own config.

KnightMiner commented 5 months ago

I managed to make an early loading config back in 1.16.5 with minimal effort for the sake of configuring registry subs. It was just enough effort that people won't do it without having a good reason but its not so much effort its impossible. Not sure Forge needs something fancier

TelepathicGrunt commented 5 months ago

Another dev found a cleaner way to load configs earlier. Don’t use my workaround as that’s ugly.

image (Be sure to add .sync to the builder for synchronous writes)

MehVahdJukaar commented 2 months ago

This would be very nice to have as an opt in. I've seen many instances of people trying to do this and causing all other mod configs to load early causing all sorts of issues

Matyrobbrt commented 2 months ago

Closed in 39aa9f216cada1e477960669ec36833aebd94902.