Class Item

java.lang.Object
ActiverseEngine.Item

public abstract class Item extends Object
Represents an item in the Activerse game engine. Each item has a name, type, and value.
Version:
1.4.1
Author:
Knivier
  • Constructor Summary

    Constructors
    Constructor
    Description
    Item(String name, String type, int value)
    Constructor for items inside an inventory.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canStack(Item other)
    Checks if this item can stack with another item
    Returns the name of the item
    For implementation
    int
    Returns the value as signed and serialized of type item
    void
    setValue(int value)
    Sets the value of the item (for stacking, quantity changes, etc.)
    boolean
    stack(Item other)
    Stacks another item with this one by adding quantities
     
    abstract void
    use()
    Action that the item does to something

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Item

      public Item(String name, String type, int value)
      Constructor for items inside an inventory. All inventory items must go under the Item class
      Parameters:
      name - The name of the item
      type - The classification you give the item (ex: heal etc)
      value - The value you give (strength, modifier, etc)
  • Method Details

    • getName

      public String getName()
      Returns the name of the item
      Returns:
      String item name
    • getType

      public String getType()
      For implementation
      Returns:
      String type of item
    • getValue

      public int getValue()
      Returns the value as signed and serialized of type item
      Returns:
      Value none defined
    • setValue

      public void setValue(int value)
      Sets the value of the item (for stacking, quantity changes, etc.)
      Parameters:
      value - The new value to set
    • canStack

      public boolean canStack(Item other)
      Checks if this item can stack with another item
      Parameters:
      other - The other item to check
      Returns:
      true if items can be stacked together
    • stack

      public boolean stack(Item other)
      Stacks another item with this one by adding quantities
      Parameters:
      other - The item to stack with this one
      Returns:
      true if stacking was successful
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • use

      public abstract void use()
      Action that the item does to something