Refactoring: get rid of outer loop
This commit is contained in:
parent
79a71b7c64
commit
d99fbb398c
1 changed files with 17 additions and 19 deletions
|
@ -217,25 +217,23 @@ public class EntityJump extends Entity {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean checkForChunksGeneratedIn(World w) {
|
public boolean checkForChunksGeneratedIn(World w) {
|
||||||
for (int y = minY; y <= maxY; y++) {
|
// TODO: ходить не по координатам, а по координатам чанков, так быстрее.
|
||||||
for (int x = Xmin; x <= Xmax; x++) {
|
for (int x = Xmin; x <= Xmax; x++) {
|
||||||
for (int z = Zmin; z <= Zmax; z++) {
|
for (int z = Zmin; z <= Zmax; z++) {
|
||||||
final int newX = getNewXCoord(x, 0, z, this.distance, this.dir);
|
final int newX = getNewXCoord(x, 0, z, this.distance, this.dir);
|
||||||
final int newZ = getNewZCoord(x, 0, z, this.distance, this.dir);
|
final int newZ = getNewZCoord(x, 0, z, this.distance, this.dir);
|
||||||
|
|
||||||
int chunkX = newX >> 4;
|
int chunkX = newX >> 4;
|
||||||
int chunkZ = newZ >> 4;
|
int chunkZ = newZ >> 4;
|
||||||
|
|
||||||
if (!w.getChunkProvider().chunkExists(chunkX, chunkZ)) {
|
if (!w.getChunkProvider().chunkExists(chunkX, chunkZ)) {
|
||||||
messageToAllPlayersOnShip("Generating chunks...");
|
messageToAllPlayersOnShip("Generating chunks...");
|
||||||
w.getBlockId(newX, 128, newZ);
|
w.getBlockId(newX, 128, newZ);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,10 +245,10 @@ public class EntityJump extends Entity {
|
||||||
if (!(obj instanceof MovingEntity)) {
|
if (!(obj instanceof MovingEntity)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
MovingEntity me = (MovingEntity)obj;
|
MovingEntity me = (MovingEntity)obj;
|
||||||
Entity entity = me.entity;
|
Entity entity = me.entity;
|
||||||
|
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
((EntityPlayer)entity).sendChatToPlayer("[WarpCore] " + msg);
|
((EntityPlayer)entity).sendChatToPlayer("[WarpCore] " + msg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue