MidnightLib

MidnightLib

22M Downloads

Add Map support

QuImUfu opened this issue ยท 3 comments

commented

I'd love to be able to use maps, e.g. Map<String, Enum> as config options.

commented

It is already possible to edit the json files for this kind of option, but I'm not sure how I could implement it in the UI and if it would really be used that much.
If you have any idea how to get this across visually, please lmk.
Also, I'd appreciate an example of a use case for String-Enum maps in the config.

commented

I'd use String-Enum maps for mapping Blocks to Portal colours in my Colourful Portals mod. In that mod there is a Portal group for each block that is a portal frame block. When portals form, their plane has a colour depending on the frame block.
The config should enable the user to add arbitrary portal frame blocks and set the colour of the planes they get.
My current workaround is a List for each colour, but that enables a user to select multiple portal colours for one block, which is not supported and results in a conflict if set that way. Additionally, its kinda confusing, because the colour is a purely visual, additional setting.

In the same mod, I'd use a String-Int map to allow the user to assign dimension ID's a weight for them being selected when searching for a random destination. I have not found a suitable workaround for that use case.

I think the easiest, useable way to display a Map, is a List with an additional selection field, that prevents duplicates in the first one. Even a Map of Lists could be displayed that way. Other, maybe better options seem to be a lot of work. (e.g. expanding list + suboption(s)...)
Mock-up:
example_map

commented

I think the easiest, useable way to display a Map, is a List with an additional selection field, that prevents duplicates in the first one. Even a Map of Lists could be displayed that way. Other, maybe better options seem to be a lot of work. (e.g. expanding list + suboption(s)...)

I had to implement a way to edit a String-Integer map for my mod and I found that using a separate screen was the best way to do it as it made it easier to see the existing entries, especially when there were a lot of them

image