Just Enough Items (JEI)

Just Enough Items (JEI)

387M Downloads

[Other]: Re-introducing Configured support

MrCrayfish opened this issue ยท 9 comments

commented

Other

Hello, I've added support back to Configured to allow players to edit the client configuration of JEI. I've not published this update yet since I am hoping you can make a few additions to the config system just to make it easier to access.

The most important change would be to have an instance of JEIClientConfigs that can be accessed. As it stands, it's currently a local value and the only way I was able to grab an instance was through a Mixin in the constructor. I personally try to avoid using Mixins where possible and especially using them in another developers mod since it's just not good practice. I've only done it for testing the config screen.

From browsing code I'd need getters that waterfall down from:
JustEnoughItems
JustEnoughItemsClient
ClientLifecycleHandler
JeiStarter
StartData
ConfigData (would need JEIClientConfigs added to the record)

Other changes but not as important, is a bunch of getters to access values in your config system. I am using reflection at the moment to access them. You can find all reflection I've used a link, this should give you can idea what needs to be changed.
https://github.com/MrCrayfish/Configured/blob/1.19.X/src/main/java/com/mrcrayfish/configured/impl/jei/JeiReflection.java

Hopefully the changes can be propagated down to 1.18 too

commented

I've managed to pretty much support 100% of your new config system. Here is how it looks in game

image
image

Even deserializing and serializing custom list types, like ColorName

image

Also thank you for adding valid value description, worked well in my mod.
image

commented

Wow, ok nice!

Can you offer an API that I can call into in order to give you this information, instead of requiring reflection from your side?
I am likely to make changes to the configs and I would like to be able to ensure it works with Configured from my side.

commented

I could add method you could invoke with reflection (assuming you don't want to depend on the mod in your workspace), which you could pass the JEIClientConfigs instance. I don't mind keeping the reflection that I am currently using to access what I need, however that does depend on your code not changing.

If you're going to make changes and want to ensure it continues to work with Configured, you will need to use the full API. This is the implementation of the API for your mod.
https://github.com/MrCrayfish/Configured/tree/1.19.X/src/main/java/com/mrcrayfish/configured/impl/jei

Another thing is Configured is on Fabric too.

commented

Just popping back in to see if you're still considering this?

commented

I think the best place for this code to live is in JEI, with an optional dependency on Configured's API.
If the code is in Configured, it'll break when I change the configs. Reflection is much more fragile than an optional API dependency.

commented

Feel free to take my implementation as a start for your mod. If you have any questions, let me know. You can contact me here or I am on Discord if you need quicker help, I am pretty active on my server.

commented

Thanks!

commented

I think this has been completed by MrCrayfish/Configured#83

commented

Hope this also gets ported to 1.18.x? Last Configured update on that version was 2023 hence that wasn't ported (yet?). Just thought I ask. Or has anything changed since JEI 10.2.1.1005 (to 1007) that makes it unnecessary for 1.18.2?