Class LootCondition

java.lang.Object
com.github.darksoulq.abyssallib.world.data.loot.LootCondition
Direct Known Subclasses:
KilledByPlayerCondition, LocationCheckCondition, MatchToolCondition, RandomChanceCondition, RandomChanceWithLootingCondition

public abstract class LootCondition extends Object
An abstract base class for logic gates that determine if a loot element should be processed.

LootConditions can be applied to both LootPools and LootEntrys. If a condition evaluates to false, the associated pool or entry is skipped entirely for the current generation cycle.

  • Field Details

    • CODEC

      public static final Codec<LootCondition> CODEC
      Polymorphic codec for serializing and deserializing loot conditions.

      Decodes the condition by identifying the "type" field via Registries.LOOT_CONDITIONS and delegating to the specific type's internal codec.

  • Constructor Details

    • LootCondition

      public LootCondition()
  • Method Details

    • test

      public abstract boolean test(LootContext context)
      Evaluates this condition against the provided loot context.
      Parameters:
      context - The LootContext containing environment and entity data.
      Returns:
      true if the condition is met; false otherwise.
    • getType

      public abstract LootConditionType<?> getType()
      Retrieves the specific type definition associated with this condition instance.
      Returns:
      The LootConditionType used for registry identification and serialization.