Search in sources :

Example 1 with ItemScrewdriver

use of com.bluepowermod.item.ItemScrewdriver in project BluePower by Qmunity.

the class BPItems method initializeItems.

public static void initializeItems() {
    amethyst_gem = new ItemCrafting(Refs.AMETHYST_NAME);
    sapphire_gem = new ItemCrafting(Refs.SAPPHIRE_NAME);
    ruby_gem = new ItemCrafting(Refs.RUBY_NAME);
    teslatite_dust = new ItemCrafting(Refs.TESLATITE_NAME);
    copper_ingot = new ItemCrafting(Refs.COPPERINGOT_NAME);
    silver_ingot = new ItemCrafting(Refs.SILVERINGOT_NAME);
    zinc_ingot = new ItemCrafting(Refs.ZINCINGOT_NAME);
    brass_ingot = new ItemCrafting(Refs.BRASSINGOT_NAME);
    blue_alloy_ingot = new ItemCrafting(Refs.BLUEALLOYINGOT_NAME);
    red_alloy_ingot = new ItemCrafting(Refs.REDALLOYINGOT_NAME);
    purple_alloy_ingot = new ItemCrafting(Refs.PURPLEALLOYINGOT_NAME);
    tungsten_ingot = new ItemCrafting(Refs.TUNGSTENINGOT_NAME);
    tungsten_nugget = new ItemCrafting(Refs.TUNGSTENNUGGET_NAME);
    zinc_ore_crushed = new ItemBase().setUnlocalizedName(Refs.ZINC_ORE_CRUSHED_NAME).setTextureName(Refs.MODID + ":" + Refs.ZINC_ORE_CRUSHED_NAME).setCreativeTab(BPCreativeTabs.items);
    zinc_ore_purified = new ItemBase().setUnlocalizedName(Refs.ZINC_ORE_CRUSHED_PURIFIED_NAME).setTextureName(Refs.MODID + ":" + Refs.ZINC_ORE_CRUSHED_PURIFIED_NAME).setCreativeTab(BPCreativeTabs.items);
    zinc_dust = new ItemBase().setUnlocalizedName(Refs.ZINCDUST_NAME).setTextureName(Refs.MODID + ":" + Refs.ZINCDUST_NAME).setCreativeTab(BPCreativeTabs.items);
    zinc_tiny_dust = new ItemBase().setUnlocalizedName(Refs.ZINCDUST_TINY_NAME).setTextureName(Refs.MODID + ":" + Refs.ZINCDUST_TINY_NAME).setCreativeTab(BPCreativeTabs.items);
    ruby_saw = new ItemSaw(2, Refs.RUBYSAW_NAME);
    sapphire_saw = new ItemSaw(2, Refs.SAPPHIRESAW_NAME);
    amethyst_saw = new ItemSaw(2, Refs.AMETHYSTSAW_NAME);
    wood_sickle = new ItemSickle(ToolMaterial.WOOD, Refs.WOODSICKLE_NAME, Item.getItemFromBlock(Blocks.planks));
    stone_sickle = new ItemSickle(ToolMaterial.STONE, Refs.STONESICKLE_NAME, Item.getItemFromBlock(Blocks.cobblestone));
    iron_sickle = new ItemSickle(ToolMaterial.IRON, Refs.IRONSICKLE_NAME, Items.iron_ingot);
    gold_sickle = new ItemSickle(ToolMaterial.GOLD, Refs.GOLDSICKLE_NAME, Items.gold_ingot);
    diamond_sickle = new ItemSickle(ToolMaterial.EMERALD, Refs.DIAMONDSICKLE_NAME, Items.diamond);
    flax_seeds = new ItemCropSeed(BPBlocks.flax_crop, Blocks.farmland).setUnlocalizedName(Refs.FLAXSEED_NAME);
    indigo_dye = new ItemIndigoDye(Refs.INDIGODYE_NAME);
    silicon_boule = new ItemCrafting(Refs.SILICONBOULE_NAME).setCreativeTab(BPCreativeTabs.items);
    silicon_wafer = new ItemCrafting(Refs.SILICONWAFER_NAME).setCreativeTab(BPCreativeTabs.items);
    red_doped_wafer = new ItemCrafting(Refs.REDDOPEDWAFER_NAME).setCreativeTab(BPCreativeTabs.items);
    blue_doped_wafer = new ItemCrafting(Refs.BLUEDOPEDWAFER_NAME).setCreativeTab(BPCreativeTabs.items);
    infused_teslatite_dust = new ItemCrafting(Refs.INFUSEDTESLATITEDUST_NAME);
    screwdriver = new ItemScrewdriver();
    silky_screwdriver = new ItemSilkyScrewdriver();
    athame = new ItemAthame();
    zincplate = new ItemCrafting(Refs.ZINCPLATE_NAME);
    stone_tile = new ItemCrafting(Refs.STONETILE_NAME);
    bluestone_wire_tile = new ItemCrafting(Refs.BLUESTONEWIRETILE_NAME);
    bluestone_anode_tile = new ItemCrafting(Refs.BLUESTONEANODETILE_NAME);
    bluestone_cathode_tile = new ItemCrafting(Refs.BLUESTONECATHODE_NAME);
    bluestone_pointer_tile = new ItemCrafting(Refs.BLUESTONEPOINTER_NAME);
    silicon_chip_tile = new ItemCrafting(Refs.SILICONCHIP_NAME);
    tainted_silicon_chip_tile = new ItemCrafting(Refs.TAINTEDSILICONCHIP_NAME);
    quartz_resonator_tile = new ItemCrafting(Refs.QUARTZRESONATOR_NAME);
    redstone_wire_tile = new ItemCrafting(Refs.REDSTONEWIRETILE_NAME);
    redstone_anode_tile = new ItemCrafting(Refs.REDSTONEANODETILE_NAME);
    redstone_cathode_tile = new ItemCrafting(Refs.REDSTONECATHODE_NAME);
    redstone_pointer_tile = new ItemCrafting(Refs.REDSTONEPOINTER_NAME);
    // stone_redwire = new ItemCrafting(Refs.STONEREDWIRE_NAME);
    // plate_assembly = new ItemCrafting(Refs.PLATEASSEMBLY_NAME);
    stone_bundle = new ItemCrafting(Refs.STONEBUNDLE_NAME);
    screwdriver_handle = new ItemCrafting(Refs.SCREWDRIVERHANDLE_NAME);
    seed_bag = new ItemSeedBag(Refs.SEEDBAG_NAME);
    canvas_bag = new ItemCanvasBag(Refs.CANVASBAG_NAME);
    canvas = new ItemCrafting(Refs.CANVAS_NAME);
    lumar = new ItemLumar();
    wool_card = new ItemLimitedCrafting(Refs.WOOLCARD_NAME, 64);
    diamond_drawplate = new ItemLimitedCrafting(Refs.DIAMONDDRAWPLATE_NAME, 256);
    copper_wire = new ItemCrafting(Refs.COPPERWIRE_NAME);
    iron_wire = new ItemCrafting(Refs.IRONWIRE_NAME);
    paint_can = new ItemPaintCan(Refs.PAINTCAN_NAME);
    paint_brush = new ItemPaintBrush(Refs.PAINTBRUSH_NAME);
    ruby_axe = new ItemGemAxe(BluePower.gemMaterial, Refs.RUBYAXE_NAME, BPItems.ruby_gem);
    ruby_sword = new ItemGemSword(BluePower.gemMaterial, Refs.RUBYSWORD_NAME, BPItems.ruby_gem);
    ruby_pickaxe = new ItemGemPickaxe(BluePower.gemMaterial, Refs.RUBYPICKAXE_NAME, BPItems.ruby_gem);
    ruby_shovel = new ItemGemSpade(BluePower.gemMaterial, Refs.RUBYSPADE_NAME, BPItems.ruby_gem);
    ruby_hoe = new ItemGemHoe(BluePower.gemMaterial, Refs.RUBYHOE_NAME, BPItems.ruby_gem);
    ruby_sickle = new ItemSickle(BluePower.gemMaterial, Refs.RUBYSICKLE_NAME, BPItems.ruby_gem);
    sapphire_axe = new ItemGemAxe(BluePower.gemMaterial, Refs.SAPPHIREAXE_NAME, BPItems.sapphire_gem);
    sapphire_sword = new ItemGemSword(BluePower.gemMaterial, Refs.SAPPHIRESWORD_NAME, BPItems.sapphire_gem);
    sapphire_pickaxe = new ItemGemPickaxe(BluePower.gemMaterial, Refs.SAPPHIREPICKAXE_NAME, BPItems.sapphire_gem);
    sapphire_shovel = new ItemGemSpade(BluePower.gemMaterial, Refs.SAPPHIRESPADE_NAME, BPItems.sapphire_gem);
    sapphire_hoe = new ItemGemHoe(BluePower.gemMaterial, Refs.SAPPHIREHOE_NAME, BPItems.sapphire_gem);
    sapphire_sickle = new ItemSickle(BluePower.gemMaterial, Refs.SAPPHIRESICKLE_NAME, BPItems.sapphire_gem);
    amethyst_axe = new ItemGemAxe(BluePower.gemMaterial, Refs.AMETHYSTAXE_NAME, BPItems.amethyst_gem);
    amethyst_sword = new ItemGemSword(BluePower.gemMaterial, Refs.AMETHYSTSWORD_NAME, BPItems.amethyst_gem);
    amethyst_pickaxe = new ItemGemPickaxe(BluePower.gemMaterial, Refs.AMETHYSTPICKAXE_NAME, BPItems.amethyst_gem);
    amethyst_shovel = new ItemGemSpade(BluePower.gemMaterial, Refs.AMETHYSTSPADE_NAME, BPItems.amethyst_gem);
    amethyst_hoe = new ItemGemHoe(BluePower.gemMaterial, Refs.AMETHYSTHOE_NAME, BPItems.amethyst_gem);
    amethyst_sickle = new ItemSickle(BluePower.gemMaterial, Refs.AMETHYSTSICKLE_NAME, BPItems.amethyst_gem);
}
Also used : ItemCrafting(com.bluepowermod.item.ItemCrafting) ItemCropSeed(com.bluepowermod.item.ItemCropSeed) ItemSickle(com.bluepowermod.item.ItemSickle) ItemBase(com.bluepowermod.item.ItemBase) ItemLumar(com.bluepowermod.item.ItemLumar) ItemGemPickaxe(com.bluepowermod.item.ItemGemPickaxe) ItemPaintBrush(com.bluepowermod.item.ItemPaintBrush) ItemGemAxe(com.bluepowermod.item.ItemGemAxe) ItemSaw(com.bluepowermod.item.ItemSaw) ItemScrewdriver(com.bluepowermod.item.ItemScrewdriver) ItemIndigoDye(com.bluepowermod.item.ItemIndigoDye) ItemCanvasBag(com.bluepowermod.item.ItemCanvasBag) ItemPaintCan(com.bluepowermod.item.ItemPaintCan) ItemAthame(com.bluepowermod.item.ItemAthame) ItemGemSword(com.bluepowermod.item.ItemGemSword) ItemGemHoe(com.bluepowermod.item.ItemGemHoe) ItemSilkyScrewdriver(com.bluepowermod.item.ItemSilkyScrewdriver) ItemGemSpade(com.bluepowermod.item.ItemGemSpade) ItemSeedBag(com.bluepowermod.item.ItemSeedBag) ItemLimitedCrafting(com.bluepowermod.item.ItemLimitedCrafting)

Example 2 with ItemScrewdriver

use of com.bluepowermod.item.ItemScrewdriver in project BluePower by Qmunity.

the class RecipeNullCell method getCraftingResult.

private ItemStack getCraftingResult(IInventory inv, EntityPlayer player, boolean isCrafting) {
    if (inv.getSizeInventory() < 9)
        return null;
    int centerX = 0;
    int centerY = 0;
    GateNullCell gnc = null;
    // Find the null cell
    for (int x = 0; x < 3; x++) {
        for (int y = 0; y < 3; y++) {
            ItemStack item = getItemAt(inv, x, y);
            if (item == null)
                continue;
            if (!(item.getItem() instanceof ItemPart))
                continue;
            IPart p = ((ItemPart) item.getItem()).createPart(item, BluePower.proxy.getPlayer(), null, null);
            if (p != null && p instanceof GateNullCell) {
                gnc = (GateNullCell) p;
                centerX = x;
                centerY = y;
                break;
            }
        }
        if (gnc != null)
            break;
    }
    // If there's no null cell, return null
    if (gnc == null)
        return null;
    // Make this recipe invalid if there's items where there shouldn't be
    {
        // To the right
        if (centerX < 2)
            for (int x = centerX + 1; x < 3; x++) for (int y = 0; y < 3; y++) if (getItemAt(inv, x, y) != null)
                return null;
        // To the left - 1
        for (int x = 0; x < centerX - 1; x++) for (int y = 0; y < 3; y++) if (getItemAt(inv, x, y) != null)
            return null;
        // To the left
        if (centerX > 0) {
            if (getItemAt(inv, centerX - 1, 0) != null)
                return null;
            if (getItemAt(inv, centerX - 1, 2) != null)
                return null;
        }
    }
    // Determine what kind of crafting operation this is
    // Removing > adding
    {
        // Removing
        {
            // Screwdriver on top
            if (centerY > 0) {
                ItemStack sd = getItemAt(inv, centerX, centerY - 1);
                if (sd != null && sd.getItem() instanceof ItemScrewdriver) {
                    RedwireType t = gnc.getTypeB();
                    boolean bundled = gnc.isBundledB();
                    if (t != null) {
                        boolean can = true;
                        if (centerY < 2)
                            if (getItemAt(inv, centerX, centerY + 1) != null)
                                can = false;
                        if (centerX > 0)
                            if (getItemAt(inv, centerX - 1, centerY) != null)
                                can = false;
                        if (!((IScrewdriver) sd.getItem()).damage(sd, getItemAt(inv, centerX, centerY).stackSize, null, true))
                            can = false;
                        if (can) {
                            ItemStack wire = PartManager.getPartInfo("wire." + t.getName() + (bundled ? ".bundled" : "")).getStack(getItemAt(inv, centerX, centerY).stackSize);
                            if (isCrafting) {
                                gnc = new GateNullCell(gnc.getTypeA(), gnc.isBundledA(), null, false);
                                ItemStack nullCellStack = GateNullCell.getStackWithData(gnc);
                                nullCellStack.stackSize = getItemAt(inv, centerX, centerY).stackSize + 1;
                                setItemAt(inv, centerX, centerY, nullCellStack);
                                sd.stackSize++;
                                ((IScrewdriver) sd.getItem()).damage(sd, nullCellStack.stackSize - 1, null, false);
                            }
                            return wire;
                        }
                    }
                }
            }
            // Screwdriver below
            if (centerY < 2) {
                ItemStack sd = getItemAt(inv, centerX, centerY + 1);
                if (sd != null && sd.getItem() instanceof ItemScrewdriver) {
                    RedwireType t = gnc.getTypeA();
                    boolean bundled = gnc.isBundledA();
                    if (t != null) {
                        boolean can = true;
                        if (centerY > 0)
                            if (getItemAt(inv, centerX, centerY - 1) != null)
                                can = false;
                        if (centerX > 0)
                            if (getItemAt(inv, centerX - 1, centerY) != null)
                                can = false;
                        if (!((IScrewdriver) sd.getItem()).damage(sd, getItemAt(inv, centerX, centerY).stackSize, null, true))
                            can = false;
                        if (can) {
                            ItemStack wire = PartManager.getPartInfo("wire." + t.getName() + (bundled ? ".bundled" : "")).getStack(getItemAt(inv, centerX, centerY).stackSize);
                            if (isCrafting) {
                                gnc = new GateNullCell(null, false, gnc.getTypeB(), gnc.isBundledB());
                                ItemStack nullCellStack = GateNullCell.getStackWithData(gnc);
                                nullCellStack.stackSize = getItemAt(inv, centerX, centerY).stackSize + 1;
                                setItemAt(inv, centerX, centerY, nullCellStack);
                                sd.stackSize++;
                                ((IScrewdriver) sd.getItem()).damage(sd, nullCellStack.stackSize - 1, null, false);
                            }
                            return wire;
                        }
                    }
                }
            }
            // Screwdriver on the left
            if (centerX > 0) {
                ItemStack sd = getItemAt(inv, centerX - 1, centerY);
                if (sd != null && sd.getItem() instanceof ItemScrewdriver) {
                    RedwireType tA = gnc.getTypeA();
                    boolean bundledA = gnc.isBundledA();
                    RedwireType tB = gnc.getTypeB();
                    boolean bundledB = gnc.isBundledB();
                    if (tA != null || tB != null) {
                        boolean can = true;
                        if (centerY > 0)
                            if (getItemAt(inv, centerX, centerY - 1) != null)
                                can = false;
                        if (centerY < 2)
                            if (getItemAt(inv, centerX, centerY + 1) != null)
                                can = false;
                        int amt = 0;
                        if (tA != null && (tB == null || tB == tA))
                            amt += getItemAt(inv, centerX, centerY).stackSize;
                        if (tB != null)
                            amt += getItemAt(inv, centerX, centerY).stackSize;
                        if (amt > 64)
                            can = false;
                        if (!((IScrewdriver) sd.getItem()).damage(sd, amt, null, true))
                            can = false;
                        if (can) {
                            ItemStack wire = null;
                            if (tB != null) {
                                wire = PartManager.getPartInfo("wire." + tB.getName() + (bundledB ? ".bundled" : "")).getStack(amt);
                            } else {
                                wire = PartManager.getPartInfo("wire." + tA.getName() + (bundledA ? ".bundled" : "")).getStack(amt);
                            }
                            if (isCrafting) {
                                if (tA != null && tB != null && tA == tB) {
                                    gnc = new GateNullCell(null, false, null, false);
                                } else if (tB != null) {
                                    gnc = new GateNullCell(gnc.getTypeA(), gnc.isBundledA(), null, false);
                                } else if (tA != null) {
                                    gnc = new GateNullCell(null, false, gnc.getTypeB(), gnc.isBundledB());
                                }
                                ItemStack nullCellStack = GateNullCell.getStackWithData(gnc);
                                nullCellStack.stackSize = getItemAt(inv, centerX, centerY).stackSize + 1;
                                setItemAt(inv, centerX, centerY, nullCellStack);
                                sd.stackSize++;
                                System.out.println(((IScrewdriver) sd.getItem()).damage(sd, amt, null, false) + " " + player);
                            }
                            return wire;
                        }
                    }
                }
            }
        }
        // Adding
        {
            // Wire on top
            if (centerY > 0 && gnc.getTypeB() == null) {
                ItemStack wire = getItemAt(inv, centerX, centerY - 1);
                if (wire != null && wire.getItem() instanceof ItemPart) {
                    IPart p = ((ItemPart) wire.getItem()).createPart(wire, BluePower.proxy.getPlayer(), null, null);
                    if (p != null && p instanceof PartRedwireFaceUninsulated) {
                        RedwireType t = ((PartRedwireFace) p).getRedwireType(ForgeDirection.UNKNOWN);
                        boolean bundled = false;
                        boolean can = true;
                        if (centerY < 2)
                            if (getItemAt(inv, centerX, centerY + 1) != null)
                                can = false;
                        if (centerX > 0)
                            if (getItemAt(inv, centerX - 1, centerY) != null)
                                can = false;
                        if (can)
                            return GateNullCell.getStackWithData(new GateNullCell(gnc.getTypeA(), gnc.isBundledA(), t, bundled));
                    }
                }
            }
            // Wire below
            if (centerY < 2 && gnc.getTypeA() == null) {
                ItemStack wire = getItemAt(inv, centerX, centerY + 1);
                if (wire != null && wire.getItem() instanceof ItemPart) {
                    IPart p = ((ItemPart) wire.getItem()).createPart(wire, BluePower.proxy.getPlayer(), null, null);
                    if (p != null && p instanceof PartRedwireFaceUninsulated) {
                        RedwireType t = ((PartRedwireFace) p).getRedwireType(ForgeDirection.UNKNOWN);
                        boolean bundled = false;
                        boolean can = true;
                        if (centerY > 0)
                            if (getItemAt(inv, centerX, centerY - 1) != null)
                                can = false;
                        if (centerX > 0)
                            if (getItemAt(inv, centerX - 1, centerY) != null)
                                can = false;
                        if (can)
                            return GateNullCell.getStackWithData(new GateNullCell(t, bundled, gnc.getTypeB(), gnc.isBundledB()));
                    }
                }
            }
            // Wire below
            if (centerY == 1 && gnc.getTypeA() == null && gnc.getTypeB() == null) {
                ItemStack wireA = getItemAt(inv, centerX, centerY + 1);
                ItemStack wireB = getItemAt(inv, centerX, centerY - 1);
                if (wireA != null && wireA.getItem() instanceof ItemPart && wireB != null && wireB.getItem() instanceof ItemPart) {
                    IPart pA = ((ItemPart) wireA.getItem()).createPart(wireA, BluePower.proxy.getPlayer(), null, null);
                    IPart pB = ((ItemPart) wireB.getItem()).createPart(wireB, BluePower.proxy.getPlayer(), null, null);
                    if (pA != null && pA instanceof PartRedwireFaceUninsulated && pB != null && pB instanceof PartRedwireFaceUninsulated) {
                        RedwireType tA = ((PartRedwireFace) pA).getRedwireType(ForgeDirection.UNKNOWN);
                        boolean bundledA = false;
                        RedwireType tB = ((PartRedwireFace) pB).getRedwireType(ForgeDirection.UNKNOWN);
                        boolean bundledB = false;
                        boolean can = true;
                        if (centerX > 0)
                            if (getItemAt(inv, centerX - 1, centerY) != null)
                                can = false;
                        if (can)
                            return GateNullCell.getStackWithData(new GateNullCell(tA, bundledA, tB, bundledB));
                    }
                }
            }
        }
    }
    return null;
}
Also used : RedwireType(com.bluepowermod.api.wire.redstone.RedwireType) GateNullCell(com.bluepowermod.part.gate.supported.GateNullCell) ItemPart(com.bluepowermod.item.ItemPart) IScrewdriver(com.bluepowermod.api.misc.IScrewdriver) IPart(uk.co.qmunity.lib.part.IPart) PartRedwireFace(com.bluepowermod.part.wire.redstone.PartRedwireFace) ItemStack(net.minecraft.item.ItemStack) ItemScrewdriver(com.bluepowermod.item.ItemScrewdriver) PartRedwireFaceUninsulated(com.bluepowermod.part.wire.redstone.PartRedwireFace.PartRedwireFaceUninsulated)

Aggregations

ItemScrewdriver (com.bluepowermod.item.ItemScrewdriver)2 IScrewdriver (com.bluepowermod.api.misc.IScrewdriver)1 RedwireType (com.bluepowermod.api.wire.redstone.RedwireType)1 ItemAthame (com.bluepowermod.item.ItemAthame)1 ItemBase (com.bluepowermod.item.ItemBase)1 ItemCanvasBag (com.bluepowermod.item.ItemCanvasBag)1 ItemCrafting (com.bluepowermod.item.ItemCrafting)1 ItemCropSeed (com.bluepowermod.item.ItemCropSeed)1 ItemGemAxe (com.bluepowermod.item.ItemGemAxe)1 ItemGemHoe (com.bluepowermod.item.ItemGemHoe)1 ItemGemPickaxe (com.bluepowermod.item.ItemGemPickaxe)1 ItemGemSpade (com.bluepowermod.item.ItemGemSpade)1 ItemGemSword (com.bluepowermod.item.ItemGemSword)1 ItemIndigoDye (com.bluepowermod.item.ItemIndigoDye)1 ItemLimitedCrafting (com.bluepowermod.item.ItemLimitedCrafting)1 ItemLumar (com.bluepowermod.item.ItemLumar)1 ItemPaintBrush (com.bluepowermod.item.ItemPaintBrush)1 ItemPaintCan (com.bluepowermod.item.ItemPaintCan)1 ItemPart (com.bluepowermod.item.ItemPart)1 ItemSaw (com.bluepowermod.item.ItemSaw)1