Program: 177322
Project: 177322
Buggy source:
/** 
 * Updates the list of chunks around the player.
 * @param force Forces the update
 * @return True if the list was changed
 */
public boolean updateNearbyChunkMeshes(boolean force){
  if (world == null) {
    world=client.getDefaultWorld();
    if (world != null)     System.out.println("String_Node_Str" + world.getName() + "String_Node_Str"+ world.getUID());
 else     System.out.println("String_Node_Str");
  }
  if (world == null) {
    try {
      Thread.sleep(5);
    }
 catch (    InterruptedException e) {
    }
    return false;
  }
  int chunkViewDistance=client.getActivePlayer().getViewDistance() / 16;
  Point currentPos=client.getActivePlayer().getTransform().getPosition();
  int currentChunkX=currentPos.getChunkX();
  int currentChunkY=currentPos.getChunkY();
  int currentChunkZ=currentPos.getChunkZ();
  if (currentChunkX == lastChunkX && currentChunkY == lastChunkY && currentChunkZ == lastChunkZ && !force && !firstUpdate) {
    return false;
  }
  if (chunkRenderers.size() == 0 || force) {
    chunkRenderers.clear();
    int cubeMinX=currentChunkX - chunkViewDistance;
    int cubeMinY=currentChunkY - chunkViewDistance;
    int cubeMinZ=currentChunkZ - chunkViewDistance;
    int cubeMaxX=currentChunkX + chunkViewDistance;
    int cubeMaxY=currentChunkY + chunkViewDistance;
    int cubeMaxZ=currentChunkZ + chunkViewDistance;
    Vector3 batchMin=ChunkMeshBatch.getBatchCoordinates(new Vector3(cubeMinX,cubeMinY,cubeMinZ));
    Vector3 batchMax=ChunkMeshBatch.getBatchCoordinates(new Vector3(cubeMaxX,cubeMaxY,cubeMaxZ));
    for (int x=batchMin.getFloorX(); x <= batchMax.getFloorX(); x++) {
      for (int y=batchMin.getFloorY(); y <= batchMax.getFloorY(); y++) {
        for (int z=batchMin.getFloorZ(); z <= batchMax.getFloorZ(); z++) {
          Vector3 chunkCoords=ChunkMeshBatch.getChunkCoordinates(new Vector3(x,y,z));
          ChunkMeshBatch batch=new ChunkMeshBatch(world,chunkCoords.getFloorX(),chunkCoords.getFloorY(),chunkCoords.getFloorZ());
          addChunkMeshBatch(batch);
          batch.update();
          System.out.println(batch);
        }
      }
    }
  }
 else {
    Cube oldView=new Cube(new Point(world,lastChunkX - chunkViewDistance,lastChunkY - chunkViewDistance,lastChunkZ - chunkViewDistance),chunkViewDistance * 2);
    Cube newView=new Cube(new Point(world,currentChunkX - chunkViewDistance,currentChunkY - chunkViewDistance,currentChunkZ - chunkViewDistance),chunkViewDistance * 2);
    Vector3 min=oldView.getBase().min(newView.getBase());
    Vector3 max=oldView.getBase().add(oldView.getSize()).max(newView.getBase().add(newView.getSize()));
    Vector3 ignoreMin=oldView.getBase().max(newView.getBase());
    Vector3 ignoreMax=oldView.getBase().add(oldView.getSize()).min(newView.getBase().add(newView.getSize()));
    Cuboid ignore=new Cuboid(new Point(ignoreMin,world),ignoreMax.subtract(ignoreMin));
    for (int x=min.getFloorX(); x < max.getFloorX(); x++) {
      for (int y=min.getFloorY(); y < max.getFloorY(); y++) {
        for (int z=min.getFloorZ(); z < max.getFloorZ(); z++) {
          Vector3 vec=new Vector3(x,y,z);
          if (ignore.contains(vec)) {
            continue;
          }
          Vector3 pos=ChunkMeshBatch.getChunkCoordinates(vec);
          if (oldView.contains(vec)) {
            ChunkMeshBatch c=chunkRenderersByPosition.get(pos.getFloorX(),pos.getFloorY(),pos.getFloorZ());
            removeChunkMeshBatch(c);
            continue;
          }
          if (newView.contains(vec)) {
            ChunkMeshBatch c=new ChunkMeshBatch(world,pos.getFloorX(),pos.getFloorY(),pos.getFloorZ());
            addChunkMeshBatch(c);
            c.update();
          }
        }
      }
    }
  }
  firstUpdate=false;
  lastChunkX=currentChunkX;
  lastChunkY=currentChunkY;
  lastChunkZ=currentChunkZ;
  return true;
}

Fixed version (ground truth):
/** 
 * Updates the list of chunks around the player.
 * @param force Forces the update
 * @return True if the list was changed
 */
public boolean updateNearbyChunkMeshes(boolean force){
  if (world == null) {
    world=client.getDefaultWorld();
    if (world != null)     System.out.println("String_Node_Str" + world.getName() + "String_Node_Str"+ world.getUID());
 else     System.out.println("String_Node_Str");
  }
  if (world == null) {
    try {
      Thread.sleep(5);
    }
 catch (    InterruptedException e) {
    }
    return false;
  }
  int chunkViewDistance=0;
  Point currentPos=client.getActivePlayer().getTransform().getPosition();
  int currentChunkX=currentPos.getChunkX();
  int currentChunkY=currentPos.getChunkY();
  int currentChunkZ=currentPos.getChunkZ();
  if (currentChunkX == lastChunkX && currentChunkY == lastChunkY && currentChunkZ == lastChunkZ && !force && !firstUpdate) {
    return false;
  }
  if (chunkRenderers.size() == 0 || force) {
    chunkRenderers.clear();
    int cubeMinX=currentChunkX - chunkViewDistance;
    int cubeMinY=currentChunkY - chunkViewDistance;
    int cubeMinZ=currentChunkZ - chunkViewDistance;
    int cubeMaxX=currentChunkX + chunkViewDistance;
    int cubeMaxY=currentChunkY + chunkViewDistance;
    int cubeMaxZ=currentChunkZ + chunkViewDistance;
    Vector3 batchMin=ChunkMeshBatch.getBatchCoordinates(new Vector3(cubeMinX,cubeMinY,cubeMinZ));
    Vector3 batchMax=ChunkMeshBatch.getBatchCoordinates(new Vector3(cubeMaxX,cubeMaxY,cubeMaxZ));
    for (int x=batchMin.getFloorX(); x <= batchMax.getFloorX(); x++) {
      for (int y=batchMin.getFloorY(); y <= batchMax.getFloorY(); y++) {
        for (int z=batchMin.getFloorZ(); z <= batchMax.getFloorZ(); z++) {
          Vector3 chunkCoords=ChunkMeshBatch.getChunkCoordinates(new Vector3(x,y,z));
          ChunkMeshBatch batch=new ChunkMeshBatch(world,chunkCoords.getFloorX(),chunkCoords.getFloorY(),chunkCoords.getFloorZ());
          addChunkMeshBatch(batch);
          batch.update();
          System.out.println(batch);
        }
      }
    }
  }
 else {
    Cube oldView=new Cube(new Point(world,lastChunkX - chunkViewDistance,lastChunkY - chunkViewDistance,lastChunkZ - chunkViewDistance),chunkViewDistance * 2);
    Cube newView=new Cube(new Point(world,currentChunkX - chunkViewDistance,currentChunkY - chunkViewDistance,currentChunkZ - chunkViewDistance),chunkViewDistance * 2);
    Vector3 min=oldView.getBase().min(newView.getBase());
    Vector3 max=oldView.getBase().add(oldView.getSize()).max(newView.getBase().add(newView.getSize()));
    Vector3 ignoreMin=oldView.getBase().max(newView.getBase());
    Vector3 ignoreMax=oldView.getBase().add(oldView.getSize()).min(newView.getBase().add(newView.getSize()));
    Cuboid ignore=new Cuboid(new Point(ignoreMin,world),ignoreMax.subtract(ignoreMin));
    for (int x=min.getFloorX(); x < max.getFloorX(); x++) {
      for (int y=min.getFloorY(); y < max.getFloorY(); y++) {
        for (int z=min.getFloorZ(); z < max.getFloorZ(); z++) {
          Vector3 vec=new Vector3(x,y,z);
          if (ignore.contains(vec)) {
            continue;
          }
          Vector3 pos=ChunkMeshBatch.getChunkCoordinates(vec);
          if (oldView.contains(vec)) {
            ChunkMeshBatch c=chunkRenderersByPosition.get(pos.getFloorX(),pos.getFloorY(),pos.getFloorZ());
            removeChunkMeshBatch(c);
            continue;
          }
          if (newView.contains(vec)) {
            ChunkMeshBatch c=new ChunkMeshBatch(world,pos.getFloorX(),pos.getFloorY(),pos.getFloorZ());
            addChunkMeshBatch(c);
            c.update();
          }
        }
      }
    }
  }
  firstUpdate=false;
  lastChunkX=currentChunkX;
  lastChunkY=currentChunkY;
  lastChunkZ=currentChunkZ;
  return true;
}