Class LootTableUtils

java.lang.Object
org.skriptlang.skript.bukkit.loottables.LootTableUtils

public class LootTableUtils extends Object
Utility class for loot tables.
  • Constructor Details

    • LootTableUtils

      public LootTableUtils()
  • Method Details

    • isLootable

      public static boolean isLootable(Object object)
      * Checks whether a block or entity is an instance of Lootable. This is done because a block is not an instance of Lootable, but a block state is.
      Parameters:
      object - the object to check.
      Returns:
      whether the object is lootable.
    • getAsLootable

      public static org.bukkit.loot.Lootable getAsLootable(Object object)
      Gets the Lootable instance of an object. You should call isLootable(Object) before calling this method.
      Parameters:
      object - the object to get the Lootable instance of.
      Returns:
      the Lootable instance of the object.
    • getLootTable

      public static org.bukkit.loot.LootTable getLootTable(Object object)
      Gets the loot table of an object. You should call isLootable(Object) before calling this method.
      Parameters:
      object - the object to get the loot table of.
      Returns:
      returns the LootTable of the object.
    • updateState

      public static void updateState(org.bukkit.loot.Lootable lootable)
      Updates the state of a Lootable. This is done because setting the LootTable or seed of a BlockState changes the NBT value, but is never updated.
      Parameters:
      lootable - the Lootable to update the state of.