SpongePowered / Mixin

Mixin is a trait/mixin and bytecode weaving framework for Java using ASM
MIT License
1.41k stars 194 forks source link

Apply mixins to non- obfuscated methods in obfuscated targets, #626

Closed AutomaticalEchoes closed 1 year ago

AutomaticalEchoes commented 1 year ago

Target method is added by forge,it doesn‘t work ,what should i do. it will crash if remap = true base to the doc , and exactly it happened

> @Inject(method = "getCapability",at = {@At("HEAD")},remap = false)
>     public  void getCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @Nullable Direction facing , CallbackInfoReturnable<net.minecraftforge.common.util.LazyOptional<?>> callbackInfoReturnable){
>         if (this.isAlive() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
>             if (facing == null){
>                 callbackInfoReturnable.setReturnValue(playerJoinedHandler.cast());
>             } else if (facing.getAxis().isVertical()) {
>                 callbackInfoReturnable.setReturnValue(playerMainHandler.cast());
>             } else if (facing.getAxis().isHorizontal()){
>                 callbackInfoReturnable.setReturnValue(playerEquipmentHandler.cast());
>             }
>         }
>         callbackInfoReturnable.setReturnValue(super.getCapability(capability, facing)) ;
>     }
Mumfrey commented 1 year ago

This issue tracker is for bugs and feature requests for mixin. For support questions please use the discord channel as mentioned in the README.