Fixed Configuration and Rift Generation Bugs

Although fields were created in DDProperties for Monolith spawning and
Rift generation, they were mislabeled as reading the "World Rift
Generation Enabled" property. I gave them proper names. I also changed
the fields and names to be more intuitive and rewrote the descriptions.
For instance, "MonolithSpawnDensity" is a misnomer because as density
increases, there should be more Monoliths, not less. Now the properties
clearly state how they affect a feature. I rewrote the conditions that
used each property to correspond with those simplified descriptions and
gave the properties default values that will match the generation rates
seen before.

I also made the rift generation code less cryptic and fixed a bug; there
was a check that compared if a dimension was a pocket dimension by its
name to prevent rift generation. That name check was wrong - it would
never work. Now we check if the provider is an instance of
pocketProvider. That will continue working even if we change the way
that pocket dimensions are named.
This commit is contained in:
SenseiKiwi
2013-06-16 09:57:51 -04:00
parent 328f7d7e84
commit 697b0da59f
4 changed files with 123 additions and 230 deletions

View File

@@ -33,6 +33,7 @@ import net.minecraftforge.event.terraingen.ChunkProviderEvent;
public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider
{
public static final int MAX_MONOLITH_SPAWNING_CHANCE = 100;
private static Random rand;
/** A NoiseGeneratorOctaves used in generating terrain */
@@ -108,7 +109,7 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
{
// caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
}
private static DDProperties properties = null;
public LimboGenerator(World par1World, long par2)
@@ -135,7 +136,7 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
this.mobSpawnerNoise = noiseGens[6];
// TODO Auto-generated constructor stub
this.worldObj=par1World;
if (properties == null)
properties = DDProperties.instance();
}
@@ -177,49 +178,37 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
@Override
public void populate(IChunkProvider var1, int var2, int var3)
{
if(rand.nextInt(properties.MonolithSpawnDensity)>1)
{
return;
}
if (rand.nextInt(MAX_MONOLITH_SPAWNING_CHANCE) < properties.MonolithSpawningChance)
{
int y =0;
int x = var2*16 + rand.nextInt(16);
int z = var3*16 + rand.nextInt(16);
int yTest;
do
{
x = var2*16 + rand.nextInt(16);
z = var3*16 + rand.nextInt(16);
while(this.worldObj.getBlockId(x, y, z)==0&&y<255)
{
y++;
}
y = yCoordHelper.getFirstUncovered(this.worldObj,x , y+2, z);
Entity mob = new MobObelisk(this.worldObj);
mob.setLocationAndAngles(x, y, z, 1, 1);
yTest=yCoordHelper.getFirstUncovered(this.worldObj,x , y+5, z);
if(yTest>245)
{
return;
}
this.worldObj.spawnEntityInWorld(mob);
}
while(yTest >y);
// TODO Auto-generated method stub
while (yTest > y);
}
}
@Override

View File

@@ -15,112 +15,115 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class pocketProvider extends WorldProvider
{
public int exitXCoord;
public int exitYCoord;
public int exitZCoord;
public int exitDimID;
public boolean hasNoSky = true;
public boolean isSavingSchematic= false;
public int dimToSave;
private static DDProperties properties = null;
public pocketProvider()
{
this.hasNoSky=true;
if (properties == null)
properties = DDProperties.instance();
}
@Override
protected void registerWorldChunkManager()
{
protected void registerWorldChunkManager()
{
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome,1,1);
//this.dimensionId = ConfigAtum.dimensionID;
}
//this.dimensionId = ConfigAtum.dimensionID;
}
@Override
public String getSaveFolder()
{
return (dimensionId == 0 ? null : "DimensionalDoors/pocketDimID" + dimensionId);
}
{
return (dimensionId == 0 ? null : "DimensionalDoors/pocketDimID" + dimensionId);
}
public void saveAsSchematic(int id)
{
this.isSavingSchematic=true;
this.dimensionId=id;
}
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
{
setCloudRenderer( new CloudRenderBlank());
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
setCloudRenderer( new CloudRenderBlank());
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
}
@SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT)
@Override
public Vec3 getFogColor(float par1, float par2)
{
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
{
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
}
}
@Override
public double getHorizon()
{
return worldObj.getHeight();
}
{
return worldObj.getHeight();
}
@Override
public IChunkProvider createChunkGenerator()
{
return new pocketGenerator(worldObj, dimensionId, false);
}
@Override
public boolean canSnowAt(int x, int y, int z)
{
return false;
}
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
{
return false;
}
@Override
public boolean canSnowAt(int x, int y, int z)
{
return false;
}
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
{
return false;
}
@Override
public String getDimensionName()
{
//TODO: This should be a proper name. We need to show people proper names for things whenever possible.
//The question is whether this should be "Pocket Dimension" or "Pocket Dimension #" -- I'm not going to change
//it out of concern that it could break something. ~SenseiKiwi
return "PocketDim " + this.dimensionId;
}
public int getRespawnDimension(EntityPlayerMP player)
{
int respawnDim;
if (properties.LimboEnabled)
{
respawnDim = properties.LimboDimensionID;
}
else
{
respawnDim= dimHelper.dimList.get(this.dimensionId).exitDimLink.destDimID;
respawnDim = dimHelper.dimList.get(this.dimensionId).exitDimLink.destDimID;
}
if (dimHelper.getWorld(respawnDim)==null)
if (dimHelper.getWorld(respawnDim) == null)
{
dimHelper.initDimension(respawnDim);
}
return respawnDim;
}
public boolean canRespawnHere()
{
return false;
}
public boolean canRespawnHere()
{
return false;
}
}