/** * Get the maximum health of this MABoss * @return the maximum health of the boss */ public double getMaxHealth() { return entity.getMaxHealth(); }
@Override public double getMaxHealth() { // Deprecated in 1.11 return le.getMaxHealth(); }
/** * Get the maximum health for an entity (LivingEntity). * * @param entity * @return * @throws RuntimeException, * in case of an IncompatibleClassChangeError without success on * recovery attempts. */ public static double getMaxHealth(final LivingEntity entity) { try{ // TODO: Attribute.GENERIC_MAX_HEALTH for latest. return entity.getMaxHealth(); } catch(IncompatibleClassChangeError e) { return getDoubleOrInt(entity, "getMaxHealth", e); } }
@Override public boolean isTarget(LivingEntity ent, String text) { try { if (text.startsWith("healthabove:")) { String haText = text.substring("healthabove:".length()); double haVal = Double.parseDouble(haText); if (ent.getHealth() / ent.getMaxHealth() > haVal * 0.01) { return true; } } else if (text.startsWith("healthbelow:")) { String haText = text.substring("healthbelow:".length()); double haVal = Double.parseDouble(haText); if (ent.getHealth() / ent.getMaxHealth() < haVal * 0.01) { return true; } } } catch (NumberFormatException ex) { // Do nothing. // TODO: Maybe show a one-time warning? } catch (Exception ex) { ex.printStackTrace(); } return false; } }
private static String createHealthDisplay(MobHealthbarType mobHealthbarType, LivingEntity entity, double damage) { double maxHealth = entity.getMaxHealth(); double currentHealth = Math.max(entity.getHealth() - damage, 0); double healthPercentage = (currentHealth / maxHealth) * 100.0D;
private void applyHealing(final LivingEntity livingEntity) { if (livingEntity.getHealth() < livingEntity.getMaxHealth()) { livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, this.potDuration, this.power)); AirAbility.breakBreathbendingHold(livingEntity); this.healing = true; this.healingSelf = false; } }
/** * Handle the Beast Lore ability. * * @param target The entity to examine */ public void beastLore(LivingEntity target) { Player player = getPlayer(); Tameable beast = (Tameable) target; String message = LocaleLoader.getString("Combat.BeastLore") + " "; if (beast.isTamed() && beast.getOwner() != null) { message = message.concat(LocaleLoader.getString("Combat.BeastLoreOwner", beast.getOwner().getName()) + " "); } message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth())); player.sendMessage(message); }
@Override public void run() { if (livingEntity.isValid()) { Location location = livingEntity.getLocation(); location.getWorld().playSound(location, Sound.BLOCK_FIRE_EXTINGUISH, 0.8F, 0.8F); ParticleEffectUtils.playCallOfTheWildEffect(livingEntity); CombatUtils.dealDamage(livingEntity, livingEntity.getMaxHealth(), DamageCause.SUICIDE, livingEntity); } TamingManager.removeFromTracker(this); this.cancel(); }
private void giveHP(final LivingEntity livingEntity) { if (!livingEntity.isDead() && livingEntity.getHealth() < livingEntity.getMaxHealth()) { this.applyHealing(livingEntity); } else { this.healing = false; } for (final PotionEffect effect : livingEntity.getActivePotionEffects()) { if (ElementalAbility.isNegativeEffect(effect.getType())) { livingEntity.removePotionEffect(effect.getType()); } } }
int health = (int) Math.max(1D, e.getMaxHealth() * mul); try { e.setMaxHealth(health); health = (int) (mul < 1D ? e.getMaxHealth() * mul : 1); health = Math.max(1, health); e.setHealth(Math.min(health, e.getMaxHealth())); break; case SUPPLY:
entity.setHealth(entity.getMaxHealth()); break; entity.setHealth(entity.getMaxHealth()); horse.setColor(Horse.Color.values()[Misc.getRandom().nextInt(Horse.Color.values().length)]); horse.setStyle(Horse.Style.values()[Misc.getRandom().nextInt(Horse.Style.values().length)]);
final LivingEntity entity = e.getEntity(); final int level = (new Double(entity.getMaxHealth()).intValue()) - 1;
CombatUtils.dealDamage(target, Math.max(target.getMaxHealth() / 4, 1), EntityDamageEvent.DamageCause.CUSTOM, getPlayer()); // Make it so you can shake a mob no more than 4 times. applyXpGain(ExperienceConfig.getInstance().getFishingShakeXP(), XPGainReason.PVE);
+ spawn_distance + " maxhealth: " + entity.getMaxHealth());
if (health != getLivingEntity().getMaxHealth()) { getLivingEntity().setMaxHealth(health);