Skip to content

Fix slot interactivity issue#1890

Open
LNatit wants to merge 1 commit intoshedaniel:19.x-1.21.5from
LNatit:slotfix
Open

Fix slot interactivity issue#1890
LNatit wants to merge 1 commit intoshedaniel:19.x-1.21.5from
LNatit:slotfix

Conversation

@LNatit
Copy link

@LNatit LNatit commented May 15, 2025

See #1889 entry 3.
Basically, Neoforge implemented Slots (SlotItemHandler) have a more strict mayPickup & mayPlace judgement.
When judging mayPickup, the slot would trigger a virtual takeItem operation, and rely on whether the return value (ideally the ItemStack to take) is an empty stack to judge. Hence when the slot is empty initially, it would be marked as not able to be picked up.
Similar issue occurred in mayPlace. When checking modifiability, the slot would try judging whether it's able to place the same item in the slot into it. But for an empty slot, the input ItemStack would be EMPTY, which is also blocked by Neoforge's judgement.
As a result, both ways will get wrong interactivity for an empty slot of SlotItemHandler. So we can do an extra judgement to see whether the slot is empty. Additionally, before actually placing items, a canPlace check is applyed, so we don't need to worry a wrong item transfer.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant