Skip to content

[BUG] Item.use() mixin cancels all items #54

Open

Description

@mariumbacchus

I recently got an issue on my mod Soulslike Weaponry stating that this mod prevents my custom weapons and abilities from being used, found here. I looked into your code and found that in vice.sol_valheim.mixin.ItemMixin the injection always calls:

info.setReturnValue(InteractionResultHolder.pass(player.getItemInHand(usedHand)));
info.cancel();

for non food items.

Since the callback is cancelled unconditionally, this overrides the normal Item.use() execution path and can interfere with other mods that inject into or rely on Item.use(), which includes my custom item ability system. It likely hasn't been a problem for other mods because they probably override the use method in their custom item classes, but I intend to make my abilities work from any item in minecraft in the future which is why I rely on this mixin system to work.

Making the method only target and cancel edible items should do the trick, like adding

if (!item.isEdible()) {
    return;
}

at the top.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions