Search in sources :

Example 1 with Location

use of com.builtbroken.mc.lib.transform.vector.Location in project Engine by VoltzEngine-Project.

the class NodeConnectionTest method setUpForTest.

@Override
public void setUpForTest(String name) {
    world = new FakeWorld();
    center = new Location(world, 8, 8, 8);
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) Location(com.builtbroken.mc.lib.transform.vector.Location)

Example 2 with Location

use of com.builtbroken.mc.lib.transform.vector.Location in project Engine by VoltzEngine-Project.

the class NodeConnectionTest method buildWireInDir.

private void buildWireInDir(ForgeDirection dir) {
    Location vec = center.add(dir);
    vec.setBlock(WireMap.wire());
    assertNotNull("Failed to place wire at " + vec, vec.getBlock());
    assertNotNull("Failed to place tile at " + vec, vec.getTileEntity());
}
Also used : Location(com.builtbroken.mc.lib.transform.vector.Location)

Example 3 with Location

use of com.builtbroken.mc.lib.transform.vector.Location 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();
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ITileModuleProvider(com.builtbroken.mc.api.tile.ITileModuleProvider) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) NodeBranchPart(com.builtbroken.mc.lib.grid.branch.NodeBranchPart) Location(com.builtbroken.mc.lib.transform.vector.Location)

Aggregations

Location (com.builtbroken.mc.lib.transform.vector.Location)3 ITileModuleProvider (com.builtbroken.mc.api.tile.ITileModuleProvider)1 NodeBranchPart (com.builtbroken.mc.lib.grid.branch.NodeBranchPart)1 FakeWorld (com.builtbroken.mc.testing.junit.world.FakeWorld)1 TileEntity (net.minecraft.tileentity.TileEntity)1 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)1