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