Record Class LootContext
java.lang.Object
java.lang.Record
com.github.darksoulq.abyssallib.world.data.loot.LootContext
- Record Components:
location- TheLocationwhere loot is being generated.looter- TheEntity(usually a Player) receiving the loot.killer- TheEntitythat caused a death (if applicable).victim- TheEntitythat died (if applicable).tool- TheItemStackused to obtain the loot.luck- The calculated luck value used for bonus rolls and quality.random- TheRandominstance used for selections.
public record LootContext(org.bukkit.Location location, @Nullable org.bukkit.entity.Entity looter, @Nullable org.bukkit.entity.Entity killer, @Nullable org.bukkit.entity.Entity victim, @Nullable org.bukkit.inventory.ItemStack tool, float luck, Random random)
extends Record
Immutable record containing the environment and entity data for loot generation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for constructingLootContextinstances. -
Constructor Summary
ConstructorsConstructorDescriptionLootContext(org.bukkit.Location location, org.bukkit.entity.Entity looter, org.bukkit.entity.Entity killer, org.bukkit.entity.Entity victim, org.bukkit.inventory.ItemStack tool, float luck, Random random) Creates an instance of aLootContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic LootContext.Builderbuilder(org.bukkit.Location loc) Initializes a builder for a LootContext.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.org.bukkit.entity.Entitykiller()Returns the value of thekillerrecord component.org.bukkit.Locationlocation()Returns the value of thelocationrecord component.org.bukkit.entity.Entitylooter()Returns the value of thelooterrecord component.floatluck()Returns the value of theluckrecord component.random()Returns the value of therandomrecord component.org.bukkit.inventory.ItemStacktool()Returns the value of thetoolrecord component.final StringtoString()Returns a string representation of this record class.org.bukkit.entity.Entityvictim()Returns the value of thevictimrecord component.
-
Constructor Details
-
LootContext
public LootContext(org.bukkit.Location location, @Nullable org.bukkit.entity.Entity looter, @Nullable org.bukkit.entity.Entity killer, @Nullable org.bukkit.entity.Entity victim, @Nullable org.bukkit.inventory.ItemStack tool, float luck, Random random) Creates an instance of aLootContextrecord class.- Parameters:
location- the value for thelocationrecord componentlooter- the value for thelooterrecord componentkiller- the value for thekillerrecord componentvictim- the value for thevictimrecord componenttool- the value for thetoolrecord componentluck- the value for theluckrecord componentrandom- the value for therandomrecord component
-
-
Method Details
-
builder
Initializes a builder for a LootContext.- Parameters:
loc- The world location.- Returns:
- A new
LootContext.Builderinstance.
-
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. -
location
-
looter
-
killer
-
victim
-
tool
-
luck
-
random
-