Class UniversalLootBox


public class UniversalLootBox extends ConsumableItem
  • Constructor Details

  • Method Details

    • open

      public List<AbstractItem> open()
      Opens the loot box and returns a list of randomly selected items based on the loot table and number of rolls.
      Returns:
      List of randomly selected AbstractItem objects.
    • useItem

      public void useItem(ItemUsageContext context) throws ConsumedException
      Consumes one instance of the loot box and adds the generated items to the player's inventory. This method triggers the addition of new items to the player's inventory and updates the player's UI.
      Overrides:
      useItem in class ConsumableItem
      Parameters:
      context - The context in which the item is being used, typically includes information about the entity using the item.
      Throws:
      ConsumedException - If the loot box has already been fully consumed and has no remaining uses.
    • getPlayer

      public Entity getPlayer()