Codota Logo
AttributeModifier.getAmount
Code IndexAdd Codota to your IDE (free)

How to use
getAmount
method
in
net.minecraft.entity.ai.attributes.AttributeModifier

Best Java code snippets using net.minecraft.entity.ai.attributes.AttributeModifier.getAmount (Showing top 9 results out of 315)

  • Common ways to obtain AttributeModifier
private void myMethod () {
AttributeModifier a =
  • Codota IconIAttributeInstance iAttributeInstance;UUID uUID;iAttributeInstance.getModifier(uUID)
  • Smart code suggestions by Codota
}
origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

@SideOnly(Side.CLIENT)
public void addDetails(ItemStack itemstack, EntityPlayer player, @Nullable World worldIn, List<String> infos) {
  super.addDetails(itemstack, player, worldIn, infos);
  Multimap<String, AttributeModifier> multimap = getModifiers(MOPlayerCapabilityProvider.GetAndroidCapability(player), itemstack);
  if (multimap != null) {
    multimap.values()
        .forEach(modifier -> {
          switch (modifier.getOperation()) {
            case 0:
              infos.add(TextFormatting.GREEN + String.format("%s: +%s", modifier.getName(), modifier.getAmount()));
              break;
            case 1:
              infos.add(TextFormatting.GREEN + String.format("%s: %s", modifier.getName(), (modifier.getAmount() >= 0 ? "+" : "") + DecimalFormat.getPercentInstance().format(modifier.getAmount())));
              break;
            default:
              infos.add(TextFormatting.GREEN + String.format("%s: %s", modifier.getName(), DecimalFormat.getPercentInstance().format(modifier.getAmount() + 1)));
          }
        });
  }
}
origin: Vazkii/Quark

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;
}

origin: Zyin055/zyinhud

/**
 * Gets the amount of melee damage delt by the specified item
 * @param itemStack
 * @return -1 if it doesn't have a damage modifier
 */
public static double GetItemWeaponDamage(ItemStack itemStack)
{
  Multimap multimap = itemStack.getItem().getAttributeModifiers(itemStack);
  
  if (multimap.containsKey(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()))
  {
    Collection attributes = multimap.get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
    if (attributes.size() > 0)
    {
      Object attribute = attributes.iterator().next();
      if (attribute instanceof AttributeModifier)
      {
        AttributeModifier weaponModifier = (AttributeModifier)attribute;
        return weaponModifier.getAmount();
      }
    }
  }
  return -1;
}

origin: PrinceOfAmber/Cyclic

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;
}
origin: CoFH/CoFHCore

double d0 = attributemodifier.getAmount();
origin: CoFH/CoFHCore

double d0 = attributemodifier2.getAmount();
double d1;
  d1 = attributemodifier2.getAmount();
} else {
  d1 = attributemodifier2.getAmount() * 100.0D;
origin: GregTechCE/GregTech

double d0 = modifier.getAmount();
double d1;
if (modifier.getOperation() != 1 && modifier.getOperation() != 2) {
  d1 = modifier.getAmount();
} else {
  d1 = modifier.getAmount() * 100.0D;
origin: vadis365/TheErebus

double amount0 = modifier.getAmount();
double amount1;
  amount1 = modifier.getAmount();
else
  amount1 = modifier.getAmount() * 100.0D;
origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

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;
}
net.minecraft.entity.ai.attributesAttributeModifiergetAmount

Popular methods of AttributeModifier

  • <init>
  • getName
  • getID
  • getOperation
  • setSaved
  • equals

Popular in Java

  • Running tasks concurrently on multiple threads
  • getContentResolver (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • findViewById (Activity)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now