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