You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Essentially, packet.slot won't match the "inventory slot" properly. For example, "Creative Slot #0" > is not the hotbar, but the helmet slot. This mapping depends on the "top view" and "bottom view" of the inventory (think of the slots in a crafting bench, vs. the slots in a survival inventory with the equipment).
In Bukkit, there is this concept of "InventoryView" which has a convert-slot function to handle this.
This is an issue because there is a desync as to which item is currently held by the player: using the "hotbar index" for the inventory slot will give the wrong item.
Yes, I see what you mean. Inventory slot indices are currently numbered as per https://wiki.vg/Inventory#Player_Inventory, which is only valid for the normal inventory—not for when e.g. the player is interacting with a crafting table (although those aren't implemented, so I haven't observed the problem).
I'm not sure of the ideal way to fix this in a Rust-like way. Perhaps we could use an enum type with a variant for each possible slot and then map those variants to raw slot IDs depending on the inventory type.
Activity
caelunshun commentedon Aug 23, 2019
Some initial work on fixing inventory indices (see #79)
Merge pull request #221 from feather-rs/inventory-refactor