Basics
Guides
API Reference
Basics
Guides
API Reference
[17:7] extends: FxObj
Wraps FXGL's Inventory, a generic container of items keyed by an arbitrary type T (often a string, enum, or entity-type tag). Each item carries a display name, description, view Node, and quantity. The wrapper exposes the simple-add path (name + description + view + quantity) plus the quantity queries and remove operations needed by typical inventory UIs.
Inventory (int Capacity = 100)
Creates a new Inventory with the given capacity (max number of distinct items, not total stack size).
Capacity is the maximum distinct-item count.adopt (object Ajo)
Wraps an existing Inventory AussomJavaObject.
Ajo is an AussomJavaObject around an Inventory.A new wrapper.add (Item, string Name, string Description, int Quantity = 1)
Adds an item with name + description + quantity. View defaults to FXGL's empty Group and maxStackQuantity to Integer.MAX_VALUE. Returns true on success, false if the inventory is full or Quantity is non-positive.
Item is the item key (string, enum, or arbitrary value).Name is the display name.Description is the item description.Quantity is the initial quantity.A bool.addConfig (Item, object ConfigObj, int Quantity = 1)
Adds an item using a full ItemConfig (so callers can set a view Node and a per-stack quantity cap). Use this when the simple name + description form is not enough -- e.g. when a UI inventory needs each item to render with its own sprite, or when an item should split across stacks at a known cap. Returns true on success, false if the inventory is full.
Item is the item key.ConfigObj is an ItemConfig wrapper.Quantity is the initial quantity.A bool.remove (Item)
Removes an item by key.
Item is the item key.this objecthasItem (Item)
Returns whether the inventory currently holds the item.
Item is the item key.A bool.getItemQuantity (Item)
Returns the current quantity of the item (0 if not held).
Item is the item key.An int.incrementQuantity (Item, int Amount)
Increments the item's quantity by the given amount. Returns true on success, false if capacity exceeded.
Item is the item key.Amount is the delta to apply.A bool.size ()
Returns the inventory item count (number of stacks).
An int.getCapacity ()
Returns the inventory's capacity (the maximum number of stacks it can hold).
An int.setCapacity (int Capacity)
Resizes the inventory's capacity at runtime. Reducing below the current size does not drop existing stacks; it only blocks future adds.
Capacity is the new stack count.this objectisFull ()
Returns true when the inventory has reached its capacity.
A bool.getNumFreeStacks ()
Returns how many stack slots are still free.
An int.itemsProperty ()
Returns the underlying unmodifiable ObservableList of ItemStacks. Bind a JavaFX ListView to this to render an inventory grid that updates as items change.
An AussomJavaObject around an ObservableListgetItemQuantityProperty (Item)
Returns the IntegerProperty backing the item's total quantity (across all stacks). Useful for binding a label to a stack count. Throws if the item is not in the inventory.
Item is the item key.An AussomJavaObject around an IntegerProperty.getData (Item)
Returns the ItemData wrapper for the given item, or null if not held. ItemData carries the name, description, view Node, total quantity, per-stack cap, and the list of stacks.
Item is the item key.An ItemData wrapper or null.getAllData ()
Returns the inventory's full metadata as a list of ItemData wrappers, one per held item.
A list of ItemData wrappers.transferFrom (object OtherObj, Item, int Quantity = 1)
Moves an item with the given quantity from Other to this inventory. Returns true when both halves of the transfer succeed; returns false (with no changes) on capacity or stock failure.
OtherObj is an Inventory wrapper.Item is the item key.Quantity is the amount to move.A bool.transferAllFrom (object OtherObj)
Moves every stack from Other into this inventory. Returns true when at least one item transferred successfully.
OtherObj is an Inventory wrapper.A bool.getSize ()
Returns the count of distinct item stacks currently in the inventory.
itemQuantityProperty (object ItemObj)
Returns the live IntegerProperty tracking the quantity of the supplied item. Use for binding into a HUD count label.

Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.