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);
}
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") + '>');
}
}
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;
}
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]);
}
Aggregations