Source:
<code>public void update(){ if( world == null ){ setupWorld(); if( world == null ) return; } final long start = System.currentTimeMillis(); for(Region region : world.getRegions()){ SpoutChunkSnapshotModel chunkSnapshotModel; while( (chunkSnapshotModel = ((SpoutRegion)region).getRenderChunkQueue().poll()) != null){ final SpoutChunkSnapshotModel temp = chunkSnapshotModel; Spout.getEngine().getScheduler().scheduleAsyncTask(this, new Runnable() { @Override public void run() { ChunkMesh mesh = new ChunkMesh(temp); mesh.update(); renderChunkMeshBatchQueue.add(mesh); } }); if( System.currentTimeMillis() - start > TIME_LIMIT) return; } } Set<ChunkMeshBatch> modifiedBatch = new HashSet<ChunkMeshBatch>(); ChunkMesh chunkMesh; while( (chunkMesh = renderChunkMeshBatchQueue.poll()) != null){ Vector3 batchCoords = ChunkMeshBatch.getBatchCoordinates(new Vector3(chunkMesh.getX(), chunkMesh.getY(), chunkMesh.getZ())); Vector3 chunkCoords = ChunkMeshBatch.getChunkCoordinates(batchCoords); ChunkMeshBatch chunkMeshBatch = getChunkMeshBatchByChunkPosition(chunkCoords.getFloorX(), chunkCoords.getFloorY(), chunkCoords.getFloorZ()); <START> if(chunkMeshBatch==null){ <END> if(!chunkMesh.hasVertices()) continue; chunkMeshBatch = new ChunkMeshBatch(world,chunkCoords.getFloorX(), chunkCoords.getFloorY(), chunkCoords.getFloorZ()); addChunkMeshBatch(chunkMeshBatch); } if(chunkMesh.hasVertices()){ chunkMeshBatch.addMesh(chunkMesh); modifiedBatch.add(chunkMeshBatch); }else{ chunkMeshBatch.removeMesh(chunkMesh); modifiedBatch.add(chunkMeshBatch); } if( System.currentTimeMillis() - start > TIME_LIMIT) break; } for(ChunkMeshBatch batch : modifiedBatch){ if(batch.isFull()){ batch.update(); }else if(batch.isEmpty()){ removeChunkMeshBatch(batch); } } }</code><technical_language>if ( if(</technical_language>

Target:
public void update(){ if( world == null ){ setupWorld(); if( world == null ) return; } final long start = System.currentTimeMillis(); Set<ChunkMeshBatch> modifiedBatch = new HashSet<ChunkMeshBatch>(); ChunkMesh chunkMesh; while( (chunkMesh = renderChunkMeshBatchQueue.poll()) != null){ Vector3 batchCoords = ChunkMeshBatch.getBatchCoordinates(new Vector3(chunkMesh.getX(), chunkMesh.getY(), chunkMesh.getZ())); Vector3 chunkCoords = ChunkMeshBatch.getChunkCoordinates(batchCoords); ChunkMeshBatch chunkMeshBatch = getChunkMeshBatchByChunkPosition(chunkCoords.getFloorX(), chunkCoords.getFloorY(), chunkCoords.getFloorZ()); if(chunkMeshBatch==null){ if(!chunkMesh.hasVertices()) continue; chunkMeshBatch = new ChunkMeshBatch(world,chunkCoords.getFloorX(), chunkCoords.getFloorY(), chunkCoords.getFloorZ()); addChunkMeshBatch(chunkMeshBatch); } if(chunkMesh.hasVertices()){ chunkMeshBatch.addMesh(chunkMesh); modifiedBatch.add(chunkMeshBatch); }else{ chunkMeshBatch.removeMesh(chunkMesh); modifiedBatch.add(chunkMeshBatch); } if( System.currentTimeMillis() - start > TIME_LIMIT) break; } for(ChunkMeshBatch batch : modifiedBatch){ if(batch.isFull()){ batch.update(); }else if(batch.isEmpty()){ removeChunkMeshBatch(batch); } } for(Region region : world.getRegions()){ SpoutChunkSnapshotModel chunkSnapshotModel; while( (chunkSnapshotModel = ((SpoutRegion)region).getRenderChunkQueue().poll()) != null){ final SpoutChunkSnapshotModel temp = chunkSnapshotModel; Spout.getEngine().getScheduler().scheduleAsyncTask(this, new Runnable() { @Override public void run() { ChunkMesh mesh = new ChunkMesh(temp); mesh.update(); renderChunkMeshBatchQueue.add(mesh); } }); if( System.currentTimeMillis() - start > TIME_LIMIT) return; } } }