Solved Giving Mobs Armor

Discussion in 'Plugin Development' started by The Fancy Whale, Mar 2, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    The Fancy Whale

    I am trying to give my mob a glass helmet. Is this impossible? This is how I am trying to do it but this is wrong:
    Code:java
    1. @EventHandler
    2. public void onSpawn(CreatureSpawnEvent e){
    3. ItemStack glass = new ItemStack(Material.GLASS);
    4. if (e.getSpawnReason() == (SpawnReason.NATURAL)){
    5. if (e.getEntityType() == EntityType.ZOMBIE){
    6. Zombie zombi = (Zombie)e.getEntity();
    7. zombi.setEquiment(0, glass);
    8. }
    9.  
    10. }
    11. }


    Thanks any help is greatly appreciated!
     
  2. Offline

    GaaTavares

    I'm pretty sure you can just add armor to them (not blocks). I may be wrong, try using armor and see what happens.
     
  3. Offline

    The Fancy Whale

    GaaTavares Well that code is wrong even if I were to put armor.
    Code:java
    1. zombi.setEquiment(0, glass);

    Isn't a real thing
     
  4. Offline

    Desle

    The Fancy Whale

    This and all the other stuff;
    Code:java
    1. entity.getEquipment().setBoots();
    2. entity.getEquipment().setLeggings();
    3. entity.getEquipment().setHelmet();
    4. entity.getEquipment().setChestplate();
     
    The Fancy Whale likes this.
  5. Offline

    The Fancy Whale

    Desle Thanks so much!
     
Thread Status:
Not open for further replies.

Share This Page