Search in sources :

Example 6 with ConnectionMode

use of crazypants.enderio.base.conduit.ConnectionMode in project EnderIO by SleepyTrousers.

the class InsulatedRedstoneConduit method writeToNBT.

@Override
public void writeToNBT(@Nonnull NBTTagCompound nbtRoot) {
    super.writeToNBT(nbtRoot);
    if (forcedConnections.size() >= 0) {
        byte[] modes = new byte[6];
        int i = 0;
        for (EnumFacing dir : EnumFacing.VALUES) {
            ConnectionMode mode = forcedConnections.get(dir);
            if (mode != null) {
                modes[i] = (byte) mode.ordinal();
            } else {
                modes[i] = -1;
            }
            i++;
        }
        nbtRoot.setByteArray("forcedConnections", modes);
    }
    if (signalColors.size() >= 0) {
        byte[] modes = new byte[6];
        int i = 0;
        for (EnumFacing dir : EnumFacing.VALUES) {
            DyeColor col = signalColors.get(dir);
            if (col != null) {
                modes[i] = (byte) col.ordinal();
            } else {
                modes[i] = -1;
            }
            i++;
        }
        nbtRoot.setByteArray("signalColors", modes);
    }
    if (signalStrengths.size() >= 0) {
        byte[] modes = new byte[6];
        int i = 0;
        for (EnumFacing dir : EnumFacing.VALUES) {
            boolean isStrong = isOutputStrong(dir);
            if (isStrong) {
                modes[i] = 1;
            } else {
                modes[i] = 0;
            }
            i++;
        }
        nbtRoot.setByteArray("signalStrengths", modes);
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) ConnectionMode(crazypants.enderio.base.conduit.ConnectionMode) DyeColor(com.enderio.core.common.util.DyeColor)

Example 7 with ConnectionMode

use of crazypants.enderio.base.conduit.ConnectionMode in project EnderIO by SleepyTrousers.

the class AbstractConduit method setConnectionMode.

@Override
public void setConnectionMode(@Nonnull EnumFacing dir, @Nonnull ConnectionMode mode) {
    ConnectionMode oldVal = conectionModes.get(dir);
    if (oldVal == mode) {
        return;
    }
    if (mode == getDefaultConnectionMode()) {
        conectionModes.remove(dir);
    } else {
        conectionModes.put(dir, mode);
    }
    connectionsChanged();
}
Also used : ConnectionMode(crazypants.enderio.base.conduit.ConnectionMode)

Example 8 with ConnectionMode

use of crazypants.enderio.base.conduit.ConnectionMode in project EnderIO by SleepyTrousers.

the class AbstractConduit method getPreviousConnectionMode.

@Override
@Nonnull
public ConnectionMode getPreviousConnectionMode(@Nonnull EnumFacing dir) {
    ConnectionMode curMode = getConnectionMode(dir);
    ConnectionMode prev = ConnectionMode.getPrevious(curMode);
    if (prev == ConnectionMode.NOT_SET) {
        prev = ConnectionMode.DISABLED;
    }
    return prev;
}
Also used : ConnectionMode(crazypants.enderio.base.conduit.ConnectionMode) Nonnull(javax.annotation.Nonnull)

Example 9 with ConnectionMode

use of crazypants.enderio.base.conduit.ConnectionMode in project EnderIO by SleepyTrousers.

the class ItemConduit method setConnectionMode.

@Override
public void setConnectionMode(@Nonnull EnumFacing dir, @Nonnull ConnectionMode mode) {
    ConnectionMode oldVal = conectionModes.get(dir);
    if (oldVal == mode) {
        return;
    }
    super.setConnectionMode(dir, mode);
    checkInventoryConnections(dir);
    if (network != null) {
        network.routesChanged();
    }
}
Also used : ConnectionMode(crazypants.enderio.base.conduit.ConnectionMode)

Aggregations

ConnectionMode (crazypants.enderio.base.conduit.ConnectionMode)9 Nonnull (javax.annotation.Nonnull)3 DyeColor (com.enderio.core.common.util.DyeColor)2 BoundingBox (com.enderio.core.client.render.BoundingBox)1 Vector3d (com.enderio.core.common.vecmath.Vector3d)1 Vector4f (com.enderio.core.common.vecmath.Vector4f)1 Offset (crazypants.enderio.base.conduit.geom.Offset)1 Signal (crazypants.enderio.base.conduit.redstone.signals.Signal)1 PacketConnectionMode (crazypants.enderio.conduits.network.PacketConnectionMode)1 HashSet (java.util.HashSet)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 EnumFacing (net.minecraft.util.EnumFacing)1