Added Witch Huts, Jungle and Desert Temples to some of the biomes in BOP

World Type.
This commit is contained in:
Amnet 2013-04-28 13:54:04 +02:00
parent 9a47fb67c8
commit 325ac1eb0c
6 changed files with 177 additions and 19 deletions

View file

@ -25,7 +25,7 @@ public class BiomeGenDesertNew extends BiomeGenBase
this.customBiomeDecorator.cactiPerChunk = 10; this.customBiomeDecorator.cactiPerChunk = 10;
this.customBiomeDecorator.desertSproutsPerChunk = 1; this.customBiomeDecorator.desertSproutsPerChunk = 1;
this.customBiomeDecorator.tinyCactiPerChunk = 5; this.customBiomeDecorator.tinyCactiPerChunk = 5;
this.customBiomeDecorator.quicksand2PerChunk = 6; this.customBiomeDecorator.quicksand2PerChunk = 3;
} }
public void decorate(World par1World, Random par2Random, int par3, int par4) public void decorate(World par1World, Random par2Random, int par3, int par4)

View file

@ -316,7 +316,7 @@ public class BOPConfiguration {
config.load(); config.load();
skyColors = true; skyColors = true;
biomeSize = config.get("Biomes O\' Plenty World Type Settings", "Biome Size", 5, "Default World Type has 4. Large Biomes Worl Type has 6.").getInt(); biomeSize = config.get("Biomes O\' Plenty World Type Settings", "Biome Size", 5, "Default World Type has 4. Large Biomes World Type has 6.").getInt();
achievements = config.get("Achievement Settings", "Add Biomes O\' Plenty Achievements", true).getBoolean(false); achievements = config.get("Achievement Settings", "Add Biomes O\' Plenty Achievements", true).getBoolean(false);
vanillaEnhanced = config.get("Biome Settings", "Enhanced Vanilla Biomes", true).getBoolean(false); vanillaEnhanced = config.get("Biome Settings", "Enhanced Vanilla Biomes", true).getBoolean(false);
promisedLandDimID = config.get("Dimension Settings", "Promised Land Dimension ID", 20, null).getInt(); promisedLandDimID = config.get("Dimension Settings", "Promised Land Dimension ID", 20, null).getInt();

View file

@ -0,0 +1,116 @@
package biomesoplenty.worldgen.structure;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import biomesoplenty.api.Biomes;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.util.MathHelper;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.SpawnListEntry;
import net.minecraft.world.gen.structure.MapGenStructure;
import net.minecraft.world.gen.structure.StructureStart;
public class BOPMapGenScatteredFeature extends MapGenStructure
{
private static List biomelist = Arrays.asList(new BiomeGenBase[] {
BiomeGenBase.desert, BiomeGenBase.desertHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills, BiomeGenBase.swampland,
Biomes.badlands.get(), Biomes.dunes.get(), Biomes.oasis.get(), Biomes.desertNew.get(),
Biomes.bayou.get(), Biomes.bog.get(), Biomes.deadSwamp.get(), Biomes.fen.get(), Biomes.swampwoods.get(), Biomes.swamplandNew.get(),
Biomes.rainforest.get(), Biomes.temperateRainforest.get(), Biomes.tropicalRainforest.get(), Biomes.jungleNew.get()
});
/** contains possible spawns for scattered features */
private List scatteredFeatureSpawnList;
/** the maximum distance between scattered features */
private int maxDistanceBetweenScatteredFeatures;
/** the minimum distance between scattered features */
private int minDistanceBetweenScatteredFeatures;
public BOPMapGenScatteredFeature()
{
this.scatteredFeatureSpawnList = new ArrayList();
this.maxDistanceBetweenScatteredFeatures = 32;
this.minDistanceBetweenScatteredFeatures = 8;
this.scatteredFeatureSpawnList.add(new SpawnListEntry(EntityWitch.class, 1, 1, 1));
}
public BOPMapGenScatteredFeature(Map par1Map)
{
this();
Iterator iterator = par1Map.entrySet().iterator();
while (iterator.hasNext())
{
Entry entry = (Entry)iterator.next();
if (((String)entry.getKey()).equals("distance"))
{
this.maxDistanceBetweenScatteredFeatures = MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.maxDistanceBetweenScatteredFeatures, this.minDistanceBetweenScatteredFeatures + 1);
}
}
}
protected boolean canSpawnStructureAtCoords(int par1, int par2)
{
int k = par1;
int l = par2;
if (par1 < 0)
{
par1 -= this.maxDistanceBetweenScatteredFeatures - 1;
}
if (par2 < 0)
{
par2 -= this.maxDistanceBetweenScatteredFeatures - 1;
}
int i1 = par1 / this.maxDistanceBetweenScatteredFeatures;
int j1 = par2 / this.maxDistanceBetweenScatteredFeatures;
Random random = this.worldObj.setRandomSeed(i1, j1, 14357617);
i1 *= this.maxDistanceBetweenScatteredFeatures;
j1 *= this.maxDistanceBetweenScatteredFeatures;
i1 += random.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures);
j1 += random.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures);
if (k == i1 && l == j1)
{
BiomeGenBase biomegenbase = this.worldObj.getWorldChunkManager().getBiomeGenAt(k * 16 + 8, l * 16 + 8);
Iterator iterator = biomelist.iterator();
while (iterator.hasNext())
{
BiomeGenBase biomegenbase1 = (BiomeGenBase)iterator.next();
if (biomegenbase == biomegenbase1)
{
return true;
}
}
}
return false;
}
protected StructureStart getStructureStart(int par1, int par2)
{
return new BOPStructureScatteredFeatureStart(this.worldObj, this.rand, par1, par2);
}
/**
* returns possible spawns for scattered features
*/
public List getScatteredFeatureSpawnList()
{
return this.scatteredFeatureSpawnList;
}
}

View file

@ -21,14 +21,14 @@ public class BOPMapGenVillage extends MapGenStructure
/** World terrain type, 0 for normal, 1 for flat map */ /** World terrain type, 0 for normal, 1 for flat map */
private int terrainType; private int terrainType;
private int distance; private int maxDistance;
private int field_82666_h; private int minDistance;
public BOPMapGenVillage() public BOPMapGenVillage()
{ {
this.terrainType = 0; this.terrainType = 0;
this.distance = BOPConfiguration.villageDistance; this.maxDistance = BOPConfiguration.villageDistance;
this.field_82666_h = BOPConfiguration.villageDistance / 4; this.minDistance = BOPConfiguration.villageDistance / 4;
villageSpawnBiomes = MapGenVillage.villageSpawnBiomes; villageSpawnBiomes = MapGenVillage.villageSpawnBiomes;
} }
@ -47,7 +47,7 @@ public class BOPMapGenVillage extends MapGenStructure
} }
else if (((String)entry.getKey()).equals("distance")) else if (((String)entry.getKey()).equals("distance"))
{ {
this.distance = MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.distance, this.field_82666_h + 1); this.maxDistance = MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.maxDistance, this.minDistance + 1);
} }
} }
} }
@ -59,21 +59,21 @@ public class BOPMapGenVillage extends MapGenStructure
if (par1 < 0) if (par1 < 0)
{ {
par1 -= this.distance - 1; par1 -= this.maxDistance - 1;
} }
if (par2 < 0) if (par2 < 0)
{ {
par2 -= this.distance - 1; par2 -= this.maxDistance - 1;
} }
int i1 = par1 / this.distance; int i1 = par1 / this.maxDistance;
int j1 = par2 / this.distance; int j1 = par2 / this.maxDistance;
Random random = this.worldObj.setRandomSeed(i1, j1, 10387312); Random random = this.worldObj.setRandomSeed(i1, j1, 10387312);
i1 *= this.distance; i1 *= this.maxDistance;
j1 *= this.distance; j1 *= this.maxDistance;
i1 += random.nextInt(this.distance - this.field_82666_h); i1 += random.nextInt(this.maxDistance - this.minDistance);
j1 += random.nextInt(this.distance - this.field_82666_h); j1 += random.nextInt(this.maxDistance - this.minDistance);
if (k == i1 && l == j1) if (k == i1 && l == j1)
{ {

View file

@ -0,0 +1,43 @@
package biomesoplenty.worldgen.structure;
import java.util.Random;
import biomesoplenty.api.Biomes;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.structure.ComponentScatteredFeatureDesertPyramid;
import net.minecraft.world.gen.structure.ComponentScatteredFeatureJunglePyramid;
import net.minecraft.world.gen.structure.ComponentScatteredFeatureSwampHut;
import net.minecraft.world.gen.structure.StructureStart;
public class BOPStructureScatteredFeatureStart extends StructureStart
{
public BOPStructureScatteredFeatureStart(World world, Random random, int x, int z)
{
BiomeGenBase biome = world.getBiomeGenForCoords(x * 16 + 8, z * 16 + 8);
if (biome != BiomeGenBase.jungle && biome != BiomeGenBase.jungleHills && biome != Biomes.rainforest.get() &&
biome != Biomes.temperateRainforest.get() && biome != Biomes.tropicalRainforest.get() && biome != Biomes.jungleNew.get())
{
if (biome == BiomeGenBase.swampland || biome == Biomes.bayou.get() || biome == Biomes.bog.get()
|| biome == Biomes.deadSwamp.get() || biome == Biomes.fen.get() || biome == Biomes.swampwoods.get()
|| biome == Biomes.swamplandNew.get())
{
ComponentScatteredFeatureSwampHut componentscatteredfeatureswamphut = new ComponentScatteredFeatureSwampHut(random, x * 16, z * 16);
this.components.add(componentscatteredfeatureswamphut);
}
else
{
ComponentScatteredFeatureDesertPyramid componentscatteredfeaturedesertpyramid = new ComponentScatteredFeatureDesertPyramid(random, x * 16, z * 16);
this.components.add(componentscatteredfeaturedesertpyramid);
}
}
else
{
ComponentScatteredFeatureJunglePyramid componentscatteredfeaturejunglepyramid = new ComponentScatteredFeatureJunglePyramid(random, x * 16, z * 16);
this.components.add(componentscatteredfeaturejunglepyramid);
}
this.updateBoundingBox();
}
}

View file

@ -15,6 +15,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import biomesoplenty.configuration.BOPConfiguration; import biomesoplenty.configuration.BOPConfiguration;
import biomesoplenty.worldgen.structure.BOPMapGenScatteredFeature;
import biomesoplenty.worldgen.structure.BOPMapGenVillage; import biomesoplenty.worldgen.structure.BOPMapGenVillage;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -32,12 +33,10 @@ import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.MapGenCaves; import net.minecraft.world.gen.MapGenCaves;
import net.minecraft.world.gen.MapGenRavine; import net.minecraft.world.gen.MapGenRavine;
import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.NoiseGeneratorOctaves;
import net.minecraft.world.gen.feature.MapGenScatteredFeature;
import net.minecraft.world.gen.feature.WorldGenDungeons; import net.minecraft.world.gen.feature.WorldGenDungeons;
import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenLakes;
import net.minecraft.world.gen.structure.MapGenMineshaft; import net.minecraft.world.gen.structure.MapGenMineshaft;
import net.minecraft.world.gen.structure.MapGenStronghold; import net.minecraft.world.gen.structure.MapGenStronghold;
import net.minecraft.world.gen.structure.MapGenVillage;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.terraingen.ChunkProviderEvent; import net.minecraftforge.event.terraingen.ChunkProviderEvent;
@ -62,7 +61,7 @@ public class ChunkProviderBOP implements IChunkProvider
private MapGenStronghold strongholdGenerator = new MapGenStronghold(); private MapGenStronghold strongholdGenerator = new MapGenStronghold();
private BOPMapGenVillage villageGenerator = new BOPMapGenVillage(); private BOPMapGenVillage villageGenerator = new BOPMapGenVillage();
private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft(); private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature(); private BOPMapGenScatteredFeature scatteredFeatureGenerator = new BOPMapGenScatteredFeature();
private MapGenBase ravineGenerator = new MapGenRavine(); private MapGenBase ravineGenerator = new MapGenRavine();
private BiomeGenBase[] biomesForGeneration; private BiomeGenBase[] biomesForGeneration;
double[] noise3; double[] noise3;
@ -83,7 +82,7 @@ public class ChunkProviderBOP implements IChunkProvider
strongholdGenerator = (MapGenStronghold) TerrainGen.getModdedMapGen(strongholdGenerator, STRONGHOLD); strongholdGenerator = (MapGenStronghold) TerrainGen.getModdedMapGen(strongholdGenerator, STRONGHOLD);
villageGenerator = (BOPMapGenVillage) TerrainGen.getModdedMapGen(villageGenerator, VILLAGE); villageGenerator = (BOPMapGenVillage) TerrainGen.getModdedMapGen(villageGenerator, VILLAGE);
mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT); mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT);
scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE); scatteredFeatureGenerator = (BOPMapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE);
ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE); ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE);
} }