Search in sources :

Example 1 with FakeWorld

use of com.builtbroken.mc.testing.junit.world.FakeWorld 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();
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileConductor(com.builtbroken.mc.prefab.tile.TileConductor) Pos(com.builtbroken.mc.lib.transform.vector.Pos) FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld)

Example 2 with FakeWorld

use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.

the class AbstractTileTest method testSetOwner.

@Test
public void testSetOwner() {
    FakeWorld world = FakeWorld.newWorld("TestSetOwner");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    tile.setOwner(player);
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) PacketTile(com.builtbroken.mc.core.network.packet.PacketTile) BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) Tile(com.builtbroken.mc.prefab.tile.Tile) Test(org.junit.Test)

Example 3 with FakeWorld

use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.

the class AbstractTileTest method testSetAccess.

@Test
public void testSetAccess() {
    FakeWorld world = FakeWorld.newWorld("TestSetAccess");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    tile.setAccess(world);
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) PacketTile(com.builtbroken.mc.core.network.packet.PacketTile) BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) Tile(com.builtbroken.mc.prefab.tile.Tile) Test(org.junit.Test)

Example 4 with FakeWorld

use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.

the class AbstractTileTest method testFirstTick.

@Test
public void testFirstTick() {
    FakeWorld world = FakeWorld.newWorld("TestFirstTick");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    tile.firstTick();
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) PacketTile(com.builtbroken.mc.core.network.packet.PacketTile) BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) Tile(com.builtbroken.mc.prefab.tile.Tile) Test(org.junit.Test)

Example 5 with FakeWorld

use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.

the class AbstractTileTest method testGetIcon.

@Test
public void testGetIcon() {
    FakeWorld world = FakeWorld.newWorld("TestGetIcon");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    tile.registerIcons(new SudoIconReg());
    tile.getIcon();
    for (int i = 0; i < 6; i++) {
        tile.getIcon(i);
        tile.getIcon(i, 0);
    }
    tile.getIcon(tile.name);
}
Also used : SudoIconReg(com.builtbroken.mc.testing.junit.icons.SudoIconReg) FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) PacketTile(com.builtbroken.mc.core.network.packet.PacketTile) BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) Tile(com.builtbroken.mc.prefab.tile.Tile) Test(org.junit.Test)

Aggregations

FakeWorld (com.builtbroken.mc.testing.junit.world.FakeWorld)114 Test (org.junit.Test)111 BlockTile (com.builtbroken.mc.prefab.tile.BlockTile)85 Tile (com.builtbroken.mc.prefab.tile.Tile)85 PacketTile (com.builtbroken.mc.core.network.packet.PacketTile)84 AbstractTest (com.builtbroken.mc.testing.junit.AbstractTest)21 TileEntity (net.minecraft.tileentity.TileEntity)11 InvocationTargetException (java.lang.reflect.InvocationTargetException)6 Method (java.lang.reflect.Method)6 Pos (com.builtbroken.mc.lib.transform.vector.Pos)5 SudoIconReg (com.builtbroken.mc.testing.junit.icons.SudoIconReg)4 ItemStack (net.minecraft.item.ItemStack)4 Cube (com.builtbroken.mc.lib.transform.region.Cube)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 Location (com.builtbroken.mc.lib.transform.vector.Location)2 TileConductor (com.builtbroken.mc.prefab.tile.TileConductor)1 ArrayList (java.util.ArrayList)1 Block (net.minecraft.block.Block)1 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)1