net.minecraft.entity.ai.attributes.IAttribute Java Examples
The following examples show how to use
net.minecraft.entity.ai.attributes.IAttribute.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HorseStats.java From ForgeHax with MIT License | 5 votes |
private void applyStats(double newJump, double newSpeed) { final IAttribute jump_strength = FastReflection.Fields.AbstractHorse_JUMP_STRENGTH.get(getRidingEntity()); final IAttribute movement_speed = FastReflection.Fields.SharedMonsterAttributes_MOVEMENT_SPEED.get(getRidingEntity()); ((EntityLivingBase) getRidingEntity()) .getEntityAttribute(jump_strength) .setBaseValue(newJump); ((EntityLivingBase) getRidingEntity()) .getEntityAttribute(movement_speed) .setBaseValue(newSpeed); }
Example #2
Source File: BodyguardGolemCore.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public IAttributeInstance getEntityAttribute(IAttribute p_110148_1_) { if(golem != null) { return golem.getEntityAttribute(p_110148_1_); } return super.getEntityAttribute(p_110148_1_); }
Example #3
Source File: WeaponHelper.java From Levels with GNU General Public License v2.0 | 5 votes |
private static NBTTagCompound writeAttributeModifierToNBT(IAttribute attribute, AttributeModifier modifier, EntityEquipmentSlot slot) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("AttributeName", attribute.getName()); nbt.setString("Name", modifier.getName()); nbt.setString("Slot", slot.getName()); nbt.setDouble("Amount", modifier.getAmount()); nbt.setInteger("Operation", modifier.getOperation()); nbt.setLong("UUIDMost", modifier.getID().getMostSignificantBits()); nbt.setLong("UUIDLeast", modifier.getID().getLeastSignificantBits()); return nbt; }
Example #4
Source File: EntityUtil.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
public static IAttributeInstance removeModifier(EntityLivingBase ent, IAttribute p, UUID u) { IAttributeInstance att = ent.getEntityAttribute(p); AttributeModifier curmod = att.getModifier(u); if (curmod != null) { att.removeModifier(curmod); } return att; }
Example #5
Source File: LingeringPotion.java From Et-Futurum with The Unlicense | 4 votes |
@Override @SideOnly(Side.CLIENT) @SuppressWarnings({ "rawtypes", "unchecked" }) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isComplex) { if (stack.getItemDamage() == 0) return; List<PotionEffect> effects = getEffects(stack); HashMultimap<String, AttributeModifier> attributes = HashMultimap.create(); if (effects == null || effects.isEmpty()) { String s = StatCollector.translateToLocal("potion.empty").trim(); list.add(EnumChatFormatting.GRAY + s); } else for (PotionEffect potioneffect : effects) { String s1 = StatCollector.translateToLocal(potioneffect.getEffectName()).trim(); Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; Map<IAttribute, AttributeModifier> map = potion.func_111186_k(); if (map != null && map.size() > 0) for (Entry<IAttribute, AttributeModifier> entry : map.entrySet()) { AttributeModifier attributemodifier = entry.getValue(); AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.func_111183_a(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation()); attributes.put(entry.getKey().getAttributeUnlocalizedName(), attributemodifier1); } if (potioneffect.getAmplifier() > 0) s1 = s1 + " " + StatCollector.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim(); if (potioneffect.getDuration() > 20) s1 = s1 + " (" + Potion.getDurationString(potioneffect) + ")"; if (potion.isBadEffect()) list.add(EnumChatFormatting.RED + s1); else list.add(EnumChatFormatting.GRAY + s1); } if (!attributes.isEmpty()) { list.add(""); list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("potion.effects.whenDrank")); for (Entry<String, AttributeModifier> entry1 : attributes.entries()) { AttributeModifier attributemodifier2 = entry1.getValue(); double d0 = attributemodifier2.getAmount(); double d1; if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2) d1 = attributemodifier2.getAmount(); else d1 = attributemodifier2.getAmount() * 100.0D; if (d0 > 0.0D) list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier2.getOperation(), new Object[] { ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + entry1.getKey()) })); else if (d0 < 0.0D) { d1 *= -1.0D; list.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + attributemodifier2.getOperation(), new Object[] { ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + entry1.getKey()) })); } } } }