java.lang.Object
io.github.cottonmc.cotton.gui.widget.WWidget
io.github.cottonmc.cotton.gui.widget.WItem

public class WItem extends WWidget
A widget that displays an item or a list of items.
Since:
1.8.0
  • Constructor Details

  • Method Details

    • canResize

      public boolean canResize()
      Description copied from class: WWidget
      Checks whether this widget can be resized using WWidget.setSize(int, int).
      Overrides:
      canResize in class WWidget
      Returns:
      true if this widget can be resized, false otherwise
    • tick

      @Environment(CLIENT) public void tick()
      Description copied from class: WWidget
      Executes a client-side tick for this widget.
      Overrides:
      tick in class WWidget
    • paint

      @Environment(CLIENT) public void paint(DrawContext context, int x, int y, int mouseX, int mouseY)
      Description copied from class: WWidget
      Paints this widget.
      Overrides:
      paint in class WWidget
      Parameters:
      context - the draw context
      x - this widget's X coordinate on the screen
      y - this widget's Y coordinate on the screen
      mouseX - the X coordinate of the cursor
      mouseY - the X coordinate of the cursor
    • getDuration

      public int getDuration()
      Returns the animation duration of this WItem.

      Defaults to 25 screen ticks.

    • setDuration

      public WItem setDuration(int duration)
    • getItems

      public List<ItemStack> getItems()
    • setItems

      public WItem setItems(List<ItemStack> items)
      Sets the item list of this WItem and resets the animation state.
      Parameters:
      items - the new item list
      Returns:
      this instance