Custom Mob with armor

Discussion in 'Plugin Development' started by Julian., Aug 23, 2021.

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


    Hi i trying to make custom mob have amor when i try to cast my custom mob in EntitySpawnigEvent with the armor i choice its say
    Caused by: java.lang.ClassCastException: fr.julian.SpecialMob.SpeMob.ZombieCuir cannot be cast to org.bukkit.entity.LivingEntity
            at ~[?:?]
            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[?:1.8.0_211]
            at java.lang.reflect.Method.invoke( ~[?:1.8.0_211]
            at$1.execute( ~[server.jar:git-Spigot-37d799b-3eb7236]

    and there is my code :

    if (chance < 0.75f && chance > 0.25f) {
                    ZombieCuir ZombieC = new ZombieCuir(e.getLocation());
                    ((CraftWorld) e.getLocation().getWorld()).getHandle().addEntity(ZombieC);
                    LivingEntity entity = (LivingEntity)ZombieC;
                    entity.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
  2. Offline


    You cannot cast your custom class to a LivingEntity, read the error.
  3. Offline


    Why dont you try ZombieC.getBukkitEntity().getInventory().setBoots() //not sure if thats how you do it but smthing like that.
Thread Status:
Not open for further replies.

Share This Page