Skip to content

Support for source enum extension#62

Draft
lukebemish wants to merge 3 commits intoneoforged:mainfrom
lukebemish:enum-extension
Draft

Support for source enum extension#62
lukebemish wants to merge 3 commits intoneoforged:mainfrom
lukebemish:enum-extension

Conversation

@lukebemish
Copy link
Contributor

@lukebemish lukebemish commented Feb 15, 2026

In light of the recent discussion on discord -- this seems like a useful thing to have in-source support for, right?

Like interface injection, JST has to generate stubs occasionally here -- for the EnumProxy fields or parameter providing methods that enum extensions can use.

This PR is marked as a draft for now. It is blocked by:

  • Matching MDG PR
  • Matching NG PR
  • Matching FML work
  • Implementing IndexedEnum and company support
  • Handle ambiguity with multiple ctors and make sure to pick the right one when grabbing indices for getParameter

In particular -- FML needs to handle cases where enum entries to be injected exist already gracefully, including handling ordering so that "dev env with source-injected plus runtime-injected-from-a-dependency enum entries" and "prod server being tested against" get the same enum ordering.

This system validates that the targeted class extends a provided interface (presumably, you'd pass it IExtensibleEnum for neoforge-mode, and nothing for "vanilla" mode).

One question I have -- I currently hard-code the EnumProxy class used in stubs. Should this be un-hard-coded as an argument or the like?

@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

@lukebemish
Copy link
Contributor Author

Whoops, just realized I think there's some indexed-enum stuff or the like this needs to support, I'll add that to the TODO list too

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.

1 participant