Skip to content

[26.3] Allow all contacts specified as per the fabric.mod.json spec to appear in the links section of a mod's entry - #1120

Draft
Jab125 wants to merge 1 commit into
TerraformersMC:26.3from
Jab125:fabric-mod-json-contacts
Draft

Jab125 wants to merge 1 commit into
TerraformersMC:26.3from
Jab125:fabric-mod-json-contacts

Conversation

@Jab125

@Jab125 Jab125 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@gniftygnome gniftygnome left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems pretty good, really (less ugly than I suspected). If we do end up using the extra map, it should go up top with the other class constants.


private static Map<String, String> getLinksForDisplay(Map<String, String> modMenuLinks, Map<String, String> fabricApiLinks) {
LinkedHashMap<String, String> links = new LinkedHashMap<>();
fabricApiLinks.entrySet().stream().filter(entry -> !entry.getKey().equals("homepage") && !entry.getKey().equals("issues") && !entry.getKey().equals("sources") /* TODO before merging, should sources have its special case removed? */)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm understanding correctly, we should continue to support the existing API (i.e. not rename any modmenu or custom JSON field names). But if this is just a matter of renaming the translation key from modmenu.source to modmenu.sources without any user impact, then I'm fine with that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left the modmenu.source special case as currently Mod Menu always orders it first and I'm not sure what to do with it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I have not figured out yet what to do if we don't already have a translation key for a contact, so that's something else that needs to be figured out

fabricApiLinks.entrySet().stream().filter(entry -> !entry.getKey().equals("homepage") && !entry.getKey().equals("issues") && !entry.getKey().equals("sources") /* TODO before merging, should sources have its special case removed? */)
.forEach(entry ->
links.put(/*IDS_TO_TRANSLATION_KEYS.getOrDefault(entry.getKey(), */"modmenu." + entry.getKey()/*)*/, entry.getValue()));
modMenuLinks.entrySet().stream().filter(entry -> !links.containsKey(entry.getKey()))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to figure out how I feel about this. I guess the official FMJ versions should take precedence, but will folks be frustrated by us retroactively changing it in older versions? I kind of feel like the 26.3 and earlier versions should prefer the custom value over the FMJ value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check before marking as ready how many mods use any contacts other than sources, homepage, and issues

links.putAll(getLinksForDisplay(CustomValueUtil.getStringMap("links", modMenuObject).orElse(new HashMap<>()), metadata.getContact().asMap()));
allowsUpdateChecks = CustomValueUtil.getBoolean("update_checker", modMenuObject).orElse(true);
} else {
links.putAll(getLinksForDisplay(Map.of(), metadata.getContact().asMap()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to try to consolidate these and maybe get rid of the else but it's a weak preference. It might be worth using local variables for both of the input maps just to make the code clearer.

@Jab125

Jab125 commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

I'll move it there later if it's still needed

@Jab125

Jab125 commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

I intend to backport this as far back as possible too, maybe possibly to 1.16 or 1.14.4 if it's not too difficult

@gniftygnome

gniftygnome commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Building for 1.14 requires some acrobatics. I've done it before but didn't intend to again. :P
Has to be published by hand too, or tinker with the test and publish actions maybe a lot.

@Jab125

Jab125 commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

There still needs to figured out whether or not the it should be like discord or modmenu.discord to namespace it, if Mod Menu picks one then it basically becomes the standard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants