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

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

Best Java code snippets using net.minecraft.entity.ai.attributes.AttributeModifier.getOperation (Showing top 6 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: CoFH/CoFHCore

if (attributemodifier.getOperation() != 1 && attributemodifier.getOperation() != 2) {
  d1 = d0;
} else {
  ret.add(new TextComponentString("     " + StringHelper.LIGHT_BLUE + I18n.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier.getOperation(), ItemStack.DECIMALFORMAT.format(d1), I18n.translateToLocal("attribute.name." + entry.getKey()))));
} else if (d0 < 0.0D) {
  d1 = -d1;
  ret.add(new TextComponentString("     " + StringHelper.LIGHT_RED + I18n.translateToLocalFormatted("attribute.modifier.take." + attributemodifier.getOperation(), ItemStack.DECIMALFORMAT.format(d1), I18n.translateToLocal("attribute.name." + entry.getKey()))));
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: CoFH/CoFHCore

  for (Entry<IAttribute, AttributeModifier> entry : map.entrySet()) {
    AttributeModifier attributemodifier = entry.getValue();
    AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.getAttributeModifierAmount(effect.getAmplifier(), attributemodifier), attributemodifier.getOperation());
    list1.add(new Tuple((entry.getKey()).getName(), attributemodifier1));
double d1;
if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2) {
  d1 = attributemodifier2.getAmount();
} else {
  list.add(TextFormatting.BLUE + StringHelper.localizeFormat("attribute.modifier.plus." + attributemodifier2.getOperation(), ItemStack.DECIMALFORMAT.format(d1), StringHelper.localize("attribute.name." + tuple.getFirst())));
} else if (d0 < 0.0D) {
  d1 = d1 * -1.0D;
  list.add(TextFormatting.RED + StringHelper.localizeFormat("attribute.modifier.take." + attributemodifier2.getOperation(), ItemStack.DECIMALFORMAT.format(d1), StringHelper.localize("attribute.name." + tuple.getFirst())));
origin: GregTechCE/GregTech

      new AttributeModifier(modifier.getName(),
          potion.getAttributeModifierAmount(potionEffect.getAmplifier(), modifier),
          modifier.getOperation())));
double d0 = modifier.getAmount();
double d1;
if (modifier.getOperation() != 1 && modifier.getOperation() != 2) {
  d1 = modifier.getAmount();
} else {
  lines.add(TextFormatting.BLUE + I18n.format("attribute.modifier.plus." + modifier.getOperation(), ItemStack.DECIMALFORMAT.format(d1), I18n.format("attribute.name." + tuple.getFirst())));
} else if (d0 < 0.0D) {
  d1 = d1 * -1.0D;
  lines.add(TextFormatting.RED + I18n.format("attribute.modifier.take." + modifier.getOperation(), ItemStack.DECIMALFORMAT.format(d1), I18n.format("attribute.name." + tuple.getFirst())));
origin: vadis365/TheErebus

for (Entry<IAttribute, AttributeModifier> entry : map.entrySet()) {
  AttributeModifier modifier = entry.getValue();
  attributes.put(entry.getKey().getName(), new AttributeModifier(modifier.getName(), potion.getAttributeModifierAmount(effect.getAmplifier(), modifier), modifier.getOperation()));
double amount1;
if (modifier.getOperation() != 1 && modifier.getOperation() != 2)
  amount1 = modifier.getAmount();
else
  list.add(TextFormatting.BLUE + new TextComponentTranslation("attribute.modifier.plus." + modifier.getOperation(), new Object[] { ItemStack.DECIMALFORMAT.format(amount1), new TextComponentTranslation("attribute.name." + entry.getKey()) }).getFormattedText());
else if (amount0 < 0.0D) {
  amount1 *= -1.0D;
  list.add(TextFormatting.RED + new TextComponentTranslation("attribute.modifier.take." + modifier.getOperation(), new Object[] { ItemStack.DECIMALFORMAT.format(amount1), new TextComponentTranslation("attribute.name." + entry.getKey()) }).getFormattedText());
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.attributesAttributeModifiergetOperation

Popular methods of AttributeModifier

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • runOnUiThread (Activity)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
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