Search in sources :

Example 1 with GateConnectionBase

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++;
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IGateComponent(com.bluepowermod.api.gate.IGateComponent) GateConnectionBase(com.bluepowermod.part.gate.connection.GateConnectionBase)

Example 2 with GateConnectionBase

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);
}
Also used : GateConnectionBase(com.bluepowermod.part.gate.connection.GateConnectionBase)

Example 3 with GateConnectionBase

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);
}
Also used : GateConnectionBase(com.bluepowermod.part.gate.connection.GateConnectionBase)

Example 4 with GateConnectionBase

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);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IGateComponent(com.bluepowermod.api.gate.IGateComponent) GateConnectionBase(com.bluepowermod.part.gate.connection.GateConnectionBase)

Example 5 with GateConnectionBase

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);
}
Also used : GateConnectionBase(com.bluepowermod.part.gate.connection.GateConnectionBase)

Aggregations

GateConnectionBase (com.bluepowermod.part.gate.connection.GateConnectionBase)7 IGateComponent (com.bluepowermod.api.gate.IGateComponent)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 IGateConnection (com.bluepowermod.api.gate.IGateConnection)1 IScrewdriver (com.bluepowermod.api.misc.IScrewdriver)1