-
-
Notifications
You must be signed in to change notification settings - Fork 448
Description
The following code has no IDE support currently:
minecraft {
mappings channel: 'official', version: '1.21.8'
runs {
server {
mainClass = 'net.minecraft.server.Main'
args 'nogui'
}
}
}
After investigating further, I've determined that it's due to a visibility issue - IntelliJ is picking up the internal implementations which are not publicly accessible:

A workaround is to manually cast to the correct type and wrap in a tap, like so:
minecraft { ((MinecraftExtension.ForProject) it).tap {
mappings channel: 'official', version: '1.21.8'
runs {
server {
mainClass = 'net.minecraft.server.Main'
args 'nogui'
}
}
}}
As for the yellow highlight for the runs block, that's because IntelliJ is a dumbass and thinks Closure<Void> means you expect users to explicitly return null - likely a bug in their Groovy support. I remember advising you to add the return type and forgot about this edge-case, my bad. The fix is to replace Closure<Void> with Closure<?> or have a raw Closure when you don't care about the return type (such as void).
Interestingly, the fg extension does have IDE support. Possibly a difference between how the fg and minecraft extensions are registered?