Skip to content

Incorrect "missing argsOnly = true" warning on @Local #2521

@Earthcomputer

Description

@Earthcomputer

Minecraft Development for IntelliJ plugin version

2025.2-1.8.6-581

IntelliJ version

2025.2

Operating System

Linux

Target platform

Mixins

Description of the bug

mcdev sometimes incorrectly marks a @Local as being possible to have argsOnly = true, even when the local doesn't refer to an argument. Here's an example

@Mixin(ShelfBlock.class)
public class MixinShelfBlock {
    @Definition(id = "swapItemNoUpdate", method = "Lnet/minecraft/world/level/block/entity/ShelfBlockEntity;swapItemNoUpdate(ILnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/item/ItemStack;")
    @Definition(id = "hotbarStack", local = @Local(type = ItemStack.class, ordinal = 0))
    @Definition(id = "shelfStack", local = @Local(type = ItemStack.class, ordinal = 1))
    @Expression("shelfStack = ?.swapItemNoUpdate(?, hotbarStack)")
    @Inject(method = "swapHotbar", at = @At(value = "MIXINEXTRAS:EXPRESSION", shift = At.Shift.AFTER))
    private void countHotbarSwap(
        CallbackInfoReturnable<Boolean> cir,
        @Local(ordinal = 0) ItemStack hotbarStack,
        @Local(ordinal = 1) ItemStack shelfStack,
        @Share("count") LocalIntRef count
    ) {
        if (!hotbarStack.isEmpty() && !shelfStack.isEmpty()) {
            count.set(count.get() + 1);
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions