Mob with Armor 1.16.4

Discussion in 'Plugin Development' started by Julian., Feb 4, 2021.

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

    Julian.

    Hi i try too do a plugin to play with a friend but i can't add armor to a mob (its a special entity) i want to know if i can do it or its impossible

    The code of my entity :
    (he spawn with block break event / block place event)
    Code:
    package fr.julian.mob.mobs;
    
    
    import org.bukkit.Location;
    import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
    import org.bukkit.event.Listener;
    
    import net.md_5.bungee.api.ChatColor;
    import net.minecraft.server.v1_16_R3.ChatComponentText;
    import net.minecraft.server.v1_16_R3.EntityTypes;
    import net.minecraft.server.v1_16_R3.EntityZombie;
    import net.minecraft.server.v1_16_R3.GenericAttributes;
    
    
    public class End_Guard extends EntityZombie implements Listener {
    
        public End_Guard(Location loc) {
            super(EntityTypes.ZOMBIE, ((CraftWorld) loc.getWorld()).getHandle());
            this.setPosition(loc.getX(), loc.getY(), loc.getZ());
            this.setCustomName(new ChatComponentText(ChatColor.DARK_RED + "" + ChatColor.BOLD + "End Guard") );
            this.setCustomNameVisible(true);
            this.setAbsorptionHearts(100);
            this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(10.0D);
            this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.75D);
            this.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(50.0D);
           
    
           
        }   
    }
    
    sorry for my english i use a translator

     
    Last edited by a moderator: Feb 4, 2021
  2. Offline

    Kars

  3. Offline

    Julian.

  4. Offline

    Kars

    EntityZombie is a LivingEntity.
    You can figure the rest out yourself.
     
  5. Offline

    Julian.

    last question you tell me use living entity but inside the code i send to you and its work in 1.16.4
     
  6. Offline

    Kars

    That didn't make sense.

    But you should use Bukkits Zombie instead of vanilla EntityZombie because Bukkits Zombie is a LivingEntity.
     
Thread Status:
Not open for further replies.

Share This Page