Skip to content

Add Java Core Mods#79

Merged
shartte merged 8 commits intoneoforged:mainfrom
shartte:jcm
Jun 2, 2024
Merged

Add Java Core Mods#79
shartte merged 8 commits intoneoforged:mainfrom
shartte:jcm

Conversation

@shartte
Copy link
Copy Markdown
Contributor

@shartte shartte commented Jan 21, 2024

Mods must ship a separate Jar-file (for example via jar-in-jar) and mark it as FMLModType: LIBRARY to make it load above the GAME layer. They then must provide an implementation of ICoreMod via the Java ServiceLoader to contribute their transformers.

This tries to avoid loading the script-engine based coremod library unless any modfile contains such coremod scripts.

@Technici4n
Copy link
Copy Markdown
Member

We do not have generics for ITransformer yet. :P

@shartte
Copy link
Copy Markdown
Contributor Author

shartte commented Jan 22, 2024

@Technici4n You will notice that it did compile (yes, yes, license violation...) with FML head, so I think we do ;-)

@Technici4n
Copy link
Copy Markdown
Member

Ah, yes we do. Didn't read why the build was failing. 😁

Good idea in any case. We can change the interface later but for now this is good enough. I also expect noticeable startup time improvements once we move the NF coremods to this.

@sciwhiz12 sciwhiz12 added the enhancement New feature or request label Feb 11, 2024
@neoforged-pr-publishing
Copy link
Copy Markdown

neoforged-pr-publishing bot commented Apr 5, 2024

  • Publish PR to GitHub Packages

Last commit published: 02c2e73818ad66a22dc348a98201c0259e749451.

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name 'Maven for PR #79' // https://github.com/neoforged/FancyModLoader/pull/79
        url 'https://prmaven.neoforged.net/FancyModLoader/pr79'
        content {
            includeModule('net.neoforged.fancymodloader', 'junit-fml')
            includeModule('net.neoforged.fancymodloader', 'loader')
            includeModule('net.neoforged.fancymodloader', 'earlydisplay')
        }
    }
}

@neoforged-compatibility-checks
Copy link
Copy Markdown

neoforged-compatibility-checks bot commented Apr 27, 2024

@shartte, this PR introduces breaking changes.
Fortunately, this project is currently accepting breaking changes, but if they are not intentional, please revert them.
Last checked commit: 02c2e73818ad66a22dc348a98201c0259e749451.

loader (:loader)

  • net/neoforged/fml/loading/ModSorter
    • sort(Ljava/util/List;Ljava/util/List;)Lnet/neoforged/fml/loading/LoadingModList;: ❗ API method was removed
  • net/neoforged/fml/loading/moddiscovery/CoreModFile
    • ❗ Class was made final
    • ❗ Class missing interface: net/neoforged/coremod/ICoreModScriptSource
    • getDebugSource()Ljava/lang/String;: ❗ API method was removed
    • getOwnerId()Ljava/lang/String;: ❗ API method was removed
    • toString()Ljava/lang/String;: ❗ Method was made final
    • getAdditionalFile(Ljava/lang/String;)Ljava/io/Reader;: ❗ API method was removed
    • readCoreMod()Ljava/io/Reader;: ❗ API method was removed
  • net/neoforged/fml/loading/LoadingModList
    • of(Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/Map;)Lnet/neoforged/fml/loading/LoadingModList;: ❗ API method was removed
    • addCoreMods()V: ❗ API method was removed

Mods must ship a separate Jar-file (for example via jar-in-jar) and mark it as FMLModType: LIBRARY to make it load above the GAME layer. They then must provide an implementation of ICoreMod via the Java ServiceLoader to contribute their transformers.
@shartte shartte requested a review from Matyrobbrt May 30, 2024 23:00
@shartte shartte requested a review from Matyrobbrt June 2, 2024 09:53
@shartte shartte merged commit 69b5811 into neoforged:main Jun 2, 2024
@shartte shartte deleted the jcm branch June 2, 2024 09:58
Technici4n pushed a commit that referenced this pull request Jun 23, 2025
…`FileSystemProvider#newDirectoryStream` (#79)

Fixes #78; use of `Files.walk` should now produce `Path`s that are as if
resolved from the root path. This required a change to `JarContentsImpl`
as it relied on the old (incorrect!) behavior where `walk` returned
explicitly relative paths no matter what, as well as some changes to
certain tests where similar assumptions were made.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants