Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Invokers with the same name and different signatures are not supported #522

Open
PanSzelescik opened this issue Sep 4, 2021 · 1 comment

Comments

@PanSzelescik
Copy link

PanSzelescik commented Sep 4, 2021

I have Minecraft class with 2 methods:

private boolean removeBlock(BlockPos p_180235_1_) {
    return this.removeBlock(p_180235_1_, false);
}

private boolean removeBlock(BlockPos p_removeBlock_1_, boolean p_removeBlock_2_) {
    /* ... */
}

The first one is remapped, the second one not, so if you create Invokers:

@Mixin(PlayerInteractionManager.class)
public interface InvokerRemoveBlock {
    
    @Invoker("removeBlock")
    boolean invoke_removeBlock(BlockPos pos);
    @Invoker(value = "removeBlock", remap = false)
    boolean invoke_removeBlock(BlockPos pos, boolean canHarvest);
}

You will get such Exception:
crash-2021-09-04_22.16.45-client.txt

I know there are no such situations in Vanilla and probably in Fabric, but you can find such things in Forge.

Created refmap:

{
  "mappings": {
    "pl/test/mixin/mixins/extrautils2/InvokerRemoveBlock": {
      "removeBlock": "func_180235_c(Lnet/minecraft/util/math/BlockPos;)Z"
    }
  },
  "data": {
    "searge": {
      "pl/test/mixin/mixins/extrautils2/InvokerRemoveBlock": {
        "removeBlock": "func_180235_c(Lnet/minecraft/util/math/BlockPos;)Z"
      }
    }
  }
}

Mixin: 0.8.3
MixinGradle: 0.7-SNAPSHOT
ForgeGradle: 3.+
Forge: 1.12.2-14.23.5.2855

@PanSzelescik PanSzelescik changed the title @Invoker remap bug, when two methods has the same name, but other arguments and one has remap and other no @Invoker remap bug, when two methods have the same name, but other arguments and one has remap and other no Sep 4, 2021
@Mumfrey Mumfrey changed the title @Invoker remap bug, when two methods have the same name, but other arguments and one has remap and other no @Invokers with the same name and different signatures are not supported Dec 6, 2021
@Mumfrey
Copy link
Member

Mumfrey commented Dec 6, 2021

Invokers and Accessors are very old part of the toolkit and the method signature/descriptor is not part of their identifier. Thus this is not currently supported but I will look at adding support for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants