下面列出了怎么用org.bukkit.attribute.Attribute的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* what should be done to the Tool if the Modifier gets removed
*
* @param tool the Tool
*/
public void removeMod(ItemStack tool) {
ItemMeta meta = tool.getItemMeta();
if (meta != null) {
for (Enchantment enchantment : getAppliedEnchantments()) {
meta.removeEnchant(enchantment);
}
for (Attribute attribute : getAppliedAttributes()) {
meta.removeAttributeModifier(attribute);
}
tool.setItemMeta(meta);
}
}
public static LivingEntity constructSuperMob(LivingEntity livingEntity) {
if (!SuperMobProperties.isValidSuperMobType(livingEntity)) {
Bukkit.getLogger().warning("[EliteMobs] Attempted to construct an invalid supermob. Report this to the dev!");
return null;
}
String name = ChatColorConverter.convert(SuperMobProperties.getDataInstance(livingEntity).getName());
double newMaxHealth = SuperMobProperties.getDataInstance(livingEntity).getDefaultMaxHealth() * ConfigValues.defaultConfig.getInt(DefaultConfig.SUPERMOB_STACK_AMOUNT);
livingEntity.setCustomName(name);
livingEntity.setCustomNameVisible(true);
livingEntity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(newMaxHealth);
livingEntity.setHealth(newMaxHealth);
EntityTracker.registerSuperMob(livingEntity);
return livingEntity;
}
private Player mockPlayer(String name, GameMode gameMode) {
Player mock = mock(Player.class);
PlayerInventory inv = mock(PlayerInventory.class);
inv.setContents(new ItemStack[39]);
inv.setArmorContents(new ItemStack[4]);
Inventory enderChest = mock(Inventory.class);
enderChest.setContents(new ItemStack[27]);
given(mock.getInventory()).willReturn(inv);
given(mock.getEnderChest()).willReturn(enderChest);
given(mock.getName()).willReturn(name);
given(mock.getUniqueId()).willReturn(TestHelper.TEST_UUID);
given(mock.getGameMode()).willReturn(gameMode);
AttributeInstance attribute = mock(AttributeInstance.class);
given(mock.getAttribute(Attribute.GENERIC_MAX_HEALTH)).willReturn(attribute);
given(attribute.getBaseValue()).willReturn(20.0);
return mock;
}
/**
* Clear the player's inventory, potion effects etc.
* <p>
* Does NOT handle flight.
*/
public void clearPlayerData() {
player.getInventory().clear();
player.getInventory().setArmorContents(null);
player.setExp(0f);
player.setLevel(0);
double maxHealth;
if (is1_9) {
maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
} else {
maxHealth = player.getMaxHealth();
}
player.setHealth(maxHealth);
player.setFoodLevel(20);
player.setExp(0f);
player.setLevel(0);
for (PotionEffect effect : player.getActivePotionEffects()) {
player.removePotionEffect(effect.getType());
}
if (is1_9) {
player.setCollidable(true);
player.setInvulnerable(false);
}
}
@EventHandler(ignoreCancelled = true)
public void onDamagePlayer(ProjectileHitEvent event) {
if (event.getHitEntity() instanceof Player) {
Player player = (Player) event.getHitEntity();
Projectile projectile = event.getEntity();
Region r = RedProtect.get().rm.getTopRegion(projectile.getLocation());
double damage;
if (getConfig().getString("projectile-damage").endsWith("%")) {
damage = (player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() / 100) * Double.valueOf(getConfig().getString("projectile-damage", "100%").replace("%", ""));
} else {
damage = getConfig().getInt("projectile-damage");
}
if (r != null && r.getFlagBool("killer-projectiles") && getConfig().getStringList("allowed-types").contains(projectile.getType().name())) {
player.setHealth(damage);
}
}
}
@Override
public ItemUseHandler getItemHandler() {
return e -> {
Player p = e.getPlayer();
// Player is neither burning nor injured
if (p.getFireTicks() <= 0 && p.getHealth() >= p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
return;
}
if (p.getGameMode() != GameMode.CREATIVE) {
ItemUtils.consumeItem(e.getItem(), false);
}
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_SKELETON_HURT, 1, 1);
p.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 0));
e.cancel();
};
}
@Override
public ItemUseHandler getItemHandler() {
return e -> {
Player p = e.getPlayer();
// Player is neither burning nor injured
if (p.getFireTicks() <= 0 && p.getHealth() >= p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
return;
}
if (p.getGameMode() != GameMode.CREATIVE) {
ItemUtils.consumeItem(e.getItem(), false);
}
p.getWorld().playEffect(p.getLocation(), Effect.STEP_SOUND, Material.WHITE_WOOL);
p.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 1));
p.setFireTicks(0);
e.cancel();
};
}
/**
* Updates all the values of a player in the cache.
*
* @param newData The current snapshot of the Player
* @param currentPlayer The PWIPlayer currently in the cache
*/
public void updateCache(Player newData, PWIPlayer currentPlayer) {
ConsoleLogger.debug("Updating player '" + newData.getName() + "' in the cache");
currentPlayer.setSaved(false);
currentPlayer.setArmor(newData.getInventory().getArmorContents());
currentPlayer.setEnderChest(newData.getEnderChest().getContents());
currentPlayer.setInventory(newData.getInventory().getContents());
currentPlayer.setCanFly(newData.getAllowFlight());
currentPlayer.setDisplayName(newData.getDisplayName());
currentPlayer.setExhaustion(newData.getExhaustion());
currentPlayer.setExperience(newData.getExp());
currentPlayer.setFlying(newData.isFlying());
currentPlayer.setFoodLevel(newData.getFoodLevel());
if (checkServerVersion(plugin.getServer().getVersion(), 1, 9, 0)) {
currentPlayer.setMaxHealth(newData.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue());
} else {
currentPlayer.setMaxHealth(newData.getMaxHealth());
}
currentPlayer.setHealth(newData.getHealth());
currentPlayer.setLevel(newData.getLevel());
currentPlayer.setSaturationLevel(newData.getSaturation());
currentPlayer.setPotionEffects(newData.getActivePotionEffects());
currentPlayer.setFallDistance(newData.getFallDistance());
currentPlayer.setFireTicks(newData.getFireTicks());
currentPlayer.setMaxAir(newData.getMaximumAir());
currentPlayer.setRemainingAir(newData.getRemainingAir());
if (plugin.getEconomy() != null) {
currentPlayer.setBankBalance(plugin.getEconomy().bankBalance(newData.getName()).balance);
currentPlayer.setBalance(plugin.getEconomy().getBalance(newData));
}
}
@Override
public void remove(MatchPlayer player) {
for (Map.Entry<String, AttributeModifier> entry : modifiers.entries()) {
AttributeInstance attributeValue =
player.getBukkit().getAttribute(Attribute.byName(entry.getKey()));
if (attributeValue != null && attributeValue.getModifiers().contains(entry.getValue())) {
attributeValue.removeModifier(entry.getValue());
}
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onDamage(EntityDamageEvent event) {
if (event.getCause() != EntityDamageEvent.DamageCause.WITHER) return;
if (!(event.getEntity() instanceof Player)) return;
if (!this.effectHealsPlayer) return;
Player player = (Player) event.getEntity();
if (!player.hasPermission("minetinker.modifiers.withered.use")) {
return;
}
boolean hasWither = false;
ItemStack armor = null;
for (ItemStack stack : player.getInventory().getArmorContents()) {
if (stack == null) continue;
if (modManager.hasMod(stack, this)) {
hasWither = true;
armor = stack;
break;
}
}
if (!hasWither) return;
double damage = event.getDamage();
if (damage > 0) {
event.setDamage(0);
double health = player.getHealth();
player.setHealth(Math.min(health + damage, player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()));
ChatWriter.logModifier(player, event, this, armor, String.format("Health(%.2f -> %.2f)", health, player.getHealth()));
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onHit(EntityDamageEvent event) {
if (!(event.getEntity() instanceof Player)) {
return;
}
Player player = (Player) event.getEntity();
if (!player.hasPermission("minetinker.modifiers.berserk.use")) {
return;
}
ItemStack chest = player.getInventory().getChestplate();
if (!modManager.isArmorViable(chest)) {
return;
}
int modifierLevel = modManager.getModLevel(chest, this);
if (modifierLevel <= 0) {
return;
}
double lifeAfterDamage = player.getHealth() - event.getFinalDamage();
AttributeInstance healthAttr = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
double maxHealth = 20;
if (healthAttr != null) {
maxHealth = healthAttr.getValue();
}
if (player.getHealth() / maxHealth > trigger / 100.0 && lifeAfterDamage / maxHealth <= trigger / 100.0) {
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, boostTime, modifierLevel - 1));
ChatWriter.logModifier(player, event, this, chest,
"Time(" + boostTime + ")", "Amplifier(" + (modifierLevel - 1) + ")");
}
}
@EventHandler
public void onDamage(EntityDamageEvent event) {
if (event.getEntityType() != EntityType.PLAYER) return;
String world = event.getEntity().getWorld().getName().toLowerCase();
Player player = (Player) event.getEntity();
if (this.worldHealthMap.containsKey(world)) {
player.setHealth(this.worldHealthMap.get(world));
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
if (attribute != null) {
attribute.setBaseValue(this.worldMaxHealthMap.get(world));
}
event.setCancelled(true);
}
}
@Override
public boolean applyMod(Player player, ItemStack tool, boolean isCommand) {
ItemMeta meta = tool.getItemMeta();
if (meta == null) {
return false;
}
//To check if armor modifiers are on the armor
Collection<AttributeModifier> attributeModifiers = meta.getAttributeModifiers(Attribute.GENERIC_ARMOR);
if (attributeModifiers == null || attributeModifiers.isEmpty()) {
modManager.addArmorAttributes(tool);
meta = tool.getItemMeta();
}
Collection<AttributeModifier> speedModifiers = meta.getAttributeModifiers(Attribute.GENERIC_MOVEMENT_SPEED);
double speedOnItem = 0.0D;
if (!(speedModifiers == null || speedModifiers.isEmpty())) {
HashSet<String> names = new HashSet<>();
for (AttributeModifier am : speedModifiers) {
if (names.add(am.getName())) speedOnItem += am.getAmount();
}
}
meta.removeAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED);
meta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED,
new AttributeModifier(UUID.randomUUID(), (MineTinker.is16compatible) ? "generic.movement_speed" : "generic.movementSpeed", speedOnItem + this.speedPerLevel, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.LEGS));
meta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED,
new AttributeModifier(UUID.randomUUID(), (MineTinker.is16compatible) ? "generic.movement_speed" : "generic.movementSpeed", speedOnItem + this.speedPerLevel, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.FEET));
tool.setItemMeta(meta);
return true;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onDamage(EntityDamageEvent event) {
if (event.getCause() != EntityDamageEvent.DamageCause.POISON) return;
if (!(event.getEntity() instanceof Player)) return;
if (!this.effectHealsPlayer) return;
Player player = (Player) event.getEntity();
if (!player.hasPermission("minetinker.modifiers.poisonous.use")) {
return;
}
boolean hasPoisonous = false;
ItemStack armor = null;
for (ItemStack stack : player.getInventory().getArmorContents()) {
if (stack == null) continue;
if (modManager.hasMod(stack, this)) {
hasPoisonous = true;
armor = stack;
break;
}
}
if (!hasPoisonous) return;
double damage = event.getDamage();
if (damage > 0) {
event.setDamage(0);
double health = player.getHealth();
player.setHealth(Math.min(health + damage, player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()));
ChatWriter.logModifier(player, event, this, armor, String.format("Health(%.2f -> %.2f)", health, player.getHealth()));
}
}
@Override
public ItemUseHandler getItemHandler() {
return e -> {
Player p = e.getPlayer();
// Player is neither burning nor injured
if (p.getFireTicks() <= 0 && p.getHealth() >= p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
return;
}
if (p.getGameMode() != GameMode.CREATIVE) {
ItemUtils.consumeItem(e.getItem(), false);
}
p.getWorld().playEffect(p.getLocation(), Effect.STEP_SOUND, Material.WHITE_WOOL);
p.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 0));
p.setFireTicks(0);
e.cancel();
};
}
/**
* Gets the first found modifier that applies the supplied attribute.
*
* @param attribute
* @return the Modifier or null
*/
@Nullable
public Modifier getModifierFromAttribute(@NotNull Attribute attribute) {
for (Modifier modifier : getAllMods()) {
if (modifier.getAppliedAttributes().contains(attribute)) {
return modifier;
}
}
return null;
}
PWIPlayer(Player player, Group group, double bankBalance, double balance, boolean useAttributes) {
this.uuid = player.getUniqueId();
this.name = player.getName();
this.location = player.getLocation();
this.group = group;
this.saved = false;
this.armor = player.getInventory().getArmorContents();
this.enderChest = player.getEnderChest().getContents();
this.inventory = player.getInventory().getContents();
this.canFly = player.getAllowFlight();
this.displayName = player.getDisplayName();
this.exhaustion = player.getExhaustion();
this.experience = player.getExp();
this.isFlying = player.isFlying();
this.foodLevel = player.getFoodLevel();
if (useAttributes) {
this.maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
} else {
this.maxHealth = player.getMaxHealth();
}
this.health = player.getHealth();
this.gamemode = player.getGameMode();
this.level = player.getLevel();
this.saturationLevel = player.getSaturation();
this.potionEffects = player.getActivePotionEffects();
this.fallDistance = player.getFallDistance();
this.fireTicks = player.getFireTicks();
this.maxAir = player.getMaximumAir();
this.remainingAir = player.getRemainingAir();
this.bankBalance = bankBalance;
this.balance = balance;
}
/**
* Set a player's stats to defaults, and optionally clear their inventory.
*
* @param plugin {@link PerWorldInventory} for econ.
* @param player The player to zero.
* @param clearInventory Clear the player's inventory.
*/
public static void zeroPlayer(PerWorldInventory plugin, Player player, boolean clearInventory) {
if (clearInventory) {
player.getInventory().clear();
player.getEnderChest().clear();
}
player.setExp(0f);
player.setFoodLevel(20);
if (checkServerVersion(Bukkit.getVersion(), 1, 9, 0)) {
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
} else {
player.setHealth(player.getMaxHealth());
}
player.setLevel(0);
for (PotionEffect effect : player.getActivePotionEffects()) {
player.removePotionEffect(effect.getType());
}
player.setSaturation(5f);
player.setFallDistance(0f);
player.setFireTicks(0);
if (plugin.isEconEnabled()) {
Economy econ = plugin.getEconomy();
econ.bankWithdraw(player.getName(), econ.bankBalance(player.getName()).amount);
econ.withdrawPlayer(player, econ.getBalance(player));
}
}
@Override
public AttributeInstance getAttribute(Attribute attribute) {
Preconditions.checkArgument(attribute != null, "attribute");
net.minecraft.entity.ai.attributes.IAttributeInstance nms = handle.getAttributeInstanceByName(toMinecraft(attribute.name()));
return (nms == null) ? null : new CraftAttributeInstance(nms, attribute);
}
private boolean addModifier0(Attribute attribute, AttributeModifier modifier) {
final AttributeInstance attributeInstance = player.getAttribute(attribute);
if(attributeInstance != null && !attributeInstance.getModifiers().contains(modifier)) {
attributeInstance.addModifier(modifier);
return true;
}
return false;
}
private boolean removeModifier0(Attribute attribute, AttributeModifier modifier) {
AttributeInstance attributeValue = player.getAttribute(attribute);
if(attributeValue != null && attributeValue.getModifiers().contains(modifier)) {
attributeValue.removeModifier(modifier);
return true;
}
return false;
}
@Override
protected Attribute parseInternal(Node node, String text) throws FormatException, InvalidXMLException {
Attribute attribute = Attribute.byName(text);
if(attribute != null) return attribute;
attribute = Attribute.byName("generic." + text);
if(attribute != null) return attribute;
throw new InvalidXMLException("Unknown attribute '" + text + "'", node);
}
@Override
protected void configure() {
NumberFactory.numberTypes().forEach(type -> bindNumber((Class) type));
bindPrimitiveParser(Boolean.class).to(BooleanParser.class);
bindPrimitiveParser(String.class).to(StringParser.class);
bindPrimitiveParser(Duration.class).to(DurationParser.class);
bindPrimitiveParser(ImVector.class).to(new TypeLiteral<VectorParser<Double>>(){});
bindPrimitiveParser(Vector.class).to((TypeLiteral) new TypeLiteral<PrimitiveParser<ImVector>>(){});
bindPrimitiveParser(Team.OptionStatus.class).to(TeamRelationParser.class);
bindPrimitiveParser(MessageTemplate.class).to(MessageTemplateParser.class);
bindPrimitiveParser(Material.class).to(MaterialParser.class);
bindPrimitiveParser(MaterialData.class).to(MaterialDataParser.class);
bindPrimitiveParser(Attribute.class).to(AttributeParser.class);
bind(PercentageParser.class);
bind(PercentagePropertyFactory.class);
install(new EnumPropertyManifest<ChatColor>(){});
install(new EnumPropertyManifest<EntityType>(){});
install(new EnumPropertyManifest<DyeColor>(){});
// etc...
install(new PropertyManifest<>(Boolean.class));
install(new PropertyManifest<>(String.class));
install(new PropertyManifest<>(Duration.class, DurationProperty.class));
install(new PropertyManifest<>(ImVector.class));
install(new PropertyManifest<>(Vector.class));
install(new PropertyManifest<>(MessageTemplate.class, MessageTemplateProperty.class));
}
@Override
public boolean matches(IPlayerQuery query) {
return query.onlinePlayer()
.filter(player -> range.contains(player.getBukkit()
.getAttribute(Attribute.GENERIC_LUCK)
.getValue()))
.isPresent();
}
@Nullable
@Override
public JsonObject getItemAttributes(ItemMeta meta){
if (!meta.hasAttributeModifiers()){
return null;
}
JsonObject attributesJson = new JsonObject();
Multimap<Attribute, AttributeModifier> attributeModifiers = meta.getAttributeModifiers();
for (Attribute attribute : attributeModifiers.keySet()){
JsonArray modifiersJson = new JsonArray();
Collection<AttributeModifier> modifiers = attributeModifiers.get(attribute);
for (AttributeModifier modifier : modifiers){
JsonObject modifierObject = new JsonObject();
modifierObject.addProperty("name", modifier.getName());
modifierObject.addProperty("amount", modifier.getAmount());
modifierObject.addProperty("operation", modifier.getOperation().name());
if (modifier.getSlot() != null){
modifierObject.addProperty("slot", modifier.getSlot().name());
}
modifiersJson.add(modifierObject);
}
attributesJson.add(attribute.name(), modifiersJson);
}
return attributesJson;
}
@Override
public ItemMeta applyItemAttributes(ItemMeta meta, JsonObject attributes){
Set<Map.Entry<String, JsonElement>> entries = attributes.entrySet();
for (Map.Entry<String, JsonElement> attributeEntry : entries){
Attribute attribute = Attribute.valueOf(attributeEntry.getKey());
for (JsonElement jsonElement : attributeEntry.getValue().getAsJsonArray()) {
JsonObject modifier = jsonElement.getAsJsonObject();
String name = modifier.get("name").getAsString();
double amount = modifier.get("amount").getAsDouble();
String operation = modifier.get("operation").getAsString();
EquipmentSlot slot = null;
if (modifier.has("slot")){
slot = EquipmentSlot.valueOf(modifier.get("slot").getAsString());
}
meta.addAttributeModifier(attribute, new AttributeModifier(
UUID.randomUUID(),
name,
amount,
AttributeModifier.Operation.valueOf(operation),
slot
));
}
}
return meta;
}
@EventHandler
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}
Entity projectile = event.getDamager();
if (!(projectile instanceof Arrow) || !(event.getEntity() instanceof Player)) {
return;
}
Arrow arrow = (Arrow) projectile;
Player damagee = (Player) event.getEntity();
double maxHP = damagee.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); //TODO check to make sure this works
if (arrowDamages.get(arrow) == null) {
return;
}
//String ownerName = arrowOwners.get(arrow);
//Player player = null;
//if (ownerName != null) {
// player = Bukkit.getPlayer(ownerName);
//}
int damage = (int) ((double) arrowDamages.get(arrow) / 100.0 * maxHP);
arrowDamages.remove(arrow);
//arrowOwners.remove(arrow);
//if (player != null) {
// damagee.damage(damage, player);
//} else {
// damagee.damage(damage);
//damagee.damage(damage);
//}
// event.setCancelled(true);
damage = DamageEffect.adjustForArmor(damage, damagee);
event.setDamage(damage);
}
@EventHandler @SuppressWarnings("unused")
public void onCivilianQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
Civilian civilian = CivilianManager.getInstance().getCivilian(uuid);
if (civilian.isInCombat() && ConfigManager.getInstance().getCombatLogPenalty() > 0) {
int penalty = (int) (player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() *
ConfigManager.getInstance().getCombatLogPenalty() / 100);
if (civilian.getLastDamager() != null) {
Player damager = Bukkit.getPlayer(civilian.getLastDamager());
if (damager != null && damager.isOnline()) {
player.damage(penalty);
}
} else {
player.damage(penalty);
}
}
CivilianManager.getInstance().unloadCivilian(player);
CommonScheduler.getLastRegion().remove(uuid);
CommonScheduler.getLastTown().remove(uuid);
CommonScheduler.removeLastAnnouncement(uuid);
MenuManager.clearHistory(uuid);
MenuManager.clearData(uuid);
TownManager.getInstance().clearInvite(uuid);
AnnouncementUtil.clearPlayer(uuid);
StructureUtil.removeBoundingBox(uuid);
}
@Override
public HashMap<String, Double> getVariables() {
Object target = getTarget();
HashMap<String, Double> returnMap = new HashMap<>();
if (!(target instanceof LivingEntity)) {
return returnMap;
}
LivingEntity livingEntity = (LivingEntity) target;
returnMap.put("health", livingEntity.getHealth());
returnMap.put("maxHealth", livingEntity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
return returnMap;
}
/**
* Gets the maximum health of an {@link LivingEntity}.
*/
public static double getMaxHealth(LivingEntity livingEntity)
{
switch (ServerVersion.getActiveServerVersion()) {
case MC188:
return livingEntity.getMaxHealth();
case MC112:
case MC113:
case MC114:
case MC115:
return Objects.requireNonNull((livingEntity).getAttribute(Attribute.GENERIC_MAX_HEALTH), "Tried to get max health of an entity without health.").getValue();
default:
throw new UnknownMinecraftVersion();
}
}