GaldurItemSlot
classclient uniquementdepuis 0.1.0com.galdurstudio.galdurui.api.widget.GaldurItemSlot
Pas encore traduit : texte d’origine en anglais.
Themed item cell: an item icon and its short amount ("64", "1,2k", "64k", "1,2M"), usable in vanilla layouts.
This is a display cell, not a real menu slot: it moves no item and does not talk to the server. It shows items in large numbers (a storage network's contents, a recipe) and tells the mod when it is clicked; the mod decides what to do.
Like GaldurCheckbox, the widget reads the item and the amount every
frame from suppliers, so the cell follows the contents without being rebuilt. The
amount is a long, separate from the stack size, so it can go past 64 and even
Integer.MAX_VALUE.
GaldurItemSlot iron = GaldurItemSlot.of(() -> new ItemStack(Items.IRON_INGOT), () -> network.amount(iron)) .onPress(button -> button == 0 ? takeStack() : takeHalf());- Amount: hidden when it is 1, as in vanilla.
- Tooltip: the item's own, as in an inventory, followed by the exact amount when it is shortened.
- Click: left (
0) or right (1), passed to the mod; Enter or Space count as a left click. - Disabled (
active = false): muted amount, no click; the tooltip stays. - Empty: an empty stack shows an empty cell, without tooltip.
Champs 1
SIZE
staticSide of a cell, frame included, in pixels: the size of a vanilla slot.
Constructeurs 1
GaldurItemSlot
protectedPARAMÈTRES
Méthodes 4
of
static2 surchargesPARAMÈTRES
RENVOIEGaldurItemSlot — a cell that shows the stack size as amount
onPress
Sets the action called when the cell is clicked. Only one action is kept.
PARAMÈTRES
0 left, 1 rightRENVOIEGaldurItemSlot — this cell, for chaining
isValidClickButton
protectedAccepts left and right clicks.
PARAMÈTRES
playDownSound
An item cell does not play the button sound.
PARAMÈTRES