public class WeightedItem extends WeightedObject<ItemType> implements DataSerializable
Modifier and Type | Field and Description |
---|---|
static DataQuery |
WEIGHTED_ITEM_DATA |
static DataQuery |
WEIGHTED_ITEM_QUANTITY |
static DataQuery |
WEIGHTED_ITEM_TYPE |
static DataQuery |
WEIGHTED_ITEM_WEIGHT |
object, weight
Constructor and Description |
---|
WeightedItem(ItemType object,
VariableAmount quantity,
int weight)
Creates a new
WeightedEntity with no additional properties. |
WeightedItem(ItemType object,
VariableAmount quantity,
int weight,
Collection<? extends DataManipulator<?,?>> collection)
Creates a new
WeightedEntity with the given additional
properties. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
List<ImmutableDataManipulator<?,?>> |
getAdditionalProperties()
Gets the additional properties to apply to the item.
|
VariableAmount |
getQuantity()
Gets a
VariableAmount representing the quantity of the item. |
Collection<ItemStack> |
getRandomItem(ItemStackBuilder builder,
Random rand,
int maxStacks)
|
DataContainer |
toContainer()
Serializes this object into a comprehensible
DataContainer . |
String |
toString() |
get, getWeight, hashCode
public static final DataQuery WEIGHTED_ITEM_TYPE
public static final DataQuery WEIGHTED_ITEM_WEIGHT
public static final DataQuery WEIGHTED_ITEM_DATA
public static final DataQuery WEIGHTED_ITEM_QUANTITY
public WeightedItem(ItemType object, VariableAmount quantity, int weight)
WeightedEntity
with no additional properties.object
- The entity typequantity
- The item quantityweight
- The weightpublic WeightedItem(ItemType object, VariableAmount quantity, int weight, Collection<? extends DataManipulator<?,?>> collection)
WeightedEntity
with the given additional
properties.object
- The entity typequantity
- The item quantityweight
- The weightcollection
- The additional properties to apply to the entitypublic VariableAmount getQuantity()
VariableAmount
representing the quantity of the item.public List<ImmutableDataManipulator<?,?>> getAdditionalProperties()
public Collection<ItemStack> getRandomItem(ItemStackBuilder builder, Random rand, int maxStacks)
builder
- The builder to use to create the item stacksrand
- The random object to usemaxStacks
- The maximum number of item stacks that may be createdpublic String toString()
toString
in class WeightedObject<ItemType>
public boolean equals(Object obj)
equals
in class WeightedObject<ItemType>
public DataContainer toContainer()
DataSerializable
DataContainer
.toContainer
in interface DataSerializable