pmmp / BedrockProtocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP
GNU Lesser General Public License v3.0
135 stars 91 forks source link

PacketSerializer error when using MobEquipmentPacket #218

Closed DanteDEVS closed 7 months ago

DanteDEVS commented 7 months ago

[21:12:21.288] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\network\mcpe\protocol\MobEquipmentPacket::getTypeId()" (EXCEPTION) in "pmsrc/vendor/pocketmine/bedrock-protocol/src/serializer/PacketSerializer" at line 453

Thats exact error

im not sure if its a problem with my code but its only giving out that.

Newcoolboys commented 7 months ago

Can you show how you're using MobEquipmentPacket?

jasonw4331 commented 7 months ago

Is your pocketmine installation operating onthe src directory with composer for dependencies? If so, make sure you updated the composer dependencies after you updated your pocketmine source.

Newcoolboys commented 7 months ago

I don't think this is a PM sided error, its a user sided error, something within the users code

DanteDEVS commented 7 months ago

`
$pk = new MobEquipmentPacket(); $pk->actorRuntimeId = $player->getId(); $pk->item = ItemStackWrapper::legacy(new ItemStack(20138, 0, 1, 0, null, [], [])); $pk->inventorySlot = 0; $pk->hotbarSlot = 0; $player->sendData($this->getViewers(), [$pk]);

`

Newcoolboys commented 7 months ago

try and see if the error presists after using this:

        $pk = MobEquipmentPacket::create(
            $this->getId(),
            ItemStackWrapper::legacy(TypeConverter::getInstance()->coreItemStackToNet(VanillaItems::IRON_SWORD())),
            0,
            0,
            ContainerIds::INVENTORY
        );
        $player->getNetworkSession()->sendDataPacket($pk);
DanteDEVS commented 7 months ago

Wow it works know, but know, u see the code is for throwable sword entity that i attempted to convert from pm3 to pm5, but know its not moving like the thing just stands still, then despawns because of a despawn sword task, and ive tried mostly everything i can do with my knowledge with pm5