Math fixes

This commit is contained in:
Daniel Mills 2021-07-19 05:43:46 -04:00
parent 1726d6f59e
commit e19ae7af59
2 changed files with 4 additions and 19 deletions

View File

@ -216,11 +216,11 @@ public class PregeneratorJob implements PregenListener {
} }
private Position2 getMax() { private Position2 getMax() {
return task.getCenter().add(task.getRadius(), task.getRadius()).topLeftChunkOfRegion(); return task.getCenter().add(task.getRadius(), task.getRadius()).regionToChunk();
} }
private Position2 getMin() { private Position2 getMin() {
return task.getCenter().add(-task.getRadius(), -task.getRadius()).topLeftChunkOfRegion(); return task.getCenter().add(-task.getRadius(), -task.getRadius()).regionToChunk();
} }
private boolean paused() { private boolean paused() {

View File

@ -57,24 +57,9 @@ public class Position2 {
return result; return result;
} }
public Position2 topLeftChunkOfRegion() public Position2 regionToChunk()
{ {
return new Position2((x >> 5) << 5, (z >> 5) << 5); return new Position2(x << 5, z << 5);
}
public Position2 bottomRightChunkOfRegion()
{
return new Position2((((x >> 5)+1) << 5) - 1, (((z >> 5)+1) << 5) - 1);
}
public Position2 topRightChunkOfRegion()
{
return new Position2((((x >> 5)+1) << 5) - 1, (z >> 5) << 5);
}
public Position2 bottomLeftChunkOfRegion()
{
return new Position2((x >> 5) << 5, (((z >> 5)+1) << 5) - 1);
} }
@Override @Override