MinecraftDev
MinecraftDev copied to clipboard
Incorrect InvalidInjectorMethodSignature Warning with "JUMP" type injection
Please include the following information in all bug reports:
- Minecraft Development for IntelliJ plugin version: 2022.1-15.1.19
- IntelliJ Version 2022.1
- Operating System: PopOS 22.04
- Target Platform: Quilt, though this seems to occur with Fabric as well
Description of Problem
When trying to port one of Fabric API's events to Quilt's Standard Libraries, I was looking into making one of their mixins less fragile. Specifically, a mixin into WorldChunk with the following signature:
@Inject(method = "setBlockEntity", at = @At(value = "INVOKE", target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", shift = At.Shift.BY, by = 3), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
private void valid_onLoadBlockEntity(BlockEntity blockEntity, CallbackInfo ci, BlockPos blockPos, @Nullable BlockEntity removedBlockEntity)
That signature does not cause any issues. However, the following signature I devised (which targets an opcode just past the one prior, and thus should have access to the same local arguments) raises a "InvalidInjectorMethodSignature" warning. When tested, it does not cause any issues, building and running just fine with identical in-game behavior:
@Inject(method = "setBlockEntity", at = @At(value = "JUMP", opcode = Opcodes.IFNULL), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
private void warned_onLoadBlockEntity(BlockEntity blockEntity, CallbackInfo ci, BlockPos __, @Nullable BlockEntity removedBlockEntity)
I believe this is the result of the bytecode search used by the plugin latching onto an earlier JUMP-like opcode mistakenly (rather than the IFNULL opcode I specified), though I don't have a reliable way to test this. If you need any additional information or files, let me know and I will provide them ASAP.