use of buildcraft.api.transport.PipeWire in project BuildCraft by BuildCraft.
the class PipeModelCacheWire method generate.
private static ImmutableList<MutableQuad> generate(PipeWireKeySingle key) {
PipeWire wire = key.type;
Vec3d pos = wirePosMap.get(wire);
boolean isLit = key.on;
// BCLog.logger.info("generate[" + wire + ", " + isLit + ", " + key.connections + "]");
TextureAtlasSprite sprite = BuildCraftTransport.instance.wireIconProvider.getIcon(wire, isLit);
List<MutableQuad> unprocessed = new ArrayList<>();
Vec3d center = pos;
Vec3d centerSize = new Vec3d(WIRE_WIDTH, WIRE_WIDTH, WIRE_WIDTH);
AxisDirection[] directions = wireDirectionMap.get(wire);
int numFaces = 0;
for (EnumFacing face : EnumFacing.values()) {
boolean positive = face.getAxisDirection() == AxisDirection.POSITIVE;
Axis axis = face.getAxis();
AxisDirection wireCenter = directions[axis.ordinal()];
if (key.connections.contains(face)) {
if (wireCenter == face.getAxisDirection()) {
numFaces++;
}
numFaces++;
Vec3d start = pos;
Vec3d end = pos.add(centerSize);
if (positive) {
start = VecUtil.replaceValue(start, axis, VecUtil.getValue(start, axis) + WIRE_WIDTH);
end = VecUtil.replaceValue(end, axis, (double) 1);
} else {
start = VecUtil.replaceValue(start, axis, (double) 0);
end = VecUtil.replaceValue(end, axis, VecUtil.getValue(end, axis) - WIRE_WIDTH);
}
renderCuboid(unprocessed, start, end.subtract(start), sprite);
} else {
boolean anyOther = false;
for (EnumFacing face2 : EnumFacing.values()) {
if (face2.getOpposite() == face) {
continue;
}
anyOther |= key.connections.contains(face2);
}
if (anyOther) {
continue;
}
Vec3d start = pos;
Vec3d end = pos.add(centerSize);
if (positive) {
start = VecUtil.replaceValue(start, axis, VecUtil.getValue(start, axis) + WIRE_WIDTH);
end = VecUtil.replaceValue(end, axis, (double) CoreConstants.PIPE_MAX_POS);
} else {
start = VecUtil.replaceValue(start, axis, (double) CoreConstants.PIPE_MIN_POS);
end = VecUtil.replaceValue(end, axis, VecUtil.getValue(end, axis) - WIRE_WIDTH);
}
Vec3d size = end.subtract(start);
if (size.lengthVector() > WIRE_WIDTH * 2) {
renderCuboid(unprocessed, start, size, sprite);
}
}
}
if (numFaces != 1) {
renderCuboid(unprocessed, center, centerSize, sprite);
}
ImmutableList.Builder<MutableQuad> builder = ImmutableList.builder();
for (MutableQuad quad : unprocessed) {
if (isLit)
quad.lightf(1, 0);
quad.colourf(1, 1, 1, 1);
// quad.setCalculatedDiffuse();
builder.add(quad);
}
return builder.build();
}
use of buildcraft.api.transport.PipeWire in project BuildCraft by BuildCraft.
the class BlockGenericPipe method stripEquipment.
private boolean stripEquipment(World world, BlockPos pos, EntityPlayer player, Pipe<?> pipe, EnumFacing side) {
if (!world.isRemote) {
// Try to strip pluggables first
EnumFacing nSide = side;
RaytraceResult rayTraceResult = doRayTrace(world, pos, player);
if (rayTraceResult != null && rayTraceResult.hitPart != Part.Pipe) {
nSide = rayTraceResult.sideHit;
}
if (pipe.container.hasPipePluggable(nSide)) {
return pipe.container.setPluggable(nSide, null, player);
}
// Try to strip wires second, starting with yellow.
for (PipeWire color : PipeWire.values()) {
if (stripWire(pipe, color, player)) {
return true;
}
}
}
return false;
}
use of buildcraft.api.transport.PipeWire in project BuildCraft by BuildCraft.
the class Gate method addTriggers.
// TRIGGERS
public void addTriggers(Collection<ITriggerInternal> list) {
for (PipeWire wire : PipeWire.VALUES) {
if (pipe.wireSet[wire.ordinal()] && wire.ordinal() < material.maxWireColor) {
list.add(BuildCraftTransport.triggerPipeWireActive[wire.ordinal()]);
list.add(BuildCraftTransport.triggerPipeWireInactive[wire.ordinal()]);
}
}
// for (GateExpansionController expansion : expansions.values()) {
// expansion.addTriggers(list);
// }
}
use of buildcraft.api.transport.PipeWire in project BuildCraft by BuildCraft.
the class TransportSiliconRecipes method addGateRecipe.
@Optional.Method(modid = "BuildCraft|Silicon")
private static void addGateRecipe(String materialName, int energyCost, GateDefinition.GateMaterial material, EnumRedstoneChipset chipset, PipeWire... pipeWire) {
List<ItemStack> temp = new ArrayList<>();
temp.add(chipset.getStack());
for (PipeWire wire : pipeWire) {
temp.add(wire.getStack());
}
Object[] inputs = temp.toArray();
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:andGate" + materialName, energyCost, ItemGate.makeGateItem(material, GateDefinition.GateLogic.AND), inputs);
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:orGate" + materialName, energyCost, ItemGate.makeGateItem(material, GateDefinition.GateLogic.OR), inputs);
}
Aggregations