Class WItem
java.lang.Object
io.github.cottonmc.cotton.gui.widget.WWidget
io.github.cottonmc.cotton.gui.widget.WItem
A widget that displays an item or a list of items.
- Since:
- 1.8.0
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks whether this widget can be resized usingWWidget.setSize(int, int)
.int
Returns the animation duration of thisWItem
.getItems()
void
paint
(DrawContext context, int x, int y, int mouseX, int mouseY) Paints this widget.setDuration
(int duration) Sets the item list of thisWItem
and resets the animation state.void
tick()
Executes a client-side tick for this widget.Methods inherited from class io.github.cottonmc.cotton.gui.widget.WWidget
addNarrations, addPainters, addTooltip, canFocus, canHover, getAbsoluteX, getAbsoluteY, getFocusModel, getHeight, getHost, getParent, getWidth, getX, getY, hit, hoveredProperty, isActivationKey, isFocused, isHovered, isNarratable, isWithinBounds, onCharTyped, onClick, onFocusGained, onFocusLost, onHidden, onKeyPressed, onKeyReleased, onMouseDown, onMouseDrag, onMouseMove, onMouseScroll, onMouseUp, onShown, releaseFocus, renderTooltip, requestFocus, setHost, setHovered, setLocation, setParent, setSize, shouldRenderInDarkMode, validate
-
Constructor Details
-
WItem
-
WItem
-
WItem
-
-
Method Details
-
canResize
public boolean canResize()Description copied from class:WWidget
Checks whether this widget can be resized usingWWidget.setSize(int, int)
. -
tick
@Environment(CLIENT) public void tick()Description copied from class:WWidget
Executes a client-side tick for this widget. -
paint
Description copied from class:WWidget
Paints this widget. -
getDuration
public int getDuration()Returns the animation duration of thisWItem
.Defaults to 25 screen ticks.
-
setDuration
-
getItems
-
setItems
Sets the item list of thisWItem
and resets the animation state.- Parameters:
items
- the new item list- Returns:
- this instance
-