Search in sources :

Example 1 with EnergyUpgrade

use of crazypants.enderio.base.item.darksteel.upgrade.energy.EnergyUpgrade in project EnderIO by SleepyTrousers.

the class ItemDarkSteelArmor method getSubItems.

@Override
@SideOnly(Side.CLIENT)
public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> par3List) {
    if (isInCreativeTab(tab)) {
        @Nonnull ItemStack is = new ItemStack(this);
        par3List.add(is);
        is = new ItemStack(this);
        EnergyUpgrade.EMPOWERED_FOUR.addToItem(is, this);
        EnergyUpgradeManager.setPowerFull(is, this);
        Iterator<IDarkSteelUpgrade> iter = DarkSteelRecipeManager.recipeIterator();
        while (iter.hasNext()) {
            IDarkSteelUpgrade upgrade = iter.next();
            if (!(upgrade instanceof EnergyUpgrade || upgrade instanceof GliderUpgrade || upgrade instanceof ElytraUpgrade) && upgrade.canAddToItem(is, this)) {
                upgrade.addToItem(is, this);
            }
        }
        if (GliderUpgrade.INSTANCE.canAddToItem(is, this)) {
            ItemStack is2 = is.copy();
            GliderUpgrade.INSTANCE.addToItem(is2, this);
            par3List.add(is2);
            if (ElytraUpgrade.INSTANCE.canAddToItem(is, this)) {
                ItemStack is3 = is.copy();
                ElytraUpgrade.INSTANCE.addToItem(is3, this);
                par3List.add(is3);
            }
            return;
        }
        par3List.add(is);
    }
}
Also used : GliderUpgrade(crazypants.enderio.base.item.darksteel.upgrade.glider.GliderUpgrade) Nonnull(javax.annotation.Nonnull) ElytraUpgrade(crazypants.enderio.base.item.darksteel.upgrade.elytra.ElytraUpgrade) EnergyUpgrade(crazypants.enderio.base.item.darksteel.upgrade.energy.EnergyUpgrade) ItemStack(net.minecraft.item.ItemStack) IDarkSteelUpgrade(crazypants.enderio.api.upgrades.IDarkSteelUpgrade) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with EnergyUpgrade

use of crazypants.enderio.base.item.darksteel.upgrade.energy.EnergyUpgrade in project EnderIO by SleepyTrousers.

the class ItemDarkSteelSword method getAttributeModifiers.

@Override
@Nonnull
public Multimap<String, AttributeModifier> getAttributeModifiers(@Nonnull EntityEquipmentSlot equipmentSlot, @Nonnull ItemStack stack) {
    Multimap<String, AttributeModifier> res = super.getItemAttributeModifiers(equipmentSlot);
    if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
        if (Config.darkSteelSwordPowerUsePerHit <= 0 || EnergyUpgradeManager.getEnergyStored(stack) >= Config.darkSteelSwordPowerUsePerHit) {
            EnergyUpgrade energyUpgrade = EnergyUpgrade.loadAnyFromItem(stack);
            int level = energyUpgrade.getLevel();
            res.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), DarkSteelAttributeModifiers.getAttackDamage(level));
            res.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), DarkSteelAttributeModifiers.getAttackSpeed(level));
        }
    }
    return res;
}
Also used : EnergyUpgrade(crazypants.enderio.base.item.darksteel.upgrade.energy.EnergyUpgrade) AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier) Nonnull(javax.annotation.Nonnull)

Example 3 with EnergyUpgrade

use of crazypants.enderio.base.item.darksteel.upgrade.energy.EnergyUpgrade in project EnderIO by SleepyTrousers.

the class SpeedController method setModifiers.

private static void setModifiers(@Nonnull EntityPlayer player) {
    SpeedUpgrade speedUpgrade = getActiveSpeedUpgrade(player);
    if (speedUpgrade != null) {
        EnergyUpgrade energyUpgrade = getActiveEnergyUpgrade(player);
        if (energyUpgrade != null) {
            IAttributeInstance moveInst = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MOVEMENT_SPEED);
            AttributeModifier modifier = DarkSteelAttributeModifiers.getWalkSpeed(player.isSprinting(), speedUpgrade.getLevel(), energyUpgrade.getLevel());
            moveInst.applyModifier(modifier);
        }
    }
}
Also used : EnergyUpgrade(crazypants.enderio.base.item.darksteel.upgrade.energy.EnergyUpgrade) IAttributeInstance(net.minecraft.entity.ai.attributes.IAttributeInstance) AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Aggregations

EnergyUpgrade (crazypants.enderio.base.item.darksteel.upgrade.energy.EnergyUpgrade)3 Nonnull (javax.annotation.Nonnull)2 AttributeModifier (net.minecraft.entity.ai.attributes.AttributeModifier)2 IDarkSteelUpgrade (crazypants.enderio.api.upgrades.IDarkSteelUpgrade)1 ElytraUpgrade (crazypants.enderio.base.item.darksteel.upgrade.elytra.ElytraUpgrade)1 GliderUpgrade (crazypants.enderio.base.item.darksteel.upgrade.glider.GliderUpgrade)1 IAttributeInstance (net.minecraft.entity.ai.attributes.IAttributeInstance)1 ItemStack (net.minecraft.item.ItemStack)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1