use of li.cil.oc.api.network.Node in project OpenLights by PC-Logix.
the class TileEntitySidedEnvironment method writeToNBT.
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
int index = 0;
for (Node node : nodes) {
// See readFromNBT() regarding host check.
if (node != null && node.host() == this) {
final NBTTagCompound nodeNbt = new NBTTagCompound();
node.save(nodeNbt);
nbt.setTag("oc:node" + index, nodeNbt);
}
++index;
}
}
use of li.cil.oc.api.network.Node in project OpenLights by PC-Logix.
the class TileEntitySidedEnvironment method readFromNBT.
// ----------------------------------------------------------------------- //
@Override
public void readFromNBT(final NBTTagCompound nbt) {
super.readFromNBT(nbt);
int index = 0;
for (Node node : nodes) {
// nodes in this tile entity).
if (node != null && node.host() == this) {
// This restores the node's address, which is required for networks
// to continue working without interruption across loads. If the
// node is a power connector this is also required to restore the
// internal energy buffer of the node.
node.load(nbt.getCompoundTag("oc:node" + index));
}
++index;
}
}
use of li.cil.oc.api.network.Node in project LogisticsPipes by RS485.
the class OpenComputersProxy method handleWriteToNBT.
@Override
public void handleWriteToNBT(IOCTile tile, NBTTagCompound nbt) {
if (((Node) tile.getOCNode()) != null && ((Node) tile.getOCNode()).host() == tile) {
final NBTTagCompound nodeNbt = new NBTTagCompound();
((Node) tile.getOCNode()).save(nodeNbt);
nbt.setTag("oc:node", nodeNbt);
}
}
Aggregations