Class LootTable<T>
- java.lang.Object
-
- org.spongepowered.api.util.weighted.LootTable<T>
-
- Type Parameters:
T- The entry type
public class LootTable<T> extends java.lang.ObjectRepresents a pool of tables which are rolled sequentially when retrieving entries.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAll(LootTable<T> other)Adds all tables from the givenLootTableto this LootTable's pool.voidaddTable(RandomObjectTable<T> table)Adds a table to the pool.voidclearPool()Clears all tables from the pool.booleanequals(java.lang.Object o)java.util.List<T>get(java.util.Random rand)Gets a List of objects as retrieved from all pools.inthashCode()booleanremoveTable(RandomObjectTable<T> table)Removes a table from the pool.java.util.List<RandomObjectTable<T>>tables()Gets all tables in the pool.java.lang.StringtoString()
-
-
-
Constructor Detail
-
LootTable
public LootTable()
Creates a newLootTable.
-
-
Method Detail
-
addTable
public void addTable(RandomObjectTable<T> table)
Adds a table to the pool.- Parameters:
table- The new table
-
addAll
public void addAll(LootTable<T> other)
Adds all tables from the givenLootTableto this LootTable's pool.- Parameters:
other- The other loot table
-
removeTable
public boolean removeTable(RandomObjectTable<T> table)
Removes a table from the pool.- Parameters:
table- The table to remove- Returns:
- If the pool contained the table
-
tables
public java.util.List<RandomObjectTable<T>> tables()
Gets all tables in the pool.- Returns:
- The tables
-
clearPool
public void clearPool()
Clears all tables from the pool.
-
get
public java.util.List<T> get(java.util.Random rand)
Gets a List of objects as retrieved from all pools.- Parameters:
rand- The random object to use- Returns:
- The retrieved entries
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-