Class CustomLootTableReward

java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.reward.CustomLootTableReward
All Implemented Interfaces:
AdvancementReward

public class CustomLootTableReward extends Object implements AdvancementReward
An advancement reward that generates and distributes items using a custom LootTable defined in AbyssalLib's registry or inline.
  • Field Details

    • CODEC

      public static final Codec<CustomLootTableReward> CODEC
      The hybrid fallback codec handling both explicit map definitions and simple string references.
    • TYPE

      public static final RewardType<CustomLootTableReward> TYPE
      The registered type definition for the custom loot table reward.
  • Constructor Details

    • CustomLootTableReward

      public CustomLootTableReward(String id, LootTable table)
      Constructs a new CustomLootTableReward.
      Parameters:
      id - The registry identifier of the loot table (nullable if inline).
      table - The literal inline loot table (nullable if referenced).
  • Method Details

    • getType

      public RewardType<?> getType()
      Description copied from interface: AdvancementReward
      Retrieves the reward type definition associated with this instance. This is used to identify the logic and handle polymorphic serialization.
      Specified by:
      getType in interface AdvancementReward
      Returns:
      The RewardType characterizing this specific reward.
    • grant

      public void grant(org.bukkit.entity.Player player)
      Generates loot using the configured table and grants it to the player.
      Specified by:
      grant in interface AdvancementReward
      Parameters:
      player - The player receiving the reward.