Search in sources :

Example 51 with FakeWorld

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

the class AbstractTileTest method testCanPlaceBlockOnSide.

@Test
public void testCanPlaceBlockOnSide() {
    FakeWorld world = FakeWorld.newWorld("TestCanplaceBlockOnSide");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
        tile.canPlaceBlockOnSide(dir);
    }
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) 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 52 with FakeWorld

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

the class AbstractTileTest method testHasSpecialRenderer.

@Test
public void testHasSpecialRenderer() {
    FakeWorld world = FakeWorld.newWorld("TestHasSpecialRenderer");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    tile.hasSpecialRenderer();
}
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 53 with FakeWorld

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

the class AbstractTileEntityTest method testCanUpdate.

@Test
public void testCanUpdate() {
    //Test for no errors/crash
    FakeWorld world = FakeWorld.newWorld("testCanUpdate");
    world.setBlock(10, 11, 12, block);
    world.getTileEntity(10, 11, 12).canUpdate();
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) AbstractTest(com.builtbroken.mc.testing.junit.AbstractTest) Test(org.junit.Test)

Example 54 with FakeWorld

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

the class AbstractTileEntityTest method testGetMaxRenderDistanceSquared.

@Test
public void testGetMaxRenderDistanceSquared() {
    FakeWorld world = FakeWorld.newWorld("testGetMaxRenderDistanceSquared");
    world.setBlock(10, 11, 12, block);
    double d = world.getTileEntity(10, 11, 12).getMaxRenderDistanceSquared();
    assertTrue(d >= 0);
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) AbstractTest(com.builtbroken.mc.testing.junit.AbstractTest) Test(org.junit.Test)

Example 55 with FakeWorld

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

the class AbstractTileEntityTest method testWriteToNBT.

/** Tests {@link TileEntity#writeToNBT(NBTTagCompound)} */
@Test
public void testWriteToNBT() {
    T tile = newTile();
    tile.xCoord = 10;
    tile.yCoord = 11;
    tile.zCoord = 3;
    FakeWorld world = FakeWorld.newWorld("testWriteToNBT");
    tile.setWorldObj(world);
    NBTTagCompound nbt = new NBTTagCompound();
    assertTrue("NBT should have not tags on init", nbt.hasNoTags());
    tile.writeToNBT(nbt);
    assertTrue("NBT should have saved something", !nbt.hasNoTags());
    assertTrue("X coord should have saved", nbt.hasKey("x"));
    assertTrue("X should equal tile xCoord", nbt.getInteger("x") == tile.xCoord);
    assertTrue("Y coord should have saved", nbt.hasKey("y"));
    assertTrue("Y should equal tile yCoord", nbt.getInteger("y") == tile.yCoord);
    assertTrue("Z coord should have saved", nbt.hasKey("z"));
    assertTrue("Z should equal tile zCoord", nbt.getInteger("z") == tile.zCoord);
    assertTrue("ID tag should have saved", nbt.hasKey("id"));
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) AbstractTest(com.builtbroken.mc.testing.junit.AbstractTest) 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.imp.transform.vector.Pos)4 SudoIconReg (com.builtbroken.mc.testing.junit.icons.SudoIconReg)4 ItemStack (net.minecraft.item.ItemStack)4 Cube (com.builtbroken.mc.imp.transform.region.Cube)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 Location (com.builtbroken.mc.imp.transform.vector.Location)1 Location (com.builtbroken.mc.lib.transform.vector.Location)1 Pos (com.builtbroken.mc.lib.transform.vector.Pos)1 TileConductor (com.builtbroken.mc.prefab.tile.TileConductor)1 ArrayList (java.util.ArrayList)1