1

I am writing an injector for a method that looks like this:

protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) { if (player.isShiftKeyDown() || !player.mayBuild()) return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; //I want to inject some code here boolean isWrench = AllItems.WRENCH.isIn(stack); //rest of method, not shown } 

My current injector signature is as follows:

@Inject(method = "useItemOn", at = @At(value = "RETURN", ordinal = 0)) 

I know RETURN injects before the specified return opcode, and I know for some mixin targets there is a way to shift injection after the opcode. Could I do that with RETURN or is there a different InjectionPoint I should use?

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.