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