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

I want to setHelmet() the ZOMBIE HEAD

Discussion in 'Facepalm' started by Krome, Apr 30, 2017.

  1. Krome

    Krome Silverfish

    Messages:
    19
    GitHub:
    kromethirty
    What do i have to type in
    $a = Item::get(Item::_____)
    I want to sethelmet the zombie head
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Use MobArmorEquipmentPacket.
    PHP:
    /** @var Zombie $zombie */
    $pk = new MobArmorEquipmentPacket();
    $pk->eid $zombie->getId();
    $helmet = new ItemItem(ItemItem::DIAMOND_HELMET);
    $pk->slots = [$helmet];
    foreach(
    $zombie->getViewers() as $viewer){
        if(
    $viewer instanceof Player){
            
    $viewer->dataPacket($pk);
        }
    }
    I highly recommend you overwrite Zombie::spawnTo(). It'll be better...
    PHP:
    public function spawnTo(Player $player){
        
    parent::spawnTo($player);
        
    $player->dataPacket($pk);
    }
     
  3. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    I think he meant setting the helmet of a player to a zombie head :p
     
  4. Krome

    Krome Silverfish

    Messages:
    19
    GitHub:
    kromethirty
    @Sandertv yes,i want to set the players helmet to zombie
     
  5. Krome

    Krome Silverfish

    Messages:
    19
    GitHub:
    kromethirty
    What do i have to write on it?
     
  6. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Use PlayerInventory::setHelmet(Item::get(Item::SKULL, 2));
     
    Last edited: Apr 30, 2017
  7. Krome

    Krome Silverfish

    Messages:
    19
    GitHub:
    kromethirty
    Thanks..Hope it'll work;)
     
  8. Primus

    Primus Zombie Pigman

    Messages:
    749
    It's much cooler if you disguise player as a zombie instead. Just my humble opinion.
     
    Sandertv likes this.
  9. Krome

    Krome Silverfish

    Messages:
    19
    GitHub:
    kromethirty
    How am i going to do that?I'll send you the php..can you put it?
     
  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.