use of com.bluepowermod.part.gate.connection.GateConnectionBase in project BluePower by Qmunity.
the class GateBase method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
NBTTagCompound connections = tag.getCompoundTag("connections");
for (GateConnectionBase c : getConnections()) if (c != null)
c.readFromNBT(connections.getCompoundTag(c.getDirection().name()));
NBTTagCompound components = tag.getCompoundTag("components");
int i = 0;
for (IGateComponent c : getComponents()) {
c.readFromNBT(components.getCompoundTag(i + ""));
i++;
}
}
use of com.bluepowermod.part.gate.connection.GateConnectionBase in project BluePower by Qmunity.
the class GateBase method setBundledPower.
@Override
public void setBundledPower(ForgeDirection side, byte[] power) {
GateConnectionBase con = getConnection(side);
if (con == null)
return;
con.setBundledPower(power);
}
use of com.bluepowermod.part.gate.connection.GateConnectionBase in project BluePower by Qmunity.
the class GateBase method onDisconnect.
@Override
public void onDisconnect(IConnection<?> connection) {
if (connection == null)
return;
GateConnectionBase c = getConnection(connection.getSideA());
if (c == null)
return;
c.setRedstonePower((byte) 0);
}
use of com.bluepowermod.part.gate.connection.GateConnectionBase in project BluePower by Qmunity.
the class GateBase method writeToNBT.
// NBT and update packets
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
NBTTagCompound connections = new NBTTagCompound();
for (GateConnectionBase c : getConnections()) {
if (c == null)
continue;
NBTTagCompound data = new NBTTagCompound();
c.writeToNBT(data);
connections.setTag(c.getDirection().name(), data);
}
tag.setTag("connections", connections);
NBTTagCompound t = new NBTTagCompound();
int i = 0;
for (IGateComponent c : getComponents()) {
NBTTagCompound data = new NBTTagCompound();
c.writeToNBT(data);
t.setTag(i + "", data);
i++;
}
tag.setTag("components", t);
}
use of com.bluepowermod.part.gate.connection.GateConnectionBase in project BluePower by Qmunity.
the class GateBase method setRedstonePower.
@Override
public void setRedstonePower(ForgeDirection side, byte power) {
GateConnectionBase con = getConnection(side);
if (con == null)
return;
con.setRedstonePower(power);
}
Aggregations