@Override protected int getAttackStrength() { int res = (int) getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue(); return res; }
@Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.4); getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(MAX_HP); getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(1.0); }
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));
/** * Removes existing modifiers * * @param att Attribute * @param uuid UUID of modifier to remove */ private static void rmMod(IAttributeInstance att, UUID uuid) { AttributeModifier m = att.getModifier(uuid); if (m != null) { att.removeModifier(m); } } }
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); }
private void applyScaleModifier(IAttribute attribute) { IAttributeInstance instance = dragon.getEntityAttribute(attribute); AttributeModifier oldModifier = instance.getModifier(DragonScaleModifier.ID); if (oldModifier != null) { instance.removeModifier(oldModifier); } instance.applyModifier(new DragonScaleModifier(getScale())); }
@Override public void setAttackTarget(@Nullable EntityLivingBase entitylivingbaseIn) { super.setAttackTarget(entitylivingbaseIn); IAttributeInstance iattributeinstance = getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); if (entitylivingbaseIn == null) { targetChangeTime = 0; this.dataManager.set(SCREAMING, Boolean.valueOf(false)); iattributeinstance.removeModifier(ATTACKING_SPEED_BOOST); } else { targetChangeTime = ticksExisted; this.dataManager.set(SCREAMING, Boolean.valueOf(true)); if (!iattributeinstance.hasModifier(ATTACKING_SPEED_BOOST)) { iattributeinstance.applyModifier(ATTACKING_SPEED_BOOST); } } }
public double getSpeedMultiply() { return player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue() / player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getBaseValue(); }
private void applyModifiers() { removeModifiers(); horse.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).applyModifier(moveSpeedModifier); horse.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).applyModifier(followRangeModifier); }
if (held.isEmpty() == false) { for (AttributeModifier modifier : held.getAttributeModifiers(EntityEquipmentSlot.MAINHAND).get(SharedMonsterAttributes.ATTACK_DAMAGE.getName())) { damage.applyModifier(modifier); float dmgVal = (float) damage.getAttributeValue(); float f1 = EnchantmentHelper.getModifierForCreature(held, (ent).getCreatureAttribute()); if (ent.attackEntityFrom(DamageSource.causePlayerDamage(fakePlayer.get()), dmgVal + f1)) {
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(); }
@Override public boolean assignCitizen(final CitizenData citizen) { // Only change HP values if assign successful if (super.assignCitizen(citizen) && citizen != null) { final Optional<EntityCitizen> optCitizen = citizen.getCitizenEntity(); if (optCitizen.isPresent()) { final AttributeModifier healthModBuildingHP = new AttributeModifier(GUARD_HEALTH_MOD_BUILDING_NAME, getBonusHealth(), 0); optCitizen.get().increaseHPForGuards(); optCitizen .get() .getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH) .applyModifier(healthModBuildingHP); optCitizen .get() .getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH) .applyModifier(healthModConfig); optCitizen .get() .getEntityAttribute(SharedMonsterAttributes.ARMOR) .setBaseValue(SharedMonsterAttributes.ARMOR.getDefaultValue() + getDefenceBonus()); } return true; } return false; }
public void setChild (boolean isChild) { this.getDataManager().set(IS_CHILD, Boolean.valueOf(isChild)); if (this.world != null && !this.world.isRemote) { final IAttributeInstance speed = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); speed.removeModifier(BABY_SPEED_BOOST); if (isChild) { speed.applyModifier(BABY_SPEED_BOOST); } } this.setChildSize(isChild); } }
public NpcAI(T npc) { this.npc = npc; maxPFDist = npc.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getBaseValue() * 0.90d; maxPFDistSq = maxPFDist * maxPFDist; }
private void manageOutOfPower() { IAttributeInstance speed = player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); if (speed.getModifier(outOfPowerSpeedModifier.getID()) == null) { speed.applyModifier(outOfPowerSpeedModifier); } if (player.world.getWorldTime() % 60 == 0) { androidEffects.updateEffect(EFFECT_GLITCH_TIME, 5); playGlitchSound(this, player.getRNG(), 0.2f); } }
private void removeModifiers() { horse.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).removeModifier(moveSpeedModifier); horse.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).removeModifier(followRangeModifier); }
@Override public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) { if (player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).hasModifier(SPEED_BOOST)) { player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).removeModifier(SPEED_BOOST); } return true; }
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; }
/** * Remove all healthmodifiers from a citizen */ public void removeAllHealthModifiers() { for (final AttributeModifier mod : getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).getModifiers()) { getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).removeModifier(mod); } if (getHealth() > getMaxHealth()) { setHealth(getMaxHealth()); } }
private void setModifier(EntityPlayer player, boolean enabled) { if (enabled) { IAttributeInstance health = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH); if (health.getModifier(healthModifierUUID) == null) { health.applyModifier(new AttributeModifier(healthModifierUUID, "Bat Health Reduction", -0.9, 2).setSaved(false)); } player.capabilities.allowFlying = true; player.capabilities.isFlying = true; setFlightSpeed(player, (float) Balance.vpa.BAT_FLIGHT_SPEED); player.sendPlayerAbilities(); } else { // Health modifier IAttributeInstance health = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH); AttributeModifier m = health.getModifier(healthModifierUUID); if (m != null) { health.removeModifier(m); } if (!player.capabilities.isCreativeMode) { player.capabilities.allowFlying = false; } player.capabilities.isFlying = false; setFlightSpeed(player, 0.05F); player.sendPlayerAbilities(); } }