fixing client color check
This commit is contained in:
parent
298a568566
commit
cf60df75e6
|
@ -123,9 +123,12 @@ export function getPixelFromChunkOffset(
|
|||
return [x, y];
|
||||
}
|
||||
|
||||
export function getCellInsideChunk(pixel: Cell): Cell {
|
||||
export function getCellInsideChunk(
|
||||
canvasSize: number,
|
||||
pixel: Cell,
|
||||
): Cell {
|
||||
// TODO assert is positive!
|
||||
return pixel.map((x) => mod(x, TILE_SIZE));
|
||||
return pixel.map((x) => mod(x + canvasSize / 2, TILE_SIZE));
|
||||
}
|
||||
|
||||
export function screenToWorld(
|
||||
|
|
|
@ -72,7 +72,7 @@ class ChunkLoader {
|
|||
return 0;
|
||||
}
|
||||
return chunk.getColorIndex(
|
||||
getCellInsideChunk([x, y]),
|
||||
getCellInsideChunk(canvasSize, [x, y]),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user