MrCrayfish / Framework

A library mod providing tools for developing multi-loader Minecraft mods
GNU Lesser General Public License v2.1
36 stars 3 forks source link

Mixin crash in dev environment #27

Closed Entropy159 closed 1 month ago

Entropy159 commented 1 month ago

I've opened an issue on the CGM page, but it seems to stem from this mod (and that issue has been inactive for over a year), so I'll try it here. I am trying to make an addon for CGM, but when I try and test it in IntelliJ (and previously Eclipse) I get a crash:

[08Oct2024 12:11:47.344] [pool-3-thread-1/FATAL] [mixin/]: Mixin apply failed cgm.mixins.json:common.LivingEntityMixin -> net.minecraft.world.entity.LivingEntity: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException Critical injection failure: @Inject annotation on capture could not find any targets matching 'Lnet/minecraft/world/entity/LivingEntity;m_6469_(Lnet/minecraft/world/damagesource/DamageSource;F)Z' in net.minecraft.world.entity.LivingEntity. Using refmap cgm.refmap.json [PREINJECT Applicator Phase -> cgm.mixins.json:common.LivingEntityMixin -> Prepare Injections ->  -> handler$zzb000$capture(Lnet/minecraft/world/damagesource/DamageSource;FLorg/spongepowered/asm/mixin/injection/callback/CallbackInfoReturnable;)V -> Parse]
org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: Critical injection failure: @Inject annotation on capture could not find any targets matching 'Lnet/minecraft/world/entity/LivingEntity;m_6469_(Lnet/minecraft/world/damagesource/DamageSource;F)Z' in net.minecraft.world.entity.LivingEntity. Using refmap cgm.refmap.json [PREINJECT Applicator Phase -> cgm.mixins.json:common.LivingEntityMixin -> Prepare Injections ->  -> handler$zzb000$capture(Lnet/minecraft/world/damagesource/DamageSource;FLorg/spongepowered/asm/mixin/injection/callback/CallbackInfoReturnable;)V -> Parse]

It seems to me that the mixins are not deobfuscated in the dev environment. Is there a way to fix this?

MrCrayfish commented 1 month ago

In each of your runs in your build.gradle, add the below code and then regen your runs.

property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"