diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index 81ca14ff62..ffe9881943 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -407,6 +407,7 @@ public class Blocks implements ContentList{ outputItem = new ItemStack(Items.silicon, 1); craftTime = 40f; size = 2; + hasPower = true; hasLiquids = false; flameColor = Color.valueOf("ffef99"); @@ -462,6 +463,7 @@ public class Blocks implements ContentList{ outputItem = new ItemStack(Items.phasefabric, 1); craftTime = 120f; size = 2; + hasPower = true; consumes.items(new ItemStack(Items.thorium, 4), new ItemStack(Items.sand, 10)); consumes.power(5f); @@ -507,6 +509,7 @@ public class Blocks implements ContentList{ outputItem = new ItemStack(Items.surgealloy, 1); craftTime = 75f; size = 3; + hasPower = true; consumes.power(4f); consumes.items(new ItemStack(Items.titanium, 2), new ItemStack(Items.lead, 4), new ItemStack(Items.silicon, 3), new ItemStack(Items.copper, 3)); @@ -625,6 +628,7 @@ public class Blocks implements ContentList{ size = 2; health = 320; hasLiquids = true; + hasPower = true; consumes.item(Items.sporePod, 1); consumes.power(0.60f); diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index 28b98f14a1..d4809b2746 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -334,6 +334,43 @@ public class ApplicationTests{ assertEquals(Blocks.air, world.tile(1, 1).block()); } + @Test + void allBlockTest(){ + Tile[][] tiles = world.createTiles(256 + 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); + } + } + int i = 0; + + for(int x = 5; x < tiles.length && i < content.blocks().size;){ + Block block = content.block(i++); + if(block.buildVisibility.get()){ + tiles[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); + if(tile.entity != null){ + try{ + tile.entity.update(); + }catch(Throwable t){ + fail("Failed to update block '" + tile.block() + "'.", t); + } + assertEquals(tile.block(), tile.entity.block); + assertEquals(tile.block().health, tile.entity.health); + } + } + } + } + void initBuilding(){ createMap();