Fixed unit tests

This commit is contained in:
Anuken 2019-11-16 12:40:26 -05:00
parent edfe58cb38
commit 94cf054312

View File

@ -111,14 +111,10 @@ public class ApplicationTests{
@Test
void createMap(){
Tile[][] tiles = world.resize(8, 8);
Tiles tiles = world.resize(8, 8);
world.beginMapLoad();
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
tiles[x][y] = new Tile(x, y);
}
}
tiles.fill();
world.endMapLoad();
}
@ -329,29 +325,29 @@ public class ApplicationTests{
@Test
void allBlockTest(){
Tile[][] tiles = world.resize(256*2 + 20, 10);
Tiles tiles = world.resize(256*2 + 20, 10);
world.beginMapLoad();
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
tiles[x][y] = new Tile(x, y, Blocks.stone.id, (byte)0, (byte)0);
for(int x = 0; x < tiles.width(); x++){
for(int y = 0; y < tiles.height(); y++){
tiles.set(x, y, new Tile(x, y, Blocks.stone.id, (byte)0, (byte)0));
}
}
int i = 0;
for(int x = 5; x < tiles.length && i < content.blocks().size; ){
for(int x = 5; x < tiles.width() && i < content.blocks().size; ){
Block block = content.block(i++);
if(block.isBuildable()){
x += block.size;
tiles[x][5].setBlock(block);
tiles.get(x, 5).setBlock(block);
x += block.size;
}
}
world.endMapLoad();
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
Tile tile = world.tile(x, y);
for(int x = 0; x < tiles.width(); x++){
for(int y = 0; y < tiles.height(); y++){
Tile tile = world.rawTile(x, y);
if(tile.entity != null){
try{
tile.entity.update();