Search in sources :

Example 1 with IDarkSteelUpgrade

use of crazypants.enderio.api.upgrades.IDarkSteelUpgrade 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 IDarkSteelUpgrade

use of crazypants.enderio.api.upgrades.IDarkSteelUpgrade in project EnderIO by SleepyTrousers.

the class UpgradeRenderDispatcher method doRenderLayer.

@Override
public void doRenderLayer(@Nonnull AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    NNList.of(EntityEquipmentSlot.class).apply(new Callback<EntityEquipmentSlot>() {

        @Override
        public void apply(@Nonnull EntityEquipmentSlot slot) {
            ItemStack item = player.getItemStackFromSlot(slot);
            if (item.getItem() instanceof IDarkSteelItem) {
                for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
                    if (upgrade instanceof IHasPlayerRenderer && upgrade.hasUpgrade(item)) {
                        ((IHasPlayerRenderer) upgrade).getRender().doRenderLayer(renderPlayer, slot, item, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
                    }
                }
            }
            if (item.getItem() instanceof IHasPlayerRenderer) {
                ((IHasPlayerRenderer) item.getItem()).getRender().doRenderLayer(renderPlayer, slot, item, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
            }
        }
    });
    IInventory baubles = BaublesUtil.instance().getBaubles(player);
    if (baubles != null) {
        for (int i = 0; i < baubles.getSizeInventory(); i++) {
            ItemStack piece = baubles.getStackInSlot(i);
            if (piece.getItem() instanceof IHasPlayerRenderer) {
                ((IHasPlayerRenderer) piece.getItem()).getRender().doRenderLayer(renderPlayer, null, piece, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
            }
        }
    }
}
Also used : IInventory(net.minecraft.inventory.IInventory) EntityEquipmentSlot(net.minecraft.inventory.EntityEquipmentSlot) IHasPlayerRenderer(crazypants.enderio.api.upgrades.IHasPlayerRenderer) ItemStack(net.minecraft.item.ItemStack) IDarkSteelUpgrade(crazypants.enderio.api.upgrades.IDarkSteelUpgrade) IDarkSteelItem(crazypants.enderio.api.upgrades.IDarkSteelItem)

Example 3 with IDarkSteelUpgrade

use of crazypants.enderio.api.upgrades.IDarkSteelUpgrade in project EnderIO by SleepyTrousers.

the class DarkSteelController method onPlayerTick.

@SubscribeEvent
public static void onPlayerTick(TickEvent.PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (event.phase == Phase.START && !player.isSpectator()) {
        // boots
        updateStepHeightAndFallDistance(player);
        // leggings
        SpeedController.updateSpeed(player);
        NNList.of(EntityEquipmentSlot.class).apply(new Callback<EntityEquipmentSlot>() {

            @Override
            public void apply(@Nonnull EntityEquipmentSlot slot) {
                ItemStack item = player.getItemStackFromSlot(slot);
                if (item.getItem() instanceof IDarkSteelItem) {
                    for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
                        if (upgrade.hasUpgrade(item)) {
                            upgrade.onPlayerTick(item, (IDarkSteelItem) item.getItem(), player);
                        }
                    }
                }
            }
        });
    }
}
Also used : EntityEquipmentSlot(net.minecraft.inventory.EntityEquipmentSlot) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) IDarkSteelUpgrade(crazypants.enderio.api.upgrades.IDarkSteelUpgrade) IDarkSteelItem(crazypants.enderio.api.upgrades.IDarkSteelItem) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 4 with IDarkSteelUpgrade

use of crazypants.enderio.api.upgrades.IDarkSteelUpgrade in project EnderIO by SleepyTrousers.

the class DarkSteelRecipeManager method getRecipes.

public static NNList<ItemStack> getRecipes(@Nonnull Set<UpgradePath> list, @Nonnull NNList<ItemStack> input) {
    NNList<ItemStack> output = new NNList<ItemStack>();
    NNIterator<ItemStack> iterator = input.iterator();
    while (iterator.hasNext()) {
        ItemStack inputStack = iterator.next();
        if (inputStack.getItem() instanceof IDarkSteelItem) {
            for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
                if (upgrade.canAddToItem(inputStack, (IDarkSteelItem) inputStack.getItem())) {
                    ItemStack outputStack = inputStack.copy();
                    upgrade.addToItem(outputStack, (IDarkSteelItem) outputStack.getItem());
                    final UpgradePath path = new UpgradePath(inputStack, upgrade.getUpgradeItem(), outputStack);
                    if (!list.contains(path)) {
                        list.add(path);
                        output.add(outputStack);
                    }
                }
            }
        }
    }
    return output;
}
Also used : NNList(com.enderio.core.common.util.NNList) ItemStack(net.minecraft.item.ItemStack) IDarkSteelUpgrade(crazypants.enderio.api.upgrades.IDarkSteelUpgrade) IDarkSteelItem(crazypants.enderio.api.upgrades.IDarkSteelItem)

Example 5 with IDarkSteelUpgrade

use of crazypants.enderio.api.upgrades.IDarkSteelUpgrade in project EnderIO by SleepyTrousers.

the class DarkSteelRecipeManager method addAdvancedTooltipEntries.

public static void addAdvancedTooltipEntries(@Nonnull ItemStack itemstack, EntityPlayer entityplayer, @Nonnull List<String> list, boolean flag) {
    if (itemstack.getItem() instanceof IDarkSteelItem) {
        List<IDarkSteelUpgrade> applyableUpgrades = new ArrayList<IDarkSteelUpgrade>();
        for (IDarkSteelUpgrade upgrade : UpgradeRegistry.getUpgrades()) {
            if (upgrade instanceof IAdvancedTooltipProvider && upgrade.hasUpgrade(itemstack, (IDarkSteelItem) itemstack.getItem())) {
                ((IAdvancedTooltipProvider) upgrade).addDetailedEntries(itemstack, entityplayer, list, flag);
            } else if (upgrade.canAddToItem(itemstack, (IDarkSteelItem) itemstack.getItem())) {
                applyableUpgrades.add(upgrade);
            }
        }
        if (!applyableUpgrades.isEmpty()) {
            list.add(TextFormatting.YELLOW + EnderIO.lang.localize("tooltip.anvilupgrades") + " ");
            for (IDarkSteelUpgrade up : applyableUpgrades) {
                list.add(Lang.DARK_STEEL_LEVELS1.get(TextFormatting.DARK_AQUA, EnderIO.lang.localizeExact(up.getUnlocalizedName() + ".name")));
                list.add(Lang.DARK_STEEL_LEVELS2.get(TextFormatting.DARK_AQUA, TextFormatting.ITALIC, up.getUpgradeItemName(), up.getLevelCost()));
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) IAdvancedTooltipProvider(com.enderio.core.api.client.gui.IAdvancedTooltipProvider) IDarkSteelUpgrade(crazypants.enderio.api.upgrades.IDarkSteelUpgrade) IDarkSteelItem(crazypants.enderio.api.upgrades.IDarkSteelItem)

Aggregations

IDarkSteelUpgrade (crazypants.enderio.api.upgrades.IDarkSteelUpgrade)7 ItemStack (net.minecraft.item.ItemStack)5 IDarkSteelItem (crazypants.enderio.api.upgrades.IDarkSteelItem)4 EntityEquipmentSlot (net.minecraft.inventory.EntityEquipmentSlot)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 IAdvancedTooltipProvider (com.enderio.core.api.client.gui.IAdvancedTooltipProvider)1 NNList (com.enderio.core.common.util.NNList)1 IHasPlayerRenderer (crazypants.enderio.api.upgrades.IHasPlayerRenderer)1 ElytraUpgrade (crazypants.enderio.base.item.darksteel.upgrade.elytra.ElytraUpgrade)1 EnergyUpgrade (crazypants.enderio.base.item.darksteel.upgrade.energy.EnergyUpgrade)1 GliderUpgrade (crazypants.enderio.base.item.darksteel.upgrade.glider.GliderUpgrade)1 ApiaristArmorUpgrade (crazypants.enderio.integration.forestry.upgrades.ApiaristArmorUpgrade)1 NaturalistEyeUpgrade (crazypants.enderio.integration.forestry.upgrades.NaturalistEyeUpgrade)1 ArrayList (java.util.ArrayList)1 Nonnull (javax.annotation.Nonnull)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 IInventory (net.minecraft.inventory.IInventory)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1