Record Class LootPool
java.lang.Object
java.lang.Record
com.github.darksoulq.abyssallib.world.data.loot.LootPool
- Record Components:
rolls- The base number of times to roll this pool.bonusRolls- Additional rolls scaled by theLootContext.luck()value.entries- The list ofLootEntryobjects to choose from.conditions- A list ofLootConditions that must pass for the pool to execute.
public record LootPool(int rolls, int bonusRolls, List<LootEntry> entries, List<LootCondition> conditions)
extends Record
A pool of potential loot entries within a table.
A pool determines how many "rolls" it performs. During each roll, weights are calculated for valid entries to determine which item is selected.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLootPool(int rolls, int bonusRolls, List<LootEntry> entries, List<LootCondition> conditions) Creates an instance of aLootPoolrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thebonusRollsrecord component.Returns the value of theconditionsrecord component.entries()Returns the value of theentriesrecord component.final booleanIndicates whether some other object is "equal to" this one.voidgenerate(LootContext context, Consumer<org.bukkit.inventory.ItemStack> sink) Executes the logic to generate loot from this pool.final inthashCode()Returns a hash code value for this object.introlls()Returns the value of therollsrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
-
Constructor Details
-
LootPool
Creates an instance of aLootPoolrecord class.- Parameters:
rolls- the value for therollsrecord componentbonusRolls- the value for thebonusRollsrecord componententries- the value for theentriesrecord componentconditions- the value for theconditionsrecord component
-
-
Method Details
-
generate
Executes the logic to generate loot from this pool.- Parameters:
context- TheLootContextused for conditions and random selection.sink- AConsumerthat accepts the generatedItemStacks.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
rolls
-
bonusRolls
public int bonusRolls()Returns the value of thebonusRollsrecord component.- Returns:
- the value of the
bonusRollsrecord component
-
entries
-
conditions
Returns the value of theconditionsrecord component.- Returns:
- the value of the
conditionsrecord component
-