Skip to content

LootCompiler 5.46.0 ​

final class · pocketmine\loot\LootCompiler · source

Turns the vanilla loot table JSON (Java Edition 26.3 format: "condition"/"modifier", older "conditions"/"functions" also accepted) into loot tables, with conditions and functions compiled to closures.

Supported conditions: all_of, any_of, inverted, reference, random_chance, random_chance_with_enchanted_bonus, killed_by_player, survives_explosion, table_bonus, match_tool, match_block (block_state_property), entity_properties, damage_source_properties and location_check (through the context resolvers), time_check, value_check. Supported functions: set_count, set_damage, enchant_randomly, enchant_with_levels, set_enchantments, set_potion, set_stew_effect, set_name, explosion_decay, apply_bonus, furnace_smelt, enchanted_count_increase (looting_enchant), limit_count, set_ominous_bottle_amplifier, set_instrument, filtered, discard, sequence, set_item. exploration_map leaves the map empty (as vanilla does when no structure is found); functions that only copy block data or set cosmetic components (copy_components, copy_state, set_components...) do nothing. None of the unsupported ones use the random, so the rest of the rolls stay exact.

Properties ​

$data ​

php
public readonly \pocketmine\loot\LootData $data

Methods ​

__construct() ​

php
public function __construct(\pocketmine\loot\LootData $data, \Closure $tableResolver, \Closure $warn)

condition() ​

php
public function condition(mixed $json) : \Closure

conditionsOf() ​

php
public function conditionsOf(array $json) : ?\Closure

The conditions of an object ("condition" in 26.x, "conditions" before), all of which must pass.

entry() ​

php
public function entry(array $json) : \pocketmine\loot\LootEntry

function() ​

php
public function function(mixed $json) : \Closure

functionsOf() ​

php
public function functionsOf(array $json) : ?\Closure

The functions of an object ("modifier" in 26.x, "functions" before), applied in order.

table() ​

php
public function table(string $id, array $json) : \pocketmine\loot\LootTable

warn() ​

php
public function warn(string $key, string $message) : void

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