1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Skeleton Armor, ItemHeld

Discussion in 'Development' started by DanDen, Jun 22, 2018.

  1. DanDen

    DanDen Spider

    Messages:
    11
    Hi, I implemented a mob how do I add armor and items in the hand?
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Living entities have a getArmorInventory() method. For the held item, you might need to fake it using MobEquipmentPacket.
     
  3. DanDen

    DanDen Spider

    Messages:
    11
    PHP:
        public function spawnTo(Player $player): void {
            
    parent::spawnTo($player);
            
    $pk = new MobEquipmentPacket();
            
    $pk->entityRuntimeId $this->getId();
            
    $pk->item = new Item(Item::BOW);
            
    $pk->slot 0;
            
    $pk->selectedSlot 0;
            
    $player->dataPacket($pk);
        }
    ok work ty
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.