[F] Fix concurrent modification error
This commit is contained in:
@@ -41,6 +41,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static baritone.api.utils.Helper.mc;
|
import static baritone.api.utils.Helper.mc;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
import static java.util.stream.Collectors.toList;
|
||||||
import static org.hydev.hyritone.MiscUtils.debug;
|
import static org.hydev.hyritone.MiscUtils.debug;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,16 +153,16 @@ public class SeedServerCache extends Behavior
|
|||||||
{
|
{
|
||||||
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);
|
||||||
|
|
||||||
|
debug("Removing air...");
|
||||||
|
|
||||||
// Clear unwanted blocks
|
// Clear unwanted blocks
|
||||||
blocks.forEach(block ->
|
blocks.forEach(block ->
|
||||||
{
|
{
|
||||||
// Exited
|
// Exited
|
||||||
if (mc.world == null) return;
|
if (mc.world == null) return;
|
||||||
|
|
||||||
debug("Removing air...");
|
|
||||||
|
|
||||||
// Only add it if it is not air in the client world
|
// Only add it if it is not air in the client world
|
||||||
if (!mc.world.getBlockState(block).isAir()) cacheBlocks.add(block);
|
cacheBlocks = blocks.stream().filter(b -> !mc.world.getBlockState(b).isAir()).collect(toList());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
|
|||||||
Reference in New Issue
Block a user