Package net.risingworld.api.objects
Klasse Item
java.lang.Object
net.risingworld.api.objects.Item
- Bekannte direkte Unterklassen:
Item.BlueprintItem
,Item.ClothingItem
,Item.ConstructionItem
,Item.ObjectItem
Represents an item that exists in the inventory of a player or in a storage box.
Please note that this item does not really exists in the game world. If a player drops an item, the original Item instance will be deleted and a
Some items have a specific subtype, e.g blocks or objects (like furniture). They're all derived from
Example: Check equipped item type
Please note that this item does not really exists in the game world. If a player drops an item, the original Item instance will be deleted and a
WorldItem
will
be spawned in the world instead.Some items have a specific subtype, e.g blocks or objects (like furniture). They're all derived from
Item
and can be casted accordingly.
- Siehe auch:
-
Verschachtelte Klassen - Übersicht
Modifizierer und TypKlasseBeschreibungstatic class
Represents a blueprint item in the inventory of a player or in a storage box.
A blueprint item is a ready-to-use blueprint (this does not apply to empty blueprints!), i.e a blueprint item representing an actual blueprint.static class
Represents a clothing item in the inventory of a player or in a storage box.
This is any type of clothes (or headgear or accessory).static class
Represents a construction item in the inventory of a player or in a storage box.
This is, for example, a block.static class
Represents an object item in the inventory of a player or in a storage box.
This is, for example, a furniture item. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
destroy()
Destroys this item, i.e remove it from inventory/storage.boolean
Gets the item definition of this item.int
int
Gets the max possible stack size of the item.getName()
Gets the ingame name (not the localized name) of the item.int
getStack()
Gets the current stack size of the item.short
Gets the current status of the item.short
Gets the type ID of the item.float
getValue()
Gets the current value of the item.int
Gets the item variant, i.e the texture of the item.int
hashCode()
boolean
isValid()
Checks whether or not the item still exists and is valid.void
setDurability
(int durability) void
setModifier
(Items.Modifier modifier) void
setStack
(int stack) void
setStatus
(short status) Sets the item status.void
setValue
(float value)
-
Methodendetails
-
isValid
public boolean isValid()Checks whether or not the item still exists and is valid.- Gibt zurück:
- true if the item still exists, false if the item instance had been disposed (i.e the item is no longer valid).
-
getDefinition
Gets the item definition of this item.- Gibt zurück:
- the definition of this item.
-
getName
Gets the ingame name (not the localized name) of the item. Never null.- Gibt zurück:
- the name of the item, e.g "pickaxe".
-
getTypeID
public short getTypeID()Gets the type ID of the item.- Gibt zurück:
- the type ID of the item.
-
getVariant
public int getVariant()Gets the item variant, i.e the texture of the item. For construction elements, for example, this is the texture.- Gibt zurück:
- the variant/texture of the item. Usually this returns for most regular items.
-
getStack
public int getStack()Gets the current stack size of the item.- Gibt zurück:
- the stack size of the item.
-
setStack
public void setStack(int stack) -
getMaxStackSize
public int getMaxStackSize()Gets the max possible stack size of the item.- Gibt zurück:
- the max stack size of the item (between 1 and 64).
-
getValue
public float getValue()Gets the current value of the item. Usually the value is used to describe a "fill level" or "charging level", for example it describes how much water is in a bottle etc.- Gibt zurück:
- the value of the item. 0 for most items.
-
setValue
public void setValue(float value) -
getStatus
public short getStatus()Gets the current status of the item. The status is used to store additional information about an item (for example the water type in a bucket, or if an electronic device is switched on/off).- Gibt zurück:
- the status of the item.
-
setStatus
public void setStatus(short status) Sets the item status.- Parameter:
status
- the new status you want to set for the item.- Example: Turn off the torch the player holds in his hands
-
getModifier
-
setModifier
-
getDurability
public int getDurability() -
setDurability
public void setDurability(int durability) -
destroy
public void destroy()Destroys this item, i.e remove it from inventory/storage. After calling this method, you can no longer use this item instance. -
equals
-
hashCode
public int hashCode()
-