use of crazypants.enderio.base.conduit.ConnectionMode in project EnderIO by SleepyTrousers.
the class AbstractConduit method getNextConnectionMode.
@Override
@Nonnull
public ConnectionMode getNextConnectionMode(@Nonnull EnumFacing dir) {
ConnectionMode curMode = getConnectionMode(dir);
ConnectionMode next = ConnectionMode.getNext(curMode);
if (next == ConnectionMode.NOT_SET) {
next = ConnectionMode.IN_OUT;
}
return next;
}
use of crazypants.enderio.base.conduit.ConnectionMode in project EnderIO by SleepyTrousers.
the class AbstractConduit method readConduitSettingsFromNBT.
@Override
public boolean readConduitSettingsFromNBT(@Nonnull EnumFacing dir, @Nonnull NBTTagCompound nbt) {
if (!getExternalConnections().contains(dir)) {
return false;
}
NBTTagCompound dataRoot = getNbtRootForType(nbt, false);
if (dataRoot == null) {
return false;
}
if (dataRoot.hasKey("connectionMode")) {
ConnectionMode mode = NullHelper.first(ConnectionMode.values()[dataRoot.getShort("connectionMode")], getDefaultConnectionMode());
setConnectionMode(dir, mode);
}
readTypeSettings(dir, dataRoot);
return true;
}
use of crazypants.enderio.base.conduit.ConnectionMode in project EnderIO by SleepyTrousers.
the class BaseSettingsPanel method updateConnectionMode.
private void updateConnectionMode() {
ConnectionMode mode = ConnectionMode.DISABLED;
if (insertEnabled && extractEnabled) {
mode = ConnectionMode.IN_OUT;
} else if (insertEnabled) {
mode = ConnectionMode.OUTPUT;
} else if (extractEnabled) {
mode = ConnectionMode.INPUT;
}
PacketHandler.INSTANCE.sendToServer(new PacketConnectionMode(con, gui.getDir(), mode));
}
use of crazypants.enderio.base.conduit.ConnectionMode in project EnderIO by SleepyTrousers.
the class PowerConduitRenderer method addConduitQuads.
@Override
protected void addConduitQuads(@Nonnull IConduitBundle bundle, @Nonnull IConduit conduit, @Nonnull TextureAtlasSprite tex, @Nonnull CollidableComponent component, float selfIllum, BlockRenderLayer layer, @Nonnull List<BakedQuad> quads) {
if (IPowerConduit.COLOR_CONTROLLER_ID.equals(component.data)) {
IPowerConduit pc = (IPowerConduit) conduit;
ConnectionMode conMode = pc.getConnectionMode(component.dir);
if (conduit.containsExternalConnection(component.dir) && pc.getExtractionRedstoneMode(component.dir) != RedstoneControlMode.IGNORE && conMode != ConnectionMode.DISABLED) {
int cInt = ((IPowerConduit) conduit).getExtractionSignalColor(component.dir).getColor();
Vector4f col = ColorUtil.toFloat4(cInt);
BoundingBox bound = component.bound;
if (conMode != ConnectionMode.IN_OUT && conMode != ConnectionMode.NOT_SET) {
Vector3d trans = ForgeDirectionOffsets.offsetScaled(component.dir, -0.12);
bound = bound.translate(trans);
}
addQuadsForSection(bound, tex, component.dir, quads, col);
}
return;
}
super.addConduitQuads(bundle, conduit, tex, component, selfIllum, layer, quads);
if (component.dir == null) {
return;
}
IPowerConduit pc = (IPowerConduit) conduit;
ConnectionMode mode = pc.getConnectionMode(component.dir);
if (mode != ConnectionMode.INPUT && mode != ConnectionMode.OUTPUT) {
return;
}
if (mode == ConnectionMode.INPUT) {
tex = pc.getTextureForInputMode();
} else {
tex = pc.getTextureForOutputMode();
}
Offset offset = bundle.getOffset(IPowerConduit.class, component.dir);
ConnectionModeGeometry.addModeConnectorQuads(component.dir, offset, tex, null, quads);
}
use of crazypants.enderio.base.conduit.ConnectionMode in project EnderIO by SleepyTrousers.
the class InsulatedRedstoneConduit method getNetworkOutputs.
@Override
@Nonnull
public Collection<Signal> getNetworkOutputs(@Nonnull EnumFacing side) {
if (side == null) {
if (network == null) {
return Collections.emptySet();
}
return network.getSignals().values();
}
ConnectionMode mode = getConnectionMode(side);
if (network == null || mode != ConnectionMode.IN_OUT) {
return Collections.emptySet();
}
Collection<Signal> allSigs = network.getSignals().values();
if (allSigs.isEmpty()) {
return allSigs;
}
DyeColor col = getSignalColor(side);
Set<Signal> result = new HashSet<Signal>();
for (Signal signal : allSigs) {
if (signal.getColor() == col) {
result.add(signal);
}
}
return result;
}
Aggregations