Package dev.twilite.game.wrapper
Class Item
java.lang.Object
dev.twilite.game.wrapper.BaseItem
dev.twilite.game.wrapper.Item
- All Implemented Interfaces:
Id,Interactable
Represents an item stack in an interactive item container, such as inventory, bank, or equipment.
-
Constructor Summary
ConstructorsConstructorDescriptionItem(int id, int stackSize, int slot, Function<Item, Optional<IfComponent>> componentFunction) -
Method Summary
Modifier and TypeMethodDescriptionReturns the interface component that currently backs this item stack.intid()Returns the item id.options()Returns menu options associated with this interactable.booleanEnqueues the resume/pause-button action.booleanselect()Performs the use/select action for this object.intslot()Returns the item slot inside its container.intReturns the stack size.booleantarget()Performs the target action used when a selected component/item/spell targets this object.static booleanvalid(int id) Returns whether the item id represents a real item entry.Methods inherited from class dev.twilite.game.wrapper.BaseItem
constantName, integerParameter, marketable, name, note, noted, objectParameter, placeholder, stackable, tradeable, unnoteMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.twilite.game.trait.Interactable
interact, option
-
Constructor Details
-
Item
public Item(int id, int stackSize, int slot, Function<Item, Optional<IfComponent>> componentFunction)
-
-
Method Details
-
valid
public static boolean valid(int id) Returns whether the item id represents a real item entry. -
id
public int id()Description copied from class:BaseItemReturns the item id. -
stackSize
public int stackSize()Description copied from class:BaseItemReturns the stack size. -
slot
public int slot()Returns the item slot inside its container. -
component
Returns the interface component that currently backs this item stack.Items created from non-component contexts may return
Optional.empty(). -
options
Description copied from interface:InteractableReturns menu options associated with this interactable.- Specified by:
optionsin interfaceInteractable
-
target
public boolean target()Description copied from interface:InteractablePerforms the target action used when a selected component/item/spell targets this object. Returnstruewhen the target action was performed.- Specified by:
targetin interfaceInteractable
-
select
public boolean select()Description copied from interface:InteractablePerforms the use/select action for this object. Returnstruewhen the "Use" action was performed.- Specified by:
selectin interfaceInteractable
-
resumePause
public boolean resumePause()Enqueues the resume/pause-button action.
-