PocketMine-MP 5.35.1 git-e32e836dad793a3a3c8ddd8927c00e112b1e576a
Loading...
Searching...
No Matches
VanillaItems.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
24namespace pocketmine\item;
25
26use pocketmine\block\utils\RecordType;
36use pocketmine\item\VanillaArmorMaterials as ArmorMaterials;
38use pocketmine\utils\CloningRegistryTrait;
40use function is_int;
41use function mb_strtoupper;
42use function strtolower;
43
362final class VanillaItems{
363 use CloningRegistryTrait;
364
365 private function __construct(){
366 //NOOP
367 }
368
374 protected static function register(string $name, \Closure $createItem) : Item{
375 //this sketchy hack allows us to avoid manually writing the constants inline
376 //since type IDs are generated from this class anyway, I'm OK with this hack
377 //nonetheless, we should try to get rid of it in a future major version (e.g by using string type IDs)
378 $reflect = new \ReflectionClass(ItemTypeIds::class);
379 $typeId = $reflect->getConstant(mb_strtoupper($name));
380 if(!is_int($typeId)){
381 //this allows registering new stuff without adding new type ID constants
382 //this reduces the number of mandatory steps to test new features in local development
383 \GlobalLogger::get()->error(self::class . ": No constant type ID found for $name, generating a new one");
384 $typeId = ItemTypeIds::newId();
385 }
386
387 $item = $createItem(new IID($typeId));
388
389 self::_registryRegister($name, $item);
390
391 return $item;
392 }
393
398 public static function getAll() : array{
399 //phpstan doesn't support generic traits yet :(
401 $result = self::_registryGetAll();
402 return $result;
403 }
404
405 protected static function setup() : void{
406 self::registerArmorItems();
407 self::registerSpawnEggs();
408 self::registerTierToolItems();
409 self::registerSmithingTemplates();
410
411 //this doesn't use the regular register() because it doesn't have an item typeID
412 //in the future we'll probably want to dissociate this from the air block and make a proper null item
413 self::_registryRegister("air", Blocks::AIR()->asItem()->setCount(0));
414
415 self::register("acacia_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::ACACIA_SIGN(), Blocks::ACACIA_WALL_SIGN()));
416 self::register("acacia_hanging_sign", fn(IID $id) => new HangingSign($id, "Acacia Hanging Sign", Blocks::ACACIA_CEILING_CENTER_HANGING_SIGN(), Blocks::ACACIA_CEILING_EDGES_HANGING_SIGN(), Blocks::ACACIA_WALL_HANGING_SIGN()));
417 self::register("amethyst_shard", fn(IID $id) => new Item($id, "Amethyst Shard"));
418 self::register("apple", fn(IID $id) => new Apple($id, "Apple"));
419 self::register("arrow", fn(IID $id) => new Arrow($id, "Arrow"));
420 self::register("baked_potato", fn(IID $id) => new BakedPotato($id, "Baked Potato"));
421 self::register("bamboo", fn(IID $id) => new Bamboo($id, "Bamboo"));
422 self::register("banner", fn(IID $id) => new Banner($id, Blocks::BANNER(), Blocks::WALL_BANNER()));
423 self::register("beetroot", fn(IID $id) => new Beetroot($id, "Beetroot"));
424 self::register("beetroot_seeds", fn(IID $id) => new BeetrootSeeds($id, "Beetroot Seeds"));
425 self::register("beetroot_soup", fn(IID $id) => new BeetrootSoup($id, "Beetroot Soup"));
426 self::register("birch_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::BIRCH_SIGN(), Blocks::BIRCH_WALL_SIGN()));
427 self::register("birch_hanging_sign", fn(IID $id) => new HangingSign($id, "Birch Hanging Sign", Blocks::BIRCH_CEILING_CENTER_HANGING_SIGN(), Blocks::BIRCH_CEILING_EDGES_HANGING_SIGN(), Blocks::BIRCH_WALL_HANGING_SIGN()));
428 self::register("blaze_powder", fn(IID $id) => new Item($id, "Blaze Powder"));
429 self::register("blaze_rod", fn(IID $id) => new BlazeRod($id, "Blaze Rod"));
430 self::register("bleach", fn(IID $id) => new Item($id, "Bleach"));
431 self::register("bone", fn(IID $id) => new Item($id, "Bone"));
432 self::register("bone_meal", fn(IID $id) => new Fertilizer($id, "Bone Meal"));
433 self::register("book", fn(IID $id) => new Book($id, "Book", [EnchantmentTags::ALL]));
434 self::register("bow", fn(IID $id) => new Bow($id, "Bow", [EnchantmentTags::BOW]));
435 self::register("bowl", fn(IID $id) => new Bowl($id, "Bowl"));
436 self::register("bread", fn(IID $id) => new Bread($id, "Bread"));
437 self::register("brick", fn(IID $id) => new Item($id, "Brick"));
438 self::register("bucket", fn(IID $id) => new Bucket($id, "Bucket"));
439 self::register("carrot", fn(IID $id) => new Carrot($id, "Carrot"));
440 self::register("charcoal", fn(IID $id) => new Coal($id, "Charcoal"));
441 self::register("cherry_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::CHERRY_SIGN(), Blocks::CHERRY_WALL_SIGN()));
442 self::register("cherry_hanging_sign", fn(IID $id) => new HangingSign($id, "Cherry Hanging Sign", Blocks::CHERRY_CEILING_CENTER_HANGING_SIGN(), Blocks::CHERRY_CEILING_EDGES_HANGING_SIGN(), Blocks::CHERRY_WALL_HANGING_SIGN()));
443 self::register("chemical_aluminium_oxide", fn(IID $id) => new Item($id, "Aluminium Oxide"));
444 self::register("chemical_ammonia", fn(IID $id) => new Item($id, "Ammonia"));
445 self::register("chemical_barium_sulphate", fn(IID $id) => new Item($id, "Barium Sulphate"));
446 self::register("chemical_benzene", fn(IID $id) => new Item($id, "Benzene"));
447 self::register("chemical_boron_trioxide", fn(IID $id) => new Item($id, "Boron Trioxide"));
448 self::register("chemical_calcium_bromide", fn(IID $id) => new Item($id, "Calcium Bromide"));
449 self::register("chemical_calcium_chloride", fn(IID $id) => new Item($id, "Calcium Chloride"));
450 self::register("chemical_cerium_chloride", fn(IID $id) => new Item($id, "Cerium Chloride"));
451 self::register("chemical_charcoal", fn(IID $id) => new Item($id, "Charcoal"));
452 self::register("chemical_crude_oil", fn(IID $id) => new Item($id, "Crude Oil"));
453 self::register("chemical_glue", fn(IID $id) => new Item($id, "Glue"));
454 self::register("chemical_hydrogen_peroxide", fn(IID $id) => new Item($id, "Hydrogen Peroxide"));
455 self::register("chemical_hypochlorite", fn(IID $id) => new Item($id, "Hypochlorite"));
456 self::register("chemical_ink", fn(IID $id) => new Item($id, "Ink"));
457 self::register("chemical_iron_sulphide", fn(IID $id) => new Item($id, "Iron Sulphide"));
458 self::register("chemical_latex", fn(IID $id) => new Item($id, "Latex"));
459 self::register("chemical_lithium_hydride", fn(IID $id) => new Item($id, "Lithium Hydride"));
460 self::register("chemical_luminol", fn(IID $id) => new Item($id, "Luminol"));
461 self::register("chemical_magnesium_nitrate", fn(IID $id) => new Item($id, "Magnesium Nitrate"));
462 self::register("chemical_magnesium_oxide", fn(IID $id) => new Item($id, "Magnesium Oxide"));
463 self::register("chemical_magnesium_salts", fn(IID $id) => new Item($id, "Magnesium Salts"));
464 self::register("chemical_mercuric_chloride", fn(IID $id) => new Item($id, "Mercuric Chloride"));
465 self::register("chemical_polyethylene", fn(IID $id) => new Item($id, "Polyethylene"));
466 self::register("chemical_potassium_chloride", fn(IID $id) => new Item($id, "Potassium Chloride"));
467 self::register("chemical_potassium_iodide", fn(IID $id) => new Item($id, "Potassium Iodide"));
468 self::register("chemical_rubbish", fn(IID $id) => new Item($id, "Rubbish"));
469 self::register("chemical_salt", fn(IID $id) => new Item($id, "Salt"));
470 self::register("chemical_soap", fn(IID $id) => new Item($id, "Soap"));
471 self::register("chemical_sodium_acetate", fn(IID $id) => new Item($id, "Sodium Acetate"));
472 self::register("chemical_sodium_fluoride", fn(IID $id) => new Item($id, "Sodium Fluoride"));
473 self::register("chemical_sodium_hydride", fn(IID $id) => new Item($id, "Sodium Hydride"));
474 self::register("chemical_sodium_hydroxide", fn(IID $id) => new Item($id, "Sodium Hydroxide"));
475 self::register("chemical_sodium_hypochlorite", fn(IID $id) => new Item($id, "Sodium Hypochlorite"));
476 self::register("chemical_sodium_oxide", fn(IID $id) => new Item($id, "Sodium Oxide"));
477 self::register("chemical_sugar", fn(IID $id) => new Item($id, "Sugar"));
478 self::register("chemical_sulphate", fn(IID $id) => new Item($id, "Sulphate"));
479 self::register("chemical_tungsten_chloride", fn(IID $id) => new Item($id, "Tungsten Chloride"));
480 self::register("chemical_water", fn(IID $id) => new Item($id, "Water"));
481 self::register("chorus_fruit", fn(IID $id) => new ChorusFruit($id, "Chorus Fruit"));
482 self::register("clay", fn(IID $id) => new Item($id, "Clay"));
483 self::register("clock", fn(IID $id) => new Clock($id, "Clock"));
484 self::register("clownfish", fn(IID $id) => new Clownfish($id, "Clownfish"));
485 self::register("coal", fn(IID $id) => new Coal($id, "Coal"));
486 self::register("cocoa_beans", fn(IID $id) => new CocoaBeans($id, "Cocoa Beans"));
487 self::register("compass", fn(IID $id) => new Compass($id, "Compass", [EnchantmentTags::COMPASS]));
488 self::register("cooked_chicken", fn(IID $id) => new CookedChicken($id, "Cooked Chicken"));
489 self::register("cooked_fish", fn(IID $id) => new CookedFish($id, "Cooked Fish"));
490 self::register("cooked_mutton", fn(IID $id) => new CookedMutton($id, "Cooked Mutton"));
491 self::register("cooked_porkchop", fn(IID $id) => new CookedPorkchop($id, "Cooked Porkchop"));
492 self::register("cooked_rabbit", fn(IID $id) => new CookedRabbit($id, "Cooked Rabbit"));
493 self::register("cooked_salmon", fn(IID $id) => new CookedSalmon($id, "Cooked Salmon"));
494 self::register("cookie", fn(IID $id) => new Cookie($id, "Cookie"));
495 self::register("copper_ingot", fn(IID $id) => new Item($id, "Copper Ingot"));
496 self::register("coral_fan", fn(IID $id) => new CoralFan($id));
497 self::register("crimson_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::CRIMSON_SIGN(), Blocks::CRIMSON_WALL_SIGN()));
498 self::register("crimson_hanging_sign", fn(IID $id) => new HangingSign($id, "Crimson Hanging Sign", Blocks::CRIMSON_CEILING_CENTER_HANGING_SIGN(), Blocks::CRIMSON_CEILING_EDGES_HANGING_SIGN(), Blocks::CRIMSON_WALL_HANGING_SIGN()));
499 self::register("dark_oak_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::DARK_OAK_SIGN(), Blocks::DARK_OAK_WALL_SIGN()));
500 self::register("dark_oak_hanging_sign", fn(IID $id) => new HangingSign($id, "Dark Oak Hanging Sign", Blocks::DARK_OAK_CEILING_CENTER_HANGING_SIGN(), Blocks::DARK_OAK_CEILING_EDGES_HANGING_SIGN(), Blocks::DARK_OAK_WALL_HANGING_SIGN()));
501 self::register("diamond", fn(IID $id) => new Item($id, "Diamond"));
502 self::register("disc_fragment_5", fn(IID $id) => new Item($id, "Disc Fragment (5)"));
503 self::register("dragon_breath", fn(IID $id) => new Item($id, "Dragon's Breath"));
504 self::register("dried_kelp", fn(IID $id) => new DriedKelp($id, "Dried Kelp"));
505 //TODO: add interface to dye-colour objects
506 self::register("dye", fn(IID $id) => new Dye($id, "Dye"));
507 self::register("echo_shard", fn(IID $id) => new Item($id, "Echo Shard"));
508 self::register("egg", fn(IID $id) => new Egg($id, "Egg"));
509 self::register("emerald", fn(IID $id) => new Item($id, "Emerald"));
510 self::register("enchanted_book", fn(IID $id) => new EnchantedBook($id, "Enchanted Book", [EnchantmentTags::ALL]));
511 self::register("enchanted_golden_apple", fn(IID $id) => new GoldenAppleEnchanted($id, "Enchanted Golden Apple"));
512 self::register("end_crystal", fn(IID $id) => new EndCrystal($id, "End Crystal"));
513 self::register("ender_pearl", fn(IID $id) => new EnderPearl($id, "Ender Pearl"));
514 self::register("experience_bottle", fn(IID $id) => new ExperienceBottle($id, "Bottle o' Enchanting"));
515 self::register("feather", fn(IID $id) => new Item($id, "Feather"));
516 self::register("fermented_spider_eye", fn(IID $id) => new Item($id, "Fermented Spider Eye"));
517 self::register("firework_rocket", fn(IID $id) => new FireworkRocket($id, "Firework Rocket"));
518 self::register("firework_star", fn(IID $id) => new FireworkStar($id, "Firework Star"));
519 self::register("fire_charge", fn(IID $id) => new FireCharge($id, "Fire Charge"));
520 self::register("fishing_rod", fn(IID $id) => new FishingRod($id, "Fishing Rod", [EnchantmentTags::FISHING_ROD]));
521 self::register("flint", fn(IID $id) => new Item($id, "Flint"));
522 self::register("flint_and_steel", fn(IID $id) => new FlintSteel($id, "Flint and Steel", [EnchantmentTags::FLINT_AND_STEEL]));
523 self::register("ghast_tear", fn(IID $id) => new Item($id, "Ghast Tear"));
524 self::register("glass_bottle", fn(IID $id) => new GlassBottle($id, "Glass Bottle"));
525 self::register("glistering_melon", fn(IID $id) => new Item($id, "Glistering Melon"));
526 self::register("glow_berries", fn(IID $id) => new GlowBerries($id, "Glow Berries"));
527 self::register("glow_ink_sac", fn(IID $id) => new Item($id, "Glow Ink Sac"));
528 self::register("glowstone_dust", fn(IID $id) => new Item($id, "Glowstone Dust"));
529 self::register("goat_horn", fn(IID $id) => new GoatHorn($id, "Goat Horn"));
530 self::register("gold_ingot", fn(IID $id) => new Item($id, "Gold Ingot"));
531 self::register("gold_nugget", fn(IID $id) => new Item($id, "Gold Nugget"));
532 self::register("golden_apple", fn(IID $id) => new GoldenApple($id, "Golden Apple"));
533 self::register("golden_carrot", fn(IID $id) => new GoldenCarrot($id, "Golden Carrot"));
534 self::register("gunpowder", fn(IID $id) => new Item($id, "Gunpowder"));
535 self::register("heart_of_the_sea", fn(IID $id) => new Item($id, "Heart of the Sea"));
536 self::register("honey_bottle", fn(IID $id) => new HoneyBottle($id, "Honey Bottle"));
537 self::register("honeycomb", fn(IID $id) => new Item($id, "Honeycomb"));
538 self::register("ice_bomb", fn(IID $id) => new IceBomb($id, "Ice Bomb"));
539 self::register("ink_sac", fn(IID $id) => new Item($id, "Ink Sac"));
540 self::register("iron_ingot", fn(IID $id) => new Item($id, "Iron Ingot"));
541 self::register("iron_nugget", fn(IID $id) => new Item($id, "Iron Nugget"));
542 self::register("jungle_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::JUNGLE_SIGN(), Blocks::JUNGLE_WALL_SIGN()));
543 self::register("jungle_hanging_sign", fn(IID $id) => new HangingSign($id, "Jungle Hanging Sign", Blocks::JUNGLE_CEILING_CENTER_HANGING_SIGN(), Blocks::JUNGLE_CEILING_EDGES_HANGING_SIGN(), Blocks::JUNGLE_WALL_HANGING_SIGN()));
544 self::register("lapis_lazuli", fn(IID $id) => new Item($id, "Lapis Lazuli"));
545 self::register("lava_bucket", fn(IID $id) => new LiquidBucket($id, "Lava Bucket", Blocks::LAVA()));
546 self::register("leather", fn(IID $id) => new Item($id, "Leather"));
547 self::register("lingering_potion", fn(IID $id) => new SplashPotion($id, "Lingering Potion", linger: true));
548 self::register("magma_cream", fn(IID $id) => new Item($id, "Magma Cream"));
549 self::register("mangrove_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::MANGROVE_SIGN(), Blocks::MANGROVE_WALL_SIGN()));
550 self::register("mangrove_hanging_sign", fn(IID $id) => new HangingSign($id, "Mangrove Hanging Sign", Blocks::MANGROVE_CEILING_CENTER_HANGING_SIGN(), Blocks::MANGROVE_CEILING_EDGES_HANGING_SIGN(), Blocks::MANGROVE_WALL_HANGING_SIGN()));
551 self::register("medicine", fn(IID $id) => new Medicine($id, "Medicine"));
552 self::register("melon", fn(IID $id) => new Melon($id, "Melon"));
553 self::register("melon_seeds", fn(IID $id) => new MelonSeeds($id, "Melon Seeds"));
554 self::register("milk_bucket", fn(IID $id) => new MilkBucket($id, "Milk Bucket"));
555 self::register("minecart", fn(IID $id) => new Minecart($id, "Minecart"));
556 self::register("mushroom_stew", fn(IID $id) => new MushroomStew($id, "Mushroom Stew"));
557 self::register("name_tag", fn(IID $id) => new NameTag($id, "Name Tag"));
558 self::register("nautilus_shell", fn(IID $id) => new Item($id, "Nautilus Shell"));
559 self::register("nether_brick", fn(IID $id) => new Item($id, "Nether Brick"));
560 self::register("nether_quartz", fn(IID $id) => new Item($id, "Nether Quartz"));
561 self::register("nether_star", fn(IID $id) => new Item($id, "Nether Star"));
562 self::register("netherite_ingot", fn(IID $id) => new class($id, "Netherite Ingot") extends Item{
563 public function isFireProof() : bool{ return true; }
564 });
565 self::register("netherite_scrap", fn(IID $id) => new class($id, "Netherite Scrap") extends Item{
566 public function isFireProof() : bool{ return true; }
567 });
568 self::register("oak_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::OAK_SIGN(), Blocks::OAK_WALL_SIGN()));
569 self::register("oak_hanging_sign", fn(IID $id) => new HangingSign($id, "Oak Hanging Sign", Blocks::OAK_CEILING_CENTER_HANGING_SIGN(), Blocks::OAK_CEILING_EDGES_HANGING_SIGN(), Blocks::OAK_WALL_HANGING_SIGN()));
570 self::register("ominous_banner", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::OMINOUS_BANNER(), Blocks::OMINOUS_WALL_BANNER()));
571 self::register("painting", fn(IID $id) => new PaintingItem($id, "Painting"));
572 self::register("pale_oak_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::PALE_OAK_SIGN(), Blocks::PALE_OAK_WALL_SIGN()));
573 self::register("pale_oak_hanging_sign", fn(IID $id) => new HangingSign($id, "Pale Oak Hanging Sign", Blocks::PALE_OAK_CEILING_CENTER_HANGING_SIGN(), Blocks::PALE_OAK_CEILING_EDGES_HANGING_SIGN(), Blocks::PALE_OAK_WALL_HANGING_SIGN()));
574 self::register("paper", fn(IID $id) => new Item($id, "Paper"));
575 self::register("phantom_membrane", fn(IID $id) => new Item($id, "Phantom Membrane"));
576 self::register("pitcher_pod", fn(IID $id) => new PitcherPod($id, "Pitcher Pod"));
577 self::register("poisonous_potato", fn(IID $id) => new PoisonousPotato($id, "Poisonous Potato"));
578 self::register("popped_chorus_fruit", fn(IID $id) => new Item($id, "Popped Chorus Fruit"));
579 self::register("potato", fn(IID $id) => new Potato($id, "Potato"));
580 self::register("potion", fn(IID $id) => new Potion($id, "Potion"));
581 self::register("prismarine_crystals", fn(IID $id) => new Item($id, "Prismarine Crystals"));
582 self::register("prismarine_shard", fn(IID $id) => new Item($id, "Prismarine Shard"));
583 self::register("pufferfish", fn(IID $id) => new Pufferfish($id, "Pufferfish"));
584 self::register("pumpkin_pie", fn(IID $id) => new PumpkinPie($id, "Pumpkin Pie"));
585 self::register("pumpkin_seeds", fn(IID $id) => new PumpkinSeeds($id, "Pumpkin Seeds"));
586 self::register("rabbit_foot", fn(IID $id) => new Item($id, "Rabbit's Foot"));
587 self::register("rabbit_hide", fn(IID $id) => new Item($id, "Rabbit Hide"));
588 self::register("rabbit_stew", fn(IID $id) => new RabbitStew($id, "Rabbit Stew"));
589 self::register("raw_beef", fn(IID $id) => new RawBeef($id, "Raw Beef"));
590 self::register("raw_chicken", fn(IID $id) => new RawChicken($id, "Raw Chicken"));
591 self::register("raw_copper", fn(IID $id) => new Item($id, "Raw Copper"));
592 self::register("raw_fish", fn(IID $id) => new RawFish($id, "Raw Fish"));
593 self::register("raw_gold", fn(IID $id) => new Item($id, "Raw Gold"));
594 self::register("raw_iron", fn(IID $id) => new Item($id, "Raw Iron"));
595 self::register("raw_mutton", fn(IID $id) => new RawMutton($id, "Raw Mutton"));
596 self::register("raw_porkchop", fn(IID $id) => new RawPorkchop($id, "Raw Porkchop"));
597 self::register("raw_rabbit", fn(IID $id) => new RawRabbit($id, "Raw Rabbit"));
598 self::register("raw_salmon", fn(IID $id) => new RawSalmon($id, "Raw Salmon"));
599 self::register("record_11", fn(IID $id) => new Record($id, RecordType::DISK_11, "Record 11"));
600 self::register("record_13", fn(IID $id) => new Record($id, RecordType::DISK_13, "Record 13"));
601 self::register("record_5", fn(IID $id) => new Record($id, RecordType::DISK_5, "Record 5"));
602 self::register("record_blocks", fn(IID $id) => new Record($id, RecordType::DISK_BLOCKS, "Record Blocks"));
603 self::register("record_cat", fn(IID $id) => new Record($id, RecordType::DISK_CAT, "Record Cat"));
604 self::register("record_chirp", fn(IID $id) => new Record($id, RecordType::DISK_CHIRP, "Record Chirp"));
605 self::register("record_creator", fn(IID $id) => new Record($id, RecordType::DISK_CREATOR, "Record Creator"));
606 self::register("record_creator_music_box", fn(IID $id) => new Record($id, RecordType::DISK_CREATOR_MUSIC_BOX, "Record Creator (Music Box)"));
607 self::register("record_far", fn(IID $id) => new Record($id, RecordType::DISK_FAR, "Record Far"));
608 self::register("record_mall", fn(IID $id) => new Record($id, RecordType::DISK_MALL, "Record Mall"));
609 self::register("record_mellohi", fn(IID $id) => new Record($id, RecordType::DISK_MELLOHI, "Record Mellohi"));
610 self::register("record_otherside", fn(IID $id) => new Record($id, RecordType::DISK_OTHERSIDE, "Record Otherside"));
611 self::register("record_pigstep", fn(IID $id) => new Record($id, RecordType::DISK_PIGSTEP, "Record Pigstep"));
612 self::register("record_precipice", fn(IID $id) => new Record($id, RecordType::DISK_PRECIPICE, "Record Precipice"));
613 self::register("record_relic", fn(IID $id) => new Record($id, RecordType::DISK_RELIC, "Record Relic"));
614 self::register("record_stal", fn(IID $id) => new Record($id, RecordType::DISK_STAL, "Record Stal"));
615 self::register("record_strad", fn(IID $id) => new Record($id, RecordType::DISK_STRAD, "Record Strad"));
616 self::register("record_wait", fn(IID $id) => new Record($id, RecordType::DISK_WAIT, "Record Wait"));
617 self::register("record_ward", fn(IID $id) => new Record($id, RecordType::DISK_WARD, "Record Ward"));
618 self::register("recovery_compass", fn(IID $id) => new Item($id, "Recovery Compass"));
619 self::register("redstone_dust", fn(IID $id) => new Redstone($id, "Redstone"));
620 self::register("resin_brick", fn(IID $id) => new Item($id, "Resin Brick"));
621 self::register("rotten_flesh", fn(IID $id) => new RottenFlesh($id, "Rotten Flesh"));
622 self::register("scute", fn(IID $id) => new Item($id, "Scute"));
623 self::register("shears", fn(IID $id) => new Shears($id, "Shears", [EnchantmentTags::SHEARS]));
624 self::register("shulker_shell", fn(IID $id) => new Item($id, "Shulker Shell"));
625 self::register("slimeball", fn(IID $id) => new Item($id, "Slimeball"));
626 self::register("snowball", fn(IID $id) => new Snowball($id, "Snowball"));
627 self::register("spider_eye", fn(IID $id) => new SpiderEye($id, "Spider Eye"));
628 self::register("splash_potion", fn(IID $id) => new SplashPotion($id, "Splash Potion"));
629 self::register("spruce_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::SPRUCE_SIGN(), Blocks::SPRUCE_WALL_SIGN()));
630 self::register("spruce_hanging_sign", fn(IID $id) => new HangingSign($id, "Spruce Hanging Sign", Blocks::SPRUCE_CEILING_CENTER_HANGING_SIGN(), Blocks::SPRUCE_CEILING_EDGES_HANGING_SIGN(), Blocks::SPRUCE_WALL_HANGING_SIGN()));
631 self::register("spyglass", fn(IID $id) => new Spyglass($id, "Spyglass"));
632 self::register("steak", fn(IID $id) => new Steak($id, "Steak"));
633 self::register("stick", fn(IID $id) => new Stick($id, "Stick"));
634 self::register("string", fn(IID $id) => new StringItem($id, "String"));
635 self::register("sugar", fn(IID $id) => new Item($id, "Sugar"));
636 self::register("suspicious_stew", fn(IID $id) => new SuspiciousStew($id, "Suspicious Stew"));
637 self::register("sweet_berries", fn(IID $id) => new SweetBerries($id, "Sweet Berries"));
638 self::register("torchflower_seeds", fn(IID $id) => new TorchflowerSeeds($id, "Torchflower Seeds"));
639 self::register("totem", fn(IID $id) => new Totem($id, "Totem of Undying"));
640 self::register("trident", fn(IID $id) => new Trident($id, "Trident"));
641 self::register("warped_sign", fn(IID $id) => new ItemBlockWallOrFloor($id, Blocks::WARPED_SIGN(), Blocks::WARPED_WALL_SIGN()));
642 self::register("warped_hanging_sign", fn(IID $id) => new HangingSign($id, "Warped Hanging Sign", Blocks::WARPED_CEILING_CENTER_HANGING_SIGN(), Blocks::WARPED_CEILING_EDGES_HANGING_SIGN(), Blocks::WARPED_WALL_HANGING_SIGN()));
643 self::register("water_bucket", fn(IID $id) => new LiquidBucket($id, "Water Bucket", Blocks::WATER()));
644 self::register("wheat", fn(IID $id) => new Item($id, "Wheat"));
645 self::register("wheat_seeds", fn(IID $id) => new WheatSeeds($id, "Wheat Seeds"));
646 self::register("writable_book", fn(IID $id) => new WritableBook($id, "Book & Quill"));
647 self::register("written_book", fn(IID $id) => new WrittenBook($id, "Written Book"));
648
649 foreach(BoatType::cases() as $type){
650 //boat type is static, because different types of wood may have different properties
651 self::register(strtolower($type->name) . "_boat", fn(IID $id) => new Boat($id, $type->getDisplayName() . " Boat", $type));
652 }
653 }
654
655 private static function registerSpawnEggs() : void{
656 self::register("zombie_spawn_egg", fn(IID $id) => new class($id, "Zombie Spawn Egg") extends SpawnEgg{
657 protected function createEntity(World $world, Vector3 $pos, float $yaw, float $pitch) : Entity{
658 return new Zombie(Location::fromObject($pos, $world, $yaw, $pitch));
659 }
660 });
661 self::register("squid_spawn_egg", fn(IID $id) => new class($id, "Squid Spawn Egg") extends SpawnEgg{
662 protected function createEntity(World $world, Vector3 $pos, float $yaw, float $pitch) : Entity{
663 return new Squid(Location::fromObject($pos, $world, $yaw, $pitch));
664 }
665 });
666 self::register("villager_spawn_egg", fn(IID $id) => new class($id, "Villager Spawn Egg") extends SpawnEgg{
667 protected function createEntity(World $world, Vector3 $pos, float $yaw, float $pitch) : Entity{
668 return new Villager(Location::fromObject($pos, $world, $yaw, $pitch));
669 }
670 });
671 }
672
673 private static function registerTierToolItems() : void{
674 self::register("diamond_axe", fn(IID $id) => new Axe($id, "Diamond Axe", ToolTier::DIAMOND, [EnchantmentTags::AXE]));
675 self::register("golden_axe", fn(IID $id) => new Axe($id, "Golden Axe", ToolTier::GOLD, [EnchantmentTags::AXE]));
676 self::register("iron_axe", fn(IID $id) => new Axe($id, "Iron Axe", ToolTier::IRON, [EnchantmentTags::AXE]));
677 self::register("netherite_axe", fn(IID $id) => new Axe($id, "Netherite Axe", ToolTier::NETHERITE, [EnchantmentTags::AXE]));
678 self::register("stone_axe", fn(IID $id) => new Axe($id, "Stone Axe", ToolTier::STONE, [EnchantmentTags::AXE]));
679 self::register("wooden_axe", fn(IID $id) => new Axe($id, "Wooden Axe", ToolTier::WOOD, [EnchantmentTags::AXE]));
680 self::register("diamond_hoe", fn(IID $id) => new Hoe($id, "Diamond Hoe", ToolTier::DIAMOND, [EnchantmentTags::HOE]));
681 self::register("golden_hoe", fn(IID $id) => new Hoe($id, "Golden Hoe", ToolTier::GOLD, [EnchantmentTags::HOE]));
682 self::register("iron_hoe", fn(IID $id) => new Hoe($id, "Iron Hoe", ToolTier::IRON, [EnchantmentTags::HOE]));
683 self::register("netherite_hoe", fn(IID $id) => new Hoe($id, "Netherite Hoe", ToolTier::NETHERITE, [EnchantmentTags::HOE]));
684 self::register("stone_hoe", fn(IID $id) => new Hoe($id, "Stone Hoe", ToolTier::STONE, [EnchantmentTags::HOE]));
685 self::register("wooden_hoe", fn(IID $id) => new Hoe($id, "Wooden Hoe", ToolTier::WOOD, [EnchantmentTags::HOE]));
686 self::register("diamond_pickaxe", fn(IID $id) => new Pickaxe($id, "Diamond Pickaxe", ToolTier::DIAMOND, [EnchantmentTags::PICKAXE]));
687 self::register("golden_pickaxe", fn(IID $id) => new Pickaxe($id, "Golden Pickaxe", ToolTier::GOLD, [EnchantmentTags::PICKAXE]));
688 self::register("iron_pickaxe", fn(IID $id) => new Pickaxe($id, "Iron Pickaxe", ToolTier::IRON, [EnchantmentTags::PICKAXE]));
689 self::register("netherite_pickaxe", fn(IID $id) => new Pickaxe($id, "Netherite Pickaxe", ToolTier::NETHERITE, [EnchantmentTags::PICKAXE]));
690 self::register("stone_pickaxe", fn(IID $id) => new Pickaxe($id, "Stone Pickaxe", ToolTier::STONE, [EnchantmentTags::PICKAXE]));
691 self::register("wooden_pickaxe", fn(IID $id) => new Pickaxe($id, "Wooden Pickaxe", ToolTier::WOOD, [EnchantmentTags::PICKAXE]));
692 self::register("diamond_shovel", fn(IID $id) => new Shovel($id, "Diamond Shovel", ToolTier::DIAMOND, [EnchantmentTags::SHOVEL]));
693 self::register("golden_shovel", fn(IID $id) => new Shovel($id, "Golden Shovel", ToolTier::GOLD, [EnchantmentTags::SHOVEL]));
694 self::register("iron_shovel", fn(IID $id) => new Shovel($id, "Iron Shovel", ToolTier::IRON, [EnchantmentTags::SHOVEL]));
695 self::register("netherite_shovel", fn(IID $id) => new Shovel($id, "Netherite Shovel", ToolTier::NETHERITE, [EnchantmentTags::SHOVEL]));
696 self::register("stone_shovel", fn(IID $id) => new Shovel($id, "Stone Shovel", ToolTier::STONE, [EnchantmentTags::SHOVEL]));
697 self::register("wooden_shovel", fn(IID $id) => new Shovel($id, "Wooden Shovel", ToolTier::WOOD, [EnchantmentTags::SHOVEL]));
698 self::register("diamond_sword", fn(IID $id) => new Sword($id, "Diamond Sword", ToolTier::DIAMOND, [EnchantmentTags::SWORD]));
699 self::register("golden_sword", fn(IID $id) => new Sword($id, "Golden Sword", ToolTier::GOLD, [EnchantmentTags::SWORD]));
700 self::register("iron_sword", fn(IID $id) => new Sword($id, "Iron Sword", ToolTier::IRON, [EnchantmentTags::SWORD]));
701 self::register("netherite_sword", fn(IID $id) => new Sword($id, "Netherite Sword", ToolTier::NETHERITE, [EnchantmentTags::SWORD]));
702 self::register("stone_sword", fn(IID $id) => new Sword($id, "Stone Sword", ToolTier::STONE, [EnchantmentTags::SWORD]));
703 self::register("wooden_sword", fn(IID $id) => new Sword($id, "Wooden Sword", ToolTier::WOOD, [EnchantmentTags::SWORD]));
704 }
705
706 private static function registerArmorItems() : void{
707 self::register("chainmail_boots", fn(IID $id) => new Armor($id, "Chainmail Boots", new ArmorTypeInfo(1, 196, ArmorInventory::SLOT_FEET, material: ArmorMaterials::CHAINMAIL()), [EnchantmentTags::BOOTS]));
708 self::register("diamond_boots", fn(IID $id) => new Armor($id, "Diamond Boots", new ArmorTypeInfo(3, 430, ArmorInventory::SLOT_FEET, 2, material: ArmorMaterials::DIAMOND()), [EnchantmentTags::BOOTS]));
709 self::register("golden_boots", fn(IID $id) => new Armor($id, "Golden Boots", new ArmorTypeInfo(1, 92, ArmorInventory::SLOT_FEET, material: ArmorMaterials::GOLD()), [EnchantmentTags::BOOTS]));
710 self::register("iron_boots", fn(IID $id) => new Armor($id, "Iron Boots", new ArmorTypeInfo(2, 196, ArmorInventory::SLOT_FEET, material: ArmorMaterials::IRON()), [EnchantmentTags::BOOTS]));
711 self::register("leather_boots", fn(IID $id) => new Armor($id, "Leather Boots", new ArmorTypeInfo(1, 66, ArmorInventory::SLOT_FEET, material: ArmorMaterials::LEATHER()), [EnchantmentTags::BOOTS]));
712 self::register("netherite_boots", fn(IID $id) => new Armor($id, "Netherite Boots", new ArmorTypeInfo(3, 482, ArmorInventory::SLOT_FEET, 3, true, material: ArmorMaterials::NETHERITE()), [EnchantmentTags::BOOTS]));
713
714 self::register("chainmail_chestplate", fn(IID $id) => new Armor($id, "Chainmail Chestplate", new ArmorTypeInfo(5, 241, ArmorInventory::SLOT_CHEST, material: ArmorMaterials::CHAINMAIL()), [EnchantmentTags::CHESTPLATE]));
715 self::register("diamond_chestplate", fn(IID $id) => new Armor($id, "Diamond Chestplate", new ArmorTypeInfo(8, 529, ArmorInventory::SLOT_CHEST, 2, material: ArmorMaterials::DIAMOND()), [EnchantmentTags::CHESTPLATE]));
716 self::register("golden_chestplate", fn(IID $id) => new Armor($id, "Golden Chestplate", new ArmorTypeInfo(5, 113, ArmorInventory::SLOT_CHEST, material: ArmorMaterials::GOLD()), [EnchantmentTags::CHESTPLATE]));
717 self::register("iron_chestplate", fn(IID $id) => new Armor($id, "Iron Chestplate", new ArmorTypeInfo(6, 241, ArmorInventory::SLOT_CHEST, material: ArmorMaterials::IRON()), [EnchantmentTags::CHESTPLATE]));
718 self::register("leather_tunic", fn(IID $id) => new Armor($id, "Leather Tunic", new ArmorTypeInfo(3, 81, ArmorInventory::SLOT_CHEST, material: ArmorMaterials::LEATHER()), [EnchantmentTags::CHESTPLATE]));
719 self::register("netherite_chestplate", fn(IID $id) => new Armor($id, "Netherite Chestplate", new ArmorTypeInfo(8, 593, ArmorInventory::SLOT_CHEST, 3, true, material: ArmorMaterials::NETHERITE()), [EnchantmentTags::CHESTPLATE]));
720
721 self::register("chainmail_helmet", fn(IID $id) => new Armor($id, "Chainmail Helmet", new ArmorTypeInfo(2, 166, ArmorInventory::SLOT_HEAD, material: ArmorMaterials::CHAINMAIL()), [EnchantmentTags::HELMET]));
722 self::register("diamond_helmet", fn(IID $id) => new Armor($id, "Diamond Helmet", new ArmorTypeInfo(3, 364, ArmorInventory::SLOT_HEAD, 2, material: ArmorMaterials::DIAMOND()), [EnchantmentTags::HELMET]));
723 self::register("golden_helmet", fn(IID $id) => new Armor($id, "Golden Helmet", new ArmorTypeInfo(2, 78, ArmorInventory::SLOT_HEAD, material: ArmorMaterials::GOLD()), [EnchantmentTags::HELMET]));
724 self::register("iron_helmet", fn(IID $id) => new Armor($id, "Iron Helmet", new ArmorTypeInfo(2, 166, ArmorInventory::SLOT_HEAD, material: ArmorMaterials::IRON()), [EnchantmentTags::HELMET]));
725 self::register("leather_cap", fn(IID $id) => new Armor($id, "Leather Cap", new ArmorTypeInfo(1, 56, ArmorInventory::SLOT_HEAD, material: ArmorMaterials::LEATHER()), [EnchantmentTags::HELMET]));
726 self::register("netherite_helmet", fn(IID $id) => new Armor($id, "Netherite Helmet", new ArmorTypeInfo(3, 408, ArmorInventory::SLOT_HEAD, 3, true, material: ArmorMaterials::NETHERITE()), [EnchantmentTags::HELMET]));
727 self::register("turtle_helmet", fn(IID $id) => new TurtleHelmet($id, "Turtle Shell", new ArmorTypeInfo(2, 276, ArmorInventory::SLOT_HEAD, material: ArmorMaterials::TURTLE()), [EnchantmentTags::HELMET]));
728
729 self::register("chainmail_leggings", fn(IID $id) => new Armor($id, "Chainmail Leggings", new ArmorTypeInfo(4, 226, ArmorInventory::SLOT_LEGS, material: ArmorMaterials::CHAINMAIL()), [EnchantmentTags::LEGGINGS]));
730 self::register("diamond_leggings", fn(IID $id) => new Armor($id, "Diamond Leggings", new ArmorTypeInfo(6, 496, ArmorInventory::SLOT_LEGS, 2, material: ArmorMaterials::DIAMOND()), [EnchantmentTags::LEGGINGS]));
731 self::register("golden_leggings", fn(IID $id) => new Armor($id, "Golden Leggings", new ArmorTypeInfo(3, 106, ArmorInventory::SLOT_LEGS, material: ArmorMaterials::GOLD()), [EnchantmentTags::LEGGINGS]));
732 self::register("iron_leggings", fn(IID $id) => new Armor($id, "Iron Leggings", new ArmorTypeInfo(5, 226, ArmorInventory::SLOT_LEGS, material: ArmorMaterials::IRON()), [EnchantmentTags::LEGGINGS]));
733 self::register("leather_pants", fn(IID $id) => new Armor($id, "Leather Pants", new ArmorTypeInfo(2, 76, ArmorInventory::SLOT_LEGS, material: ArmorMaterials::LEATHER()), [EnchantmentTags::LEGGINGS]));
734 self::register("netherite_leggings", fn(IID $id) => new Armor($id, "Netherite Leggings", new ArmorTypeInfo(6, 556, ArmorInventory::SLOT_LEGS, 3, true, material: ArmorMaterials::NETHERITE()), [EnchantmentTags::LEGGINGS]));
735 }
736
737 private static function registerSmithingTemplates() : void{
738 self::register("netherite_upgrade_smithing_template", fn(IID $id) => new Item($id, "Netherite Upgrade Smithing Template"));
739 self::register("coast_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Coast Armor Trim Smithing Template"));
740 self::register("dune_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Dune Armor Trim Smithing Template"));
741 self::register("eye_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Eye Armor Trim Smithing Template"));
742 self::register("host_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Host Armor Trim Smithing Template"));
743 self::register("raiser_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Raiser Armor Trim Smithing Template"));
744 self::register("rib_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Rib Armor Trim Smithing Template"));
745 self::register("sentry_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Sentry Armor Trim Smithing Template"));
746 self::register("shaper_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Shaper Armor Trim Smithing Template"));
747 self::register("silence_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Silence Armor Trim Smithing Template"));
748 self::register("snout_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Snout Armor Trim Smithing Template"));
749 self::register("spire_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Spire Armor Trim Smithing Template"));
750 self::register("tide_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Tide Armor Trim Smithing Template"));
751 self::register("vex_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Vex Armor Trim Smithing Template"));
752 self::register("ward_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Ward Armor Trim Smithing Template"));
753 self::register("wayfinder_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Wayfinder Armor Trim Smithing Template"));
754 self::register("wild_armor_trim_smithing_template", fn(IID $id) => new Item($id, "Wild Armor Trim Smithing Template"));
755 }
756
757}