Search in sources :

Example 6 with IDarkSteelItem

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

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

Example 8 with IDarkSteelItem

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

the class ItemDarkSteelPickaxe method doRightClickItemPlace.

@SideOnly(Side.CLIENT)
@Nonnull
static EnumActionResult doRightClickItemPlace(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, @Nonnull EnumHand hand, float par8, float par9, float par10) {
    if (hand != EnumHand.MAIN_HAND) {
        return EnumActionResult.PASS;
    }
    int current = player.inventory.currentItem;
    int slot = current == 0 && Config.slotZeroPlacesEight ? 8 : current + 1;
    if (slot < InventoryPlayer.getHotbarSize() && !(player.inventory.mainInventory.get(slot).getItem() instanceof IDarkSteelItem)) {
        /*
       * this will not work with buckets unless we don't switch back to the current item (the pick); there's probably some client <-> server event thing going
       * on with buckets, so our item-switch within the same tick would be a problem.
       */
        player.inventory.currentItem = slot;
        Minecraft mc = Minecraft.getMinecraft();
        EnumActionResult result = mc.playerController.processRightClickBlock(mc.player, mc.world, pos, side, new Vec3d(par8, par9, par10), hand);
        player.inventory.currentItem = current;
        return result;
    }
    return EnumActionResult.PASS;
}
Also used : EnumActionResult(net.minecraft.util.EnumActionResult) Minecraft(net.minecraft.client.Minecraft) IDarkSteelItem(crazypants.enderio.api.upgrades.IDarkSteelItem) Vec3d(net.minecraft.util.math.Vec3d) Nonnull(javax.annotation.Nonnull) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

IDarkSteelItem (crazypants.enderio.api.upgrades.IDarkSteelItem)8 ItemStack (net.minecraft.item.ItemStack)6 IDarkSteelUpgrade (crazypants.enderio.api.upgrades.IDarkSteelUpgrade)4 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 EntityEquipmentSlot (net.minecraft.inventory.EntityEquipmentSlot)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 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Nonnull (javax.annotation.Nonnull)1 Minecraft (net.minecraft.client.Minecraft)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 IInventory (net.minecraft.inventory.IInventory)1 Item (net.minecraft.item.Item)1 EnumActionResult (net.minecraft.util.EnumActionResult)1 Vec3d (net.minecraft.util.math.Vec3d)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1