use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.
the class AbstractTileEntityTest method testGetDistanceFrom.
@Test
public void testGetDistanceFrom() {
T tile = newTile();
FakeWorld world = FakeWorld.newWorld("testGetDistanceFrom");
tile.setWorldObj(world);
double distance = tile.getDistanceFrom(10, 14, 15);
double distance2 = new Pos(0.5).sub(10, 14, 15).magnitudeSquared();
assertTrue("Distance = " + distance + " Distance2 = " + distance2, Math.abs(distance - distance2) < .01);
}
use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.
the class AbstractTileEntityTest method testPlacement.
@Test
public void testPlacement() {
FakeWorld world = FakeWorld.newWorld("testGetBlockMetadata");
for (int i = 0; i < 16; i++) {
int placement_meta = block.damageDropped(i);
world.setBlock(10, 10, 10, block, placement_meta, 3);
assertTrue(world.getBlock(10, 10, 10) == block);
assertTrue(world.getTileEntity(10, 10, 10).getClass() == tileClazz);
world.getTileEntity(10, 10, 10).markDirty();
//Test placement meta
int meta = world.getBlockMetadata(10, 10, 10);
int placed_meta = world.getTileEntity(10, 10, 10).getBlockMetadata();
assertTrue("World meta = " + meta + " Tile meta = " + placed_meta, placed_meta == meta);
}
}
use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.
the class AbstractTileEntityTest method testInvalidate.
@Test
public void testInvalidate() {
FakeWorld world = FakeWorld.newWorld("testInvalidate");
world.setBlock(10, 11, 12, block);
TileEntity tile = world.getTileEntity(10, 11, 12);
tile.invalidate();
assertTrue(tile.isInvalid());
}
use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.
the class AbstractTileEntityTest method testWorldObj.
/**
* Tests {@link TileEntity#setWorldObj(World)} and {@link TileEntity#getWorldObj()}
*/
@Test
public void testWorldObj() {
T tile = newTile();
FakeWorld world = FakeWorld.newWorld("testGetWorldObj");
assertNull(tile.getWorldObj());
tile.setWorldObj(world);
assertNotNull(tile.getWorldObj());
}
use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.
the class AbstractTileEntityTest method testValidate.
@Test
public void testValidate() {
FakeWorld world = FakeWorld.newWorld("testValidate");
world.setBlock(10, 11, 12, block);
TileEntity tile = world.getTileEntity(10, 11, 12);
tile.validate();
assertTrue(!tile.isInvalid());
}
Aggregations