Class WPlayerInvPanel


public class WPlayerInvPanel extends WPlainPanel
A player inventory widget that has a visually separate hotbar.
See Also:
  • Field Details

  • Constructor Details

    • WPlayerInvPanel

      public WPlayerInvPanel(PlayerInventory playerInventory)
      Constructs a player inventory panel with a label.
      Parameters:
      playerInventory - the player inventory
    • WPlayerInvPanel

      public WPlayerInvPanel(PlayerInventory playerInventory, boolean hasLabel)
      Constructs a player inventory panel.
      Parameters:
      playerInventory - the player inventory
      hasLabel - whether there should be an "Inventory" label
      Since:
      2.0.0
    • WPlayerInvPanel

      public WPlayerInvPanel(PlayerInventory playerInventory, @Nullable @Nullable WWidget label)
      Constructs a player inventory panel.
      Parameters:
      playerInventory - the player inventory
      label - the label widget, can be null
      Since:
      2.0.0
  • 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 WPanel
      Returns:
      true if this widget can be resized, false otherwise
    • createInventoryLabel

      public static WLabel createInventoryLabel(PlayerInventory playerInventory)
      Creates a vanilla-style inventory label for a player inventory.
      Parameters:
      playerInventory - the player inventory
      Returns:
      the created label
      Since:
      3.1.0
    • setBackgroundPainter

      @Environment(CLIENT) public WPanel setBackgroundPainter(BackgroundPainter painter)
      Sets the background painter of this inventory widget's slots.
      Overrides:
      setBackgroundPainter in class WPanel
      Parameters:
      painter - the new painter
      Returns:
      this panel
    • validate

      public void validate(GuiDescription c)
      Description copied from class: WPanel
      Creates component peers and initializes animation data for this Widget and all its children. The host screen handler must clear any heavyweight peers from its records before this method is called.

      This method must be called on the root panel of any screen once the widgets have been initialized.

      Subclasses should call super.validate(c) to ensure that children are validated.

      Overrides:
      validate in class WPanel
      Parameters:
      c - the host GUI description