Archived
0

добавлен тест для Location

This commit is contained in:
2018-08-17 13:49:00 +03:00
parent e17acb812b
commit d02499e3b7
2 changed files with 178 additions and 5 deletions

View File

@@ -50,15 +50,15 @@ public class Location implements Cloneable {
}
public int getBlockX() {
return (int) x;
return Double.valueOf(Math.floor(x)).intValue();
}
public int getBlockY() {
return (int) y;
return Double.valueOf(Math.floor(y)).intValue();
}
public int getBlockZ() {
return (int) z;
return Double.valueOf(Math.floor(z)).intValue();
}
public Chunk getChunk() {
@@ -66,7 +66,7 @@ public class Location implements Cloneable {
if (world == null) {
return null;
} else {
return world.getChunk((int)(x / 16), (int)(z / 16));
return world.getChunk(getBlockX() >> 4, getBlockZ() >> 4);
}
}
@@ -75,7 +75,7 @@ public class Location implements Cloneable {
if (chunk == null) {
return null;
} else {
return chunk.getChunkSection((int)(y / 16));
return chunk.getChunkSection(getBlockY() >> 4);
}
}