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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether this widget can be resized usingWWidget.setSize(int, int).intReturns the animation duration of thisWItem.List<net.minecraft.item.ItemStack> getItems()voidpaint(net.minecraft.client.util.math.MatrixStack matrices, int x, int y, int mouseX, int mouseY) Paints this widget.setDuration(int duration) Sets the item list of thisWItemand resets the animation state.voidtick()Executes a client-side tick for this widget.Methods inherited from class io.github.cottonmc.cotton.gui.widget.WWidget
addNarrations, addPainters, addTooltip, canFocus, canHover, cycleFocus, getAbsoluteX, getAbsoluteY, 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, validate
-
Constructor Details
-
WItem
-
WItem
public WItem(net.minecraft.tag.Tag<? extends net.minecraft.item.ItemConvertible> tag) -
WItem
public WItem(net.minecraft.item.ItemStack stack)
-
-
Method Details
-
canResize
public boolean canResize()Description copied from class:WWidgetChecks whether this widget can be resized usingWWidget.setSize(int, int). -
tick
@Environment(CLIENT) public void tick()Description copied from class:WWidgetExecutes a client-side tick for this widget. -
paint
@Environment(CLIENT) public void paint(net.minecraft.client.util.math.MatrixStack matrices, int x, int y, int mouseX, int mouseY) Description copied from class:WWidgetPaints 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 thisWItemand resets the animation state.- Parameters:
items- the new item list- Returns:
- this instance
-