Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intellij Run configurations don't include resourceProcessing #1010

Closed
nightpool opened this issue Dec 20, 2023 · 7 comments
Closed

Intellij Run configurations don't include resourceProcessing #1010

nightpool opened this issue Dec 20, 2023 · 7 comments

Comments

@nightpool
Copy link

Hi all! A bit confused about where to begin with this report, but I'm trying to use the "Minecraft Client" run configurations generated by loom, but they fail because my fabric.mod.json file requires some template processing from Gradle before it can be used:

image

which gives me an error:

 net.fabricmc.loader.impl.FormattedException: Some of your mods are incompatible with the game or each other!
A potential solution has been determined, this may resolve your problem:
     - Replace mod 'Foo' (foo) ${version} with any version that is compatible with:
         - fabricloader 0.15.2
         - minecraft 1.20.2
More details:
     - Mod 'Foo' (foo) ${version} requires version ${loader_version} of mod 'Fabric Loader' (fabricloader), but only the wrong version is present: 0.15.2!
     - Mod 'Foo' (foo) ${version} requires version ${minecraft_version} of 'Minecraft' (minecraft), but only the wrong version is present: 1.20.2!

the gradle :runClient tasks work fine, but that seems to make it harder to debug & slower to compile. Plus, I don't think it works with hot reloading?

This seems like a bug in that the "Minecraft Client" should have a Before Build task to pre-process the resources and put them in the right place (wherever that may be).

Presumably this would also break for anybody with generated data?

@Technici4n
Copy link
Member

On Fabric, people generally don't use variable expansion in their resources like that. If you don't then you can even set "Build with" to IDEA instead of Gradle for hopefully faster compile times.

@nightpool
Copy link
Author

@Technici4n The official fabric gradle template uses it: https://github.com/FabricMC/fabric-example-mod/blob/1.20/build.gradle#L52

@nightpool
Copy link
Author

nightpool commented Dec 21, 2023

And the default MinecraftDev IDEA plugin templates extend this to fill in the loader_version and minecraft_version: https://github.com/minecraft-dev/MinecraftDev/blob/dev/src/main/resources/fileTemplates/j2ee/fabric/fabric_build.gradle.ft#L41-L42

So I don't think it's correct to say this isn't commonly done. A quick github search shows that 15k mods have this property defined:

image

For example, this snippet from Create:

https://github.com/Fabricators-of-Create/Create/blob/49cc17e/build.gradle#L188-L213

image

@modmuss50
Copy link
Member

This is an intelij limitation, sadly nothing we can do to fix it (loom has nothing to do with processResources anyway).

I would reccomend not using the MC dev template, the official template (https://fabricmc.net/develop/template/) does not do this, and works great when building+running via idea.

@modmuss50 modmuss50 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2024
@nightpool
Copy link
Author

nightpool commented Jan 7, 2024

@modmuss50 there's no way to run a single short gradle script to process the resources during the intellij Before Launch phase? That doesn't seem correct to me, Intellij definitely provides the tools to do so

The official template you provided still has the same conceptual issue, in that it uses the ${version} build variable which is not interpolated when launched through the IDE. Fabric just happens not to crash when a mod's version is malformed, by pure luck. (this would almost certainly break if you were testing with a mod that depended on the mod you're currently developing)

The fact that all fabric developers are prevented from using build variables in their fabric.mod.json file if they want resource reloading is a major issue and I think as a project we could do a better job leveraging the capabilities of the IDE to solve this

@modmuss50
Copy link
Member

modmuss50 commented Jan 7, 2024

@modmuss50 there's no way to run a single short gradle script to process the resources during the intellij Before Launch phase? That doesn't seem correct to me, Intellij definitely provides the tools to do so

Not really no, as doing so would then remove the main benefit (the major peformance improvement) of building without gradle.

Fabric just happens not to crash

This was done on purpose, loom does provide the tools to read the mod version from the fabric.mod.json and set it as the Gradle version, maybe we should do that in the example mod and remove process resources 🤔

@nightpool
Copy link
Author

nightpool commented Jan 7, 2024 via email

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

No branches or pull requests

3 participants