-
Notifications
You must be signed in to change notification settings - Fork 42
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
Capturing locals out of current scope #78
Comments
Does your mod declare a dependency on Fabric Loader 0.12+? Does the behavior change if that changes? |
I need to know what dependencies your fabric.mod.json declares on Loader, it controls the mixin locals algorithm being used. If you depend on a loader version >= 0.12, it'll use the same as current upstream, if you don't have a dependency on Loader or one starting below 0.12 it uses the old algorithm for compatibility. |
I tried |
I'm not sure if this is the correct place to post this report, I think so. The issue started in fabric loader 0.12 and above. For reference the example is with minecraft 1.17.1.
Issue: mixin is trying/requiring locals out of the current scope and this causes a verification error.
I'm trying to inject right before the second swingHand
@Inject(method={"doItemUse"}, at={@At(value="INVOKE", target="net/minecraft/client/network/ClientPlayerEntity.swingHand(Lnet/minecraft/util/Hand;)V", ordinal = 1)}, locals=LocalCapture.CAPTURE_FAILHARD)
This does, only inject right before the second swingHand.
When I tell mixin to print the locals, it gives this
private void onBlockUse(CallbackInfo ci, Hand var1[], int var2, int var3, Hand hand, ItemStack itemStack, EntityHitResult entityHitResult, Entity entity, ActionResult actionResult, BlockHitResult blockHitResult, int i, ActionResult actionResult2) {
It's suggesting Entity entity, ActionResult actionResult which is out of the current scope
When I use it's suggestion of the locals it crashes with an error
When I use the correct locals
private void onBlockUse(CallbackInfo ci, Hand var1[], int var2, int var3, Hand hand, ItemStack itemStack, EntityHitResult entityHitResult, BlockHitResult blockHitResult, int i, ActionResult actionResult2) {
, it crashes, saying it expects what I said in#1
This is the mixin
The text was updated successfully, but these errors were encountered: