ItemStack

public class ItemStack implements NetworkSerializable

Class ItemStack. Provides itemstack functionality for the Hytale server.

java.lang.Object > ItemStack

Field Summary

itemId

protected String itemId

Field itemId.

quantity

protected int quantity

Field quantity.

durability

protected double durability

Field durability.

maxDurability

protected double maxDurability

Field maxDurability.

overrideDroppedItemAnimation

protected boolean overrideDroppedItemAnimation

Field overrideDroppedItemAnimation.

metadata

protected BsonDocument metadata

Field metadata.

cachedPacket

private ItemWithAllMetadata cachedPacket

Field cachedPacket.

item

final Item item

Field item.

newItemId

final String newItemId

Field newItemId.

bsonValue

final BsonValue bsonValue

Field bsonValue.

empty

final boolean empty

Field empty.

clonedMeta

final BsonDocument clonedMeta

Field clonedMeta.

packet

final ItemWithAllMetadata packet

Field packet.

itemStack

final ItemStack itemStack

Field itemStack.

Method Detail

ItemStack

public public ItemStack (@Nonnull final String itemId, final int quantity, @Nullable final BsonDocument metadata)

Method ItemStack.

Parameters:
@Nonnull final String itemId
final int quantity
@Nullable final BsonDocument metadata

IllegalArgumentException

public new IllegalArgumentException (String.format("quantity %s must be >0!", quantity)

Method IllegalArgumentException.

Parameters:
String.format("quantity %s must be >0!", quantity

getItemId

public String getItemId ()

Method getItemId.

getQuantity

public int getQuantity ()

Method getQuantity.

getMetadata

public BsonDocument getMetadata ()

Method getMetadata.

isUnbreakable

public boolean isUnbreakable ()

Method isUnbreakable.

isBroken

public boolean isBroken ()

Method isBroken.

getMaxDurability

public double getMaxDurability ()

Method getMaxDurability.

getDurability

public double getDurability ()

Method getDurability.

isEmpty

public boolean isEmpty ()

Method isEmpty.

getOverrideDroppedItemAnimation

public boolean getOverrideDroppedItemAnimation ()

Method getOverrideDroppedItemAnimation.

setOverrideDroppedItemAnimation

public void setOverrideDroppedItemAnimation (final boolean b)

Method setOverrideDroppedItemAnimation.

Parameters:
final boolean b

getBlockKey

public String getBlockKey ()

Method getBlockKey.

getItem

public Item getItem ()

Method getItem.

isValid

public boolean isValid ()

Method isValid.

withDurability

public ItemStack withDurability (final double durability)

Method withDurability.

Parameters:
final double durability

withMaxDurability

public ItemStack withMaxDurability (final double maxDurability)

Method withMaxDurability.

Parameters:
final double maxDurability

withIncreasedDurability

public ItemStack withIncreasedDurability (final double inc)

Method withIncreasedDurability.

Parameters:
final double inc

withRestoredDurability

public ItemStack withRestoredDurability (final double maxDurability)

Method withRestoredDurability.

Parameters:
final double maxDurability

withState

public ItemStack withState (@Nonnull final String state)

Method withState.

Parameters:
@Nonnull final String state

withQuantity

public ItemStack withQuantity (final int quantity)

Method withQuantity.

Parameters:
final int quantity

withMetadata

public ItemStack withMetadata (@Nullable final BsonDocument metadata)

Method withMetadata.

Parameters:
@Nullable final BsonDocument metadata

BsonDocument

public new BsonDocument ()

Method BsonDocument.

toPacket

public ItemWithAllMetadata toPacket ()

Method toPacket.

isStackableWith

public boolean isStackableWith (@Nullable final ItemStack itemStack)

Method isStackableWith.

Parameters:
@Nullable final ItemStack itemStack

isEquivalentType

public boolean isEquivalentType (@Nullable final ItemStack itemStack)

Method isEquivalentType.

Parameters:
@Nullable final ItemStack itemStack

getFromMetadataOrNull

public T getFromMetadataOrNull (@Nonnull final KeyedCodec keyedCodec)

Method getFromMetadataOrNull.

Parameters:
@Nonnull final KeyedCodec keyedCodec

getFromMetadataOrDefault

public T getFromMetadataOrDefault (@Nonnull final String key, @Nonnull final BuilderCodec codec)

Method getFromMetadataOrDefault.

Parameters:
@Nonnull final String key
@Nonnull final BuilderCodec codec

equals

public boolean equals (@Nullable final Object o)

Method equals.

Parameters:
@Nullable final Object o

hashCode

public int hashCode ()

Method hashCode.

toString

public String toString ()

Method toString.

isSameItemType

static boolean isSameItemType (@Nullable final ItemStack a, @Nullable final ItemStack b)

Method isSameItemType.

Parameters:
@Nullable final ItemStack a
@Nullable final ItemStack b

fromPacket

static ItemStack fromPacket (@Nullable final ItemQuantity packet)

Method fromPacket.

Parameters:
@Nullable final ItemQuantity packet