How does one use the new access transformer code blocks exactly?

Started by Van on

Topic category: Advanced modding

Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How does one use the new access transformer code blocks exactly?
Mon, 03/10/2025 - 21:04 (edited)

Following Access Transformers | NeoForged docs, I've added the appropiate line in build.gradle file. After that, the mod does not compile, instead throws error:

Could not find method minecraft() for arguments [build_cjhjesdagg1t7yfhjeqvgi6rv$_run_closure1@130f8a4f] on root project 'access' of type org.gradle.api.Project.

I've instead added it in neoforge part, like so (following some mods repos)

neoForge { 
    version = "21.4.101-beta" 
    accessTransformers {
        file('src/main/resources/META-INF/accesstransformer.cfg')
    } (.. rest of build.gradle)

which doesn't throw compile error anymore, but it still gets wiped. If the code blocks were added in AT file, how can I use said AT file myself? Do I have to make a plugin specifically for that?

Edited by Van on Mon, 03/10/2025 - 21:04