use of WayofTime.alchemicalWizardry.common.demonVillage.GridSpace in project BloodMagic by WayofTime.
the class TEDemonPortal method expandAreaInNegX.
public void expandAreaInNegX() {
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 2][negZRadius + posZRadius + 1];
for (int i = 0; i <= negZRadius + posZRadius; i++) {
newGrid[0][i] = new GridSpace();
}
for (int i = 0; i <= negXRadius + posXRadius; i++) {
for (int j = 0; j <= negZRadius + posZRadius; j++) {
newGrid[i + 1][j] = area[i][j];
}
}
area = newGrid;
negXRadius += 1;
}
use of WayofTime.alchemicalWizardry.common.demonVillage.GridSpace in project BloodMagic by WayofTime.
the class TEDemonPortal method findEmptySpaceNearRoad.
public Int3 findEmptySpaceNearRoad(ForgeDirection dir, int amount, int closeness) {
int index = 0;
if (dir == ForgeDirection.NORTH) {
if (printDebug)
System.out.print("NORTH!");
for (int i = 0; i <= negZRadius + posZRadius; i++) {
for (int j = 0; j <= negXRadius + posXRadius; j++) {
GridSpace space = area[j][i];
if (space.isEmpty()) {
int yLevel = this.findNearestRoadYLevel(j - negXRadius, i - negZRadius, closeness);
if (yLevel == -1) {
continue;
}
index++;
if (index >= amount) {
return new Int3(j - negXRadius, yLevel, i - negZRadius);
}
}
}
}
} else if (dir == ForgeDirection.SOUTH) {
for (int i = negZRadius + posZRadius; i >= 0; i--) {
for (int j = 0; j <= negXRadius + posXRadius; j++) {
GridSpace space = area[j][i];
int yLevel = this.findNearestRoadYLevel(j - negXRadius, i - negZRadius, closeness);
if (yLevel == -1) {
continue;
}
if (space.isEmpty()) {
index++;
if (index >= amount) {
return new Int3(j - negXRadius, yLevel, i - negZRadius);
}
}
}
}
} else if (dir == ForgeDirection.EAST) {
for (int i = negXRadius + posXRadius; i >= 0; i--) {
for (int j = 0; j <= negZRadius + posZRadius; j++) {
GridSpace space = area[i][j];
int yLevel = this.findNearestRoadYLevel(i - negXRadius, j - negZRadius, closeness);
if (yLevel == -1) {
continue;
}
if (space.isEmpty()) {
index++;
if (index >= amount) {
return new Int3(i - negXRadius, yLevel, j - negZRadius);
}
}
}
}
} else if (dir == ForgeDirection.WEST) {
for (int i = 0; i <= negXRadius + posXRadius; i++) {
for (int j = 0; j <= negZRadius + posZRadius; j++) {
GridSpace space = area[i][j];
int yLevel = this.findNearestRoadYLevel(i - negXRadius, j - negZRadius, closeness);
if (yLevel == -1) {
continue;
}
if (space.isEmpty()) {
index++;
if (index >= amount) {
return new Int3(i - negXRadius, yLevel, j - negZRadius);
}
}
}
}
}
return new Int3(0, 0, 0);
}
Aggregations