Search in sources :

Example 11 with ICircuit

use of forestry.api.circuits.ICircuit in project ForestryMC by ForestryMC.

the class ItemInventorySolderingIron method onSlotClick.

@Override
public void onSlotClick(int slotIndex, EntityPlayer player) {
    if (layouts.getCurrent() == CircuitRegistry.DUMMY_LAYOUT) {
        return;
    }
    ItemStack inputCircuitBoard = getStackInSlot(inputCircuitBoardSlot);
    if (inputCircuitBoard.isEmpty() || inputCircuitBoard.getCount() > 1) {
        return;
    }
    if (!getStackInSlot(finishedCircuitBoardSlot).isEmpty()) {
        return;
    }
    // Need a chipset item
    if (!ChipsetManager.circuitRegistry.isChipset(inputCircuitBoard)) {
        return;
    }
    // Illegal type
    if (inputCircuitBoard.getItemDamage() < 0 || inputCircuitBoard.getItemDamage() >= EnumCircuitBoardType.values().length) {
        return;
    }
    EnumCircuitBoardType type = EnumCircuitBoardType.values()[inputCircuitBoard.getItemDamage()];
    if (getCircuitCount() != type.getSockets()) {
        return;
    }
    ICircuit[] circuits = getCircuits(true);
    ItemStack outputCircuitBoard = ItemCircuitBoard.createCircuitboard(type, layouts.getCurrent(), circuits);
    setInventorySlotContents(finishedCircuitBoardSlot, outputCircuitBoard);
    setInventorySlotContents(inputCircuitBoardSlot, ItemStack.EMPTY);
}
Also used : EnumCircuitBoardType(forestry.core.circuits.EnumCircuitBoardType) ICircuit(forestry.api.circuits.ICircuit) ItemStack(net.minecraft.item.ItemStack)

Example 12 with ICircuit

use of forestry.api.circuits.ICircuit in project Binnie by ForestryMC.

the class ItemInsulatedTube method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, @Nullable World worldIn, List<String> list, ITooltipFlag flagIn) {
    super.addInformation(itemstack, worldIn, list, flagIn);
    Multimap<ICircuitLayout, ICircuit> circuits = getCircuits(itemstack);
    if (!circuits.isEmpty()) {
        if (GuiScreen.isShiftKeyDown()) {
            for (ICircuitLayout circuitLayout : circuits.keys()) {
                String circuitLayoutName = circuitLayout.getUsage();
                list.add(TextFormatting.WHITE.toString() + TextFormatting.UNDERLINE + circuitLayoutName);
                for (ICircuit circuit : circuits.get(circuitLayout)) {
                    circuit.addTooltip(list);
                }
            }
        } else {
            list.add(TextFormatting.ITALIC + "<" + I18N.localise("for.gui.tooltip.tmi") + '>');
        }
    } else {
        list.add('<' + I18N.localise("for.gui.noeffect") + '>');
    }
}
Also used : ICircuitLayout(forestry.api.circuits.ICircuitLayout) ICircuit(forestry.api.circuits.ICircuit) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 13 with ICircuit

use of forestry.api.circuits.ICircuit in project Binnie by ForestryMC.

the class ItemInsulatedTube method getCircuits.

private static Multimap<ICircuitLayout, ICircuit> getCircuits(ItemStack itemStack) {
    Multimap<ICircuitLayout, ICircuit> circuits = ArrayListMultimap.create();
    Collection<ICircuitLayout> allLayouts = ChipsetManager.circuitRegistry.getRegisteredLayouts().values();
    for (ICircuitLayout circuitLayout : allLayouts) {
        ICircuit circuit = SolderManager.getCircuit(circuitLayout, itemStack);
        if (circuit != null) {
            circuits.put(circuitLayout, circuit);
        }
    }
    return circuits;
}
Also used : ICircuitLayout(forestry.api.circuits.ICircuitLayout) ICircuit(forestry.api.circuits.ICircuit)

Example 14 with ICircuit

use of forestry.api.circuits.ICircuit in project Binnie by ForestryMC.

the class AlvearyLogicStimulator method getCircuits.

public StimulatorCircuit[] getCircuits() {
    final ICircuitBoard board = this.getHiveFrame();
    if (board == null) {
        return new StimulatorCircuit[0];
    }
    final ICircuit[] circuits = board.getCircuits();
    final List<StimulatorCircuit> mod = new ArrayList<>();
    for (final ICircuit circuit : circuits) {
        if (circuit instanceof StimulatorCircuit) {
            mod.add((StimulatorCircuit) circuit);
        }
    }
    return mod.toArray(new StimulatorCircuit[0]);
}
Also used : ICircuitBoard(forestry.api.circuits.ICircuitBoard) StimulatorCircuit(binnie.extrabees.circuit.StimulatorCircuit) ArrayList(java.util.ArrayList) ICircuit(forestry.api.circuits.ICircuit)

Aggregations

ICircuit (forestry.api.circuits.ICircuit)14 ICircuitLayout (forestry.api.circuits.ICircuitLayout)4 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 ArrayList (java.util.ArrayList)2 ItemStack (net.minecraft.item.ItemStack)2 StimulatorCircuit (binnie.extrabees.circuit.StimulatorCircuit)1 ICircuitBoard (forestry.api.circuits.ICircuitBoard)1 ItemRegistryApiculture (forestry.apiculture.items.ItemRegistryApiculture)1 EnumCircuitBoardType (forestry.core.circuits.EnumCircuitBoardType)1 ItemRegistryCore (forestry.core.items.ItemRegistryCore)1 BlockRegistryMail (forestry.mail.blocks.BlockRegistryMail)1 EnumStampDefinition (forestry.mail.items.EnumStampDefinition)1 ItemRegistryMail (forestry.mail.items.ItemRegistryMail)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 FluidStack (net.minecraftforge.fluids.FluidStack)1