Exterminate legacy item IDs

This commit is contained in:
Dylan K. Taylor 2022-07-05 15:12:55 +01:00
parent c5282b059b
commit 68cbe46600
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
19 changed files with 375 additions and 1180 deletions

View File

@ -91,7 +91,7 @@ class CraftingManager{
*/
public static function sort(Item $i1, Item $i2) : int{
//Use spaceship operator to compare each property, then try the next one if they are equivalent.
($retval = $i1->getId() <=> $i2->getId()) === 0 && ($retval = $i1->getMeta() <=> $i2->getMeta()) === 0 && ($retval = $i1->getCount() <=> $i2->getCount()) === 0;
($retval = $i1->getTypeId() <=> $i2->getTypeId()) === 0 && ($retval = $i1->computeTypeData() <=> $i2->computeTypeData()) === 0 && ($retval = $i1->getCount() <=> $i2->getCount()) === 0;
return $retval;
}
@ -130,8 +130,7 @@ class CraftingManager{
foreach($outputs as $o){
//count is not written because the outputs might be from multiple repetitions of a single recipe
//this reduces the accuracy of the hash, but it won't matter in most cases.
$result->putVarInt($o->getId());
$result->putVarInt($o->getMeta());
$result->putVarInt(morton2d_encode($o->getTypeId(), $o->computeTypeData()));
$result->put((new LittleEndianNbtSerializer())->write(new TreeRoot($o->getNamedTag())));
}
@ -256,8 +255,8 @@ class CraftingManager{
}
public function matchBrewingRecipe(Item $input, Item $ingredient) : ?BrewingRecipe{
$inputHash = morton2d_encode($input->getId(), $input->getMeta());
$ingredientHash = morton2d_encode($ingredient->getId(), $ingredient->getMeta());
$inputHash = morton2d_encode($input->getTypeId(), $input->computeTypeData());
$ingredientHash = morton2d_encode($ingredient->getTypeId(), $ingredient->computeTypeData());
$cached = $this->brewingRecipeCache[$inputHash][$ingredientHash] ?? null;
if($cached !== null){
return $cached;

View File

@ -66,7 +66,7 @@ final class FurnaceRecipeManager{
}
public function match(Item $input) : ?FurnaceRecipe{
$index = morton2d_encode($input->getId(), $input->getMeta());
$index = morton2d_encode($input->getTypeId(), $input->computeTypeData());
$simpleRecipe = $this->lookupCache[$index] ?? null;
if($simpleRecipe !== null){
return $simpleRecipe;

View File

@ -1,68 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\data\bedrock;
use pocketmine\block\utils\CoralType;
use pocketmine\data\bedrock\block\BlockLegacyMetadata;
use pocketmine\utils\SingletonTrait;
use function array_key_exists;
final class CoralTypeIdMap{
use SingletonTrait;
/**
* @var CoralType[]
* @phpstan-var array<int, CoralType>
*/
private array $idToEnum = [];
/**
* @var int[]
* @phpstan-var array<int, int>
*/
private array $enumToId = [];
public function __construct(){
$this->register(BlockLegacyMetadata::CORAL_VARIANT_TUBE, CoralType::TUBE());
$this->register(BlockLegacyMetadata::CORAL_VARIANT_BRAIN, CoralType::BRAIN());
$this->register(BlockLegacyMetadata::CORAL_VARIANT_BUBBLE, CoralType::BUBBLE());
$this->register(BlockLegacyMetadata::CORAL_VARIANT_FIRE, CoralType::FIRE());
$this->register(BlockLegacyMetadata::CORAL_VARIANT_HORN, CoralType::HORN());
}
public function register(int $id, CoralType $type) : void{
$this->idToEnum[$id] = $type;
$this->enumToId[$type->id()] = $id;
}
public function fromId(int $id) : ?CoralType{
return $this->idToEnum[$id] ?? null;
}
public function toId(CoralType $type) : int{
if(!array_key_exists($type->id(), $this->enumToId)){
throw new \InvalidArgumentException("Coral type does not have a mapped ID"); //this should never happen
}
return $this->enumToId[$type->id()];
}
}

View File

@ -103,6 +103,54 @@ final class RuntimeEnumDeserializer{
};
}
public static function readPotionType(RuntimeDataReader $r) : \pocketmine\item\PotionType{
return match($r->readInt(6)){
0 => \pocketmine\item\PotionType::AWKWARD(),
1 => \pocketmine\item\PotionType::FIRE_RESISTANCE(),
2 => \pocketmine\item\PotionType::HARMING(),
3 => \pocketmine\item\PotionType::HEALING(),
4 => \pocketmine\item\PotionType::INVISIBILITY(),
5 => \pocketmine\item\PotionType::LEAPING(),
6 => \pocketmine\item\PotionType::LONG_FIRE_RESISTANCE(),
7 => \pocketmine\item\PotionType::LONG_INVISIBILITY(),
8 => \pocketmine\item\PotionType::LONG_LEAPING(),
9 => \pocketmine\item\PotionType::LONG_MUNDANE(),
10 => \pocketmine\item\PotionType::LONG_NIGHT_VISION(),
11 => \pocketmine\item\PotionType::LONG_POISON(),
12 => \pocketmine\item\PotionType::LONG_REGENERATION(),
13 => \pocketmine\item\PotionType::LONG_SLOWNESS(),
14 => \pocketmine\item\PotionType::LONG_SLOW_FALLING(),
15 => \pocketmine\item\PotionType::LONG_STRENGTH(),
16 => \pocketmine\item\PotionType::LONG_SWIFTNESS(),
17 => \pocketmine\item\PotionType::LONG_TURTLE_MASTER(),
18 => \pocketmine\item\PotionType::LONG_WATER_BREATHING(),
19 => \pocketmine\item\PotionType::LONG_WEAKNESS(),
20 => \pocketmine\item\PotionType::MUNDANE(),
21 => \pocketmine\item\PotionType::NIGHT_VISION(),
22 => \pocketmine\item\PotionType::POISON(),
23 => \pocketmine\item\PotionType::REGENERATION(),
24 => \pocketmine\item\PotionType::SLOWNESS(),
25 => \pocketmine\item\PotionType::SLOW_FALLING(),
26 => \pocketmine\item\PotionType::STRENGTH(),
27 => \pocketmine\item\PotionType::STRONG_HARMING(),
28 => \pocketmine\item\PotionType::STRONG_HEALING(),
29 => \pocketmine\item\PotionType::STRONG_LEAPING(),
30 => \pocketmine\item\PotionType::STRONG_POISON(),
31 => \pocketmine\item\PotionType::STRONG_REGENERATION(),
32 => \pocketmine\item\PotionType::STRONG_STRENGTH(),
33 => \pocketmine\item\PotionType::STRONG_SWIFTNESS(),
34 => \pocketmine\item\PotionType::STRONG_TURTLE_MASTER(),
35 => \pocketmine\item\PotionType::SWIFTNESS(),
36 => \pocketmine\item\PotionType::THICK(),
37 => \pocketmine\item\PotionType::TURTLE_MASTER(),
38 => \pocketmine\item\PotionType::WATER(),
39 => \pocketmine\item\PotionType::WATER_BREATHING(),
40 => \pocketmine\item\PotionType::WEAKNESS(),
41 => \pocketmine\item\PotionType::WITHER(),
default => throw new InvalidSerializedRuntimeDataException("Invalid serialized value for PotionType")
};
}
public static function readSkullType(RuntimeDataReader $r) : \pocketmine\block\utils\SkullType{
return match($r->readInt(3)){
0 => \pocketmine\block\utils\SkullType::CREEPER(),

View File

@ -103,6 +103,54 @@ final class RuntimeEnumSerializer{
});
}
public static function writePotionType(RuntimeDataWriter $w, \pocketmine\item\PotionType $value) : void{
$w->writeInt(6, match($value){
\pocketmine\item\PotionType::AWKWARD() => 0,
\pocketmine\item\PotionType::FIRE_RESISTANCE() => 1,
\pocketmine\item\PotionType::HARMING() => 2,
\pocketmine\item\PotionType::HEALING() => 3,
\pocketmine\item\PotionType::INVISIBILITY() => 4,
\pocketmine\item\PotionType::LEAPING() => 5,
\pocketmine\item\PotionType::LONG_FIRE_RESISTANCE() => 6,
\pocketmine\item\PotionType::LONG_INVISIBILITY() => 7,
\pocketmine\item\PotionType::LONG_LEAPING() => 8,
\pocketmine\item\PotionType::LONG_MUNDANE() => 9,
\pocketmine\item\PotionType::LONG_NIGHT_VISION() => 10,
\pocketmine\item\PotionType::LONG_POISON() => 11,
\pocketmine\item\PotionType::LONG_REGENERATION() => 12,
\pocketmine\item\PotionType::LONG_SLOWNESS() => 13,
\pocketmine\item\PotionType::LONG_SLOW_FALLING() => 14,
\pocketmine\item\PotionType::LONG_STRENGTH() => 15,
\pocketmine\item\PotionType::LONG_SWIFTNESS() => 16,
\pocketmine\item\PotionType::LONG_TURTLE_MASTER() => 17,
\pocketmine\item\PotionType::LONG_WATER_BREATHING() => 18,
\pocketmine\item\PotionType::LONG_WEAKNESS() => 19,
\pocketmine\item\PotionType::MUNDANE() => 20,
\pocketmine\item\PotionType::NIGHT_VISION() => 21,
\pocketmine\item\PotionType::POISON() => 22,
\pocketmine\item\PotionType::REGENERATION() => 23,
\pocketmine\item\PotionType::SLOWNESS() => 24,
\pocketmine\item\PotionType::SLOW_FALLING() => 25,
\pocketmine\item\PotionType::STRENGTH() => 26,
\pocketmine\item\PotionType::STRONG_HARMING() => 27,
\pocketmine\item\PotionType::STRONG_HEALING() => 28,
\pocketmine\item\PotionType::STRONG_LEAPING() => 29,
\pocketmine\item\PotionType::STRONG_POISON() => 30,
\pocketmine\item\PotionType::STRONG_REGENERATION() => 31,
\pocketmine\item\PotionType::STRONG_STRENGTH() => 32,
\pocketmine\item\PotionType::STRONG_SWIFTNESS() => 33,
\pocketmine\item\PotionType::STRONG_TURTLE_MASTER() => 34,
\pocketmine\item\PotionType::SWIFTNESS() => 35,
\pocketmine\item\PotionType::THICK() => 36,
\pocketmine\item\PotionType::TURTLE_MASTER() => 37,
\pocketmine\item\PotionType::WATER() => 38,
\pocketmine\item\PotionType::WATER_BREATHING() => 39,
\pocketmine\item\PotionType::WEAKNESS() => 40,
\pocketmine\item\PotionType::WITHER() => 41,
default => throw new \pocketmine\utils\AssumptionFailedError("All PotionType cases should be covered")
});
}
public static function writeSkullType(RuntimeDataWriter $w, \pocketmine\block\utils\SkullType $value) : void{
$w->writeInt(3, match($value){
\pocketmine\block\utils\SkullType::CREEPER() => 0,

View File

@ -29,6 +29,8 @@ use pocketmine\block\utils\BannerPatternLayer;
use pocketmine\block\utils\DyeColor;
use pocketmine\data\bedrock\BannerPatternTypeIdMap;
use pocketmine\data\bedrock\DyeColorIdMap;
use pocketmine\data\runtime\RuntimeDataWriter;
use pocketmine\data\runtime\RuntimeEnumSerializer;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
@ -62,8 +64,8 @@ class Banner extends ItemBlockWallOrFloor{
return $this;
}
public function getMeta() : int{
return DyeColorIdMap::getInstance()->toInvertedId($this->color);
protected function encodeType(RuntimeDataWriter $w) : void{
RuntimeEnumSerializer::writeDyeColor($w, $this->color);
}
/**

View File

@ -27,24 +27,25 @@ use pocketmine\block\Block;
use pocketmine\block\utils\CoralType;
use pocketmine\block\utils\CoralTypeTrait;
use pocketmine\block\VanillaBlocks;
use pocketmine\data\bedrock\CoralTypeIdMap;
use pocketmine\data\runtime\RuntimeDataWriter;
use pocketmine\math\Axis;
use pocketmine\math\Facing;
final class CoralFan extends Item{
use CoralTypeTrait;
use CoralTypeTrait {
encodeType as encodeCoralType;
}
public function __construct(private ItemIdentifierFlattened $identifierFlattened){
public function __construct(ItemIdentifier $identifier){
$this->coralType = CoralType::TUBE();
parent::__construct($this->identifierFlattened, VanillaBlocks::CORAL_FAN()->getName());
parent::__construct($identifier, VanillaBlocks::CORAL_FAN()->getName());
}
public function getId() : int{
return $this->dead ? $this->identifierFlattened->getAdditionalLegacyIds()[0] : $this->identifierFlattened->getLegacyId();
}
public function getMeta() : int{
return CoralTypeIdMap::getInstance()->toId($this->coralType);
protected function encodeType(RuntimeDataWriter $w) : void{
//this is aliased to ensure a compile error in case the functions in Item or Block start to differ in future
//right now we can directly reuse encodeType from CoralTypeTrait, but that might silently stop working if Item
//were to be altered. CoralTypeTrait was originally intended for blocks, so it's better not to assume anything.
$this->encodeCoralType($w);
}
public function getBlock(?int $clickedFace = null) : Block{

View File

@ -24,7 +24,8 @@ declare(strict_types=1);
namespace pocketmine\item;
use pocketmine\block\utils\DyeColor;
use pocketmine\data\bedrock\DyeColorIdMap;
use pocketmine\data\runtime\RuntimeDataWriter;
use pocketmine\data\runtime\RuntimeEnumSerializer;
class Dye extends Item{
private DyeColor $color;
@ -34,14 +35,8 @@ class Dye extends Item{
parent::__construct($identifier, $name);
}
public function getMeta() : int{
return match($this->color->id()){
DyeColor::BLACK()->id() => 16,
DyeColor::BROWN()->id() => 17,
DyeColor::BLUE()->id() => 18,
DyeColor::WHITE()->id() => 19,
default => DyeColorIdMap::getInstance()->toInvertedId($this->color)
};
protected function encodeType(RuntimeDataWriter $w) : void{
RuntimeEnumSerializer::writeDyeColor($w, $this->color);
}
public function getColor() : DyeColor{

View File

@ -32,6 +32,7 @@ use pocketmine\block\BlockToolType;
use pocketmine\block\VanillaBlocks;
use pocketmine\data\bedrock\EnchantmentIdMap;
use pocketmine\data\bedrock\item\ItemTypeDeserializeException;
use pocketmine\data\runtime\RuntimeDataWriter;
use pocketmine\data\SavedDataLoadingException;
use pocketmine\entity\Entity;
use pocketmine\item\enchantment\EnchantmentInstance;
@ -431,12 +432,14 @@ class Item implements \JsonSerializable{
return $this->identifier->getTypeId();
}
public function getId() : int{
return $this->identifier->getLegacyId();
final public function computeTypeData() : int{
$writer = new RuntimeDataWriter(16); //TODO: max bits should be a constant instead of being hardcoded all over the place
$this->encodeType($writer);
return $writer->getValue();
}
public function getMeta() : int{
return $this->identifier->getLegacyMeta();
protected function encodeType(RuntimeDataWriter $w) : void{
//NOOP
}
/**
@ -547,12 +550,12 @@ class Item implements \JsonSerializable{
/**
* Compares an Item to this Item and check if they match.
*
* @param bool $checkDamage Whether to verify that the damage values match.
* @param bool $checkDamage @deprecated
* @param bool $checkCompound Whether to verify that the items' NBT match.
*/
final public function equals(Item $item, bool $checkDamage = true, bool $checkCompound = true) : bool{
return $this->getId() === $item->getId() &&
(!$checkDamage || $this->getMeta() === $item->getMeta()) &&
return $this->getTypeId() === $item->getTypeId() &&
$this->computeTypeData() === $item->computeTypeData() &&
(!$checkCompound || $this->getNamedTag()->equals($item->getNamedTag()));
}
@ -571,7 +574,7 @@ class Item implements \JsonSerializable{
}
final public function __toString() : string{
return "Item " . $this->name . " (" . $this->getId() . ":" . $this->getMeta() . ")x" . $this->count . ($this->hasNamedTag() ? " tags:0x" . base64_encode((new LittleEndianNbtSerializer())->write(new TreeRoot($this->getNamedTag()))) : "");
return "Item " . $this->name . " (" . $this->getTypeId() . ":" . $this->computeTypeData() . ")x" . $this->count . ($this->hasNamedTag() ? " tags:0x" . base64_encode((new LittleEndianNbtSerializer())->write(new TreeRoot($this->getNamedTag()))) : "");
}
/**

View File

@ -26,6 +26,7 @@ namespace pocketmine\item;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory;
use pocketmine\block\VanillaBlocks;
use pocketmine\data\runtime\RuntimeDataWriter;
/**
* Class used for Items that directly represent blocks, such as stone, dirt, wood etc.
@ -43,6 +44,10 @@ final class ItemBlock extends Item{
$this->blockTypeData = $block->computeTypeData();
}
protected function encodeType(RuntimeDataWriter $w) : void{
$w->writeInt(Block::INTERNAL_STATE_DATA_BITS, $this->blockTypeData);
}
public function getBlock(?int $clickedFace = null) : Block{
//TODO: HACKY MESS, CLEAN IT UP
$factory = BlockFactory::getInstance();

View File

@ -27,8 +27,6 @@ use pocketmine\block\BlockFactory;
use pocketmine\block\utils\RecordType;
use pocketmine\block\utils\TreeType;
use pocketmine\block\VanillaBlocks as Blocks;
use pocketmine\data\bedrock\CompoundTypeIds;
use pocketmine\data\bedrock\EntityLegacyIds;
use pocketmine\entity\Entity;
use pocketmine\entity\Location;
use pocketmine\entity\Squid;
@ -36,7 +34,6 @@ use pocketmine\entity\Villager;
use pocketmine\entity\Zombie;
use pocketmine\inventory\ArmorInventory;
use pocketmine\item\ItemIdentifier as IID;
use pocketmine\item\ItemIds as LegacyIds;
use pocketmine\item\ItemTypeIds as Ids;
use pocketmine\math\Vector3;
use pocketmine\utils\AssumptionFailedError;
@ -58,191 +55,191 @@ class ItemFactory{
$this->registerSpawnEggs();
$this->registerTierToolItems();
$this->register(new Apple(new IID(Ids::APPLE, LegacyIds::APPLE, 0), "Apple"));
$this->register(new Arrow(new IID(Ids::ARROW, LegacyIds::ARROW, 0), "Arrow"));
$this->register(new Apple(new IID(Ids::APPLE), "Apple"));
$this->register(new Arrow(new IID(Ids::ARROW), "Arrow"));
$this->register(new BakedPotato(new IID(Ids::BAKED_POTATO, LegacyIds::BAKED_POTATO, 0), "Baked Potato"));
$this->register(new Bamboo(new IID(Ids::BAMBOO, LegacyIds::BAMBOO, 0), "Bamboo"), true);
$this->register(new Beetroot(new IID(Ids::BEETROOT, LegacyIds::BEETROOT, 0), "Beetroot"));
$this->register(new BeetrootSeeds(new IID(Ids::BEETROOT_SEEDS, LegacyIds::BEETROOT_SEEDS, 0), "Beetroot Seeds"));
$this->register(new BeetrootSoup(new IID(Ids::BEETROOT_SOUP, LegacyIds::BEETROOT_SOUP, 0), "Beetroot Soup"));
$this->register(new BlazeRod(new IID(Ids::BLAZE_ROD, LegacyIds::BLAZE_ROD, 0), "Blaze Rod"));
$this->register(new Book(new IID(Ids::BOOK, LegacyIds::BOOK, 0), "Book"));
$this->register(new Bow(new IID(Ids::BOW, LegacyIds::BOW, 0), "Bow"));
$this->register(new Bowl(new IID(Ids::BOWL, LegacyIds::BOWL, 0), "Bowl"));
$this->register(new Bread(new IID(Ids::BREAD, LegacyIds::BREAD, 0), "Bread"));
$this->register(new Bucket(new IID(Ids::BUCKET, LegacyIds::BUCKET, 0), "Bucket"));
$this->register(new Carrot(new IID(Ids::CARROT, LegacyIds::CARROT, 0), "Carrot"));
$this->register(new ChorusFruit(new IID(Ids::CHORUS_FRUIT, LegacyIds::CHORUS_FRUIT, 0), "Chorus Fruit"));
$this->register(new Clock(new IID(Ids::CLOCK, LegacyIds::CLOCK, 0), "Clock"));
$this->register(new Clownfish(new IID(Ids::CLOWNFISH, LegacyIds::CLOWNFISH, 0), "Clownfish"));
$this->register(new Coal(new IID(Ids::COAL, LegacyIds::COAL, 0), "Coal"));
$this->register(new BakedPotato(new IID(Ids::BAKED_POTATO), "Baked Potato"));
$this->register(new Bamboo(new IID(Ids::BAMBOO), "Bamboo"), true);
$this->register(new Beetroot(new IID(Ids::BEETROOT), "Beetroot"));
$this->register(new BeetrootSeeds(new IID(Ids::BEETROOT_SEEDS), "Beetroot Seeds"));
$this->register(new BeetrootSoup(new IID(Ids::BEETROOT_SOUP), "Beetroot Soup"));
$this->register(new BlazeRod(new IID(Ids::BLAZE_ROD), "Blaze Rod"));
$this->register(new Book(new IID(Ids::BOOK), "Book"));
$this->register(new Bow(new IID(Ids::BOW), "Bow"));
$this->register(new Bowl(new IID(Ids::BOWL), "Bowl"));
$this->register(new Bread(new IID(Ids::BREAD), "Bread"));
$this->register(new Bucket(new IID(Ids::BUCKET), "Bucket"));
$this->register(new Carrot(new IID(Ids::CARROT), "Carrot"));
$this->register(new ChorusFruit(new IID(Ids::CHORUS_FRUIT), "Chorus Fruit"));
$this->register(new Clock(new IID(Ids::CLOCK), "Clock"));
$this->register(new Clownfish(new IID(Ids::CLOWNFISH), "Clownfish"));
$this->register(new Coal(new IID(Ids::COAL), "Coal"));
$this->register(new CoralFan(new ItemIdentifierFlattened(Ids::CORAL_FAN, LegacyIds::CORAL_FAN, 0, [LegacyIds::CORAL_FAN_DEAD])));
$this->register(new CoralFan(new IID(Ids::CORAL_FAN)));
$this->register(new Coal(new IID(Ids::CHARCOAL, LegacyIds::COAL, 1), "Charcoal"));
$this->register(new CocoaBeans(new IID(Ids::COCOA_BEANS, LegacyIds::DYE, 3), "Cocoa Beans"));
$this->register(new Compass(new IID(Ids::COMPASS, LegacyIds::COMPASS, 0), "Compass"));
$this->register(new CookedChicken(new IID(Ids::COOKED_CHICKEN, LegacyIds::COOKED_CHICKEN, 0), "Cooked Chicken"));
$this->register(new CookedFish(new IID(Ids::COOKED_FISH, LegacyIds::COOKED_FISH, 0), "Cooked Fish"));
$this->register(new CookedMutton(new IID(Ids::COOKED_MUTTON, LegacyIds::COOKED_MUTTON, 0), "Cooked Mutton"));
$this->register(new CookedPorkchop(new IID(Ids::COOKED_PORKCHOP, LegacyIds::COOKED_PORKCHOP, 0), "Cooked Porkchop"));
$this->register(new CookedRabbit(new IID(Ids::COOKED_RABBIT, LegacyIds::COOKED_RABBIT, 0), "Cooked Rabbit"));
$this->register(new CookedSalmon(new IID(Ids::COOKED_SALMON, LegacyIds::COOKED_SALMON, 0), "Cooked Salmon"));
$this->register(new Cookie(new IID(Ids::COOKIE, LegacyIds::COOKIE, 0), "Cookie"));
$this->register(new DriedKelp(new IID(Ids::DRIED_KELP, LegacyIds::DRIED_KELP, 0), "Dried Kelp"));
$this->register(new Egg(new IID(Ids::EGG, LegacyIds::EGG, 0), "Egg"));
$this->register(new EnderPearl(new IID(Ids::ENDER_PEARL, LegacyIds::ENDER_PEARL, 0), "Ender Pearl"));
$this->register(new ExperienceBottle(new IID(Ids::EXPERIENCE_BOTTLE, LegacyIds::EXPERIENCE_BOTTLE, 0), "Bottle o' Enchanting"));
$this->register(new Fertilizer(new IID(Ids::BONE_MEAL, LegacyIds::DYE, 15), "Bone Meal"));
$this->register(new FishingRod(new IID(Ids::FISHING_ROD, LegacyIds::FISHING_ROD, 0), "Fishing Rod"));
$this->register(new FlintSteel(new IID(Ids::FLINT_AND_STEEL, LegacyIds::FLINT_STEEL, 0), "Flint and Steel"));
$this->register(new GlassBottle(new IID(Ids::GLASS_BOTTLE, LegacyIds::GLASS_BOTTLE, 0), "Glass Bottle"));
$this->register(new GoldenApple(new IID(Ids::GOLDEN_APPLE, LegacyIds::GOLDEN_APPLE, 0), "Golden Apple"));
$this->register(new GoldenAppleEnchanted(new IID(Ids::ENCHANTED_GOLDEN_APPLE, LegacyIds::ENCHANTED_GOLDEN_APPLE, 0), "Enchanted Golden Apple"));
$this->register(new GoldenCarrot(new IID(Ids::GOLDEN_CARROT, LegacyIds::GOLDEN_CARROT, 0), "Golden Carrot"));
$this->register(new Item(new IID(Ids::BLAZE_POWDER, LegacyIds::BLAZE_POWDER, 0), "Blaze Powder"));
$this->register(new Item(new IID(Ids::BLEACH, LegacyIds::BLEACH, 0), "Bleach")); //EDU
$this->register(new Item(new IID(Ids::BONE, LegacyIds::BONE, 0), "Bone"));
$this->register(new Item(new IID(Ids::BRICK, LegacyIds::BRICK, 0), "Brick"));
$this->register(new Item(new IID(Ids::POPPED_CHORUS_FRUIT, LegacyIds::CHORUS_FRUIT_POPPED, 0), "Popped Chorus Fruit"));
$this->register(new Item(new IID(Ids::CLAY, LegacyIds::CLAY_BALL, 0), "Clay"));
$this->register(new Item(new IID(Ids::CHEMICAL_SALT, LegacyIds::COMPOUND, CompoundTypeIds::SALT), "Salt"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_OXIDE, LegacyIds::COMPOUND, CompoundTypeIds::SODIUM_OXIDE), "Sodium Oxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_HYDROXIDE, LegacyIds::COMPOUND, CompoundTypeIds::SODIUM_HYDROXIDE), "Sodium Hydroxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_MAGNESIUM_NITRATE, LegacyIds::COMPOUND, CompoundTypeIds::MAGNESIUM_NITRATE), "Magnesium Nitrate"));
$this->register(new Item(new IID(Ids::CHEMICAL_IRON_SULPHIDE, LegacyIds::COMPOUND, CompoundTypeIds::IRON_SULPHIDE), "Iron Sulphide"));
$this->register(new Item(new IID(Ids::CHEMICAL_LITHIUM_HYDRIDE, LegacyIds::COMPOUND, CompoundTypeIds::LITHIUM_HYDRIDE), "Lithium Hydride"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_HYDRIDE, LegacyIds::COMPOUND, CompoundTypeIds::SODIUM_HYDRIDE), "Sodium Hydride"));
$this->register(new Item(new IID(Ids::CHEMICAL_CALCIUM_BROMIDE, LegacyIds::COMPOUND, CompoundTypeIds::CALCIUM_BROMIDE), "Calcium Bromide"));
$this->register(new Item(new IID(Ids::CHEMICAL_MAGNESIUM_OXIDE, LegacyIds::COMPOUND, CompoundTypeIds::MAGNESIUM_OXIDE), "Magnesium Oxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_ACETATE, LegacyIds::COMPOUND, CompoundTypeIds::SODIUM_ACETATE), "Sodium Acetate"));
$this->register(new Item(new IID(Ids::CHEMICAL_LUMINOL, LegacyIds::COMPOUND, CompoundTypeIds::LUMINOL), "Luminol"));
$this->register(new Item(new IID(Ids::CHEMICAL_CHARCOAL, LegacyIds::COMPOUND, CompoundTypeIds::CHARCOAL), "Charcoal")); //??? maybe bug
$this->register(new Item(new IID(Ids::CHEMICAL_SUGAR, LegacyIds::COMPOUND, CompoundTypeIds::SUGAR), "Sugar")); //??? maybe bug
$this->register(new Item(new IID(Ids::CHEMICAL_ALUMINIUM_OXIDE, LegacyIds::COMPOUND, CompoundTypeIds::ALUMINIUM_OXIDE), "Aluminium Oxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_BORON_TRIOXIDE, LegacyIds::COMPOUND, CompoundTypeIds::BORON_TRIOXIDE), "Boron Trioxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_SOAP, LegacyIds::COMPOUND, CompoundTypeIds::SOAP), "Soap"));
$this->register(new Item(new IID(Ids::CHEMICAL_POLYETHYLENE, LegacyIds::COMPOUND, CompoundTypeIds::POLYETHYLENE), "Polyethylene"));
$this->register(new Item(new IID(Ids::CHEMICAL_RUBBISH, LegacyIds::COMPOUND, CompoundTypeIds::RUBBISH), "Rubbish"));
$this->register(new Item(new IID(Ids::CHEMICAL_MAGNESIUM_SALTS, LegacyIds::COMPOUND, CompoundTypeIds::MAGNESIUM_SALTS), "Magnesium Salts"));
$this->register(new Item(new IID(Ids::CHEMICAL_SULPHATE, LegacyIds::COMPOUND, CompoundTypeIds::SULPHATE), "Sulphate"));
$this->register(new Item(new IID(Ids::CHEMICAL_BARIUM_SULPHATE, LegacyIds::COMPOUND, CompoundTypeIds::BARIUM_SULPHATE), "Barium Sulphate"));
$this->register(new Item(new IID(Ids::CHEMICAL_POTASSIUM_CHLORIDE, LegacyIds::COMPOUND, CompoundTypeIds::POTASSIUM_CHLORIDE), "Potassium Chloride"));
$this->register(new Item(new IID(Ids::CHEMICAL_MERCURIC_CHLORIDE, LegacyIds::COMPOUND, CompoundTypeIds::MERCURIC_CHLORIDE), "Mercuric Chloride"));
$this->register(new Item(new IID(Ids::CHEMICAL_CERIUM_CHLORIDE, LegacyIds::COMPOUND, CompoundTypeIds::CERIUM_CHLORIDE), "Cerium Chloride"));
$this->register(new Item(new IID(Ids::CHEMICAL_TUNGSTEN_CHLORIDE, LegacyIds::COMPOUND, CompoundTypeIds::TUNGSTEN_CHLORIDE), "Tungsten Chloride"));
$this->register(new Item(new IID(Ids::CHEMICAL_CALCIUM_CHLORIDE, LegacyIds::COMPOUND, CompoundTypeIds::CALCIUM_CHLORIDE), "Calcium Chloride"));
$this->register(new Item(new IID(Ids::CHEMICAL_WATER, LegacyIds::COMPOUND, CompoundTypeIds::WATER), "Water")); //???
$this->register(new Item(new IID(Ids::CHEMICAL_GLUE, LegacyIds::COMPOUND, CompoundTypeIds::GLUE), "Glue"));
$this->register(new Item(new IID(Ids::CHEMICAL_HYPOCHLORITE, LegacyIds::COMPOUND, CompoundTypeIds::HYPOCHLORITE), "Hypochlorite"));
$this->register(new Item(new IID(Ids::CHEMICAL_CRUDE_OIL, LegacyIds::COMPOUND, CompoundTypeIds::CRUDE_OIL), "Crude Oil"));
$this->register(new Item(new IID(Ids::CHEMICAL_LATEX, LegacyIds::COMPOUND, CompoundTypeIds::LATEX), "Latex"));
$this->register(new Item(new IID(Ids::CHEMICAL_POTASSIUM_IODIDE, LegacyIds::COMPOUND, CompoundTypeIds::POTASSIUM_IODIDE), "Potassium Iodide"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_FLUORIDE, LegacyIds::COMPOUND, CompoundTypeIds::SODIUM_FLUORIDE), "Sodium Fluoride"));
$this->register(new Item(new IID(Ids::CHEMICAL_BENZENE, LegacyIds::COMPOUND, CompoundTypeIds::BENZENE), "Benzene"));
$this->register(new Item(new IID(Ids::CHEMICAL_INK, LegacyIds::COMPOUND, CompoundTypeIds::INK), "Ink"));
$this->register(new Item(new IID(Ids::CHEMICAL_HYDROGEN_PEROXIDE, LegacyIds::COMPOUND, CompoundTypeIds::HYDROGEN_PEROXIDE), "Hydrogen Peroxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_AMMONIA, LegacyIds::COMPOUND, CompoundTypeIds::AMMONIA), "Ammonia"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_HYPOCHLORITE, LegacyIds::COMPOUND, CompoundTypeIds::SODIUM_HYPOCHLORITE), "Sodium Hypochlorite"));
$this->register(new Item(new IID(Ids::DIAMOND, LegacyIds::DIAMOND, 0), "Diamond"));
$this->register(new Item(new IID(Ids::DRAGON_BREATH, LegacyIds::DRAGON_BREATH, 0), "Dragon's Breath"));
$this->register(new Item(new IID(Ids::INK_SAC, LegacyIds::DYE, 0), "Ink Sac"));
$this->register(new Item(new IID(Ids::LAPIS_LAZULI, LegacyIds::DYE, 4), "Lapis Lazuli"));
$this->register(new Item(new IID(Ids::EMERALD, LegacyIds::EMERALD, 0), "Emerald"));
$this->register(new Item(new IID(Ids::FEATHER, LegacyIds::FEATHER, 0), "Feather"));
$this->register(new Item(new IID(Ids::FERMENTED_SPIDER_EYE, LegacyIds::FERMENTED_SPIDER_EYE, 0), "Fermented Spider Eye"));
$this->register(new Item(new IID(Ids::FLINT, LegacyIds::FLINT, 0), "Flint"));
$this->register(new Item(new IID(Ids::GHAST_TEAR, LegacyIds::GHAST_TEAR, 0), "Ghast Tear"));
$this->register(new Item(new IID(Ids::GLISTERING_MELON, LegacyIds::GLISTERING_MELON, 0), "Glistering Melon"));
$this->register(new Item(new IID(Ids::GLOWSTONE_DUST, LegacyIds::GLOWSTONE_DUST, 0), "Glowstone Dust"));
$this->register(new Item(new IID(Ids::GOLD_INGOT, LegacyIds::GOLD_INGOT, 0), "Gold Ingot"));
$this->register(new Item(new IID(Ids::GOLD_NUGGET, LegacyIds::GOLD_NUGGET, 0), "Gold Nugget"));
$this->register(new Item(new IID(Ids::GUNPOWDER, LegacyIds::GUNPOWDER, 0), "Gunpowder"));
$this->register(new Item(new IID(Ids::HEART_OF_THE_SEA, LegacyIds::HEART_OF_THE_SEA, 0), "Heart of the Sea"));
$this->register(new Item(new IID(Ids::IRON_INGOT, LegacyIds::IRON_INGOT, 0), "Iron Ingot"));
$this->register(new Item(new IID(Ids::IRON_NUGGET, LegacyIds::IRON_NUGGET, 0), "Iron Nugget"));
$this->register(new Item(new IID(Ids::LEATHER, LegacyIds::LEATHER, 0), "Leather"));
$this->register(new Item(new IID(Ids::MAGMA_CREAM, LegacyIds::MAGMA_CREAM, 0), "Magma Cream"));
$this->register(new Item(new IID(Ids::NAUTILUS_SHELL, LegacyIds::NAUTILUS_SHELL, 0), "Nautilus Shell"));
$this->register(new Item(new IID(Ids::NETHER_BRICK, LegacyIds::NETHER_BRICK, 0), "Nether Brick"));
$this->register(new Item(new IID(Ids::NETHER_QUARTZ, LegacyIds::NETHER_QUARTZ, 0), "Nether Quartz"));
$this->register(new Item(new IID(Ids::NETHER_STAR, LegacyIds::NETHER_STAR, 0), "Nether Star"));
$this->register(new Item(new IID(Ids::PAPER, LegacyIds::PAPER, 0), "Paper"));
$this->register(new Item(new IID(Ids::PRISMARINE_CRYSTALS, LegacyIds::PRISMARINE_CRYSTALS, 0), "Prismarine Crystals"));
$this->register(new Item(new IID(Ids::PRISMARINE_SHARD, LegacyIds::PRISMARINE_SHARD, 0), "Prismarine Shard"));
$this->register(new Item(new IID(Ids::RABBIT_FOOT, LegacyIds::RABBIT_FOOT, 0), "Rabbit's Foot"));
$this->register(new Item(new IID(Ids::RABBIT_HIDE, LegacyIds::RABBIT_HIDE, 0), "Rabbit Hide"));
$this->register(new Item(new IID(Ids::SHULKER_SHELL, LegacyIds::SHULKER_SHELL, 0), "Shulker Shell"));
$this->register(new Item(new IID(Ids::SLIMEBALL, LegacyIds::SLIME_BALL, 0), "Slimeball"));
$this->register(new Item(new IID(Ids::SUGAR, LegacyIds::SUGAR, 0), "Sugar"));
$this->register(new Item(new IID(Ids::SCUTE, LegacyIds::TURTLE_SHELL_PIECE, 0), "Scute"));
$this->register(new Item(new IID(Ids::WHEAT, LegacyIds::WHEAT, 0), "Wheat"));
$this->register(new Coal(new IID(Ids::CHARCOAL), "Charcoal"));
$this->register(new CocoaBeans(new IID(Ids::COCOA_BEANS), "Cocoa Beans"));
$this->register(new Compass(new IID(Ids::COMPASS), "Compass"));
$this->register(new CookedChicken(new IID(Ids::COOKED_CHICKEN), "Cooked Chicken"));
$this->register(new CookedFish(new IID(Ids::COOKED_FISH), "Cooked Fish"));
$this->register(new CookedMutton(new IID(Ids::COOKED_MUTTON), "Cooked Mutton"));
$this->register(new CookedPorkchop(new IID(Ids::COOKED_PORKCHOP), "Cooked Porkchop"));
$this->register(new CookedRabbit(new IID(Ids::COOKED_RABBIT), "Cooked Rabbit"));
$this->register(new CookedSalmon(new IID(Ids::COOKED_SALMON), "Cooked Salmon"));
$this->register(new Cookie(new IID(Ids::COOKIE), "Cookie"));
$this->register(new DriedKelp(new IID(Ids::DRIED_KELP), "Dried Kelp"));
$this->register(new Egg(new IID(Ids::EGG), "Egg"));
$this->register(new EnderPearl(new IID(Ids::ENDER_PEARL), "Ender Pearl"));
$this->register(new ExperienceBottle(new IID(Ids::EXPERIENCE_BOTTLE), "Bottle o' Enchanting"));
$this->register(new Fertilizer(new IID(Ids::BONE_MEAL), "Bone Meal"));
$this->register(new FishingRod(new IID(Ids::FISHING_ROD), "Fishing Rod"));
$this->register(new FlintSteel(new IID(Ids::FLINT_AND_STEEL), "Flint and Steel"));
$this->register(new GlassBottle(new IID(Ids::GLASS_BOTTLE), "Glass Bottle"));
$this->register(new GoldenApple(new IID(Ids::GOLDEN_APPLE), "Golden Apple"));
$this->register(new GoldenAppleEnchanted(new IID(Ids::ENCHANTED_GOLDEN_APPLE), "Enchanted Golden Apple"));
$this->register(new GoldenCarrot(new IID(Ids::GOLDEN_CARROT), "Golden Carrot"));
$this->register(new Item(new IID(Ids::BLAZE_POWDER), "Blaze Powder"));
$this->register(new Item(new IID(Ids::BLEACH), "Bleach")); //EDU
$this->register(new Item(new IID(Ids::BONE), "Bone"));
$this->register(new Item(new IID(Ids::BRICK), "Brick"));
$this->register(new Item(new IID(Ids::POPPED_CHORUS_FRUIT), "Popped Chorus Fruit"));
$this->register(new Item(new IID(Ids::CLAY), "Clay"));
$this->register(new Item(new IID(Ids::CHEMICAL_SALT), "Salt"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_OXIDE), "Sodium Oxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_HYDROXIDE), "Sodium Hydroxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_MAGNESIUM_NITRATE), "Magnesium Nitrate"));
$this->register(new Item(new IID(Ids::CHEMICAL_IRON_SULPHIDE), "Iron Sulphide"));
$this->register(new Item(new IID(Ids::CHEMICAL_LITHIUM_HYDRIDE), "Lithium Hydride"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_HYDRIDE), "Sodium Hydride"));
$this->register(new Item(new IID(Ids::CHEMICAL_CALCIUM_BROMIDE), "Calcium Bromide"));
$this->register(new Item(new IID(Ids::CHEMICAL_MAGNESIUM_OXIDE), "Magnesium Oxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_ACETATE), "Sodium Acetate"));
$this->register(new Item(new IID(Ids::CHEMICAL_LUMINOL), "Luminol"));
$this->register(new Item(new IID(Ids::CHEMICAL_CHARCOAL), "Charcoal")); //??? maybe bug
$this->register(new Item(new IID(Ids::CHEMICAL_SUGAR), "Sugar")); //??? maybe bug
$this->register(new Item(new IID(Ids::CHEMICAL_ALUMINIUM_OXIDE), "Aluminium Oxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_BORON_TRIOXIDE), "Boron Trioxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_SOAP), "Soap"));
$this->register(new Item(new IID(Ids::CHEMICAL_POLYETHYLENE), "Polyethylene"));
$this->register(new Item(new IID(Ids::CHEMICAL_RUBBISH), "Rubbish"));
$this->register(new Item(new IID(Ids::CHEMICAL_MAGNESIUM_SALTS), "Magnesium Salts"));
$this->register(new Item(new IID(Ids::CHEMICAL_SULPHATE), "Sulphate"));
$this->register(new Item(new IID(Ids::CHEMICAL_BARIUM_SULPHATE), "Barium Sulphate"));
$this->register(new Item(new IID(Ids::CHEMICAL_POTASSIUM_CHLORIDE), "Potassium Chloride"));
$this->register(new Item(new IID(Ids::CHEMICAL_MERCURIC_CHLORIDE), "Mercuric Chloride"));
$this->register(new Item(new IID(Ids::CHEMICAL_CERIUM_CHLORIDE), "Cerium Chloride"));
$this->register(new Item(new IID(Ids::CHEMICAL_TUNGSTEN_CHLORIDE), "Tungsten Chloride"));
$this->register(new Item(new IID(Ids::CHEMICAL_CALCIUM_CHLORIDE), "Calcium Chloride"));
$this->register(new Item(new IID(Ids::CHEMICAL_WATER), "Water")); //???
$this->register(new Item(new IID(Ids::CHEMICAL_GLUE), "Glue"));
$this->register(new Item(new IID(Ids::CHEMICAL_HYPOCHLORITE), "Hypochlorite"));
$this->register(new Item(new IID(Ids::CHEMICAL_CRUDE_OIL), "Crude Oil"));
$this->register(new Item(new IID(Ids::CHEMICAL_LATEX), "Latex"));
$this->register(new Item(new IID(Ids::CHEMICAL_POTASSIUM_IODIDE), "Potassium Iodide"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_FLUORIDE), "Sodium Fluoride"));
$this->register(new Item(new IID(Ids::CHEMICAL_BENZENE), "Benzene"));
$this->register(new Item(new IID(Ids::CHEMICAL_INK), "Ink"));
$this->register(new Item(new IID(Ids::CHEMICAL_HYDROGEN_PEROXIDE), "Hydrogen Peroxide"));
$this->register(new Item(new IID(Ids::CHEMICAL_AMMONIA), "Ammonia"));
$this->register(new Item(new IID(Ids::CHEMICAL_SODIUM_HYPOCHLORITE), "Sodium Hypochlorite"));
$this->register(new Item(new IID(Ids::DIAMOND), "Diamond"));
$this->register(new Item(new IID(Ids::DRAGON_BREATH), "Dragon's Breath"));
$this->register(new Item(new IID(Ids::INK_SAC), "Ink Sac"));
$this->register(new Item(new IID(Ids::LAPIS_LAZULI), "Lapis Lazuli"));
$this->register(new Item(new IID(Ids::EMERALD), "Emerald"));
$this->register(new Item(new IID(Ids::FEATHER), "Feather"));
$this->register(new Item(new IID(Ids::FERMENTED_SPIDER_EYE), "Fermented Spider Eye"));
$this->register(new Item(new IID(Ids::FLINT), "Flint"));
$this->register(new Item(new IID(Ids::GHAST_TEAR), "Ghast Tear"));
$this->register(new Item(new IID(Ids::GLISTERING_MELON), "Glistering Melon"));
$this->register(new Item(new IID(Ids::GLOWSTONE_DUST), "Glowstone Dust"));
$this->register(new Item(new IID(Ids::GOLD_INGOT), "Gold Ingot"));
$this->register(new Item(new IID(Ids::GOLD_NUGGET), "Gold Nugget"));
$this->register(new Item(new IID(Ids::GUNPOWDER), "Gunpowder"));
$this->register(new Item(new IID(Ids::HEART_OF_THE_SEA), "Heart of the Sea"));
$this->register(new Item(new IID(Ids::IRON_INGOT), "Iron Ingot"));
$this->register(new Item(new IID(Ids::IRON_NUGGET), "Iron Nugget"));
$this->register(new Item(new IID(Ids::LEATHER), "Leather"));
$this->register(new Item(new IID(Ids::MAGMA_CREAM), "Magma Cream"));
$this->register(new Item(new IID(Ids::NAUTILUS_SHELL), "Nautilus Shell"));
$this->register(new Item(new IID(Ids::NETHER_BRICK), "Nether Brick"));
$this->register(new Item(new IID(Ids::NETHER_QUARTZ), "Nether Quartz"));
$this->register(new Item(new IID(Ids::NETHER_STAR), "Nether Star"));
$this->register(new Item(new IID(Ids::PAPER), "Paper"));
$this->register(new Item(new IID(Ids::PRISMARINE_CRYSTALS), "Prismarine Crystals"));
$this->register(new Item(new IID(Ids::PRISMARINE_SHARD), "Prismarine Shard"));
$this->register(new Item(new IID(Ids::RABBIT_FOOT), "Rabbit's Foot"));
$this->register(new Item(new IID(Ids::RABBIT_HIDE), "Rabbit Hide"));
$this->register(new Item(new IID(Ids::SHULKER_SHELL), "Shulker Shell"));
$this->register(new Item(new IID(Ids::SLIMEBALL), "Slimeball"));
$this->register(new Item(new IID(Ids::SUGAR), "Sugar"));
$this->register(new Item(new IID(Ids::SCUTE), "Scute"));
$this->register(new Item(new IID(Ids::WHEAT), "Wheat"));
//the meta values for buckets are intentionally hardcoded because block IDs will change in the future
$this->register(new LiquidBucket(new IID(Ids::WATER_BUCKET, LegacyIds::BUCKET, 8), "Water Bucket", Blocks::WATER()));
$this->register(new LiquidBucket(new IID(Ids::LAVA_BUCKET, LegacyIds::BUCKET, 10), "Lava Bucket", Blocks::LAVA()));
$this->register(new Melon(new IID(Ids::MELON, LegacyIds::MELON, 0), "Melon"));
$this->register(new MelonSeeds(new IID(Ids::MELON_SEEDS, LegacyIds::MELON_SEEDS, 0), "Melon Seeds"));
$this->register(new MilkBucket(new IID(Ids::MILK_BUCKET, LegacyIds::BUCKET, 1), "Milk Bucket"));
$this->register(new Minecart(new IID(Ids::MINECART, LegacyIds::MINECART, 0), "Minecart"));
$this->register(new MushroomStew(new IID(Ids::MUSHROOM_STEW, LegacyIds::MUSHROOM_STEW, 0), "Mushroom Stew"));
$this->register(new PaintingItem(new IID(Ids::PAINTING, LegacyIds::PAINTING, 0), "Painting"));
$this->register(new PoisonousPotato(new IID(Ids::POISONOUS_POTATO, LegacyIds::POISONOUS_POTATO, 0), "Poisonous Potato"));
$this->register(new Potato(new IID(Ids::POTATO, LegacyIds::POTATO, 0), "Potato"));
$this->register(new Pufferfish(new IID(Ids::PUFFERFISH, LegacyIds::PUFFERFISH, 0), "Pufferfish"));
$this->register(new PumpkinPie(new IID(Ids::PUMPKIN_PIE, LegacyIds::PUMPKIN_PIE, 0), "Pumpkin Pie"));
$this->register(new PumpkinSeeds(new IID(Ids::PUMPKIN_SEEDS, LegacyIds::PUMPKIN_SEEDS, 0), "Pumpkin Seeds"));
$this->register(new RabbitStew(new IID(Ids::RABBIT_STEW, LegacyIds::RABBIT_STEW, 0), "Rabbit Stew"));
$this->register(new RawBeef(new IID(Ids::RAW_BEEF, LegacyIds::RAW_BEEF, 0), "Raw Beef"));
$this->register(new RawChicken(new IID(Ids::RAW_CHICKEN, LegacyIds::RAW_CHICKEN, 0), "Raw Chicken"));
$this->register(new RawFish(new IID(Ids::RAW_FISH, LegacyIds::RAW_FISH, 0), "Raw Fish"));
$this->register(new RawMutton(new IID(Ids::RAW_MUTTON, LegacyIds::RAW_MUTTON, 0), "Raw Mutton"));
$this->register(new RawPorkchop(new IID(Ids::RAW_PORKCHOP, LegacyIds::RAW_PORKCHOP, 0), "Raw Porkchop"));
$this->register(new RawRabbit(new IID(Ids::RAW_RABBIT, LegacyIds::RAW_RABBIT, 0), "Raw Rabbit"));
$this->register(new RawSalmon(new IID(Ids::RAW_SALMON, LegacyIds::RAW_SALMON, 0), "Raw Salmon"));
$this->register(new Record(new IID(Ids::RECORD_13, LegacyIds::RECORD_13, 0), RecordType::DISK_13(), "Record 13"));
$this->register(new Record(new IID(Ids::RECORD_CAT, LegacyIds::RECORD_CAT, 0), RecordType::DISK_CAT(), "Record Cat"));
$this->register(new Record(new IID(Ids::RECORD_BLOCKS, LegacyIds::RECORD_BLOCKS, 0), RecordType::DISK_BLOCKS(), "Record Blocks"));
$this->register(new Record(new IID(Ids::RECORD_CHIRP, LegacyIds::RECORD_CHIRP, 0), RecordType::DISK_CHIRP(), "Record Chirp"));
$this->register(new Record(new IID(Ids::RECORD_FAR, LegacyIds::RECORD_FAR, 0), RecordType::DISK_FAR(), "Record Far"));
$this->register(new Record(new IID(Ids::RECORD_MALL, LegacyIds::RECORD_MALL, 0), RecordType::DISK_MALL(), "Record Mall"));
$this->register(new Record(new IID(Ids::RECORD_MELLOHI, LegacyIds::RECORD_MELLOHI, 0), RecordType::DISK_MELLOHI(), "Record Mellohi"));
$this->register(new Record(new IID(Ids::RECORD_STAL, LegacyIds::RECORD_STAL, 0), RecordType::DISK_STAL(), "Record Stal"));
$this->register(new Record(new IID(Ids::RECORD_STRAD, LegacyIds::RECORD_STRAD, 0), RecordType::DISK_STRAD(), "Record Strad"));
$this->register(new Record(new IID(Ids::RECORD_WARD, LegacyIds::RECORD_WARD, 0), RecordType::DISK_WARD(), "Record Ward"));
$this->register(new Record(new IID(Ids::RECORD_11, LegacyIds::RECORD_11, 0), RecordType::DISK_11(), "Record 11"));
$this->register(new Record(new IID(Ids::RECORD_WAIT, LegacyIds::RECORD_WAIT, 0), RecordType::DISK_WAIT(), "Record Wait"));
$this->register(new Redstone(new IID(Ids::REDSTONE_DUST, LegacyIds::REDSTONE, 0), "Redstone"));
$this->register(new RottenFlesh(new IID(Ids::ROTTEN_FLESH, LegacyIds::ROTTEN_FLESH, 0), "Rotten Flesh"));
$this->register(new Shears(new IID(Ids::SHEARS, LegacyIds::SHEARS, 0), "Shears"));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::OAK_SIGN, LegacyIds::SIGN, 0), Blocks::OAK_SIGN(), Blocks::OAK_WALL_SIGN()));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::SPRUCE_SIGN, LegacyIds::SPRUCE_SIGN, 0), Blocks::SPRUCE_SIGN(), Blocks::SPRUCE_WALL_SIGN()));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::BIRCH_SIGN, LegacyIds::BIRCH_SIGN, 0), Blocks::BIRCH_SIGN(), Blocks::BIRCH_WALL_SIGN()));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::JUNGLE_SIGN, LegacyIds::JUNGLE_SIGN, 0), Blocks::JUNGLE_SIGN(), Blocks::JUNGLE_WALL_SIGN()));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::ACACIA_SIGN, LegacyIds::ACACIA_SIGN, 0), Blocks::ACACIA_SIGN(), Blocks::ACACIA_WALL_SIGN()));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::DARK_OAK_SIGN, LegacyIds::DARKOAK_SIGN, 0), Blocks::DARK_OAK_SIGN(), Blocks::DARK_OAK_WALL_SIGN()));
$this->register(new Snowball(new IID(Ids::SNOWBALL, LegacyIds::SNOWBALL, 0), "Snowball"));
$this->register(new SpiderEye(new IID(Ids::SPIDER_EYE, LegacyIds::SPIDER_EYE, 0), "Spider Eye"));
$this->register(new Steak(new IID(Ids::STEAK, LegacyIds::STEAK, 0), "Steak"));
$this->register(new Stick(new IID(Ids::STICK, LegacyIds::STICK, 0), "Stick"));
$this->register(new StringItem(new IID(Ids::STRING, LegacyIds::STRING, 0), "String"));
$this->register(new SweetBerries(new IID(Ids::SWEET_BERRIES, LegacyIds::SWEET_BERRIES, 0), "Sweet Berries"));
$this->register(new Totem(new IID(Ids::TOTEM, LegacyIds::TOTEM, 0), "Totem of Undying"));
$this->register(new WheatSeeds(new IID(Ids::WHEAT_SEEDS, LegacyIds::WHEAT_SEEDS, 0), "Wheat Seeds"));
$this->register(new WritableBook(new IID(Ids::WRITABLE_BOOK, LegacyIds::WRITABLE_BOOK, 0), "Book & Quill"));
$this->register(new WrittenBook(new IID(Ids::WRITTEN_BOOK, LegacyIds::WRITTEN_BOOK, 0), "Written Book"));
$this->register(new LiquidBucket(new IID(Ids::WATER_BUCKET), "Water Bucket", Blocks::WATER()));
$this->register(new LiquidBucket(new IID(Ids::LAVA_BUCKET), "Lava Bucket", Blocks::LAVA()));
$this->register(new Melon(new IID(Ids::MELON), "Melon"));
$this->register(new MelonSeeds(new IID(Ids::MELON_SEEDS), "Melon Seeds"));
$this->register(new MilkBucket(new IID(Ids::MILK_BUCKET), "Milk Bucket"));
$this->register(new Minecart(new IID(Ids::MINECART), "Minecart"));
$this->register(new MushroomStew(new IID(Ids::MUSHROOM_STEW), "Mushroom Stew"));
$this->register(new PaintingItem(new IID(Ids::PAINTING), "Painting"));
$this->register(new PoisonousPotato(new IID(Ids::POISONOUS_POTATO), "Poisonous Potato"));
$this->register(new Potato(new IID(Ids::POTATO), "Potato"));
$this->register(new Pufferfish(new IID(Ids::PUFFERFISH), "Pufferfish"));
$this->register(new PumpkinPie(new IID(Ids::PUMPKIN_PIE), "Pumpkin Pie"));
$this->register(new PumpkinSeeds(new IID(Ids::PUMPKIN_SEEDS), "Pumpkin Seeds"));
$this->register(new RabbitStew(new IID(Ids::RABBIT_STEW), "Rabbit Stew"));
$this->register(new RawBeef(new IID(Ids::RAW_BEEF), "Raw Beef"));
$this->register(new RawChicken(new IID(Ids::RAW_CHICKEN), "Raw Chicken"));
$this->register(new RawFish(new IID(Ids::RAW_FISH), "Raw Fish"));
$this->register(new RawMutton(new IID(Ids::RAW_MUTTON), "Raw Mutton"));
$this->register(new RawPorkchop(new IID(Ids::RAW_PORKCHOP), "Raw Porkchop"));
$this->register(new RawRabbit(new IID(Ids::RAW_RABBIT), "Raw Rabbit"));
$this->register(new RawSalmon(new IID(Ids::RAW_SALMON), "Raw Salmon"));
$this->register(new Record(new IID(Ids::RECORD_13), RecordType::DISK_13(), "Record 13"));
$this->register(new Record(new IID(Ids::RECORD_CAT), RecordType::DISK_CAT(), "Record Cat"));
$this->register(new Record(new IID(Ids::RECORD_BLOCKS), RecordType::DISK_BLOCKS(), "Record Blocks"));
$this->register(new Record(new IID(Ids::RECORD_CHIRP), RecordType::DISK_CHIRP(), "Record Chirp"));
$this->register(new Record(new IID(Ids::RECORD_FAR), RecordType::DISK_FAR(), "Record Far"));
$this->register(new Record(new IID(Ids::RECORD_MALL), RecordType::DISK_MALL(), "Record Mall"));
$this->register(new Record(new IID(Ids::RECORD_MELLOHI), RecordType::DISK_MELLOHI(), "Record Mellohi"));
$this->register(new Record(new IID(Ids::RECORD_STAL), RecordType::DISK_STAL(), "Record Stal"));
$this->register(new Record(new IID(Ids::RECORD_STRAD), RecordType::DISK_STRAD(), "Record Strad"));
$this->register(new Record(new IID(Ids::RECORD_WARD), RecordType::DISK_WARD(), "Record Ward"));
$this->register(new Record(new IID(Ids::RECORD_11), RecordType::DISK_11(), "Record 11"));
$this->register(new Record(new IID(Ids::RECORD_WAIT), RecordType::DISK_WAIT(), "Record Wait"));
$this->register(new Redstone(new IID(Ids::REDSTONE_DUST), "Redstone"));
$this->register(new RottenFlesh(new IID(Ids::ROTTEN_FLESH), "Rotten Flesh"));
$this->register(new Shears(new IID(Ids::SHEARS), "Shears"));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::OAK_SIGN), Blocks::OAK_SIGN(), Blocks::OAK_WALL_SIGN()));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::SPRUCE_SIGN), Blocks::SPRUCE_SIGN(), Blocks::SPRUCE_WALL_SIGN()));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::BIRCH_SIGN), Blocks::BIRCH_SIGN(), Blocks::BIRCH_WALL_SIGN()));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::JUNGLE_SIGN), Blocks::JUNGLE_SIGN(), Blocks::JUNGLE_WALL_SIGN()));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::ACACIA_SIGN), Blocks::ACACIA_SIGN(), Blocks::ACACIA_WALL_SIGN()));
$this->register(new ItemBlockWallOrFloor(new IID(Ids::DARK_OAK_SIGN), Blocks::DARK_OAK_SIGN(), Blocks::DARK_OAK_WALL_SIGN()));
$this->register(new Snowball(new IID(Ids::SNOWBALL), "Snowball"));
$this->register(new SpiderEye(new IID(Ids::SPIDER_EYE), "Spider Eye"));
$this->register(new Steak(new IID(Ids::STEAK), "Steak"));
$this->register(new Stick(new IID(Ids::STICK), "Stick"));
$this->register(new StringItem(new IID(Ids::STRING), "String"));
$this->register(new SweetBerries(new IID(Ids::SWEET_BERRIES), "Sweet Berries"));
$this->register(new Totem(new IID(Ids::TOTEM), "Totem of Undying"));
$this->register(new WheatSeeds(new IID(Ids::WHEAT_SEEDS), "Wheat Seeds"));
$this->register(new WritableBook(new IID(Ids::WRITABLE_BOOK), "Book & Quill"));
$this->register(new WrittenBook(new IID(Ids::WRITTEN_BOOK), "Written Book"));
//TODO: add interface to dye-colour objects
$this->register(new Dye(new IID(Ids::DYE, LegacyIds::DYE, 0), "Dye"));
$this->register(new Dye(new IID(Ids::DYE), "Dye"));
$this->register(new Banner(
new IID(Ids::BANNER, LegacyIds::BANNER, 0),
new IID(Ids::BANNER),
Blocks::BANNER(),
Blocks::WALL_BANNER()
));
$this->register(new Potion(new IID(Ids::POTION, LegacyIds::POTION, 0), "Potion"));
$this->register(new SplashPotion(new IID(Ids::SPLASH_POTION, LegacyIds::SPLASH_POTION, 0), "Splash Potion"));
$this->register(new Potion(new IID(Ids::POTION), "Potion"));
$this->register(new SplashPotion(new IID(Ids::SPLASH_POTION), "Splash Potion"));
foreach(TreeType::getAll() as $type){
//TODO: tree type should be dynamic in the future, but we're staying static for now for the sake of consistency
@ -254,7 +251,7 @@ class ItemFactory{
TreeType::ACACIA() => Ids::ACACIA_BOAT,
TreeType::DARK_OAK() => Ids::DARK_OAK_BOAT,
default => throw new AssumptionFailedError("Unhandled tree type " . $type->name())
}, LegacyIds::BOAT, $type->getMagicNumber()), $type->getDisplayName() . " Boat", $type));
}), $type->getDisplayName() . " Boat", $type));
}
//region --- auto-generated TODOs ---
@ -302,17 +299,17 @@ class ItemFactory{
private function registerSpawnEggs() : void{
//TODO: the meta values should probably be hardcoded; they won't change, but the EntityLegacyIds might
$this->register(new class(new IID(Ids::ZOMBIE_SPAWN_EGG, LegacyIds::SPAWN_EGG, EntityLegacyIds::ZOMBIE), "Zombie Spawn Egg") extends SpawnEgg{
$this->register(new class(new IID(Ids::ZOMBIE_SPAWN_EGG), "Zombie Spawn Egg") extends SpawnEgg{
protected function createEntity(World $world, Vector3 $pos, float $yaw, float $pitch) : Entity{
return new Zombie(Location::fromObject($pos, $world, $yaw, $pitch));
}
});
$this->register(new class(new IID(Ids::SQUID_SPAWN_EGG, LegacyIds::SPAWN_EGG, EntityLegacyIds::SQUID), "Squid Spawn Egg") extends SpawnEgg{
$this->register(new class(new IID(Ids::SQUID_SPAWN_EGG), "Squid Spawn Egg") extends SpawnEgg{
public function createEntity(World $world, Vector3 $pos, float $yaw, float $pitch) : Entity{
return new Squid(Location::fromObject($pos, $world, $yaw, $pitch));
}
});
$this->register(new class(new IID(Ids::VILLAGER_SPAWN_EGG, LegacyIds::SPAWN_EGG, EntityLegacyIds::VILLAGER), "Villager Spawn Egg") extends SpawnEgg{
$this->register(new class(new IID(Ids::VILLAGER_SPAWN_EGG), "Villager Spawn Egg") extends SpawnEgg{
public function createEntity(World $world, Vector3 $pos, float $yaw, float $pitch) : Entity{
return new Villager(Location::fromObject($pos, $world, $yaw, $pitch));
}
@ -320,54 +317,54 @@ class ItemFactory{
}
private function registerTierToolItems() : void{
$this->register(new Axe(new IID(Ids::DIAMOND_AXE, LegacyIds::DIAMOND_AXE, 0), "Diamond Axe", ToolTier::DIAMOND()));
$this->register(new Axe(new IID(Ids::GOLDEN_AXE, LegacyIds::GOLDEN_AXE, 0), "Golden Axe", ToolTier::GOLD()));
$this->register(new Axe(new IID(Ids::IRON_AXE, LegacyIds::IRON_AXE, 0), "Iron Axe", ToolTier::IRON()));
$this->register(new Axe(new IID(Ids::STONE_AXE, LegacyIds::STONE_AXE, 0), "Stone Axe", ToolTier::STONE()));
$this->register(new Axe(new IID(Ids::WOODEN_AXE, LegacyIds::WOODEN_AXE, 0), "Wooden Axe", ToolTier::WOOD()));
$this->register(new Hoe(new IID(Ids::DIAMOND_HOE, LegacyIds::DIAMOND_HOE, 0), "Diamond Hoe", ToolTier::DIAMOND()));
$this->register(new Hoe(new IID(Ids::GOLDEN_HOE, LegacyIds::GOLDEN_HOE, 0), "Golden Hoe", ToolTier::GOLD()));
$this->register(new Hoe(new IID(Ids::IRON_HOE, LegacyIds::IRON_HOE, 0), "Iron Hoe", ToolTier::IRON()));
$this->register(new Hoe(new IID(Ids::STONE_HOE, LegacyIds::STONE_HOE, 0), "Stone Hoe", ToolTier::STONE()));
$this->register(new Hoe(new IID(Ids::WOODEN_HOE, LegacyIds::WOODEN_HOE, 0), "Wooden Hoe", ToolTier::WOOD()));
$this->register(new Pickaxe(new IID(Ids::DIAMOND_PICKAXE, LegacyIds::DIAMOND_PICKAXE, 0), "Diamond Pickaxe", ToolTier::DIAMOND()));
$this->register(new Pickaxe(new IID(Ids::GOLDEN_PICKAXE, LegacyIds::GOLDEN_PICKAXE, 0), "Golden Pickaxe", ToolTier::GOLD()));
$this->register(new Pickaxe(new IID(Ids::IRON_PICKAXE, LegacyIds::IRON_PICKAXE, 0), "Iron Pickaxe", ToolTier::IRON()));
$this->register(new Pickaxe(new IID(Ids::STONE_PICKAXE, LegacyIds::STONE_PICKAXE, 0), "Stone Pickaxe", ToolTier::STONE()));
$this->register(new Pickaxe(new IID(Ids::WOODEN_PICKAXE, LegacyIds::WOODEN_PICKAXE, 0), "Wooden Pickaxe", ToolTier::WOOD()));
$this->register(new Shovel(new IID(Ids::DIAMOND_SHOVEL, LegacyIds::DIAMOND_SHOVEL, 0), "Diamond Shovel", ToolTier::DIAMOND()));
$this->register(new Shovel(new IID(Ids::GOLDEN_SHOVEL, LegacyIds::GOLDEN_SHOVEL, 0), "Golden Shovel", ToolTier::GOLD()));
$this->register(new Shovel(new IID(Ids::IRON_SHOVEL, LegacyIds::IRON_SHOVEL, 0), "Iron Shovel", ToolTier::IRON()));
$this->register(new Shovel(new IID(Ids::STONE_SHOVEL, LegacyIds::STONE_SHOVEL, 0), "Stone Shovel", ToolTier::STONE()));
$this->register(new Shovel(new IID(Ids::WOODEN_SHOVEL, LegacyIds::WOODEN_SHOVEL, 0), "Wooden Shovel", ToolTier::WOOD()));
$this->register(new Sword(new IID(Ids::DIAMOND_SWORD, LegacyIds::DIAMOND_SWORD, 0), "Diamond Sword", ToolTier::DIAMOND()));
$this->register(new Sword(new IID(Ids::GOLDEN_SWORD, LegacyIds::GOLDEN_SWORD, 0), "Golden Sword", ToolTier::GOLD()));
$this->register(new Sword(new IID(Ids::IRON_SWORD, LegacyIds::IRON_SWORD, 0), "Iron Sword", ToolTier::IRON()));
$this->register(new Sword(new IID(Ids::STONE_SWORD, LegacyIds::STONE_SWORD, 0), "Stone Sword", ToolTier::STONE()));
$this->register(new Sword(new IID(Ids::WOODEN_SWORD, LegacyIds::WOODEN_SWORD, 0), "Wooden Sword", ToolTier::WOOD()));
$this->register(new Axe(new IID(Ids::DIAMOND_AXE), "Diamond Axe", ToolTier::DIAMOND()));
$this->register(new Axe(new IID(Ids::GOLDEN_AXE), "Golden Axe", ToolTier::GOLD()));
$this->register(new Axe(new IID(Ids::IRON_AXE), "Iron Axe", ToolTier::IRON()));
$this->register(new Axe(new IID(Ids::STONE_AXE), "Stone Axe", ToolTier::STONE()));
$this->register(new Axe(new IID(Ids::WOODEN_AXE), "Wooden Axe", ToolTier::WOOD()));
$this->register(new Hoe(new IID(Ids::DIAMOND_HOE), "Diamond Hoe", ToolTier::DIAMOND()));
$this->register(new Hoe(new IID(Ids::GOLDEN_HOE), "Golden Hoe", ToolTier::GOLD()));
$this->register(new Hoe(new IID(Ids::IRON_HOE), "Iron Hoe", ToolTier::IRON()));
$this->register(new Hoe(new IID(Ids::STONE_HOE), "Stone Hoe", ToolTier::STONE()));
$this->register(new Hoe(new IID(Ids::WOODEN_HOE), "Wooden Hoe", ToolTier::WOOD()));
$this->register(new Pickaxe(new IID(Ids::DIAMOND_PICKAXE), "Diamond Pickaxe", ToolTier::DIAMOND()));
$this->register(new Pickaxe(new IID(Ids::GOLDEN_PICKAXE), "Golden Pickaxe", ToolTier::GOLD()));
$this->register(new Pickaxe(new IID(Ids::IRON_PICKAXE), "Iron Pickaxe", ToolTier::IRON()));
$this->register(new Pickaxe(new IID(Ids::STONE_PICKAXE), "Stone Pickaxe", ToolTier::STONE()));
$this->register(new Pickaxe(new IID(Ids::WOODEN_PICKAXE), "Wooden Pickaxe", ToolTier::WOOD()));
$this->register(new Shovel(new IID(Ids::DIAMOND_SHOVEL), "Diamond Shovel", ToolTier::DIAMOND()));
$this->register(new Shovel(new IID(Ids::GOLDEN_SHOVEL), "Golden Shovel", ToolTier::GOLD()));
$this->register(new Shovel(new IID(Ids::IRON_SHOVEL), "Iron Shovel", ToolTier::IRON()));
$this->register(new Shovel(new IID(Ids::STONE_SHOVEL), "Stone Shovel", ToolTier::STONE()));
$this->register(new Shovel(new IID(Ids::WOODEN_SHOVEL), "Wooden Shovel", ToolTier::WOOD()));
$this->register(new Sword(new IID(Ids::DIAMOND_SWORD), "Diamond Sword", ToolTier::DIAMOND()));
$this->register(new Sword(new IID(Ids::GOLDEN_SWORD), "Golden Sword", ToolTier::GOLD()));
$this->register(new Sword(new IID(Ids::IRON_SWORD), "Iron Sword", ToolTier::IRON()));
$this->register(new Sword(new IID(Ids::STONE_SWORD), "Stone Sword", ToolTier::STONE()));
$this->register(new Sword(new IID(Ids::WOODEN_SWORD), "Wooden Sword", ToolTier::WOOD()));
}
private function registerArmorItems() : void{
$this->register(new Armor(new IID(Ids::CHAINMAIL_BOOTS, LegacyIds::CHAIN_BOOTS, 0), "Chainmail Boots", new ArmorTypeInfo(1, 196, ArmorInventory::SLOT_FEET)));
$this->register(new Armor(new IID(Ids::DIAMOND_BOOTS, LegacyIds::DIAMOND_BOOTS, 0), "Diamond Boots", new ArmorTypeInfo(3, 430, ArmorInventory::SLOT_FEET)));
$this->register(new Armor(new IID(Ids::GOLDEN_BOOTS, LegacyIds::GOLDEN_BOOTS, 0), "Golden Boots", new ArmorTypeInfo(1, 92, ArmorInventory::SLOT_FEET)));
$this->register(new Armor(new IID(Ids::IRON_BOOTS, LegacyIds::IRON_BOOTS, 0), "Iron Boots", new ArmorTypeInfo(2, 196, ArmorInventory::SLOT_FEET)));
$this->register(new Armor(new IID(Ids::LEATHER_BOOTS, LegacyIds::LEATHER_BOOTS, 0), "Leather Boots", new ArmorTypeInfo(1, 66, ArmorInventory::SLOT_FEET)));
$this->register(new Armor(new IID(Ids::CHAINMAIL_CHESTPLATE, LegacyIds::CHAIN_CHESTPLATE, 0), "Chainmail Chestplate", new ArmorTypeInfo(5, 241, ArmorInventory::SLOT_CHEST)));
$this->register(new Armor(new IID(Ids::DIAMOND_CHESTPLATE, LegacyIds::DIAMOND_CHESTPLATE, 0), "Diamond Chestplate", new ArmorTypeInfo(8, 529, ArmorInventory::SLOT_CHEST)));
$this->register(new Armor(new IID(Ids::GOLDEN_CHESTPLATE, LegacyIds::GOLDEN_CHESTPLATE, 0), "Golden Chestplate", new ArmorTypeInfo(5, 113, ArmorInventory::SLOT_CHEST)));
$this->register(new Armor(new IID(Ids::IRON_CHESTPLATE, LegacyIds::IRON_CHESTPLATE, 0), "Iron Chestplate", new ArmorTypeInfo(6, 241, ArmorInventory::SLOT_CHEST)));
$this->register(new Armor(new IID(Ids::LEATHER_TUNIC, LegacyIds::LEATHER_CHESTPLATE, 0), "Leather Tunic", new ArmorTypeInfo(3, 81, ArmorInventory::SLOT_CHEST)));
$this->register(new Armor(new IID(Ids::CHAINMAIL_HELMET, LegacyIds::CHAIN_HELMET, 0), "Chainmail Helmet", new ArmorTypeInfo(2, 166, ArmorInventory::SLOT_HEAD)));
$this->register(new Armor(new IID(Ids::DIAMOND_HELMET, LegacyIds::DIAMOND_HELMET, 0), "Diamond Helmet", new ArmorTypeInfo(3, 364, ArmorInventory::SLOT_HEAD)));
$this->register(new Armor(new IID(Ids::GOLDEN_HELMET, LegacyIds::GOLDEN_HELMET, 0), "Golden Helmet", new ArmorTypeInfo(2, 78, ArmorInventory::SLOT_HEAD)));
$this->register(new Armor(new IID(Ids::IRON_HELMET, LegacyIds::IRON_HELMET, 0), "Iron Helmet", new ArmorTypeInfo(2, 166, ArmorInventory::SLOT_HEAD)));
$this->register(new Armor(new IID(Ids::LEATHER_CAP, LegacyIds::LEATHER_HELMET, 0), "Leather Cap", new ArmorTypeInfo(1, 56, ArmorInventory::SLOT_HEAD)));
$this->register(new Armor(new IID(Ids::CHAINMAIL_LEGGINGS, LegacyIds::CHAIN_LEGGINGS, 0), "Chainmail Leggings", new ArmorTypeInfo(4, 226, ArmorInventory::SLOT_LEGS)));
$this->register(new Armor(new IID(Ids::DIAMOND_LEGGINGS, LegacyIds::DIAMOND_LEGGINGS, 0), "Diamond Leggings", new ArmorTypeInfo(6, 496, ArmorInventory::SLOT_LEGS)));
$this->register(new Armor(new IID(Ids::GOLDEN_LEGGINGS, LegacyIds::GOLDEN_LEGGINGS, 0), "Golden Leggings", new ArmorTypeInfo(3, 106, ArmorInventory::SLOT_LEGS)));
$this->register(new Armor(new IID(Ids::IRON_LEGGINGS, LegacyIds::IRON_LEGGINGS, 0), "Iron Leggings", new ArmorTypeInfo(5, 226, ArmorInventory::SLOT_LEGS)));
$this->register(new Armor(new IID(Ids::LEATHER_PANTS, LegacyIds::LEATHER_LEGGINGS, 0), "Leather Pants", new ArmorTypeInfo(2, 76, ArmorInventory::SLOT_LEGS)));
$this->register(new Armor(new IID(Ids::CHAINMAIL_BOOTS), "Chainmail Boots", new ArmorTypeInfo(1, 196, ArmorInventory::SLOT_FEET)));
$this->register(new Armor(new IID(Ids::DIAMOND_BOOTS), "Diamond Boots", new ArmorTypeInfo(3, 430, ArmorInventory::SLOT_FEET)));
$this->register(new Armor(new IID(Ids::GOLDEN_BOOTS), "Golden Boots", new ArmorTypeInfo(1, 92, ArmorInventory::SLOT_FEET)));
$this->register(new Armor(new IID(Ids::IRON_BOOTS), "Iron Boots", new ArmorTypeInfo(2, 196, ArmorInventory::SLOT_FEET)));
$this->register(new Armor(new IID(Ids::LEATHER_BOOTS), "Leather Boots", new ArmorTypeInfo(1, 66, ArmorInventory::SLOT_FEET)));
$this->register(new Armor(new IID(Ids::CHAINMAIL_CHESTPLATE), "Chainmail Chestplate", new ArmorTypeInfo(5, 241, ArmorInventory::SLOT_CHEST)));
$this->register(new Armor(new IID(Ids::DIAMOND_CHESTPLATE), "Diamond Chestplate", new ArmorTypeInfo(8, 529, ArmorInventory::SLOT_CHEST)));
$this->register(new Armor(new IID(Ids::GOLDEN_CHESTPLATE), "Golden Chestplate", new ArmorTypeInfo(5, 113, ArmorInventory::SLOT_CHEST)));
$this->register(new Armor(new IID(Ids::IRON_CHESTPLATE), "Iron Chestplate", new ArmorTypeInfo(6, 241, ArmorInventory::SLOT_CHEST)));
$this->register(new Armor(new IID(Ids::LEATHER_TUNIC), "Leather Tunic", new ArmorTypeInfo(3, 81, ArmorInventory::SLOT_CHEST)));
$this->register(new Armor(new IID(Ids::CHAINMAIL_HELMET), "Chainmail Helmet", new ArmorTypeInfo(2, 166, ArmorInventory::SLOT_HEAD)));
$this->register(new Armor(new IID(Ids::DIAMOND_HELMET), "Diamond Helmet", new ArmorTypeInfo(3, 364, ArmorInventory::SLOT_HEAD)));
$this->register(new Armor(new IID(Ids::GOLDEN_HELMET), "Golden Helmet", new ArmorTypeInfo(2, 78, ArmorInventory::SLOT_HEAD)));
$this->register(new Armor(new IID(Ids::IRON_HELMET), "Iron Helmet", new ArmorTypeInfo(2, 166, ArmorInventory::SLOT_HEAD)));
$this->register(new Armor(new IID(Ids::LEATHER_CAP), "Leather Cap", new ArmorTypeInfo(1, 56, ArmorInventory::SLOT_HEAD)));
$this->register(new Armor(new IID(Ids::CHAINMAIL_LEGGINGS), "Chainmail Leggings", new ArmorTypeInfo(4, 226, ArmorInventory::SLOT_LEGS)));
$this->register(new Armor(new IID(Ids::DIAMOND_LEGGINGS), "Diamond Leggings", new ArmorTypeInfo(6, 496, ArmorInventory::SLOT_LEGS)));
$this->register(new Armor(new IID(Ids::GOLDEN_LEGGINGS), "Golden Leggings", new ArmorTypeInfo(3, 106, ArmorInventory::SLOT_LEGS)));
$this->register(new Armor(new IID(Ids::IRON_LEGGINGS), "Iron Leggings", new ArmorTypeInfo(5, 226, ArmorInventory::SLOT_LEGS)));
$this->register(new Armor(new IID(Ids::LEATHER_PANTS), "Leather Pants", new ArmorTypeInfo(2, 76, ArmorInventory::SLOT_LEGS)));
}
/**

View File

@ -26,23 +26,9 @@ namespace pocketmine\item;
use pocketmine\block\Block;
class ItemIdentifier{
private int $legacyId;
private int $legacyMeta;
public function __construct(
private int $typeId,
int $legacyId,
int $legacyMeta
){
if($legacyId < -0x8000 || $legacyId > 0x7fff){ //signed short range
throw new \InvalidArgumentException("ID must be in range " . -0x8000 . " - " . 0x7fff);
}
if($legacyMeta < 0 || $legacyMeta > 0x7ffe){
throw new \InvalidArgumentException("Meta must be in range 0 - " . 0x7ffe);
}
$this->legacyId = $legacyId;
$this->legacyMeta = $legacyMeta;
}
private int $typeId
){}
public static function fromBlock(Block $block) : self{
//negative item type IDs are treated as block IDs
@ -50,16 +36,8 @@ class ItemIdentifier{
//TODO: this isn't vanilla-compliant, but it'll do for now - we only use the "legacy" item ID/meta for full type
//indexing right now, because item type IDs aren't granular enough
//this should be removed once that's addressed
return new self(-$block->getTypeId(), -$block->getTypeId(), $block->computeTypeData());
return new self(-$block->getTypeId());
}
public function getTypeId() : int{ return $this->typeId; }
public function getLegacyId() : int{
return $this->legacyId;
}
public function getLegacyMeta() : int{
return $this->legacyMeta;
}
}

View File

@ -1,41 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\item;
final class ItemIdentifierFlattened extends ItemIdentifier{
/**
* @param int[] $additionalLegacyIds
*/
public function __construct(int $typeId, int $legacyId, int $legacyMeta, private array $additionalLegacyIds){
parent::__construct($typeId, $legacyId, $legacyMeta);
}
/** @return int[] */
public function getAdditionalLegacyIds() : array{ return $this->additionalLegacyIds; }
/** @return int[] */
public function getAllLegacyIds() : array{
return [$this->getLegacyId(), ...$this->additionalLegacyIds];
}
}

View File

@ -1,736 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\item;
final class ItemIds{
private function __construct(){
//NOOP
}
public const LIT_BLAST_FURNACE = -214;
public const COMPOSTER = -213;
public const WOOD = -212;
public const JIGSAW = -211;
public const LAVA_CAULDRON = -210;
public const CAMPFIRE = -209;
public const LANTERN = -208;
public const SWEET_BERRY_BUSH = -207;
public const BELL = -206;
public const LOOM = -204;
public const BARREL = -203;
public const SMITHING_TABLE = -202;
public const FLETCHING_TABLE = -201;
public const CARTOGRAPHY_TABLE = -200;
public const LIT_SMOKER = -199;
public const SMOKER = -198;
public const STONECUTTER_BLOCK = -197;
public const BLAST_FURNACE = -196;
public const GRINDSTONE = -195;
public const LECTERN = -194;
public const DARKOAK_WALL_SIGN = -193;
public const DARKOAK_STANDING_SIGN = -192;
public const ACACIA_WALL_SIGN = -191;
public const ACACIA_STANDING_SIGN = -190;
public const JUNGLE_WALL_SIGN = -189;
public const JUNGLE_STANDING_SIGN = -188;
public const BIRCH_WALL_SIGN = -187;
public const BIRCH_STANDING_SIGN = -186;
public const SMOOTH_QUARTZ_STAIRS = -185;
public const RED_NETHER_BRICK_STAIRS = -184;
public const SMOOTH_STONE = -183;
public const SPRUCE_WALL_SIGN = -182;
public const SPRUCE_STANDING_SIGN = -181;
public const NORMAL_STONE_STAIRS = -180;
public const MOSSY_COBBLESTONE_STAIRS = -179;
public const END_BRICK_STAIRS = -178;
public const SMOOTH_SANDSTONE_STAIRS = -177;
public const SMOOTH_RED_SANDSTONE_STAIRS = -176;
public const MOSSY_STONE_BRICK_STAIRS = -175;
public const POLISHED_ANDESITE_STAIRS = -174;
public const POLISHED_DIORITE_STAIRS = -173;
public const POLISHED_GRANITE_STAIRS = -172;
public const ANDESITE_STAIRS = -171;
public const DIORITE_STAIRS = -170;
public const GRANITE_STAIRS = -169;
public const DOUBLE_STONE_SLAB4 = -168;
public const DOUBLE_STONE_SLAB3 = -167;
public const STONE_SLAB4 = -166;
public const SCAFFOLDING = -165;
public const BAMBOO_SAPLING = -164;
public const BAMBOO = -163;
public const STONE_SLAB3 = -162;
public const BARRIER = -161;
public const BUBBLE_COLUMN = -160;
public const TURTLE_EGG = -159;
public const CONDUIT = -157;
public const SEA_PICKLE = -156;
public const CARVED_PUMPKIN = -155;
public const SPRUCE_PRESSURE_PLATE = -154;
public const JUNGLE_PRESSURE_PLATE = -153;
public const DARK_OAK_PRESSURE_PLATE = -152;
public const BIRCH_PRESSURE_PLATE = -151;
public const ACACIA_PRESSURE_PLATE = -150;
public const SPRUCE_TRAPDOOR = -149;
public const JUNGLE_TRAPDOOR = -148;
public const DARK_OAK_TRAPDOOR = -147;
public const BIRCH_TRAPDOOR = -146;
public const ACACIA_TRAPDOOR = -145;
public const SPRUCE_BUTTON = -144;
public const JUNGLE_BUTTON = -143;
public const DARK_OAK_BUTTON = -142;
public const BIRCH_BUTTON = -141;
public const ACACIA_BUTTON = -140;
public const DRIED_KELP_BLOCK = -139;
public const KELP_BLOCK = -138;
public const CORAL_FAN_HANG3 = -137;
public const CORAL_FAN_HANG2 = -136;
public const CORAL_FAN_HANG = -135;
public const CORAL_FAN_DEAD = -134;
public const CORAL_FAN = -133;
public const CORAL_BLOCK = -132;
public const CORAL = -131;
public const SEAGRASS = -130;
public const ELEMENT_118 = -129;
public const ELEMENT_117 = -128;
public const ELEMENT_116 = -127;
public const ELEMENT_115 = -126;
public const ELEMENT_114 = -125;
public const ELEMENT_113 = -124;
public const ELEMENT_112 = -123;
public const ELEMENT_111 = -122;
public const ELEMENT_110 = -121;
public const ELEMENT_109 = -120;
public const ELEMENT_108 = -119;
public const ELEMENT_107 = -118;
public const ELEMENT_106 = -117;
public const ELEMENT_105 = -116;
public const ELEMENT_104 = -115;
public const ELEMENT_103 = -114;
public const ELEMENT_102 = -113;
public const ELEMENT_101 = -112;
public const ELEMENT_100 = -111;
public const ELEMENT_99 = -110;
public const ELEMENT_98 = -109;
public const ELEMENT_97 = -108;
public const ELEMENT_96 = -107;
public const ELEMENT_95 = -106;
public const ELEMENT_94 = -105;
public const ELEMENT_93 = -104;
public const ELEMENT_92 = -103;
public const ELEMENT_91 = -102;
public const ELEMENT_90 = -101;
public const ELEMENT_89 = -100;
public const ELEMENT_88 = -99;
public const ELEMENT_87 = -98;
public const ELEMENT_86 = -97;
public const ELEMENT_85 = -96;
public const ELEMENT_84 = -95;
public const ELEMENT_83 = -94;
public const ELEMENT_82 = -93;
public const ELEMENT_81 = -92;
public const ELEMENT_80 = -91;
public const ELEMENT_79 = -90;
public const ELEMENT_78 = -89;
public const ELEMENT_77 = -88;
public const ELEMENT_76 = -87;
public const ELEMENT_75 = -86;
public const ELEMENT_74 = -85;
public const ELEMENT_73 = -84;
public const ELEMENT_72 = -83;
public const ELEMENT_71 = -82;
public const ELEMENT_70 = -81;
public const ELEMENT_69 = -80;
public const ELEMENT_68 = -79;
public const ELEMENT_67 = -78;
public const ELEMENT_66 = -77;
public const ELEMENT_65 = -76;
public const ELEMENT_64 = -75;
public const ELEMENT_63 = -74;
public const ELEMENT_62 = -73;
public const ELEMENT_61 = -72;
public const ELEMENT_60 = -71;
public const ELEMENT_59 = -70;
public const ELEMENT_58 = -69;
public const ELEMENT_57 = -68;
public const ELEMENT_56 = -67;
public const ELEMENT_55 = -66;
public const ELEMENT_54 = -65;
public const ELEMENT_53 = -64;
public const ELEMENT_52 = -63;
public const ELEMENT_51 = -62;
public const ELEMENT_50 = -61;
public const ELEMENT_49 = -60;
public const ELEMENT_48 = -59;
public const ELEMENT_47 = -58;
public const ELEMENT_46 = -57;
public const ELEMENT_45 = -56;
public const ELEMENT_44 = -55;
public const ELEMENT_43 = -54;
public const ELEMENT_42 = -53;
public const ELEMENT_41 = -52;
public const ELEMENT_40 = -51;
public const ELEMENT_39 = -50;
public const ELEMENT_38 = -49;
public const ELEMENT_37 = -48;
public const ELEMENT_36 = -47;
public const ELEMENT_35 = -46;
public const ELEMENT_34 = -45;
public const ELEMENT_33 = -44;
public const ELEMENT_32 = -43;
public const ELEMENT_31 = -42;
public const ELEMENT_30 = -41;
public const ELEMENT_29 = -40;
public const ELEMENT_28 = -39;
public const ELEMENT_27 = -38;
public const ELEMENT_26 = -37;
public const ELEMENT_25 = -36;
public const ELEMENT_24 = -35;
public const ELEMENT_23 = -34;
public const ELEMENT_22 = -33;
public const ELEMENT_21 = -32;
public const ELEMENT_20 = -31;
public const ELEMENT_19 = -30;
public const ELEMENT_18 = -29;
public const ELEMENT_17 = -28;
public const ELEMENT_16 = -27;
public const ELEMENT_15 = -26;
public const ELEMENT_14 = -25;
public const ELEMENT_13 = -24;
public const ELEMENT_12 = -23;
public const ELEMENT_11 = -22;
public const ELEMENT_10 = -21;
public const ELEMENT_9 = -20;
public const ELEMENT_8 = -19;
public const ELEMENT_7 = -18;
public const ELEMENT_6 = -17;
public const ELEMENT_5 = -16;
public const ELEMENT_4 = -15;
public const ELEMENT_3 = -14;
public const ELEMENT_2 = -13;
public const ELEMENT_1 = -12;
public const BLUE_ICE = -11;
public const STRIPPED_OAK_LOG = -10;
public const STRIPPED_DARK_OAK_LOG = -9;
public const STRIPPED_ACACIA_LOG = -8;
public const STRIPPED_JUNGLE_LOG = -7;
public const STRIPPED_BIRCH_LOG = -6;
public const STRIPPED_SPRUCE_LOG = -5;
public const PRISMARINE_BRICKS_STAIRS = -4;
public const DARK_PRISMARINE_STAIRS = -3;
public const PRISMARINE_STAIRS = -2;
public const AIR = 0;
public const STONE = 1;
public const GRASS = 2;
public const DIRT = 3;
public const COBBLESTONE = 4;
public const PLANKS = 5, WOODEN_PLANKS = 5;
public const SAPLING = 6;
public const BEDROCK = 7;
public const FLOWING_WATER = 8;
public const STILL_WATER = 9, WATER = 9;
public const FLOWING_LAVA = 10;
public const LAVA = 11, STILL_LAVA = 11;
public const SAND = 12;
public const GRAVEL = 13;
public const GOLD_ORE = 14;
public const IRON_ORE = 15;
public const COAL_ORE = 16;
public const LOG = 17;
public const LEAVES = 18;
public const SPONGE = 19;
public const GLASS = 20;
public const LAPIS_ORE = 21;
public const LAPIS_BLOCK = 22;
public const DISPENSER = 23;
public const SANDSTONE = 24;
public const NOTEBLOCK = 25, NOTE_BLOCK = 25;
public const BED_BLOCK = 26;
public const GOLDEN_RAIL = 27, POWERED_RAIL = 27;
public const DETECTOR_RAIL = 28;
public const STICKY_PISTON = 29;
public const COBWEB = 30, WEB = 30;
public const TALLGRASS = 31, TALL_GRASS = 31;
public const DEADBUSH = 32, DEAD_BUSH = 32;
public const PISTON = 33;
public const PISTONARMCOLLISION = 34, PISTON_ARM_COLLISION = 34;
public const WOOL = 35;
public const ELEMENT_0 = 36;
public const DANDELION = 37, YELLOW_FLOWER = 37;
public const POPPY = 38, RED_FLOWER = 38;
public const BROWN_MUSHROOM = 39;
public const RED_MUSHROOM = 40;
public const GOLD_BLOCK = 41;
public const IRON_BLOCK = 42;
public const DOUBLE_STONE_SLAB = 43;
public const STONE_SLAB = 44;
public const BRICK_BLOCK = 45;
public const TNT = 46;
public const BOOKSHELF = 47;
public const MOSSY_COBBLESTONE = 48, MOSS_STONE = 48;
public const OBSIDIAN = 49;
public const TORCH = 50;
public const FIRE = 51;
public const MOB_SPAWNER = 52, MONSTER_SPAWNER = 52;
public const OAK_STAIRS = 53, WOODEN_STAIRS = 53;
public const CHEST = 54;
public const REDSTONE_WIRE = 55;
public const DIAMOND_ORE = 56;
public const DIAMOND_BLOCK = 57;
public const CRAFTING_TABLE = 58, WORKBENCH = 58;
public const WHEAT_BLOCK = 59;
public const FARMLAND = 60;
public const FURNACE = 61;
public const BURNING_FURNACE = 62, LIT_FURNACE = 62;
public const SIGN_POST = 63, STANDING_SIGN = 63;
public const OAK_DOOR_BLOCK = 64, WOODEN_DOOR_BLOCK = 64;
public const LADDER = 65;
public const RAIL = 66;
public const COBBLESTONE_STAIRS = 67, STONE_STAIRS = 67;
public const WALL_SIGN = 68;
public const LEVER = 69;
public const STONE_PRESSURE_PLATE = 70;
public const IRON_DOOR_BLOCK = 71;
public const WOODEN_PRESSURE_PLATE = 72;
public const REDSTONE_ORE = 73;
public const GLOWING_REDSTONE_ORE = 74, LIT_REDSTONE_ORE = 74;
public const UNLIT_REDSTONE_TORCH = 75;
public const LIT_REDSTONE_TORCH = 76, REDSTONE_TORCH = 76;
public const STONE_BUTTON = 77;
public const SNOW_LAYER = 78;
public const ICE = 79;
public const SNOW = 80, SNOW_BLOCK = 80;
public const CACTUS = 81;
public const CLAY_BLOCK = 82;
public const REEDS_BLOCK = 83, SUGARCANE_BLOCK = 83;
public const JUKEBOX = 84;
public const FENCE = 85;
public const PUMPKIN = 86;
public const NETHERRACK = 87;
public const SOUL_SAND = 88;
public const GLOWSTONE = 89;
public const PORTAL = 90;
public const JACK_O_LANTERN = 91, LIT_PUMPKIN = 91;
public const CAKE_BLOCK = 92;
public const REPEATER_BLOCK = 93, UNPOWERED_REPEATER = 93;
public const POWERED_REPEATER = 94;
public const INVISIBLEBEDROCK = 95, INVISIBLE_BEDROCK = 95;
public const TRAPDOOR = 96, WOODEN_TRAPDOOR = 96;
public const MONSTER_EGG = 97;
public const STONEBRICK = 98, STONE_BRICK = 98, STONE_BRICKS = 98;
public const BROWN_MUSHROOM_BLOCK = 99;
public const RED_MUSHROOM_BLOCK = 100;
public const IRON_BARS = 101;
public const GLASS_PANE = 102;
public const MELON_BLOCK = 103;
public const PUMPKIN_STEM = 104;
public const MELON_STEM = 105;
public const VINE = 106, VINES = 106;
public const FENCE_GATE = 107, OAK_FENCE_GATE = 107;
public const BRICK_STAIRS = 108;
public const STONE_BRICK_STAIRS = 109;
public const MYCELIUM = 110;
public const LILY_PAD = 111, WATERLILY = 111, WATER_LILY = 111;
public const NETHER_BRICK_BLOCK = 112;
public const NETHER_BRICK_FENCE = 113;
public const NETHER_BRICK_STAIRS = 114;
public const NETHER_WART_PLANT = 115;
public const ENCHANTING_TABLE = 116, ENCHANTMENT_TABLE = 116;
public const BREWING_STAND_BLOCK = 117;
public const CAULDRON_BLOCK = 118;
public const END_PORTAL = 119;
public const END_PORTAL_FRAME = 120;
public const END_STONE = 121;
public const DRAGON_EGG = 122;
public const REDSTONE_LAMP = 123;
public const LIT_REDSTONE_LAMP = 124;
public const DROPPER = 125;
public const ACTIVATOR_RAIL = 126;
public const COCOA = 127, COCOA_BLOCK = 127;
public const SANDSTONE_STAIRS = 128;
public const EMERALD_ORE = 129;
public const ENDER_CHEST = 130;
public const TRIPWIRE_HOOK = 131;
public const TRIPWIRE = 132, TRIP_WIRE = 132;
public const EMERALD_BLOCK = 133;
public const SPRUCE_STAIRS = 134;
public const BIRCH_STAIRS = 135;
public const JUNGLE_STAIRS = 136;
public const COMMAND_BLOCK = 137;
public const BEACON = 138;
public const COBBLESTONE_WALL = 139, STONE_WALL = 139;
public const FLOWER_POT_BLOCK = 140;
public const CARROTS = 141, CARROT_BLOCK = 141;
public const POTATOES = 142, POTATO_BLOCK = 142;
public const WOODEN_BUTTON = 143;
public const MOB_HEAD_BLOCK = 144, SKULL_BLOCK = 144;
public const ANVIL = 145;
public const TRAPPED_CHEST = 146;
public const LIGHT_WEIGHTED_PRESSURE_PLATE = 147;
public const HEAVY_WEIGHTED_PRESSURE_PLATE = 148;
public const COMPARATOR_BLOCK = 149, UNPOWERED_COMPARATOR = 149;
public const POWERED_COMPARATOR = 150;
public const DAYLIGHT_DETECTOR = 151, DAYLIGHT_SENSOR = 151;
public const REDSTONE_BLOCK = 152;
public const NETHER_QUARTZ_ORE = 153, QUARTZ_ORE = 153;
public const HOPPER_BLOCK = 154;
public const QUARTZ_BLOCK = 155;
public const QUARTZ_STAIRS = 156;
public const DOUBLE_WOODEN_SLAB = 157;
public const WOODEN_SLAB = 158;
public const STAINED_CLAY = 159, STAINED_HARDENED_CLAY = 159, TERRACOTTA = 159;
public const STAINED_GLASS_PANE = 160;
public const LEAVES2 = 161;
public const LOG2 = 162;
public const ACACIA_STAIRS = 163;
public const DARK_OAK_STAIRS = 164;
public const SLIME = 165, SLIME_BLOCK = 165;
public const GLOW_STICK = 166;
public const IRON_TRAPDOOR = 167;
public const PRISMARINE = 168;
public const SEALANTERN = 169, SEA_LANTERN = 169;
public const HAY_BALE = 170, HAY_BLOCK = 170;
public const CARPET = 171;
public const HARDENED_CLAY = 172;
public const COAL_BLOCK = 173;
public const PACKED_ICE = 174;
public const DOUBLE_PLANT = 175;
public const STANDING_BANNER = 176;
public const WALL_BANNER = 177;
public const DAYLIGHT_DETECTOR_INVERTED = 178, DAYLIGHT_SENSOR_INVERTED = 178;
public const RED_SANDSTONE = 179;
public const RED_SANDSTONE_STAIRS = 180;
public const DOUBLE_STONE_SLAB2 = 181;
public const STONE_SLAB2 = 182;
public const SPRUCE_FENCE_GATE = 183;
public const BIRCH_FENCE_GATE = 184;
public const JUNGLE_FENCE_GATE = 185;
public const DARK_OAK_FENCE_GATE = 186;
public const ACACIA_FENCE_GATE = 187;
public const REPEATING_COMMAND_BLOCK = 188;
public const CHAIN_COMMAND_BLOCK = 189;
public const HARD_GLASS_PANE = 190;
public const HARD_STAINED_GLASS_PANE = 191;
public const CHEMICAL_HEAT = 192;
public const SPRUCE_DOOR_BLOCK = 193;
public const BIRCH_DOOR_BLOCK = 194;
public const JUNGLE_DOOR_BLOCK = 195;
public const ACACIA_DOOR_BLOCK = 196;
public const DARK_OAK_DOOR_BLOCK = 197;
public const GRASS_PATH = 198;
public const FRAME_BLOCK = 199, ITEM_FRAME_BLOCK = 199;
public const CHORUS_FLOWER = 200;
public const PURPUR_BLOCK = 201;
public const COLORED_TORCH_RG = 202;
public const PURPUR_STAIRS = 203;
public const COLORED_TORCH_BP = 204;
public const UNDYED_SHULKER_BOX = 205;
public const END_BRICKS = 206;
public const FROSTED_ICE = 207;
public const END_ROD = 208;
public const END_GATEWAY = 209;
public const MAGMA = 213;
public const NETHER_WART_BLOCK = 214;
public const RED_NETHER_BRICK = 215;
public const BONE_BLOCK = 216;
public const SHULKER_BOX = 218;
public const PURPLE_GLAZED_TERRACOTTA = 219;
public const WHITE_GLAZED_TERRACOTTA = 220;
public const ORANGE_GLAZED_TERRACOTTA = 221;
public const MAGENTA_GLAZED_TERRACOTTA = 222;
public const LIGHT_BLUE_GLAZED_TERRACOTTA = 223;
public const YELLOW_GLAZED_TERRACOTTA = 224;
public const LIME_GLAZED_TERRACOTTA = 225;
public const PINK_GLAZED_TERRACOTTA = 226;
public const GRAY_GLAZED_TERRACOTTA = 227;
public const SILVER_GLAZED_TERRACOTTA = 228;
public const CYAN_GLAZED_TERRACOTTA = 229;
public const BLUE_GLAZED_TERRACOTTA = 231;
public const BROWN_GLAZED_TERRACOTTA = 232;
public const GREEN_GLAZED_TERRACOTTA = 233;
public const RED_GLAZED_TERRACOTTA = 234;
public const BLACK_GLAZED_TERRACOTTA = 235;
public const CONCRETE = 236;
public const CONCRETEPOWDER = 237, CONCRETE_POWDER = 237;
public const CHEMISTRY_TABLE = 238;
public const UNDERWATER_TORCH = 239;
public const CHORUS_PLANT = 240;
public const STAINED_GLASS = 241;
public const PODZOL = 243;
public const BEETROOT_BLOCK = 244;
public const STONECUTTER = 245;
public const GLOWINGOBSIDIAN = 246, GLOWING_OBSIDIAN = 246;
public const NETHERREACTOR = 247, NETHER_REACTOR = 247;
public const INFO_UPDATE = 248;
public const INFO_UPDATE2 = 249;
public const MOVINGBLOCK = 250, MOVING_BLOCK = 250;
public const OBSERVER = 251;
public const STRUCTURE_BLOCK = 252;
public const HARD_GLASS = 253;
public const HARD_STAINED_GLASS = 254;
public const RESERVED6 = 255;
public const IRON_SHOVEL = 256;
public const IRON_PICKAXE = 257;
public const IRON_AXE = 258;
public const FLINT_AND_STEEL = 259, FLINT_STEEL = 259;
public const APPLE = 260;
public const BOW = 261;
public const ARROW = 262;
public const COAL = 263;
public const DIAMOND = 264;
public const IRON_INGOT = 265;
public const GOLD_INGOT = 266;
public const IRON_SWORD = 267;
public const WOODEN_SWORD = 268;
public const WOODEN_SHOVEL = 269;
public const WOODEN_PICKAXE = 270;
public const WOODEN_AXE = 271;
public const STONE_SWORD = 272;
public const STONE_SHOVEL = 273;
public const STONE_PICKAXE = 274;
public const STONE_AXE = 275;
public const DIAMOND_SWORD = 276;
public const DIAMOND_SHOVEL = 277;
public const DIAMOND_PICKAXE = 278;
public const DIAMOND_AXE = 279;
public const STICK = 280;
public const BOWL = 281;
public const MUSHROOM_STEW = 282;
public const GOLDEN_SWORD = 283, GOLD_SWORD = 283;
public const GOLDEN_SHOVEL = 284, GOLD_SHOVEL = 284;
public const GOLDEN_PICKAXE = 285, GOLD_PICKAXE = 285;
public const GOLDEN_AXE = 286, GOLD_AXE = 286;
public const STRING = 287;
public const FEATHER = 288;
public const GUNPOWDER = 289;
public const WOODEN_HOE = 290;
public const STONE_HOE = 291;
public const IRON_HOE = 292;
public const DIAMOND_HOE = 293;
public const GOLDEN_HOE = 294, GOLD_HOE = 294;
public const SEEDS = 295, WHEAT_SEEDS = 295;
public const WHEAT = 296;
public const BREAD = 297;
public const LEATHER_CAP = 298, LEATHER_HELMET = 298;
public const LEATHER_CHESTPLATE = 299, LEATHER_TUNIC = 299;
public const LEATHER_LEGGINGS = 300, LEATHER_PANTS = 300;
public const LEATHER_BOOTS = 301;
public const CHAINMAIL_HELMET = 302, CHAIN_HELMET = 302;
public const CHAINMAIL_CHESTPLATE = 303, CHAIN_CHESTPLATE = 303;
public const CHAINMAIL_LEGGINGS = 304, CHAIN_LEGGINGS = 304;
public const CHAINMAIL_BOOTS = 305, CHAIN_BOOTS = 305;
public const IRON_HELMET = 306;
public const IRON_CHESTPLATE = 307;
public const IRON_LEGGINGS = 308;
public const IRON_BOOTS = 309;
public const DIAMOND_HELMET = 310;
public const DIAMOND_CHESTPLATE = 311;
public const DIAMOND_LEGGINGS = 312;
public const DIAMOND_BOOTS = 313;
public const GOLDEN_HELMET = 314, GOLD_HELMET = 314;
public const GOLDEN_CHESTPLATE = 315, GOLD_CHESTPLATE = 315;
public const GOLDEN_LEGGINGS = 316, GOLD_LEGGINGS = 316;
public const GOLDEN_BOOTS = 317, GOLD_BOOTS = 317;
public const FLINT = 318;
public const PORKCHOP = 319, RAW_PORKCHOP = 319;
public const COOKED_PORKCHOP = 320;
public const PAINTING = 321;
public const GOLDEN_APPLE = 322;
public const SIGN = 323;
public const OAK_DOOR = 324, WOODEN_DOOR = 324;
public const BUCKET = 325;
public const MINECART = 328;
public const SADDLE = 329;
public const IRON_DOOR = 330;
public const REDSTONE = 331, REDSTONE_DUST = 331;
public const SNOWBALL = 332;
public const BOAT = 333;
public const LEATHER = 334;
public const KELP = 335;
public const BRICK = 336;
public const CLAY = 337, CLAY_BALL = 337;
public const REEDS = 338, SUGARCANE = 338;
public const PAPER = 339;
public const BOOK = 340;
public const SLIMEBALL = 341, SLIME_BALL = 341;
public const CHEST_MINECART = 342, MINECART_WITH_CHEST = 342;
public const EGG = 344;
public const COMPASS = 345;
public const FISHING_ROD = 346;
public const CLOCK = 347;
public const GLOWSTONE_DUST = 348;
public const FISH = 349, RAW_FISH = 349;
public const COOKED_FISH = 350;
public const DYE = 351;
public const BONE = 352;
public const SUGAR = 353;
public const CAKE = 354;
public const BED = 355;
public const REPEATER = 356;
public const COOKIE = 357;
public const FILLED_MAP = 358;
public const SHEARS = 359;
public const MELON = 360, MELON_SLICE = 360;
public const PUMPKIN_SEEDS = 361;
public const MELON_SEEDS = 362;
public const BEEF = 363, RAW_BEEF = 363;
public const COOKED_BEEF = 364, STEAK = 364;
public const CHICKEN = 365, RAW_CHICKEN = 365;
public const COOKED_CHICKEN = 366;
public const ROTTEN_FLESH = 367;
public const ENDER_PEARL = 368;
public const BLAZE_ROD = 369;
public const GHAST_TEAR = 370;
public const GOLDEN_NUGGET = 371, GOLD_NUGGET = 371;
public const NETHER_WART = 372;
public const POTION = 373;
public const GLASS_BOTTLE = 374;
public const SPIDER_EYE = 375;
public const FERMENTED_SPIDER_EYE = 376;
public const BLAZE_POWDER = 377;
public const MAGMA_CREAM = 378;
public const BREWING_STAND = 379;
public const CAULDRON = 380;
public const ENDER_EYE = 381;
public const GLISTERING_MELON = 382, SPECKLED_MELON = 382;
public const SPAWN_EGG = 383;
public const BOTTLE_O_ENCHANTING = 384, EXPERIENCE_BOTTLE = 384;
public const FIREBALL = 385, FIRE_CHARGE = 385;
public const WRITABLE_BOOK = 386;
public const WRITTEN_BOOK = 387;
public const EMERALD = 388;
public const FRAME = 389, ITEM_FRAME = 389;
public const FLOWER_POT = 390;
public const CARROT = 391;
public const POTATO = 392;
public const BAKED_POTATO = 393;
public const POISONOUS_POTATO = 394;
public const EMPTYMAP = 395, EMPTY_MAP = 395, MAP = 395;
public const GOLDEN_CARROT = 396;
public const MOB_HEAD = 397, SKULL = 397;
public const CARROTONASTICK = 398, CARROT_ON_A_STICK = 398;
public const NETHERSTAR = 399, NETHER_STAR = 399;
public const PUMPKIN_PIE = 400;
public const FIREWORKS = 401;
public const FIREWORKSCHARGE = 402, FIREWORKS_CHARGE = 402;
public const ENCHANTED_BOOK = 403;
public const COMPARATOR = 404;
public const NETHERBRICK = 405, NETHER_BRICK = 405;
public const NETHER_QUARTZ = 406, QUARTZ = 406;
public const MINECART_WITH_TNT = 407, TNT_MINECART = 407;
public const HOPPER_MINECART = 408, MINECART_WITH_HOPPER = 408;
public const PRISMARINE_SHARD = 409;
public const HOPPER = 410;
public const RABBIT = 411, RAW_RABBIT = 411;
public const COOKED_RABBIT = 412;
public const RABBIT_STEW = 413;
public const RABBIT_FOOT = 414;
public const RABBIT_HIDE = 415;
public const HORSEARMORLEATHER = 416, HORSE_ARMOR_LEATHER = 416, LEATHER_HORSE_ARMOR = 416;
public const HORSEARMORIRON = 417, HORSE_ARMOR_IRON = 417, IRON_HORSE_ARMOR = 417;
public const GOLDEN_HORSE_ARMOR = 418, GOLD_HORSE_ARMOR = 418, HORSEARMORGOLD = 418, HORSE_ARMOR_GOLD = 418;
public const DIAMOND_HORSE_ARMOR = 419, HORSEARMORDIAMOND = 419, HORSE_ARMOR_DIAMOND = 419;
public const LEAD = 420;
public const NAMETAG = 421, NAME_TAG = 421;
public const PRISMARINE_CRYSTALS = 422;
public const MUTTON = 423, MUTTONRAW = 423, MUTTON_RAW = 423, RAW_MUTTON = 423;
public const COOKED_MUTTON = 424, MUTTONCOOKED = 424, MUTTON_COOKED = 424;
public const ARMOR_STAND = 425;
public const END_CRYSTAL = 426;
public const SPRUCE_DOOR = 427;
public const BIRCH_DOOR = 428;
public const JUNGLE_DOOR = 429;
public const ACACIA_DOOR = 430;
public const DARK_OAK_DOOR = 431;
public const CHORUS_FRUIT = 432;
public const CHORUS_FRUIT_POPPED = 433;
public const BANNER_PATTERN = 434;
public const DRAGON_BREATH = 437;
public const SPLASH_POTION = 438;
public const LINGERING_POTION = 441;
public const SPARKLER = 442;
public const COMMAND_BLOCK_MINECART = 443, MINECART_WITH_COMMAND_BLOCK = 443;
public const ELYTRA = 444;
public const SHULKER_SHELL = 445;
public const BANNER = 446;
public const MEDICINE = 447;
public const BALLOON = 448;
public const RAPID_FERTILIZER = 449;
public const TOTEM = 450;
public const BLEACH = 451;
public const IRON_NUGGET = 452;
public const ICE_BOMB = 453;
public const TRIDENT = 455;
public const BEETROOT = 457;
public const BEETROOT_SEEDS = 458;
public const BEETROOT_SOUP = 459;
public const RAW_SALMON = 460, SALMON = 460;
public const CLOWNFISH = 461;
public const PUFFERFISH = 462;
public const COOKED_SALMON = 463;
public const DRIED_KELP = 464;
public const NAUTILUS_SHELL = 465;
public const APPLEENCHANTED = 466, APPLE_ENCHANTED = 466, ENCHANTED_GOLDEN_APPLE = 466;
public const HEART_OF_THE_SEA = 467;
public const TURTLE_SHELL_PIECE = 468;
public const TURTLE_HELMET = 469;
public const PHANTOM_MEMBRANE = 470;
public const CROSSBOW = 471;
public const SPRUCE_SIGN = 472;
public const BIRCH_SIGN = 473;
public const JUNGLE_SIGN = 474;
public const ACACIA_SIGN = 475;
public const DARKOAK_SIGN = 476;
public const SWEET_BERRIES = 477;
public const COMPOUND = 499;
public const RECORD_13 = 500;
public const RECORD_CAT = 501;
public const RECORD_BLOCKS = 502;
public const RECORD_CHIRP = 503;
public const RECORD_FAR = 504;
public const RECORD_MALL = 505;
public const RECORD_MELLOHI = 506;
public const RECORD_STAL = 507;
public const RECORD_STRAD = 508;
public const RECORD_WARD = 509;
public const RECORD_11 = 510;
public const RECORD_WAIT = 511;
public const SHIELD = 513;
}

View File

@ -23,7 +23,8 @@ declare(strict_types=1);
namespace pocketmine\item;
use pocketmine\data\bedrock\PotionTypeIdMap;
use pocketmine\data\runtime\RuntimeDataWriter;
use pocketmine\data\runtime\RuntimeEnumSerializer;
use pocketmine\entity\Living;
use pocketmine\player\Player;
@ -36,8 +37,8 @@ class Potion extends Item implements ConsumableItem{
parent::__construct($identifier, $name);
}
public function getMeta() : int{
return PotionTypeIdMap::getInstance()->toId($this->potionType);
protected function encodeType(RuntimeDataWriter $w) : void{
RuntimeEnumSerializer::writePotionType($w, $this->potionType);
}
public function getType() : PotionType{ return $this->potionType; }

View File

@ -23,7 +23,8 @@ declare(strict_types=1);
namespace pocketmine\item;
use pocketmine\data\bedrock\PotionTypeIdMap;
use pocketmine\data\runtime\RuntimeDataWriter;
use pocketmine\data\runtime\RuntimeEnumSerializer;
use pocketmine\entity\Location;
use pocketmine\entity\projectile\SplashPotion as SplashPotionEntity;
use pocketmine\entity\projectile\Throwable;
@ -38,8 +39,8 @@ class SplashPotion extends ProjectileItem{
parent::__construct($identifier, $name);
}
public function getMeta() : int{
return PotionTypeIdMap::getInstance()->toId($this->potionType);
protected function encodeType(RuntimeDataWriter $w) : void{
RuntimeEnumSerializer::writePotionType($w, $this->potionType);
}
public function getType() : PotionType{ return $this->potionType; }

View File

@ -54,12 +54,12 @@ use pocketmine\player\Player;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\utils\SingletonTrait;
use function get_class;
use function morton2d_encode;
class TypeConverter{
use SingletonTrait;
private const PM_ID_TAG = "___Id___";
private const PM_META_TAG = "___Meta___";
private const RECIPE_INPUT_WILDCARD_META = 0x7fff;
@ -176,8 +176,7 @@ class TypeConverter{
if($nbt === null){
$nbt = new CompoundTag();
}
$nbt->setInt(self::PM_ID_TAG, $itemStack->getId());
$nbt->setInt(self::PM_META_TAG, $itemStack->getMeta());
$nbt->setInt(self::PM_ID_TAG, morton2d_encode($itemStack->getTypeId(), $itemStack->computeTypeData()));
}else{
[$id, $meta, $blockRuntimeId] = $idMeta;
}

View File

@ -142,6 +142,7 @@ use function max;
use function mb_strlen;
use function microtime;
use function min;
use function morton2d_encode;
use function preg_match;
use function spl_object_id;
use function sqrt;
@ -641,7 +642,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
*/
public function getItemCooldownExpiry(Item $item) : int{
$this->checkItemCooldowns();
return $this->usedItemsCooldown[$item->getId()] ?? 0;
return $this->usedItemsCooldown[morton2d_encode($item->getTypeId(), $item->computeTypeData())] ?? 0;
}
/**
@ -649,7 +650,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
*/
public function hasItemCooldown(Item $item) : bool{
$this->checkItemCooldowns();
return isset($this->usedItemsCooldown[$item->getId()]);
return isset($this->usedItemsCooldown[morton2d_encode($item->getTypeId(), $item->computeTypeData())]);
}
/**
@ -658,7 +659,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
public function resetItemCooldown(Item $item, ?int $ticks = null) : void{
$ticks = $ticks ?? $item->getCooldownTicks();
if($ticks > 0){
$this->usedItemsCooldown[$item->getId()] = $this->server->getTick() + $ticks;
$this->usedItemsCooldown[morton2d_encode($item->getTypeId(), $item->computeTypeData())] = $this->server->getTick() + $ticks;
}
}

View File

@ -1,38 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\data\bedrock;
use PHPUnit\Framework\TestCase;
use pocketmine\block\utils\CoralType;
class CoralTypeIdMapTest extends TestCase{
public function testFromIdExhaustiveness() : void{
foreach(CoralType::getAll() as $type){
$id = CoralTypeIdMap::getInstance()->toId($type);
$type2 = CoralTypeIdMap::getInstance()->fromId($id);
self::assertTrue($type2 !== null && $type->equals($type2));
}
}
}