LootTableContainerTrait 5.46.0
Lazy container loot (vanilla's RandomizableContainer): a container generated with a loot table and a seed is filled from the table the first time its contents are needed (opened by a player, emptied by a hopper, broken...), with the same items for the same seed. Until then only the table name and the seed are stored.
The seed is a Java long (stored as "LootTableSeedLong"); "LootTableSeed" keeps its low 32 bits, the type Bedrock uses, and is read when the long is missing (worlds from Bedrock).
Methods
getLootTable()
public function getLootTable() : ?stringReturns the loot table that will fill the container (Bedrock path or Java id), or null if it was filled already.
getLootTableSeed()
public function getLootTableSeed() : intgetPosition() protected
abstract protected function getPosition() : \pocketmine\world\PositiongetRealInventory()
abstract public function getRealInventory() : \pocketmine\inventory\InventoryloadLootTable() protected
protected function loadLootTable(\pocketmine\nbt\tag\CompoundTag $nbt) : voidsaveLootTable() protected
protected function saveLootTable(\pocketmine\nbt\tag\CompoundTag $nbt) : voidsetLootTable()
public function setLootTable(?string $lootTable, int $seed = 0) : voidSets the loot table that fills the container when it is first used (Bedrock path such as "loot_tables/chests/simple_dungeon.json" or Java id such as "minecraft:chests/simple_dungeon"). A seed of 0 rolls different items each time; any other seed always gives the same items.
unpackLootTable()
public function unpackLootTable(?\pocketmine\entity\Entity $entity = null) : voidFills the container from its loot table, if it has one (RandomizableContainer.unpackLootTable()). $entity is the entity using the container (usually the player opening it), if any.
