Skip to content

IItemExtension#doesSneakBypassUse behaves unintuitively / incorrect with items in the offhand #2979

@Mari023

Description

@Mari023

Minecraft Version: 1.21.1

NeoForge Version: 21.1.169

Steps to Reproduce:

  1. have an item Override IItemExtension#doesSneakBypassUse, and return true
  2. put that item in the main hand
  3. put an item that doesn't do that in the offhand (e.g. an iron ingot)
  4. sneak + use on a block

BlockBehaviour#useItemOn doesn't get called, but Item#useOn does.

Description of issue:

The description of IItemExtension#doesSneakBypassUse implies that the use will be passed to the underlying block first.
Right now that is only the case if either one hand is empty, or the items in both hands Override IItemExtension#doesSneakBypassUse.

Expected Behaviour:
BlockBehaviour#useItemOn gets called if the item Overrides IItemExtension#doesSneakBypassUse before Item#useOn gets called for that item (tho with the hand that item is in).


In practice, this is noticeable with AE2's Memory Card, which doesn't work correctly if you have an item in the offhand, and instead of the sneak + use on block action, it triggers the sneak + use on air action (which clears the card instead).

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNeeds triaging and confirmation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions