use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.
the class AbstractTileTest method testGetTextureName.
@Test
public void testGetTextureName() {
FakeWorld world = FakeWorld.newWorld("TestGetTextureName");
world.setBlock(0, 0, 0, block);
try {
Method method = Tile.class.getDeclaredMethod("getTextureName");
method.setAccessible(true);
Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
assertTrue(method.invoke(tile) != null);
} catch (NoSuchMethodException e) {
fail("Could not find method getTextureName");
} catch (InvocationTargetException e) {
fail("Failed to invoke method getTextureName");
} catch (IllegalAccessException e) {
fail("Couldn't access method getTextureName");
}
}
use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.
the class AbstractTileTest method testToPos.
@Test
public void testToPos() {
FakeWorld world = FakeWorld.newWorld("TestTopos");
world.setBlock(0, 0, 0, block);
Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
Pos pos = tile.toPos();
Pos pos2 = new Pos(tile.x(), tile.y(), tile.z());
assertTrue("Pos " + pos + " does not equal " + pos2, pos.equals(pos2));
}
use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.
the class AbstractTileTest method testX.
@Test
public void testX() {
FakeWorld world = FakeWorld.newWorld("TestX");
world.setBlock(0, 0, 0, block);
TileEntity tile = world.getTileEntity(0, 0, 0);
assertTrue(tile.getClass() == tileClazz);
assertTrue(tile.xCoord == (int) ((T) tile).x());
}
use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.
the class AbstractTileTest method testDistance.
@Test
public void testDistance() {
FakeWorld world = FakeWorld.newWorld("TestDistance");
world.setBlock(0, 0, 0, block);
Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
Pos pos = new Pos(0.5).add(dir);
Pos center = tile.toPos();
double distance = tile.distance(pos.x(), pos.y(), pos.z());
assertTrue("Distance = " + distance + " Pos = " + pos + " Center = " + center, Math.abs(distance - 1) <= 0.01);
player.setLocationAndAngles(pos.x(), pos.y(), pos.z(), 0, 0);
distance = tile.distance(player);
assertTrue("Distance = " + distance + " Pos = " + pos + " Center = " + center, Math.abs(distance - 1) <= 0.01);
distance = tile.distance(pos);
assertTrue("Distance = " + distance + " Pos = " + pos + " Center = " + center, Math.abs(distance - 1) <= 0.01);
}
}
use of com.builtbroken.mc.testing.junit.world.FakeWorld in project Engine by VoltzEngine-Project.
the class AbstractTileTest method testGetCollisionBounds.
@Test
public void testGetCollisionBounds() {
FakeWorld world = FakeWorld.newWorld("TestGetCollisionBounds");
world.setBlock(0, 0, 0, block);
Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
Cube cube = tile.getCollisionBounds();
if (cube != null) {
// TODO test too see if cube is valid
}
}
Aggregations