File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ var World = class World {
5959 } ,
6060 } ) ;
6161 this . lastPlayerChunk = "" ;
62+ this . blocksUpdate = false ;
6263 }
6364 /**
6465 * Updates render order of chunk meshes
@@ -98,6 +99,7 @@ var World = class World {
9899 voxelX = parseInt ( voxelX ) ;
99100 voxelY = parseInt ( voxelY ) ;
100101 voxelZ = parseInt ( voxelZ ) ;
102+ this . blocksUpdate = true ;
101103 if ( this . cellTerrain . getVoxel ( voxelX , voxelY , voxelZ ) !== value ) {
102104 this . chunkWorker . postMessage ( {
103105 type : "setVoxel" ,
@@ -290,7 +292,13 @@ var World = class World {
290292 Math . floor ( pos . y + 0.5 ) ,
291293 Math . floor ( pos . z + 0.5 )
292294 ) ;
293- if ( this . lastPlayerChunk != JSON . stringify ( cell ) ) {
295+ if ( this . blocksUpdate ) {
296+ this . blocksUpdate = false ;
297+ this . chunkWorker . postMessage ( {
298+ type : "updateCellsAroundPlayer" ,
299+ data : [ cell , radius ] ,
300+ } ) ;
301+ } else if ( this . lastPlayerChunk != JSON . stringify ( cell ) ) {
294302 if (
295303 this . cellUpdateTime !== null &&
296304 performance . now ( ) - this . cellUpdateTime > this . renderTime
You can’t perform that action at this time.
0 commit comments