File creation and first crack at default .zip folder

This commit is contained in:
WayofTime 2014-06-24 21:08:29 -04:00
parent 74206f1dd9
commit cce90ce8fd
8 changed files with 310 additions and 65 deletions

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -41,6 +42,45 @@ public class BlockSet
{
metadata[i] = meta;
}
if(block instanceof BlockStairs)
{
int[] northSet = new int[]{2,3,0,1};
int[] eastSet = new int[]{1,0,2,3};
int[] southSet = new int[]{3,2,1,0};
int[] westSet = new int[]{0,1,3,2};
int[] northUpSet = new int[]{6,7,4,5};
int[] eastUpSet = new int[]{5,4,6,7};
int[] southUpSet = new int[]{7,6,5,4};
int[] westUpSet = new int[]{4,5,7,6};
switch(meta)
{
case 0:
metadata = westSet;
break;
case 1:
metadata = eastSet;
break;
case 2:
metadata = northSet;
break;
case 3:
metadata = southSet;
break;
case 4:
metadata = westUpSet;
break;
case 5:
metadata = eastUpSet;
break;
case 6:
metadata = northUpSet;
break;
case 7:
metadata = southUpSet;
break;
}
}
}
public List<Int3> getPositions()
@ -121,7 +161,7 @@ public class BlockSet
break;
case SOUTH:
xOff *= -1;
yOff *= -1;
zOff *= -1;
break;
case WEST:
int temp = zOff;

View file

@ -11,6 +11,8 @@ import WayofTime.alchemicalWizardry.common.Int3;
public class BuildingSchematic
{
public String name;
public int doorX;
public int doorZ;
public List<BlockSet> blockList;
public BuildingSchematic()
@ -22,6 +24,8 @@ public class BuildingSchematic
{
this.name = name;
blockList = new ArrayList();
this.doorX = 0;
this.doorZ = 0;
}
public void addBlockWithMeta(Block block, int meta, int xOffset, int yOffset, int zOffset)
@ -58,11 +62,19 @@ public class BuildingSchematic
{
int gridX = (int)((coords.xCoord+2*Math.signum(coords.xCoord))/5);
int gridZ = (int)((coords.zCoord+2*Math.signum(coords.zCoord))/5);
holder.setGridSpace(gridX, gridZ, new GridSpace());
holder.setGridSpace(gridX, gridZ, new GridSpace(GridSpace.HOUSE,0));
}
}
return holder;
}
public Int3 getGridSpotOfDoor()
{
int gridX = (int)((doorX+2*Math.signum(doorX))/5);
int gridZ = (int)((doorZ+2*Math.signum(doorZ))/5);
return new Int3(gridX, 0, gridZ);
}
}

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.demonVillage;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.Int3;
public class DemonBuilding
{
@ -9,6 +10,7 @@ public class DemonBuilding
public GridSpaceHolder area;
public int buildingTier;
public int type;
public Int3 doorGridSpace;
public DemonBuilding(BuildingSchematic schematic)
{
@ -16,6 +18,7 @@ public class DemonBuilding
this.type = 0;
this.buildingTier = 0;
this.area = this.createGSHForSchematic(schematic);
this.doorGridSpace = schematic.getGridSpotOfDoor();
}
public String getName()
@ -42,4 +45,56 @@ public class DemonBuilding
{
return scheme.createGSH();
}
public Int3 getDoorSpace(ForgeDirection dir)
{
int x = 0;
int z = 0;
switch(dir)
{
case SOUTH:
x = -doorGridSpace.xCoord;
z = -doorGridSpace.zCoord;
break;
case WEST:
x = doorGridSpace.zCoord;
z = -doorGridSpace.xCoord;
break;
case EAST:
x = -doorGridSpace.zCoord;
z = doorGridSpace.xCoord;
break;
default:
x = doorGridSpace.xCoord;
z = doorGridSpace.zCoord;
break;
}
return new Int3(x, 0, z);
}
public Int3 getGridOffsetFromRoad(ForgeDirection sideOfRoad, int yLevel)
{
Int3 doorSpace = this.getDoorSpace(sideOfRoad);
int x = doorSpace.xCoord;
int z = doorSpace.zCoord;
switch(sideOfRoad)
{
case SOUTH:
z++;
break;
case EAST:
x++;
break;
case WEST:
x--;
break;
default:
z--;
break;
}
return new Int3(x, yLevel, z);
}
}

View file

@ -144,6 +144,7 @@ public class GridSpaceHolder
{
if(master != null)
{
System.out.println("negXRadius: " + negXRadius + " posXRadius: " + posXRadius + " negZRadius: " + negZRadius + " posZRadius: " + posZRadius);
for(int i=-negXRadius; i<=posXRadius; i++)
{
for(int j=-negZRadius; j<=posZRadius; j++)
@ -154,6 +155,8 @@ public class GridSpaceHolder
continue;
}
System.out.println("x: " + i + " z: " + j);
int xOff = 0;
int zOff = 0;