neoforged / MDK

The Mod Developer Kit - this is where you start if you want to develop a new mod
https://github.com/NeoForgeMDKs
183 stars 60 forks source link

Would it be possible to get an example for mixin implimentation in build.gradle? #75

Closed sebastianbhahn closed 4 weeks ago

sebastianbhahn commented 4 weeks ago

The implementation method which works in old forge (which I found here: https://darkhax.net/2020/07/mixins) doesn't seem to be compatible with neoforge. I get this error: Could not get unknown property 'reobf' for root project 'MDK-1.20.2' of type org.gradle.api.Project

If it's something which would be obvious to a java programmer, I'm not one, sorry. If this is something I need to read 1000 pages of java or spongepowered or gradle docs to know how to implement, see above. I also couldn't find any examples of a working way to use mixins with neoforge anywhere online after extensive searching. If it does exist somewhere, it's not searchable with "new and improved" google search.

Leclowndu93150 commented 4 weeks ago

Read the Comments in the Build.gradle Or ask chatgpt Or see how other mods do it Or ask in the discord

IMS212 commented 4 weeks ago

NeoForge 1.20.4+ officially supports Mixin, and the Mixins only need to be specified in neoforge.mods.toml. There is a commented section in that file explaining what to do. build.gradle does not need to be changed.

Also, you should never ask ChatGPT for advice on this. A human will always be better.

sebastianbhahn commented 4 weeks ago

NeoForge 1.20.4+ officially supports Mixin, and the Mixins only need to be specified in neoforge.mods.toml. There is a commented section in that file explaining what to do. build.gradle does not need to be changed.

Also, you should never ask ChatGPT for advice on this. A human will always be better.

oh, cool. I was trying to do 1.20.2 and was banging my head against the wall for hours and finally gave up. Guess I'll skip it. Thanks.

Leclowndu93150 commented 4 weeks ago

NeoForge 1.20.4+ officially supports Mixin, and the Mixins only need to be specified in neoforge.mods.toml. There is a commented section in that file explaining what to do. build.gradle does not need to be changed.

Also, you should never ask ChatGPT for advice on this. A human will always be better.

ChatGPT does mixins pretty well if you give it the target class decompiled..

AterAnimAvis commented 4 weeks ago

For reference in 1.20.2 you should be using NeoGradle's Mixin plugin, In your build.gradle: Add id 'net.neoforged.gradle.mixin' version <neo-gradle-version> to your plugins block Then define your configs via:

mixin {
    config 'examplemod.mixins.json'
}

Full example available at https://github.com/neoforged/NeoGradle/blob/NG_7.0/examples/mixin/build.gradle


ChatGPT should not be used for anything Minecraft Modding related, with the rate of update/change that happens/has happened it doesn't really have a chance.

sebastianbhahn commented 4 weeks ago

@AterAnimAvis I tried it and that works, thank you.