movementSpeed.setBaseValue(oldAttributes.getAttributeInstance(SharedMonsterAttributes.MOVEMENT_SPEED).getBaseValue()); movementSpeed.applyModifier(new AttributeModifier("Ermergerd Virus D:", movementSpeed.getBaseValue(), 0)); health.setBaseValue(oldAttributes.getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).getBaseValue()); health.applyModifier(new AttributeModifier("Ermergerd Virus D:", health.getBaseValue(), 0)); jumpHeight.setBaseValue(oldAttributes.getAttributeInstance(AbstractHorse.JUMP_STRENGTH).getBaseValue()); jumpHeight.applyModifier(new AttributeModifier("Ermergerd Virus D:", jumpHeight.getBaseValue() * 0.5, 0));
@Override public double getConvertedDMG(EntityCreature entity) { IAttributeInstance dmg = entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE); if (dmg != null) { return dmg.getBaseValue() * 1.3; } else { return Balance.mobProps.CONVERTED_MOB_DEFAULT_DMG; } }
public NpcAI(T npc) { this.npc = npc; maxPFDist = npc.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getBaseValue() * 0.90d; maxPFDistSq = maxPFDist * maxPFDist; }
@Override public double getConvertedSpeed(EntityCreature entity) { return Math.min(entity.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getBaseValue() * 1.2, 2.9D); } };
@Override public double getConvertedMaxHealth(EntityCreature entity) { return entity.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).getBaseValue() * 1.5; }
@Override public double getConvertedKnockbackResistance(EntityCreature entity) { return entity.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).getBaseValue(); }
private double getAttribute(EntityPlayer player, ItemStack stack, Multimap<String, AttributeModifier> map, String key) { if(player == null) // apparently this can happen return 0; Collection<AttributeModifier> collection = map.get(key); if(collection.isEmpty()) return 0; AttributeModifier attributemodifier = collection.iterator().next(); double d0 = attributemodifier.getAmount(); boolean flag = false; if(key.equals("generic.attackDamage")) { d0 += player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getBaseValue(); d0 += (double) EnchantmentHelper.getModifierForCreature(stack, EnumCreatureAttribute.UNDEFINED); } else if(key.equals("generic.attackSpeed")) d0 += player.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getBaseValue(); return d0; }
public double getScore(Iterable<? extends EntityLivingBase> entities) { double score = 0.0F; for (EntityLivingBase entity : entities) { if (entity != null && entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE) != null) { score += entity.getHealth() * entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getBaseValue(); } } return score; }
public static double getMaxHealth(EntityLivingBase living) { IAttributeInstance healthAttribute = living.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH); double maxHealth = healthAttribute.getBaseValue(); AttributeModifier modifier = healthAttribute.getModifier(HEALTH_MODIFIER_ID); if (modifier != null) { maxHealth += modifier.getAmount(); } return maxHealth; }
public double getSpeedMultiply() { return player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue() / player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getBaseValue(); }
public static void setMaxHealth(EntityLivingBase living, double max) { IAttributeInstance healthAttribute = living.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH); double amount = max - healthAttribute.getBaseValue(); AttributeModifier modifier = healthAttribute.getModifier(HEALTH_MODIFIER_ID); // Need to remove modifier to apply a new one if (modifier != null) { healthAttribute.removeModifier(modifier); } // Operation 0 is a flat increase modifier = new AttributeModifier(HEALTH_MODIFIER_ID, HEALTH_MODIFIER_NAME, amount, 0); healthAttribute.applyModifier(modifier); }
public double maxReachDistance(EntityPlayer player) { IAttributeInstance instance = player.getEntityAttribute(Attributes.extendedReach); double reachMod = instance.getAttributeValue(); ItemStack itemStack = player.getHeldItemMainhand(); if (!itemStack.isEmpty()) { if (itemStack.getItem() instanceof ItemBlock) reachMod += 0.1F;//Don't reduce block in hands range as much else reachMod -= instance.getBaseValue(); } return reachMod + defaultReachDistance(player.capabilities.isCreativeMode); }
@Override public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { if (StringHelper.displayShiftForDetail && !StringHelper.isShiftKeyDown()) { tooltip.add(StringHelper.shiftForDetails()); } if (!StringHelper.isShiftKeyDown()) { return; } if (stack.getTagCompound() == null) { EnergyHelper.setDefaultEnergyTag(stack, 0); } tooltip.add(StringHelper.localize("info.cofh.charge") + ": " + StringHelper.getScaledNumber(getEnergyStored(stack)) + " / " + StringHelper.getScaledNumber(getMaxEnergyStored(stack)) + " RF"); tooltip.add(StringHelper.ORANGE + getEnergyPerUse(stack) + " " + StringHelper.localize("info.redstonearsenal.tool.energyPerUse") + StringHelper.END); RAProps.addEmpoweredTip(this, stack, tooltip); if (getEnergyStored(stack) >= getEnergyPerUse(stack) && worldIn != null) { int adjustedDamage = (int) (damage + Minecraft.getMinecraft().player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getBaseValue()); tooltip.add(""); tooltip.add(StringHelper.LIGHT_BLUE + adjustedDamage + " " + StringHelper.localize("info.cofh.damageAttack") + StringHelper.END); tooltip.add(StringHelper.BRIGHT_GREEN + (isEmpowered(stack) ? damageCharged : 1) + " " + StringHelper.localize("info.cofh.damageFlux") + StringHelper.END); } }
@Override public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { if (StringHelper.displayShiftForDetail && !StringHelper.isShiftKeyDown()) { tooltip.add(StringHelper.shiftForDetails()); } if (!StringHelper.isShiftKeyDown()) { return; } if (stack.getTagCompound() == null) { EnergyHelper.setDefaultEnergyTag(stack, 0); } tooltip.add(StringHelper.localize("info.cofh.charge") + ": " + StringHelper.getScaledNumber(getEnergyStored(stack)) + " / " + StringHelper.getScaledNumber(getMaxEnergyStored(stack)) + " RF"); tooltip.add(StringHelper.ORANGE + getEnergyPerUse(stack) + " " + StringHelper.localize("info.redstonearsenal.tool.energyPerUse") + StringHelper.END); RAProps.addEmpoweredTip(this, stack, tooltip); if (getEnergyStored(stack) >= getEnergyPerUse(stack) && worldIn != null) { int adjustedDamage = (int) (damage + Minecraft.getMinecraft().player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getBaseValue()); tooltip.add(""); tooltip.add(StringHelper.LIGHT_BLUE + adjustedDamage + " " + StringHelper.localize("info.cofh.damageAttack") + StringHelper.END); tooltip.add(StringHelper.BRIGHT_GREEN + (isEmpowered(stack) ? damageCharged : 1) + " " + StringHelper.localize("info.cofh.damageFlux") + StringHelper.END); } }
private void renderAttributes() { EntityTameableDragon dragon = getSelectedDragon(); if (dragon == null) { return; } text.setOrigin(text.getX() + 180, 8); text.setColor(YELLOW); text.println("Attributes"); text.setColor(WHITE); Collection<IAttributeInstance> attribs = dragon.getAttributeMap().getAllAttributes(); attribs.forEach(attrib -> { String attribName = I18n.translateToLocal("attribute.name." + attrib.getAttribute().getAttributeUnlocalizedName()); String attribValue = dfShort.format(attrib.getAttributeValue()); String attribBase = dfShort.format(attrib.getBaseValue()); text.println(attribName + " = " + attribValue + " (" + attribBase + ")"); }); text.println(); }
double health_perc = androidPlayer.getPlayer().getHealth() / androidPlayer.getPlayer().getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).getBaseValue(); int x = 0; int y = 0;