Examples of IAttributeInstance


Examples of net.minecraft.entity.ai.attributes.IAttributeInstance

    return true;
  }

  private void updateSword(EntityPlayer player) {
    if(ItemDarkSteelSword.isEquipped(player)) {
      IAttributeInstance attackInst = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.attackDamage);
      attackInst.removeModifier(swordDamageModifierPowered);

      ItemStack sword = player.getCurrentEquippedItem();
      if(Config.darkSteelSwordPowerUsePerHit <= 0 || EnderIO.itemDarkSteelSword.getEnergyStored(sword) >= Config.darkSteelSwordPowerUsePerHit) {
        attackInst.applyModifier(swordDamageModifierPowered);
      }
    }
  }
View Full Code Here

Examples of net.minecraft.entity.ai.attributes.IAttributeInstance

  private void updateSpeed(EntityPlayer player) {
    if(player.worldObj.isRemote || !player.onGround) {
      return;
    }

    IAttributeInstance moveInst = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.movementSpeed);
    if(moveInst.getModifier(walkModifiers[0].getID()) != null) {
      moveInst.removeModifier(walkModifiers[0]); //any will so as they all have the same UID
    } else if(moveInst.getModifier(sprintModifiers[0].getID()) != null) {
      moveInst.removeModifier(sprintModifiers[0]);
    }

    ItemStack leggings = player.getEquipmentInSlot(2);
    SpeedUpgrade speedUpgrade = SpeedUpgrade.loadFromItem(leggings);
    if(leggings != null && leggings.getItem() == EnderIO.itemDarkSteelLeggings && speedUpgrade != null && isSpeedActive(player)) {

      double horzMovement = Math.abs(player.distanceWalkedModified - player.prevDistanceWalkedModified);
      double costModifier = player.isSprinting() ? Config.darkSteelSprintPowerCost : Config.darkSteelWalkPowerCost;
      costModifier = costModifier + (costModifier * speedUpgrade.walkMultiplier);
      int cost = (int) (horzMovement * costModifier);
      int totalEnergy = getPlayerEnergy(player, EnderIO.itemDarkSteelLeggings);

      if(totalEnergy > 0) {
        usePlayerEnergy(player, EnderIO.itemDarkSteelLeggings, cost);
        if(player.isSprinting()) {
          moveInst.applyModifier(sprintModifiers[speedUpgrade.level - 1]);
        } else {
          moveInst.applyModifier(walkModifiers[speedUpgrade.level - 1]);
        }
      }
    }
  }
View Full Code Here

Examples of net.minecraft.entity.ai.attributes.IAttributeInstance

    if(par3EntityLivingBase instanceof EntityHorse) {
      EntityHorse horse = (EntityHorse) par3EntityLivingBase;
      if(horse.getHorseType() != 3 && horse.getHorseType() != 4 && horse.isTame()) {
        horse.setHorseType(3 + par1ItemStack.getItemDamage());
        BaseAttributeMap attributes = horse.getAttributeMap();
        IAttributeInstance movementSpeed = attributes.getAttributeInstance(SharedMonsterAttributes.movementSpeed);
        IAttributeInstance health = attributes.getAttributeInstance(SharedMonsterAttributes.maxHealth);
        health.applyModifier(new AttributeModifier("Ermergerd Virus D:", health.getBaseValue(), 0));
        movementSpeed.applyModifier(new AttributeModifier("Ermergerd Virus D:", movementSpeed.getBaseValue(), 0));
        IAttributeInstance jumpHeight = attributes.getAttributeInstance(ReflectionHelper.<IAttribute, EntityHorse>getPrivateValue(EntityHorse.class, null, LibObfuscation.HORSE_JUMP_STRENGTH));
        jumpHeight.applyModifier(new AttributeModifier("Ermergerd Virus D:", jumpHeight.getBaseValue() * 0.5, 0));
        par2EntityPlayer.worldObj.playSound(par3EntityLivingBase.posX + 0.5D, par3EntityLivingBase.posY + 0.5D, par3EntityLivingBase.posZ + 0.5D, "mob.zombie.remedy", 1.0F + par3EntityLivingBase.worldObj.rand.nextFloat(), par3EntityLivingBase.worldObj.rand.nextFloat() * 0.7F + 1.3F, false);

        par1ItemStack.stackSize--;
        return true;
      }
View Full Code Here

Examples of net.minecraft.entity.ai.attributes.IAttributeInstance

    {
        this.getDataWatcher().updateObject(12, Byte.valueOf((byte) (isChild ? 1 : 0)));

        if (this.worldObj != null && !this.worldObj.isRemote)
        {
            IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
            iattributeinstance.removeModifier(babySpeedBoostModifier);

            if (isChild)
            {
                iattributeinstance.applyModifier(babySpeedBoostModifier);
            }
        }

        this.setChildSize(isChild);
    }
View Full Code Here

Examples of net.minecraft.entity.ai.attributes.IAttributeInstance

              int width = scaledresolution.getScaledWidth();
              int height = scaledresolution.getScaledHeight();
             
              int l1 = width / 2 + 91;
              int i2 = height - 39;
                IAttributeInstance attributeinstance = mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
              float f = (float)attributeinstance.getAttributeValue();
              float f1 = mc.thePlayer.getAbsorptionAmount();
              int j2 = MathHelper.ceiling_float_int((f + f1) / 2.0F / 10.0F);
              int k2 = Math.max(10 - (j2 - 2), 3);
              int l2 = i2 - (j2 - 1) * k2 - 10;
             
View Full Code Here

Examples of net.minecraft.entity.ai.attributes.IAttributeInstance

        if (mc.thePlayer.hurtResistantTime < 10)
        {
            highlight = false;
        }

        IAttributeInstance attrMaxHealth = this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
        int health = MathHelper.ceiling_float_int(mc.thePlayer.getHealth());
        int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth);
        float healthMax = (float)attrMaxHealth.getAttributeValue();
        float absorb = this.mc.thePlayer.getAbsorptionAmount();

        int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
        int rowHeight = Math.max(10 - (healthRows - 2), 3);
View Full Code Here

Examples of net.minecraft.entity.ai.attributes.IAttributeInstance

        if (mc.thePlayer.hurtResistantTime < 10) {
          highlight = false;
        }

        IAttributeInstance attrMaxHealth = this.mc.thePlayer
            .getEntityAttribute(SharedMonsterAttributes.maxHealth);
        int health = MathHelper.ceiling_float_int(mc.thePlayer.getHealth());
        int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth);
        float healthMax = (float) attrMaxHealth.getAttributeValue();
        if (healthMax > 20)
          healthMax = 20;
        float absorb = this.mc.thePlayer.getAbsorptionAmount();

        int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.