Applied Energistics 2

Applied Energistics 2

156M Downloads

unable to lock slot 40 (offhand)

Mari023 opened this issue · 4 comments

commented

Describe the bug

it is impossible to open a wireless terminal / portable cell if it is in the offhand

How to reproduce the bug

get a wireless terminal / portable cell
make sure it can be opened in the main hand
put it in the offhand slot
open it
nothing happens

Expected behavior

the terminal would open

Additional details

I think this bug got fixed at some point and reappeared, I can't however find the original fix or report

just not locking slot 40 should fix this

Which minecraft version are you using?

1.18

On which mod loaders does it happen?

Fabric

Crash log

error in console: https://gist.github.com/Mari023/e3ef2f8637490003d7d807df3ee8df95
debug crah: https://gist.github.com/Mari023/b57819d73b63ee9360b0435eb34ed1d2

commented

Oh yeah, that's probably because we don't actually add the off-hand slot in the menu, but then try to lock it 🤔

commented

BTW: how does this interact with your code since you do add the off-hand in your crafting terminal, right?

commented

It behaves the same.

the precondition just checks if the slot is greater than playerInventory.items.size()
maybe removing that check would work too.
all lockPlayerInventorySlot() does is adding the slot to a set, so it doesn't really matter if it is out of bounds

commented

Hm, I don't quite like that. Not having preconditions like that hides errors (such as this one)