Current iteration of work.
Attempted at fixing the coordinate converter again. Added more applicable tests for them. Changing to a more stateless design for biome generator. Refactored correcting package name to fit conventions.
This commit is contained in:
@@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import ca.recrown.islandsurvivalcraft.Types.Point2;
|
||||
import ca.recrown.islandsurvivalcraft.types.Point2;
|
||||
|
||||
public class Utilities {
|
||||
public final static int CHUNK_SIZE = 16;
|
||||
@@ -53,19 +53,17 @@ public class Utilities {
|
||||
public static Point2 worldToLocalChunkCoordinates(int x, int y) {
|
||||
int xRes = 0;
|
||||
if (x < 0) {
|
||||
xRes = CHUNK_SIZE - 1 + (x % CHUNK_SIZE);
|
||||
xRes %= CHUNK_SIZE - 1;
|
||||
xRes = CHUNK_SIZE + (x % CHUNK_SIZE);
|
||||
xRes %= CHUNK_SIZE;
|
||||
} else {
|
||||
xRes = x % CHUNK_SIZE;
|
||||
if (xRes > 0) xRes -= 1;
|
||||
}
|
||||
int yRes = 0;
|
||||
if (y < 0) {
|
||||
yRes = CHUNK_SIZE - 1 + (y % CHUNK_SIZE);
|
||||
yRes %= CHUNK_SIZE - 1;
|
||||
yRes = CHUNK_SIZE + (y % CHUNK_SIZE);
|
||||
yRes %= CHUNK_SIZE;
|
||||
} else {
|
||||
yRes = y % CHUNK_SIZE;
|
||||
if (yRes > 0) yRes -= 1;
|
||||
}
|
||||
return new Point2(xRes, yRes);
|
||||
}
|
||||
|
Reference in New Issue
Block a user