Skip to content

BedrockEquipmentTables 5.47.0 ​

final class · pocketmine\loot\bedrock\BedrockEquipmentTables · source

Bedrock mob equipment loot tables (the "table" of the minecraft:equipment component: zombie_equipment.json, skeleton_gear.json, armor_set_*.json...), shipped in resources/bedrock_equipment_tables.json (generated by tools/generate-bedrock-equipment-tables.php from the behavior pack; do not edit it by hand).

Only what those tables use is supported:

  • pools with "rolls" (a number or {min, max}) of weighted entries, or with "tiers" (initial tier in [0, initial_range), then +1 for each of "bonus_rolls" passing "bonus_chance");
  • entries of type "item", "loot_table" (another bundled table) and "empty", and nested "pools" inside an entry (rolled when the entry is picked: the armor sets give the next piece that way);
  • conditions random_chance, random_difficulty_chance and random_regional_difficulty_chance (max_chance times the clamped regional difficulty); any other condition fails;
  • functions set_count, enchant_random_gear (chance times the clamped regional difficulty, then enchanted like an enchanting table of level 5 to 5 + 17 x the clamped regional difficulty, like Java mob spawn equipment) and set_banner_details type 1 (ominous banner); looting_enchant does nothing at spawn; others are ignored.

Randomness comes from mt_rand(), so that seeded tests are reproducible.

Constants ​

FILE ​

php
public const FILE = "bedrock_equipment_tables.json"

Methods ​

enchantRandomGear() ​

php
public static function enchantRandomGear(\pocketmine\item\Item $item, float $chance, float $specialMultiplier) : \pocketmine\item\Item

Vanilla mob spawn equipment enchanting: with a chance of $chance times the clamped regional difficulty, enchants the item like an enchanting table of level 5 to 5 + 17 x the clamped regional difficulty (Java Mob.enchantSpawnedEquipment with the mob_spawn_equipment enchantment provider).

has() ​

php
public static function has(string $name) : bool

normalizeName() ​

php
public static function normalizeName(string $name) : string

Returns the full name of a table: "zombie_equipment" and "loot_tables/entities/zombie_equipment.json" both give the latter.

roll() ​

php
public static function roll(string $name, int $difficulty, float $specialMultiplier) : array

Rolls an equipment table. Returns the items in the order they were generated (an empty list if the table is missing).

setTables() ​

php
public static function setTables(?array $tables) : void

Replaces the bundled tables (tests), or restores them (null).

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.