From c6557f0222784586f4657114ce3939ff36eb7708 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 17 Jun 2020 11:06:26 +0100 Subject: [PATCH] protocol: added a FixedItemIds class (this is fully auto-generated, unlike the one provided by the API) this may be different from the IDs exposed on the API and shouldn't be used for anything outside the protocol. TODO: we need to review the dynamicness of item numeric IDs and find out if it's possible for them to change based on StartGamePacket content. If they can, we might need to change this. --- .../serializer/NetworkBinaryStream.php | 4 +- .../mcpe/protocol/types/FixedItemIds.php | 757 ++++++++++++++++++ .../protocol/types/inventory/ItemStack.php | 4 +- 3 files changed, 761 insertions(+), 4 deletions(-) create mode 100644 src/network/mcpe/protocol/types/FixedItemIds.php diff --git a/src/network/mcpe/protocol/serializer/NetworkBinaryStream.php b/src/network/mcpe/protocol/serializer/NetworkBinaryStream.php index 60d5aa425..a1d5dd833 100644 --- a/src/network/mcpe/protocol/serializer/NetworkBinaryStream.php +++ b/src/network/mcpe/protocol/serializer/NetworkBinaryStream.php @@ -25,7 +25,6 @@ namespace pocketmine\network\mcpe\protocol\serializer; #include -use pocketmine\item\ItemIds; use pocketmine\math\Vector3; use pocketmine\nbt\NbtDataException; use pocketmine\nbt\tag\CompoundTag; @@ -46,6 +45,7 @@ use pocketmine\network\mcpe\protocol\types\entity\StringMetadataProperty; use pocketmine\network\mcpe\protocol\types\entity\Vec3MetadataProperty; use pocketmine\network\mcpe\protocol\types\GameRuleType; use pocketmine\network\mcpe\protocol\types\inventory\ItemStack; +use pocketmine\network\mcpe\protocol\types\FixedItemIds; use pocketmine\network\mcpe\protocol\types\PersonaPieceTintColor; use pocketmine\network\mcpe\protocol\types\PersonaSkinPiece; use pocketmine\network\mcpe\protocol\types\recipe\RecipeIngredient; @@ -240,7 +240,7 @@ class NetworkBinaryStream extends BinaryStream{ } $shieldBlockingTick = null; - if($id === ItemIds::SHIELD){ + if($id === FixedItemIds::SHIELD){ $shieldBlockingTick = $this->getVarLong(); } diff --git a/src/network/mcpe/protocol/types/FixedItemIds.php b/src/network/mcpe/protocol/types/FixedItemIds.php new file mode 100644 index 000000000..5b145e151 --- /dev/null +++ b/src/network/mcpe/protocol/types/FixedItemIds.php @@ -0,0 +1,757 @@ +id = $id;