Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
How do setMaxHealth to custom EntitySkeleton?

I want to create a custom Skeleton that has a name, more health and holds other custom items. I can add a name and setHealth(), but I can't setMaxHealth() and also setting items and armor just won't work.

Thanks for helping, here is my code:

Player p = (Player) sender;
WorldServer world = ((CraftWorld)p.getWorld()).getHandle();
Location loc = p.getLocation();

if (args.length > 0) {
            if (args[0].equalsIgnoreCase("define")) {
                //get worldedit selection
                if (getWorldEdit().getSelection(p) == null) {
                    p.sendMessage(title + "Please select a region with WorldEdit");
                    return false;
                }
                s = getWorldEdit().getSelection(p);
                Location min = s.getMinimumPoint();
                Location max = s.getMaximumPoint();

                //boss mob creation
                EntitySkeleton boss = new EntitySkeleton(world);
                boss.setHealth(400);
                boss.setCustomName("§4§lDAFT BOSS");
                boss.setCustomNameVisible(true);

                ItemStack weapon = new ItemStack(Material.DIAMOND_SWORD);
                weapon.setDurability((short) 0);
                weapon.addEnchantment(Enchantment.DAMAGE_ALL, 5);
                weapon.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2);



                boss.setLocation(max);
                world.addEntity(boss);


            }
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

That can be obtained using the Attributable interface, as said in this thread from Spigot.


Example:

For 1.9 and over:

Entity boss;
Attributable bossAttributable = (Attributable) boss;
AttributeInstance ai = bossAttributable.getAttribute(Attribute.GENERIC_MAX_HEALTH);
ai.setValue(400.0);

For 1.8.8 and lower, this must be done another way:

Entity boss;
Damageable bossDamageable = (Damageable) boss;
bossDamageable.setMaxHealth(400.0);
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda