Convert Coremods from JS to Java#785
Conversation
Last commit published: b41b9de4c07b88b3a0cb19c80787f71bf60d2803. PR PublishingThe artifacts published by this PR:
Repository DeclarationIn order to use the artifacts published by the PR, add the following repository to your buildscript: repositories {
maven {
name 'Maven for PR #785' // https://github.com/neoforged/NeoForge/pull/785
url 'https://prmaven.neoforged.net/NeoForge/pr785'
content {
includeModule('net.neoforged', 'testframework')
includeModule('net.neoforged', 'neoforge')
}
}
}MDK installationIn order to setup a MDK using the latest PR version, run the following commands in a terminal. mkdir NeoForge-pr785
cd NeoForge-pr785
curl -L https://prmaven.neoforged.net/NeoForge/pr785/net/neoforged/neoforge/21.1.60-pr-785-coremods/mdk-pr785.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zipTo test a production environment, you can download the installer from here. |
2fa70ee to
d889f90
Compare
f8145d3 to
13fd7d5
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Matyrobbrt
left a comment
There was a problem hiding this comment.
Currently, the field_to_instanceof transformer isn't used. If we decide to keep it, we should yeet its JSON file and make it similar to ReplaceFieldWithGetterAccess (i.e. having them declared in NeoForgeCoreMod)
coremods/src/main/java/net/neoforged/neoforge/coremods/package-info.java
Show resolved
Hide resolved
coremods/src/main/java/net/neoforged/neoforge/coremods/ReplaceFieldWithGetterAccess.java
Show resolved
Hide resolved
coremods/src/main/java/net/neoforged/neoforge/coremods/ReplaceFieldWithGetterAccess.java
Show resolved
Hide resolved
coremods/src/main/java/net/neoforged/neoforge/coremods/MethodRedirector.java
Show resolved
Hide resolved
Matyrobbrt
left a comment
There was a problem hiding this comment.
Just as a note for future™, we should start generating the finalize spawn targets file.
|
🚀 This PR has been released as NeoForge version |
Based on neoforged/FancyModLoader#79
This removes the need to load the JS engine if only NF is present, by removing our JS coremods and replacing them with Transformer based Java Coremods instead.
This also bumps JCC since it chokes on the subproject being present on the classpath as folders of classes, rather than jar files.
Coremods:
finalizeSpawnall around the codebase to our hook class, which emits the corresponding event.stack.getItem() == Items.XYZbystack.getItem() instanceof XYZallowing mod subclassed items to work with Vanilla logic.this.fieldfor private fields with use of the corresponding getter, allowing mods that subclass to change what the superclass uses.