Class LootTableUtils
java.lang.Object
org.skriptlang.skript.bukkit.loottables.LootTableUtils
Utility class for loot tables.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.loot.Lootable
getAsLootable
(Object object) Gets the Lootable instance of an object.static org.bukkit.loot.LootTable
getLootTable
(Object object) Gets the loot table of an object.static boolean
isLootable
(Object object) * Checks whether a block or entity is an instance ofLootable
.static void
updateState
(org.bukkit.loot.Lootable lootable) Updates the state of a Lootable.
-
Constructor Details
-
LootTableUtils
public LootTableUtils()
-
-
Method Details
-
isLootable
* Checks whether a block or entity is an instance ofLootable
. 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
Gets the Lootable instance of an object. You should callisLootable(Object)
before calling this method.- Parameters:
object
- the object to get the Lootable instance of.- Returns:
- the Lootable instance of the object.
-
getLootTable
Gets the loot table of an object. You should callisLootable(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.
-