Invsee inventory top and bottom inconsistency.
KevinNovak opened this issue ยท 10 comments
When testing which inventory is clicked (top or bottom), there is weird behavior when each slot is clicked. This only seems to happen with Essentials /invsee inventory, and not other inventorys (such as chests, OpenInv's inventory, etc). See this Spigot forum post for more info.
I feel like this is an unintended side effect of the Combat Update, as slots 36-40 have been occupied by armour and the offhand item since around that time. Does putting an item in the "top" slots at the bottom affect the other player's armour or offhand items?
Essentials is opening a 41-slot inventory, not 36, and the client doesn't know how to handle it properly. This is due to the fact that PlayerInventory#getContents contains the armor and offhand slots as well as of midway through 1.9.
PlayerInventory#getContents contains the armor and offhand slots as well
Why does Essentials use this if it is not displaying them to the /invsee viewer?
EDIT: Why not use Inventory#getStorageContents?
Why does Essentials use this if it is not displaying them to the /invsee viewer?
Old code that doesn't appear broken to the casual observer. Pre-1.9, it was fine. Pretty sure this is actually more of a CB issue - there's no special handling for opening player inventories even though it's no longer standard sized.
there's no special handling for opening player inventories even though it's no longer standard sized.
I see what you mean. That's sort of unfortunate. Maybe I'll submit an issue on the CraftBukkit site, although I guess for the majority of cases it's not a problem. Will Essentials be making any changes? It'd be great if /invsee could open a 36-slot inventory, since that is what is being shown... but it almost doesn't even seem worth it to make the change.
You could submit a PR. I can't really speak for the EssentialsX team, but based on the fact that #472 has been sitting for several months I doubt they're likely to make changes. The reason it's done the way it is is that modifying the opened inventory directly modifies the actual underlying inventory of the target player. Creating a 36-slot inventory would require either a decent lot more work in terms of event handling or some fiddly NMS to keep both inventories in sync.
For your reading pleasure: inventory click handling and inventory opening
I think the /invsee
command could be modified to deal with this by extending Inventory to create a 48 slot mirror of the given inventory. I may have a look into this at some point if I find time.
Does putting an item in the "top" slots at the bottom affect the other player's armour or offhand items?
It does not, invsee works as is should as far as I can tell. I am trying to make a plugin that relies on knowing whether an inventory is top or bottom, and for some reason Essentials /invsee is throwing me off.
Little bit late to the party here, but do keep in mind that modded versions of Minecraft can use some really odd inventories, so when I was originally writing this I was trying to avoid using any hard coded numbers.