Overhauled configuration properties
Moved all configuration variables from mod_pocketDim to DDProperties (formerly DimDoorsConfig). Changed property names to be clearer in config file, modified some comments, and generally cleaned up the config file. Fixed some missing properties and variables that were reading from the wrong properties. Modified the order in which mod_pocketDim instantiated some of its static fields so that they would load after properties are read. Almost all classes load after properties are read. Fixed indentation across various files and replaced references to properties in mod_pocketDim with references to DDProperties.
This commit is contained in:
@@ -12,94 +12,100 @@ import cpw.mods.fml.common.IWorldGenerator;
|
||||
|
||||
public class RiftGenerator implements IWorldGenerator
|
||||
{
|
||||
private int minableBlockId;
|
||||
private int numberOfBlocks;
|
||||
int cycles=40;
|
||||
boolean shouldSave = false;
|
||||
int count = 0;
|
||||
int i;
|
||||
int k;
|
||||
int j;
|
||||
Random rand = new Random();
|
||||
boolean shouldGenHere=true;
|
||||
LinkData link;
|
||||
|
||||
|
||||
DimData dimData;
|
||||
private int minableBlockId;
|
||||
private int numberOfBlocks;
|
||||
int cycles=40;
|
||||
boolean shouldSave = false;
|
||||
int count = 0;
|
||||
int i;
|
||||
int k;
|
||||
int j;
|
||||
Random rand = new Random();
|
||||
boolean shouldGenHere=true;
|
||||
LinkData link;
|
||||
DimData dimData;
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
|
||||
{
|
||||
//Long ntime = System.nanoTime();
|
||||
shouldGenHere=true;
|
||||
|
||||
if(world.provider.getDimensionName()=="PocketDim"||!mod_pocketDim.riftsInWorldGen ||world.isRemote)
|
||||
{
|
||||
|
||||
this.shouldGenHere=false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(this.shouldGenHere)
|
||||
{
|
||||
|
||||
|
||||
if(random.nextInt(3500)==0)
|
||||
{
|
||||
i=chunkX*16-random.nextInt(16);
|
||||
k=chunkZ*16-random.nextInt(16);
|
||||
|
||||
j= world.getHeightValue(i, k);
|
||||
|
||||
if(j>20&&world.getBlockId(i, j, k)==0)
|
||||
{
|
||||
// System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"Large gen");
|
||||
|
||||
link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4));
|
||||
link = dimHelper.instance.createPocket(link,true, true);
|
||||
this.shouldSave=true;
|
||||
|
||||
|
||||
// SchematicLoader loader = new SchematicLoader();
|
||||
// loader.init(link);
|
||||
// loader.generateSchematic(link);
|
||||
|
||||
|
||||
count=0;
|
||||
while(random.nextInt(4)!=1)
|
||||
{
|
||||
i=chunkX*16-random.nextInt(16);
|
||||
k=chunkZ*16-random.nextInt(16);
|
||||
|
||||
j= world.getHeightValue(i, k);
|
||||
|
||||
if(world.isAirBlock(i, j+1, k))
|
||||
{
|
||||
|
||||
|
||||
|
||||
link = dimHelper.instance.createLink(link.locDimID,link.destDimID, i, j+1, k,link.destXCoord,link.destYCoord,link.destZCoord);
|
||||
|
||||
private static DDProperties properties = null;
|
||||
|
||||
public RiftGenerator()
|
||||
{
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
|
||||
{
|
||||
//Long ntime = System.nanoTime();
|
||||
shouldGenHere=true;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
if (world.provider.getDimensionName()=="PocketDim"|| !properties.WorldRiftGenerationEnabled || world.isRemote)
|
||||
{
|
||||
|
||||
this.shouldGenHere=false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(this.shouldGenHere)
|
||||
{
|
||||
|
||||
|
||||
if(random.nextInt(3500)==0)
|
||||
{
|
||||
i=chunkX*16-random.nextInt(16);
|
||||
k=chunkZ*16-random.nextInt(16);
|
||||
|
||||
j= world.getHeightValue(i, k);
|
||||
|
||||
if(j>20&&world.getBlockId(i, j, k)==0)
|
||||
{
|
||||
// System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"Large gen");
|
||||
|
||||
link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4));
|
||||
link = dimHelper.instance.createPocket(link,true, true);
|
||||
this.shouldSave=true;
|
||||
|
||||
|
||||
// SchematicLoader loader = new SchematicLoader();
|
||||
// loader.init(link);
|
||||
// loader.generateSchematic(link);
|
||||
|
||||
|
||||
count=0;
|
||||
while(random.nextInt(4)!=1)
|
||||
{
|
||||
i=chunkX*16-random.nextInt(16);
|
||||
k=chunkZ*16-random.nextInt(16);
|
||||
|
||||
j= world.getHeightValue(i, k);
|
||||
|
||||
if(world.isAirBlock(i, j+1, k))
|
||||
{
|
||||
|
||||
|
||||
|
||||
link = dimHelper.instance.createLink(link.locDimID,link.destDimID, i, j+1, k,link.destXCoord,link.destYCoord,link.destZCoord);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
if(random.nextInt(540)==0)
|
||||
{
|
||||
i=chunkX*16-random.nextInt(16);
|
||||
k=chunkZ*16-random.nextInt(16);
|
||||
|
||||
|
||||
j= world.getHeightValue(i, k);
|
||||
if(j>20&&world.getBlockId(i, j, k)==0)
|
||||
{
|
||||
@@ -108,149 +114,149 @@ public class RiftGenerator implements IWorldGenerator
|
||||
link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4));
|
||||
link = dimHelper.instance.createPocket(link,true, true);
|
||||
this.shouldSave=true;
|
||||
|
||||
|
||||
|
||||
|
||||
// SchematicLoader loader = new SchematicLoader();
|
||||
// loader.init(link);
|
||||
// loader.generateSchematic(link);
|
||||
count=0;
|
||||
|
||||
|
||||
|
||||
|
||||
while(random.nextInt(3)!=1)
|
||||
{
|
||||
i=chunkX*16-random.nextInt(16);
|
||||
k=chunkZ*16-random.nextInt(16);
|
||||
|
||||
|
||||
j= world.getHeightValue(i, k);
|
||||
|
||||
|
||||
if(world.isAirBlock(i, j+1, k))
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
link = dimHelper.instance.createLink(link.locDimID,link.destDimID, i, j+1, k,link.destXCoord,link.destYCoord,link.destZCoord);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
**/
|
||||
|
||||
}
|
||||
|
||||
if(random.nextInt(250)==0&&world.provider.getDimensionName()!="PocketDim"&&!world.isRemote&&mod_pocketDim.riftsInWorldGen)
|
||||
{
|
||||
// System.out.println("tryingToGen");
|
||||
int blockID=Block.stoneBrick.blockID;
|
||||
if(world.provider.dimensionId==mod_pocketDim.limboDimID)
|
||||
{
|
||||
blockID= mod_pocketDim.blockLimboID;
|
||||
}
|
||||
i=chunkX*16-random.nextInt(16);
|
||||
k=chunkZ*16-random.nextInt(16);
|
||||
|
||||
j= world.getHeightValue(i, k);
|
||||
if(j>20&&world.getBlockId(i, j, k)==0)
|
||||
{
|
||||
//System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"small gen");
|
||||
**/
|
||||
|
||||
count=0;
|
||||
|
||||
|
||||
if(world.isAirBlock(i, j+1, k))
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if(world.isBlockOpaqueCube(i, j-2, k)||world.isBlockOpaqueCube(i, j-1, k))
|
||||
{
|
||||
link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4));
|
||||
link =dimHelper.instance.createPocket(link,true, true);
|
||||
|
||||
for(int xc=-3;xc<4;xc++)
|
||||
{
|
||||
for(int zc=-3;zc<4;zc++)
|
||||
{
|
||||
for(int yc=0;yc<200;yc++)
|
||||
{
|
||||
if(yc==0&&world.isBlockOpaqueCube(i+xc, j-2,k +zc))
|
||||
{
|
||||
|
||||
if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+2)
|
||||
{
|
||||
world.setBlock(i+xc, j-1+yc, k+zc, blockID);
|
||||
}
|
||||
else if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+3)
|
||||
}
|
||||
|
||||
{
|
||||
world.setBlock(i+xc, j-1+yc, k+zc, blockID,2,1);
|
||||
if(random.nextInt(250)==0&&world.provider.getDimensionName()!="PocketDim"&&!world.isRemote && properties.WorldRiftGenerationEnabled)
|
||||
{
|
||||
// System.out.println("tryingToGen");
|
||||
int blockID=Block.stoneBrick.blockID;
|
||||
if(world.provider.dimensionId==properties.LimboDimensionID)
|
||||
{
|
||||
blockID= properties.LimboBlockID;
|
||||
}
|
||||
i=chunkX*16-random.nextInt(16);
|
||||
k=chunkZ*16-random.nextInt(16);
|
||||
|
||||
}
|
||||
}
|
||||
j= world.getHeightValue(i, k);
|
||||
if(j>20&&world.getBlockId(i, j, k)==0)
|
||||
{
|
||||
//System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"small gen");
|
||||
|
||||
}
|
||||
count=0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ItemRiftBlade.placeDoorBlock(world, i, j+1, k, 0, mod_pocketDim.transientDoor);
|
||||
|
||||
{
|
||||
if(world.isAirBlock(i, j+1, k))
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if(world.isBlockOpaqueCube(i, j-2, k)||world.isBlockOpaqueCube(i, j-1, k))
|
||||
{
|
||||
link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4));
|
||||
link =dimHelper.instance.createPocket(link,true, true);
|
||||
|
||||
for(int xc=-3;xc<4;xc++)
|
||||
{
|
||||
for(int zc=-3;zc<4;zc++)
|
||||
{
|
||||
for(int yc=0;yc<200;yc++)
|
||||
{
|
||||
if(yc==0&&world.isBlockOpaqueCube(i+xc, j-2,k +zc))
|
||||
{
|
||||
|
||||
if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+2)
|
||||
{
|
||||
world.setBlock(i+xc, j-1+yc, k+zc, blockID);
|
||||
}
|
||||
else if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+3)
|
||||
|
||||
{
|
||||
world.setBlock(i+xc, j-1+yc, k+zc, blockID,2,1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ItemRiftBlade.placeDoorBlock(world, i, j+1, k, 0, mod_pocketDim.transientDoor);
|
||||
|
||||
{
|
||||
world.setBlock(i, j+1, k-1, blockID,0,1);
|
||||
world.setBlock(i, j+1, k+1, blockID,0,1);
|
||||
world.setBlock(i, j, k-1, blockID,0,1);
|
||||
world.setBlock(i, j, k+1, blockID,0,1);
|
||||
world.setBlock(i, j+2, k+1, blockID,3,1);
|
||||
world.setBlock(i, j+2, k-1, blockID,3,1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.shouldSave=true;
|
||||
|
||||
}
|
||||
|
||||
// dimData = dimHelper.instance.dimList.get(link.destDimID);
|
||||
|
||||
|
||||
// SchematicLoader loader = new SchematicLoader();
|
||||
// loader.init(link);
|
||||
// loader.generateSchematic(link);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(this.shouldSave)
|
||||
{
|
||||
// dimHelper.instance.save();
|
||||
}
|
||||
|
||||
// mod_pocketDim.genTime=((System.nanoTime()-ntime)+mod_pocketDim.genTime);
|
||||
// System.out.println( mod_pocketDim.genTime);
|
||||
// System.out.println( (System.nanoTime()-ntime));
|
||||
|
||||
// ntime=0L;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.shouldSave=true;
|
||||
|
||||
}
|
||||
|
||||
// dimData = dimHelper.instance.dimList.get(link.destDimID);
|
||||
|
||||
|
||||
// SchematicLoader loader = new SchematicLoader();
|
||||
// loader.init(link);
|
||||
// loader.generateSchematic(link);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(this.shouldSave)
|
||||
{
|
||||
// dimHelper.instance.save();
|
||||
}
|
||||
|
||||
// mod_pocketDim.genTime=((System.nanoTime()-ntime)+mod_pocketDim.genTime);
|
||||
// System.out.println( mod_pocketDim.genTime);
|
||||
// System.out.println( (System.nanoTime()-ntime));
|
||||
|
||||
// ntime=0L;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user