The center of the LodDimension was accidentally being added to the region coordinate, causing the wrong region to be selected at times.
This commit is contained in:
James Seibel
2021-02-23 15:20:12 -06:00
parent 1c2974cf6a
commit d9d1c4dfaf
2 changed files with 4 additions and 8 deletions
@@ -206,8 +206,8 @@ public class LodDimension
*/
public void addLod(LodChunk lod)
{
int regionX = (lod.x + centerX) / LodRegion.SIZE;
int regionZ = (lod.z + centerZ) / LodRegion.SIZE;
int regionX = lod.x / LodRegion.SIZE;
int regionZ = lod.z / LodRegion.SIZE;
// prevent issues if X/Z is negative and less than 16
if (lod.x < 0)
@@ -250,9 +250,8 @@ public class LodDimension
*/
public LodChunk getLodFromCoordinates(int chunkX, int chunkZ)
{
// (chunkX + centerX) % width
int regionX = (chunkX + centerX) / LodRegion.SIZE;
int regionZ = (chunkZ + centerZ) / LodRegion.SIZE;
int regionX = chunkX / LodRegion.SIZE;
int regionZ = chunkZ / LodRegion.SIZE;
// prevent issues if chunkX/Z is negative and less than width
if (chunkX < 0)
@@ -64,9 +64,6 @@ public class LodRegion
if(arrayX >= SIZE || arrayZ >= SIZE)
return null;
// TODO fix some LOD strips showing up in the wrong location
// issue #2
// maybe this has to do with ABS being used incorrectly?
return chunks[arrayX][arrayZ];
}