[O] Check exited outside the loop

This commit is contained in:
Hykilpikonna
2020-02-19 20:58:01 -05:00
parent 09c8799eb4
commit f57899838a
@@ -122,15 +122,14 @@ public class SeedServerCache extends Behavior
try (CloseableHttpResponse response = http.execute(get)) try (CloseableHttpResponse response = http.execute(get))
{ {
ArrayList<BlockPos> blocks = new Gson().fromJson(IOUtils.toString(response.getEntity().getContent(), UTF_8), blocksType); ArrayList<BlockPos> blocks = new Gson().fromJson(IOUtils.toString(response.getEntity().getContent(), UTF_8), blocksType);
// Exited
if (mc.world == null) return;
debug("Removing air..."); debug("Removing air...");
// Clear unwanted blocks // Clear unwanted blocks
blocks.forEach(block -> blocks.forEach(block ->
{ {
// Exited
if (mc.world == null) return;
// Only add it if it is not air in the client world // Only add it if it is not air in the client world
cacheBlocks = blocks.stream().filter(b -> !mc.world.getBlockState(b).isAir()).collect(toList()); cacheBlocks = blocks.stream().filter(b -> !mc.world.getBlockState(b).isAir()).collect(toList());
}); });