@Override public double getAttributeModifierAmount(int amplifier, AttributeModifier modifier) { // Reduce health if (modifier.getID().equals(ModPotions.MALNOURISHMENT_HEALTH)) return 0 - (amplifier + 1); // Half-heart per level return 0D; } }
@Override public double getAttributeModifierAmount(int amplifier, AttributeModifier modifier) { // Increase health if (modifier.getID().equals(ModPotions.NOURISHMENT_HEALTH)) return (amplifier + 1); // Half-heart per level return 0D; } }
@Override public double getAttributeModifierAmount(int amplifier, AttributeModifier modifier) { // Multiply health if (modifier.getID().equals(ModPotions.TOUGHNESS_HEALTH)) return (amplifier + 1) * 4D; // 4 = two hearts // Multiply armor toughness if (modifier.getID().equals(ModPotions.TOUGHNESS_ARMOR)) return (amplifier + 1) * 2D; // Multiply attack speed if (modifier.getID().equals(ModPotions.TOUGHNESS_ATTACK_SPEED)) return (amplifier + 1) * 0.1D; return 0D; } }
private void manageHasPower() { IAttributeInstance speed = player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); if (speed.getModifier(outOfPowerSpeedModifier.getID()) != null) { speed.removeModifier(outOfPowerSpeedModifier); } }
private static boolean clearModifiers(@Nonnull EntityPlayer player) { IAttributeInstance moveInst = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MOVEMENT_SPEED); UUID uuid = DarkSteelAttributeModifiers.getWalkSpeed(false, 1, 0).getID(); AttributeModifier modifier = moveInst.getModifier(uuid); if (modifier != null) { moveInst.removeModifier(modifier); return true; } return false; }
double d0 = attributemodifier.getAmount(); if (field_111210_e.equals(attributemodifier.getID())) { d0 += EnchantmentHelper.getModifierForCreature(stack, EnumCreatureAttribute.UNDEFINED);
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); } }
public ItemStack addAttributeToPart(ItemStack part, AttributeModifier attribute) { if (part.getTagCompound() == null) { part.setTagCompound(new NBTTagCompound()); } NBTTagList attributeList = part.getTagCompound().getTagList("CustomAttributes", Constants.NBT.TAG_COMPOUND); NBTTagCompound attributeTag = new NBTTagCompound(); attributeTag.setString("Name", attribute.getName()); attributeTag.setDouble("Amount", attribute.getAmount()); attributeTag.setString("UUID", attribute.getID().toString()); attributeTag.setByte("Operation", (byte) attribute.getOperation()); attributeList.appendTag(attributeTag); part.setTagInfo("CustomAttributes", attributeList); return part; }