Fixed some minor bugs
This commit is contained in:
parent
e7433c90e2
commit
6f82d1d8b8
@ -20,6 +20,7 @@ package ru.windcorp.progressia.client.world;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
@ -142,12 +143,14 @@ implements GenericWorld<
|
|||||||
int[] updates = new int[] { 0 };
|
int[] updates = new int[] { 0 };
|
||||||
|
|
||||||
VectorUtil.iterateCuboidAround(entity.getChunkCoords(null), 3, chunkPos -> {
|
VectorUtil.iterateCuboidAround(entity.getChunkCoords(null), 3, chunkPos -> {
|
||||||
if (chunksToUpdate.contains(chunkPos)) {
|
if (!chunksToUpdate.contains(chunkPos)) return;
|
||||||
getChunk(chunkPos).update();
|
|
||||||
chunksToUpdate.remove(chunkPos);
|
ChunkRender chunk = getChunk(chunkPos);
|
||||||
|
if (chunk == null) return;
|
||||||
updates[0]++;
|
|
||||||
}
|
chunk.update();
|
||||||
|
chunksToUpdate.remove(chunkPos);
|
||||||
|
updates[0]++;
|
||||||
});
|
});
|
||||||
|
|
||||||
return updates[0];
|
return updates[0];
|
||||||
@ -163,10 +166,14 @@ implements GenericWorld<
|
|||||||
|
|
||||||
Vec3 v = Vectors.grab3();
|
Vec3 v = Vectors.grab3();
|
||||||
|
|
||||||
for (Vec3i chunkPos : chunksToUpdate) {
|
for (Iterator<Vec3i> it = chunksToUpdate.iterator(); it.hasNext();) {
|
||||||
|
Vec3i chunkPos = it.next();
|
||||||
ChunkRender chunk = getChunk(chunkPos);
|
ChunkRender chunk = getChunk(chunkPos);
|
||||||
|
|
||||||
if (chunk == null) continue;
|
if (chunk == null) {
|
||||||
|
it.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
v.set(chunk.getMinX(), chunk.getMinY(), chunk.getMinZ()).sub(playerPos);
|
v.set(chunk.getMinX(), chunk.getMinY(), chunk.getMinZ()).sub(playerPos);
|
||||||
float distSq = v.x * v.x + v.y * v.y + v.z * v.z;
|
float distSq = v.x * v.x + v.y * v.y + v.z * v.z;
|
||||||
@ -174,7 +181,7 @@ implements GenericWorld<
|
|||||||
if (nearest == null || distSq < nearestDistSq) {
|
if (nearest == null || distSq < nearestDistSq) {
|
||||||
nearest = chunk;
|
nearest = chunk;
|
||||||
nearestDistSq = distSq;
|
nearestDistSq = distSq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nearest != null) {
|
if (nearest != null) {
|
||||||
|
@ -164,7 +164,11 @@ public class LayerTestGUI extends GUILayer {
|
|||||||
if (client == null) return "Pos: n/a";
|
if (client == null) return "Pos: n/a";
|
||||||
|
|
||||||
Vec3 pos = client.getCamera().getLastAnchorPosition();
|
Vec3 pos = client.getCamera().getLastAnchorPosition();
|
||||||
return String.format(Locale.US, "Pos: %+7.1f %+7.1f %+7.1f", pos.x, pos.y, pos.z);
|
if (Float.isNaN(pos.x)) {
|
||||||
|
return "Pos: entity n/a";
|
||||||
|
} else {
|
||||||
|
return String.format(Locale.US, "Pos: %+7.1f %+7.1f %+7.1f", pos.x, pos.y, pos.z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static class DebugComponent extends Component {
|
// private static class DebugComponent extends Component {
|
||||||
|
Reference in New Issue
Block a user