Class LootEntry

java.lang.Object
com.github.darksoulq.abyssallib.world.data.loot.LootEntry
Direct Known Subclasses:
LootEntry.EmptyEntry, LootEntry.ItemEntry

public abstract class LootEntry extends Object
An abstract representation of a single choice within a loot pool.

Entries can represent items, empty slots, or recursive loot tables.

  • Field Details

    • CODEC

      public static final Codec<LootEntry> CODEC
      Polymorphic codec for handling various LootEntry implementations.
  • Constructor Details

    • LootEntry

      public LootEntry(int weight, int quality, List<LootCondition> conditions, List<LootFunction> functions)
      Parameters:
      weight - Entry weight.
      quality - Entry quality.
      conditions - Activation conditions.
      functions - Item modifiers.
  • Method Details

    • test

      public boolean test(LootContext context)
      Tests if this entry can be selected in the given context.
      Parameters:
      context - The current LootContext.
      Returns:
      true if all conditions pass.
    • expand

      public abstract void expand(LootContext context, Consumer<org.bukkit.inventory.ItemStack> generator)
      Generates the actual content of the entry and passes it to the sink.
      Parameters:
      context - The current LootContext.
      generator - The Consumer for generated stacks.