use of com.builtbroken.mc.lib.grid.branch.NodeBranchPart in project Engine by VoltzEngine-Project.
the class NodeConnectionTest method testAllSides.
//Full all side connection test
public void testAllSides() {
buildFullWireSet();
//Trigger connection building in the wire
TileEntity tile = center.getTileEntity();
if (tile instanceof TileConductor) {
((TileConductor) tile).getNode().buildConnections();
}
//Test connections
assertNotNull("There should be a tile at Vec(8,8,8)", tile);
if (tile instanceof TileConductor) {
NodeBranchPart node = ((TileConductor) tile).getNode();
assertNotNull("There should be a node at Vec(8,8,8)", node);
if (node.getConnections().size() == 0)
fail("Should be at least one connection");
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
boolean found = false;
for (Map.Entry<NodeBranchPart, ForgeDirection> entry : node.getConnections().entrySet()) {
if (entry.getValue() == dir.getOpposite()) {
found = true;
}
}
if (!found)
fail("No " + dir + " connection found");
}
}
//Clean up
world.clear();
}
use of com.builtbroken.mc.lib.grid.branch.NodeBranchPart in project Engine by VoltzEngine-Project.
the class Part method _join.
protected Part _join(Part part) {
if (part != this) {
for (NodeBranchPart node : part.getEcapsulatedNodes()) {
add(node);
}
for (Part p : part.getEcapsulatedParts()) {
add(p);
}
//Cleanup
part.getEcapsulatedNodes().clear();
part.getEcapsulatedParts().clear();
return this;
}
return null;
}
use of com.builtbroken.mc.lib.grid.branch.NodeBranchPart in project Engine by VoltzEngine-Project.
the class NodeConnectionTest method testForNodes.
public void testForNodes() {
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
//Build
buildWireInDir(ForgeDirection.UNKNOWN);
buildWireInDir(side);
//Test
Location vec = center.add(side);
TileEntity tile = vec.getTileEntity();
if (tile instanceof ITileModuleProvider) {
NodeBranchPart part = ((ITileModuleProvider) tile).getModule(NodeBranchPart.class, side.getOpposite());
if (part == null)
fail("Failed to get NodeBranchPart from tile at " + vec + " from side " + side.getOpposite());
} else {
fail("Something failed good as the wire is not an instance of INodeProvider");
}
//Cleanup
center.setBlockToAir();
center.add(side).setBlockToAir();
}
}
Aggregations