Mirsario / Minecraft-CameraOverhaul

A Minecraft mod that makes gameplay more satisfying through the use of various camera tilting.
MIT License
37 stars 20 forks source link

Implement a ModMenu configuration screen #4

Closed Mirsario closed 3 years ago

Mirsario commented 3 years ago

I have attempted this, and found it to be rather painful. I couldn't find any good documentation.

altrisi commented 3 years ago

ModMenu config screens aren't any kind of extensive API to allow for editing config files or values. In ModMenu, the implementation you make of their interface should just open an existing screen. Therefore, you need to provide it with an actual Screen that allows to modify your config values, and shows any other related information.

The common way this is tackled is by using some config API, such as cloth-config or cotton-config. Those provide a config screen ready for you to plug into ModMenu.

Since I've seen you try to keep this as less loader dependant as possible, cloth-config has a Forge version for the same API, which may be desired. You can find their docs here. If you want to make the config creation as simple as possible, in those docs you can go directly to the auto-config section, which saves and loads the values by itself (although it's a bit more bulky, and since you already have a load method, it may not be necessary).

The problem is of course that by adding those you basically need to include or require extra libraries in your mod (the config things apis would be included, then FAPI would be required, etc), but I think making a custom config screen is a bit outside of the scope of this mod.

altrisi commented 3 years ago

If you want I can try to implement one in a PR using cloth-config.

Mirsario commented 3 years ago

Would it possible to embed both cloth-config and fabric-api into this mod? I believe I heard that it's possible somewhere.

altrisi commented 3 years ago

Cloth-config is intended to be embedded when being used. FAPI can also be embedded, although that is thought to be used only in case you don't need many modules (not sure how many does cloth-config use, it doesn't declare it directly). Should be possible.

~Not sure what is the current Gradle name for it, since the old ones I knew I think are now deprecated.~

altrisi commented 3 years ago

Wait actually cloth-config has it in their docs, it's still include.

Therefore, something like:

    include "net.fabricmc.fabric-api:fabric-resource-loader-v0:${project.fabric_resource_loader_v0_version}"

would include the resource-loader module of FAPI into the final JAR (as JiJ / Jar-in-Jar).

Mirsario commented 3 years ago

Then it sounds fine to use that.

If you want I can try to implement one in a PR using cloth-config. I would definitely appreciate that!

altrisi commented 3 years ago

Since I'm not 100% sure of what each config field means, I'll make the PR with empty texts.

You'll need to add a proper name and tooltip for each.