set Item
Sets the item in the specified slot of the virtual inventory. If the provided itemStack is null, has an amount of 0, or is of type AIR, the slot will be set to null (empty). After updating the item in the inventory, this method will notify all registered GUIs to refresh the corresponding slot in their display, ensuring that any changes to the inventory are reflected in the GUI.
Parameters
The index of the slot to update, which should be between 0 and size-1. If the slot index is out of bounds, the method will return without making any changes.
The ItemStack to set in the specified slot. If this is null, has an amount of 0, or is of type AIR, the slot will be cleared (set to null). Otherwise, the provided ItemStack will be set in the inventory at the specified slot.