use of com.builtbroken.mc.prefab.tile.TileConductor 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.prefab.tile.TileConductor in project Engine by VoltzEngine-Project.
the class BranchGridTest method setUpForTest.
@Override
public void setUpForTest(String name) {
//Create fake world to do actions in
world = new FakeWorld();
world.genFlatData();
//Set up wire grid
WireMap.WireTests.JUNCTION_FIVE.build(world, 0, 12, 0);
if (world.tiles.size() == 0) {
world.printLevel(12);
fail("No tiles were placed into the world");
}
world.updateEntities();
TileEntity tile = world.tiles.get(0);
if (tile instanceof TileConductor) {
grid = ((TileConductor) tile).getNode().getGrid();
} else {
System.out.println("Something went wrong building " + name + ".\n No tile was found to get grid from.");
for (TileEntity t : world.tiles) {
System.out.println("Tile: " + t + " Vec: " + new Pos(t));
}
fail();
}
//Trigger grid to update since we do not have a tick handler
grid.update();
}
Aggregations