ItemSlot
ItemSlot is a Minecraft item slot that integrates with the vanilla container system. It renders the held ItemStack, shows a hover highlight, and registers itself with the open AbstractContainerMenu for standard click-to-transfer behaviour. It also hooks into JEI, REI, and EMI when those mods are present.
Everything documented on UIElement (layout, styles, events, data bindings, etc.) applies here too.
Usage
XML
<!-- Basic slot (no handler — uses LocalSlot) -->
<item-slot/>
<!-- With an item pre-set for display in the editor -->
<item-slot id="minecraft:diamond" count="1"/>
<!-- Disable XEI recipe lookup -->
<item-slot allow-xei-Lookup="false"/>
| XML Attribute | Type | Description |
|---|---|---|
allow-xei-Lookup |
boolean |
Whether clicking the slot triggers XEI (JEI/REI/EMI) recipe lookup. Default: true. |
id / count / NBT |
— | Item attributes used to pre-fill the slot for editor display only. |
Slot Style
hover-overlay
Texture drawn over the slot when the mouse hovers over it.
Default: ColorRectTexture(0x80FFFFFF) (semi-transparent white)
slot-overlay
Texture drawn over the slot background (always, or only when empty — see show-slot-overlay-only-empty).
Default: none (empty)
show-slot-overlay-only-empty
When true, the slot-overlay is drawn only when the slot is empty.
Default: true
show-item-tooltips
Whether hovering the slot shows the standard item tooltip.
Default: true
is-player-slot
Marks this slot as a player inventory slot (used by the quick-move system).
Default: false
accept-quick-move / quick-move-priority
Whether this slot participates in shift-click quick-move, and its priority when multiple slots compete.
Defaults: true / 0
Value Binding
ItemSlot extends BindableUIElement<ItemStack>:
See Data Bindings for full details.
Fields
| Name | Type | Access | Description |
|---|---|---|---|
slotStyle |
SlotStyle |
private (getter) |
Current slot style. |
slot |
Slot |
private (getter) |
The bound Slot. |
Methods
| Method | Returns | Description |
|---|---|---|
bind(IItemHandlerModifiable, int) |
ItemSlot |
Binds to an item handler at the given slot index. |
bind(Slot) |
ItemSlot |
Binds to an existing vanilla Slot. |
setItem(ItemStack) |
ItemSlot |
Sets the displayed item and notifies listeners. |
setItem(ItemStack, boolean) |
ItemSlot |
Sets the displayed item; second param controls notification. |
slotStyle(Consumer<SlotStyle>) |
ItemSlot |
Configures style fluently. |
xeiPhantom() |
ItemSlot |
Enables XEI (JEI/REI/EMI) phantom drag-drop on this slot. |
xeiRecipeIngredient(IngredientIO) |
ItemSlot |
Marks this slot as a recipe ingredient in XEI recipe views. |
xeiRecipeSlot() |
ItemSlot |
Marks this slot as a recipe slot with default IngredientIO.NONE. |
xeiRecipeSlot(IngredientIO, float) |
ItemSlot |
Marks as recipe slot with given I/O type and chance. |
getFullTooltipTexts() |
List<Component> |
Returns the combined item and custom tooltip lines. |