Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ItemStack

[14:7] extends: FxObj

Wraps FXGL's ItemStack, one physical pile of identical items inside an Inventory. Each Inventory item may break across multiple stacks when its quantity exceeds the per-stack cap from ItemConfig.maxStackQuantity. Stacks are not constructed by user code -- obtain them from Inventory.itemsProperty.

Methods

  • ItemStack ()

    Empty default constructor; populated by adopt.

  • adopt (object Ajo)

    Wraps an existing ItemStack AussomJavaObject.

    • @p Ajo is an AussomJavaObject around an ItemStack.
    • @r A new wrapper.
  • getUserItem ()

    Returns the user-defined item key (often a string or enum) that this stack holds.

  • getQuantity ()

    Returns the current quantity in this stack.

    • @r An int.
  • setQuantity (int Quantity)

    Sets the stack's quantity directly. Normally driven by Inventory.incrementQuantity; this setter is provided for advanced cases.

    • @p Quantity is the new quantity.
  • isEmpty ()

    Returns true when the stack has zero items.

    • @r A bool.
  • quantityProperty ()

    Returns the underlying IntegerProperty backing this stack's quantity so callers can bind a label or progress bar to it.

    • @r An AussomJavaObject around an IntegerProperty.