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