Skip to content

Commit

Permalink
Rebuild delegated transformers
Browse files Browse the repository at this point in the history
- Brought to attention in LegacyModdingMC/UniMix#4
  • Loading branch information
Rongmario committed Oct 31, 2023
1 parent 192f173 commit b9095bc
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.transformer.IMixinTransformer;
import org.spongepowered.asm.mixin.transformer.Proxy;
import org.spongepowered.asm.service.MixinService;
import org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper;
import zone.rong.mixinbooter.*;
import zone.rong.mixinbooter.decorator.FMLContextQuery;
import zone.rong.mixinbooter.fix.MixinFixer;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
Expand Down Expand Up @@ -82,6 +85,11 @@ private void beforeConstructing(LoaderState state, Object[] eventData, CallbackI
Mixins.addConfiguration(mixinConfig);
}

// Rebuild delegated transformers
Field delegatedTransformersField = MixinServiceLaunchWrapper.class.getDeclaredField("delegatedTransformers");
delegatedTransformersField.setAccessible(true);
delegatedTransformersField.set(MixinService.getService(), null);

IMixinProcessor processor = ((IMixinTransformer) Proxy.transformer).getProcessor();
Method selectMethod = processor.getClass().getDeclaredMethod("select", MixinEnvironment.class);
selectMethod.setAccessible(true);
Expand Down

0 comments on commit b9095bc

Please sign in to comment.