Skip to content

LootData 5.46.0 ​

final class · pocketmine\loot\LootData · source

Read access to the vanilla data used by loot tables, in the vanilla data cache prepared by \pocketmine\world\generator\vanilla\VanillaDataFetcher (Mojang's data generator output, never shipped): <root>/data/minecraft/{loot_table,predicate,enchantment,tags/item,tags/enchantment,...} <root>/java_items.json (max stack size, max damage and enchantability of every Java item) <root>/geyser/items.json (GeyserMC's Java -> Bedrock item mappings)

Constants ​

GEYSER_ITEMS_FILE ​

php
public const GEYSER_ITEMS_FILE = "geyser/items.json"

JAVA_ITEMS_FILE ​

php
public const JAVA_ITEMS_FILE = "java_items.json"

Methods ​

__construct() ​

php
public function __construct(string $root)

bool() ​

php
public static function bool(mixed $value, bool $default) : bool

enchantment() ​

php
public function enchantment(string $id) : ?\pocketmine\loot\JavaEnchantment

enchantmentIds() ​

php
public function enchantmentIds() : array

Ids of the enchantment registry in registry order (vanilla loads data-driven registries sorted by id).

getRoot() ​

php
public function getRoot() : string

holderSet() ​

php
public function holderSet(string $registry, mixed $spec) : array

Resolves a holder set: "#tag", a single id or a list of ids.

isAvailable() ​

php
public static function isAvailable(string $root) : bool

Whether $root holds the loot table data (vanilla data format 3 or later).

itemExists() ​

php
public function itemExists(string $id) : bool

itemInfo() ​

php
public function itemInfo(string $id) : array

itemIs() ​

php
public function itemIs(string $itemId, mixed $spec) : bool

Whether an item matches a holder set spec ("#tag", id or list).

lootTableJson() ​

php
public function lootTableJson(string $id) : ?array

namespaced() ​

php
public static function namespaced(string $id) : string

Adds the "minecraft:" namespace to an id that has none.

predicateJson() ​

php
public function predicateJson(string $id) : mixed

readJson() ​

php
public function readJson(string $relativePath) : mixed

Reads a JSON file of the cache, or returns null if it does not exist.

stripNamespace() ​

php
public static function stripNamespace(string $id) : string

tag() ​

php
public function tag(string $registry, string $id, int $depth = 0) : array

Members of a tag (recursively resolved, in tag order without duplicates, like vanilla's TagLoader). $registry is the tag directory: "item", "enchantment", "entity_type", "instrument"...

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.