3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 18:40:05 +01:00

Control flow improvements.

Dieser Commit ist enthalten in:
TomyLobo 2013-08-24 10:43:51 +02:00
Ursprung eacd147694
Commit 878c26a8f0

Datei anzeigen

@ -1297,15 +1297,17 @@ public class BukkitWorld extends LocalWorld {
public LocalEntity[] getEntities(Region region) { public LocalEntity[] getEntities(Region region) {
List<BukkitEntity> entities = new ArrayList<BukkitEntity>(); List<BukkitEntity> entities = new ArrayList<BukkitEntity>();
for (Vector2D pt : region.getChunks()) { for (Vector2D pt : region.getChunks()) {
if (world.isChunkLoaded(pt.getBlockX(), pt.getBlockZ())) { if (!world.isChunkLoaded(pt.getBlockX(), pt.getBlockZ())) {
Entity[] ents = world.getChunkAt(pt.getBlockX(), pt.getBlockZ()).getEntities(); continue;
}
final Entity[] ents = world.getChunkAt(pt.getBlockX(), pt.getBlockZ()).getEntities();
for (Entity ent : ents) { for (Entity ent : ents) {
if (region.contains(BukkitUtil.toVector(ent.getLocation()))) { if (region.contains(BukkitUtil.toVector(ent.getLocation()))) {
entities.add(BukkitUtil.toLocalEntity(ent)); entities.add(BukkitUtil.toLocalEntity(ent));
} }
} }
} }
}
return entities.toArray(new BukkitEntity[entities.size()]); return entities.toArray(new BukkitEntity[entities.size()]);
} }