@@ -26,10 +26,11 @@ public String getRefMapperConfig() {
2626 private static final String MIXIN_PACKAGE = "com.gregtechceu.gtceu.core.mixins." ;
2727 private static final Map <String , String > MOD_COMPAT_MIXINS = new HashMap <>();
2828
29- private static final String DEV_PACKAGE = MIXIN_PACKAGE + "dev." ;
29+ private static final String DEV_PACKAGE = "dev." ;
30+ private static final String DATAGEN_PACKAGE = "datagen." ;
3031
3132 static {
32- MOD_COMPAT_MIXINS .put ("roughlyenoughitems" , MIXIN_PACKAGE + "rei" );
33+ MOD_COMPAT_MIXINS .put ("roughlyenoughitems" , "rei. " );
3334 addModCompatMixin ("emi" );
3435 addModCompatMixin ("jei" );
3536 addModCompatMixin ("top" );
@@ -40,8 +41,24 @@ public String getRefMapperConfig() {
4041
4142 @ Override
4243 public boolean shouldApplyMixin (String targetClassName , String mixinClassName ) {
44+ if (!mixinClassName .startsWith (MIXIN_PACKAGE )) {
45+ // skip checking mixins that aren't in our package
46+ // this should never happen, but better safe than sorry
47+ return true ;
48+ }
49+ mixinClassName = mixinClassName .substring (MIXIN_PACKAGE .length ());
50+
4351 if (mixinClassName .startsWith (DEV_PACKAGE )) {
44- return !FMLLoader .isProduction ();
52+ if (FMLLoader .isProduction ()) {
53+ // don't load dev-only mixins in prod
54+ return false ;
55+ }
56+ mixinClassName = mixinClassName .substring (DEV_PACKAGE .length ());
57+ if (mixinClassName .startsWith (DATAGEN_PACKAGE )) {
58+ // only load datagen mixins in datagen
59+ return FMLLoader .getLaunchHandler ().isData ();
60+ }
61+ return true ;
4562 }
4663 for (var compatMod : MOD_COMPAT_MIXINS .entrySet ()) {
4764 if (mixinClassName .startsWith (compatMod .getValue ())) {
@@ -66,7 +83,7 @@ public void preApply(String targetClassName, ClassNode targetClass, String mixin
6683 public void postApply (String targetClassName , ClassNode targetClass , String mixinClassName , IMixinInfo mixinInfo ) {}
6784
6885 private static void addModCompatMixin (String modId ) {
69- MOD_COMPAT_MIXINS .put (modId , MIXIN_PACKAGE + modId );
86+ MOD_COMPAT_MIXINS .put (modId , modId + "." );
7087 }
7188
7289 private static boolean isModLoaded (String modId ) {
0 commit comments