Search in sources :

Example 6 with ICircuitBoard

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

the class TileCentrifuge method setSocket.

@Override
public void setSocket(int slot, ItemStack stack) {
    if (!stack.isEmpty() && !ChipsetManager.circuitRegistry.isChipset(stack)) {
        return;
    }
    // Dispose correctly of old chipsets
    if (!sockets.getStackInSlot(slot).isEmpty()) {
        if (ChipsetManager.circuitRegistry.isChipset(sockets.getStackInSlot(slot))) {
            ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(sockets.getStackInSlot(slot));
            if (chipset != null) {
                chipset.onRemoval(this);
            }
        }
    }
    sockets.setInventorySlotContents(slot, stack);
    if (stack.isEmpty()) {
        return;
    }
    ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(stack);
    if (chipset != null) {
        chipset.onInsertion(this);
    }
}
Also used : ICircuitBoard(forestry.api.circuits.ICircuitBoard)

Example 7 with ICircuitBoard

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

the class TileCentrifuge method readFromNBT.

@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
    super.readFromNBT(nbttagcompound);
    NBTTagList nbttaglist = nbttagcompound.getTagList("PendingProducts", 10);
    for (int i = 0; i < nbttaglist.tagCount(); i++) {
        NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
        pendingProducts.add(new ItemStack(nbttagcompound1));
    }
    sockets.readFromNBT(nbttagcompound);
    ItemStack chip = sockets.getStackInSlot(0);
    if (!chip.isEmpty()) {
        ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(chip);
        if (chipset != null) {
            chipset.onLoad(this);
        }
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) ICircuitBoard(forestry.api.circuits.ICircuitBoard) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack)

Example 8 with ICircuitBoard

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

the class TileClimatiser method readFromNBT.

/* SAVING & LOADING */
@Override
public void readFromNBT(NBTTagCompound data) {
    super.readFromNBT(data);
    if (data.hasKey("Camouflage")) {
        camouflageBlock = new ItemStack(data.getCompoundTag("Camouflage"));
    }
    setActive(data.getBoolean("Active"));
    sockets.readFromNBT(data);
    ItemStack chip = sockets.getStackInSlot(0);
    if (!chip.isEmpty()) {
        ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(chip);
        if (chipset != null) {
            chipset.onLoad(this);
        }
    }
    source.readFromNBT(data);
}
Also used : ICircuitBoard(forestry.api.circuits.ICircuitBoard) ItemStack(net.minecraft.item.ItemStack)

Example 9 with ICircuitBoard

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

the class ItemCircuitBoard method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, @Nullable World world, List<String> list, ITooltipFlag flag) {
    super.addInformation(itemstack, world, list, flag);
    ICircuitBoard circuitboard = ChipsetManager.circuitRegistry.getCircuitBoard(itemstack);
    if (circuitboard != null) {
        circuitboard.addTooltip(list);
    }
}
Also used : ICircuitBoard(forestry.api.circuits.ICircuitBoard) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 10 with ICircuitBoard

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

the class TileSqueezer method readFromNBT.

@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
    super.readFromNBT(nbttagcompound);
    tankManager.readFromNBT(nbttagcompound);
    sockets.readFromNBT(nbttagcompound);
    ItemStack chip = sockets.getStackInSlot(0);
    if (!chip.isEmpty()) {
        ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(chip);
        if (chipset != null) {
            chipset.onLoad(this);
        }
    }
}
Also used : ICircuitBoard(forestry.api.circuits.ICircuitBoard) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ICircuitBoard (forestry.api.circuits.ICircuitBoard)11 ItemStack (net.minecraft.item.ItemStack)5 StimulatorCircuit (binnie.extrabees.circuit.StimulatorCircuit)1 ICircuit (forestry.api.circuits.ICircuit)1 PacketSocketUpdate (forestry.core.network.packets.PacketSocketUpdate)1 ArrayList (java.util.ArrayList)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagList (net.minecraft.nbt.NBTTagList)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1