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);
}
}
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);
}
}
}
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);
}
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);
}
}
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);
}
}
}
Aggregations