Skip to content

Commit

Permalink
Fix NG wackiness and transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Jun 17, 2024
1 parent bebb25c commit be49b12
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ org.gradle.daemon=false
groovybundler_version=2.1.5

fml_version=4.0.8

# Ah, NG, my old nemesis...
neogradle.subsystems.conventions.sourcesets.enabled=false
1 change: 0 additions & 1 deletion src/test/groovy/testmod/TestMod.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package testmod

import net.neoforged.fml.common.EventBusSubscriber
import org.groovymc.gml.BaseGMod
import org.groovymc.gml.GMod
import groovy.transform.CompileStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class GEventBusSubscriberTransformer extends AbstractASTTransformation {
private static final ClassNode SUBSCRIBE_EVENT = ClassHelper.make(SubscribeEvent)
private static final ClassNode MOD_BUS_EVENT = ClassHelper.make('net.neoforged.fml.event.IModBusEvent')
private static final ClassNode NEOFORGE = ClassHelper.make('net.neoforged.neoforge.common.NeoForge')
private static final ClassNode GML_MOD_LOADING_CONTEXT = ClassHelper.make('org.groovymc.gml.GMLModLoadingContext')
private static final ClassNode MOD_LOADING_CONTEXT = ClassHelper.make('net.neoforged.fml.ModLoadingContext')
private static final String GML_REGISTRATION_METHOD_NAME = 'gml$registerListeners'

private static BlockStatement buildRegistration(ClassNode node) {
Expand All @@ -53,7 +53,7 @@ class GEventBusSubscriberTransformer extends AbstractASTTransformation {
return GeneralUtils.ifElseS(
GeneralUtils.callX(GeneralUtils.classX(MOD_BUS_EVENT), 'isAssignableFrom', GeneralUtils.args(paramTypeExpression)),
GeneralUtils.stmt(GeneralUtils.callX(
GeneralUtils.callX(GeneralUtils.callX(new ClassExpression(GML_MOD_LOADING_CONTEXT), 'get'), 'getModEventBus'),
GeneralUtils.callX(GeneralUtils.callX(GeneralUtils.callX(new ClassExpression(MOD_LOADING_CONTEXT), 'get'), 'getActiveContainer'), 'getEventBus'),
'addListener',
GeneralUtils.args(paramTypeExpression, methodReference)
)),
Expand Down

0 comments on commit be49b12

Please sign in to comment.