Search in sources :

Example 1 with DemonCrosspath

use of WayofTime.alchemicalWizardry.common.demonVillage.DemonCrosspath in project BloodMagic by WayofTime.

the class TEDemonPortal method createGriddedRoad.

public // Total grid length
int createGriddedRoad(// Total grid length
int gridXi, // Total grid length
int yi, // Total grid length
int gridZi, // Total grid length
ForgeDirection dir, // Total grid length
int gridLength, // Total grid length
boolean convertStarter) {
    if (gridLength == 0 || gridLength == 1) {
        return 0;
    }
    int initGridX = gridXi;
    int initGridZ = gridZi;
    int initY = yi;
    if (convertStarter) {
        this.setGridSpace(initGridX, initGridZ, new GridSpace(GridSpace.CROSSROAD, initY));
        DemonCrosspath crosspath = new DemonCrosspath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5);
        crosspath.createCrosspath(worldObj);
    }
    for (int index = 0; index < gridLength - 1; index++) {
        DemonVillagePath path = new DemonVillagePath(xCoord + initGridX * 5, initY, zCoord + initGridZ * 5, dir, 6);
        Int3AndBool temp = path.constructFullPath(this, worldObj, this.getRoadStepClearance());
        Int3 next = temp.coords;
        if (next != null) {
            initY = next.yCoord;
            if (printDebug)
                AlchemicalWizardry.logger.info("" + initY);
        }
        if (!temp.bool) {
            return index;
        }
        initGridX += dir.offsetX;
        initGridZ += dir.offsetZ;
        if (!this.getGridSpace(initGridX, initGridZ).isRoadSegment()) {
            this.setGridSpace(initGridX, initGridZ, new GridSpace(GridSpace.ROAD, initY));
        }
    }
    return gridLength - 1;
}
Also used : Int3AndBool(WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath.Int3AndBool) DemonCrosspath(WayofTime.alchemicalWizardry.common.demonVillage.DemonCrosspath) Int3(WayofTime.alchemicalWizardry.api.Int3) GridSpace(WayofTime.alchemicalWizardry.common.demonVillage.GridSpace) DemonVillagePath(WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath)

Aggregations

Int3 (WayofTime.alchemicalWizardry.api.Int3)1 DemonCrosspath (WayofTime.alchemicalWizardry.common.demonVillage.DemonCrosspath)1 DemonVillagePath (WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath)1 Int3AndBool (WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath.Int3AndBool)1 GridSpace (WayofTime.alchemicalWizardry.common.demonVillage.GridSpace)1