Search in sources :

Example 1 with ITileModuleProvider

use of com.builtbroken.mc.api.tile.ITileModuleProvider 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

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