Class KilledByPlayerCondition
java.lang.Object
com.github.darksoulq.abyssallib.world.data.loot.LootCondition
com.github.darksoulq.abyssallib.world.data.loot.condition.KilledByPlayerCondition
A loot condition that evaluates to true only if the victim was killed by a player.
This is commonly used for mob loot tables to ensure that certain rare drops only occur when a player is actively involved in the combat, preventing automated mob farms from obtaining specific items.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<KilledByPlayerCondition> The codec used for serializing and deserializing the killed by player condition.static final LootConditionType<KilledByPlayerCondition> The registered type definition for the killed by player loot condition. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetType()Retrieves the specific type definition for this loot condition.booleantest(LootContext context) Tests whether the killer in the provided context is an instance of aPlayer.
-
Field Details
-
CODEC
The codec used for serializing and deserializing the killed by player condition.Since this condition logic is static and requires no unique parameters, it encodes to and decodes from an empty map structure.
-
TYPE
The registered type definition for the killed by player loot condition.
-
-
Constructor Details
-
KilledByPlayerCondition
public KilledByPlayerCondition()
-
-
Method Details
-
test
Tests whether the killer in the provided context is an instance of aPlayer. * @param context TheLootContextproviding the entity data for the kill event.- Specified by:
testin classLootCondition- Parameters:
context- TheLootContextcontaining environment and entity data.- Returns:
trueif the killer is a player;falseotherwise.
-
getType
Retrieves the specific type definition for this loot condition. * @return TheLootConditionTypeassociated withKilledByPlayerCondition.- Specified by:
getTypein classLootCondition- Returns:
- The
LootConditionTypeused for registry identification and serialization.
-