Search in sources :

Example 61 with FakeWorld

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

the class AbstractTileEntityTest method testReadFromNBT.

/** Tests {@link TileEntity#readFromNBT(NBTTagCompound)} */
@Test
public void testReadFromNBT() {
    T tile = newTile();
    tile.xCoord = 10;
    tile.yCoord = 11;
    tile.zCoord = 3;
    FakeWorld world = FakeWorld.newWorld("testReadFromNBT");
    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());
    tile = newTile();
    world = FakeWorld.newWorld("testReadFromNBT2");
    tile.setWorldObj(world);
    tile.readFromNBT(nbt);
    assertTrue(tile.xCoord == 10);
    assertTrue(tile.yCoord == 11);
    assertTrue(tile.zCoord == 3);
}
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)

Example 62 with FakeWorld

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

the class AbstractTileEntityTest method testOnChunkUnload.

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

Example 63 with FakeWorld

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

the class AbstractTileTest method testMetadataDropped.

@Test
public void testMetadataDropped() {
    FakeWorld world = FakeWorld.newWorld("TestMetadataDropped");
    world.setBlock(0, 0, 0, block);
    ((Tile) world.getTileEntity(0, 0, 0)).metadataDropped(0, 0);
}
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 64 with FakeWorld

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

the class AbstractTileTest method testToLocation.

@Test
public void testToLocation() {
    FakeWorld world = FakeWorld.newWorld("TestToLocation");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    Location loc = tile.toLocation();
    assertTrue(loc.world == world);
    assertTrue(loc.xi() == tile.xCoord);
    assertTrue(loc.yi() == tile.yCoord);
    assertTrue(loc.zi() == tile.zCoord);
}
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) Location(com.builtbroken.mc.imp.transform.vector.Location) Test(org.junit.Test)

Example 65 with FakeWorld

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

the class AbstractTileTest method testQuantityDropped.

@Test
public void testQuantityDropped() {
    FakeWorld world = FakeWorld.newWorld("TestQuantityDropped");
    world.setBlock(0, 0, 0, block);
    ((Tile) world.getTileEntity(0, 0, 0)).quantityDropped(0, 0);
}
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)

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