Bugfixing, and readded the Fen

This commit is contained in:
Adubbz 2014-01-08 12:55:34 +11:00
parent 81894a391e
commit f020d7a958
27 changed files with 553 additions and 215 deletions

View File

@ -74,14 +74,14 @@ public class BiomeGenBayou extends BOPBiome
}
}
for (int i = 0; i < 20; i++)
{
int x = chunkX + random.nextInt(16);
int y = 58;
int z = chunkZ + random.nextInt(16);
for (int i = 0; i < 20; i++)
{
int x = chunkX + random.nextInt(16) + 8;
short y = 58;
int z = chunkZ + random.nextInt(16) + 8;
new WorldGenMoss().generate(world, random, x, y, z);
}
new WorldGenMoss().generate(world, random, x, y, z);
}
}
@Override

View File

@ -43,7 +43,7 @@ public class BiomeGenBorealForest extends BOPBiome
public WorldGenAbstractTree func_150567_a(Random random)
{
return random.nextInt(4) == 0 ? new WorldGenOriginalTree(Blocks.log, Blocks.leaves, 0, 0, false, 8, 2, false) : (random.nextInt(5) == 0 ? new WorldGenShrub(0,0) : (random.nextInt(3) == 0 ? new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves1"), 2, 0, false, 5, 3, false) :
(random.nextInt(3) == 0 ? worldGeneratorTrees : new WorldGenBOPTaiga2(Blocks.log, Blocks.leaves, 1, 1, false, 13, 9, 4, 4, 2, 1))));
(random.nextInt(3) == 0 ? worldGeneratorTrees : new WorldGenBOPTaiga2(Blocks.log, Blocks.leaves, 1, 1, false, 13, 9, 2))));
}
@Override

View File

@ -56,7 +56,7 @@ public class BiomeGenDeadForest extends BOPBiome
public WorldGenAbstractTree func_150567_a(Random random)
{
return random.nextInt(3) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("mud")) :
(random.nextInt(4) == 0 ? new WorldGenBOPTaiga2(Blocks.log, Blocks.leaves, 1, 1, false, 9, 9, 2, 4, 2, 4) :
(random.nextInt(4) == 0 ? new WorldGenBOPTaiga2(Blocks.log, Blocks.leaves, 1, 1, false, 9, 9, 1) :
new WorldGenOriginalTree(Blocks.log, BOPBlockHelper.get("leaves2"), 0, 0, false, 5, 3, false));
}

View File

@ -1,114 +1,127 @@
package biomesoplenty.common.biomes;
import net.minecraft.world.biome.BiomeGenBase;
import java.util.HashMap;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.common.world.features.WorldGenBOPTallGrass;
import biomesoplenty.common.world.features.WorldGenMoss;
import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga1;
import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2;
import biomesoplenty.common.world.features.trees.WorldGenDeadTree1;
public class BiomeGenFen extends BOPBiome
{
public BiomeGenFen(int par1)
private static final Height biomeHeight = new Height(0.2F, 0.4F);
public BiomeGenFen(int id)
{
super(par1);
/*
theBiomeDecorator = new BiomeDecoratorBOP(this);
customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator;
customBiomeDecorator.treesPerChunk = 10;
customBiomeDecorator.grassPerChunk = 15;
customBiomeDecorator.highGrassPerChunk = 1;
customBiomeDecorator.waterlilyPerChunk = 1;
customBiomeDecorator.cattailsPerChunk = 1;
customBiomeDecorator.highCattailsPerChunk = 1;
customBiomeDecorator.pondsPerChunk = 99;
customBiomeDecorator.toadstoolsPerChunk = 2;
customBiomeDecorator.mushroomsPerChunk = 8;
customBiomeDecorator.mudPerChunk = 1;
customBiomeDecorator.mudPerChunk2 = 1;
customBiomeDecorator.sandPerChunk = -999;
customBiomeDecorator.sandPerChunk2 = -999;
customBiomeDecorator.reedsBOPPerChunk = 5;
customBiomeDecorator.algaePerChunk = 1;
customBiomeDecorator.portobellosPerChunk = 1;
customBiomeDecorator.wheatGrassPerChunk = 8;
customBiomeDecorator.waterReedsPerChunk = 10;
customBiomeDecorator.koruPerChunk = 1;
customBiomeDecorator.shrubsPerChunk = 7;
spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 1, 3));
*/
}
/**
* Gets a WorldGen appropriate for this biome.
*/
/*
@Override
public WorldGenerator getRandomWorldGenForTrees(Random par1Random)
{
return par1Random.nextInt(3) == 0 ? new WorldGenFen2(false) : (par1Random.nextInt(20) == 0 ? new WorldGenDeadTree(false) : new WorldGenFen1());
}
@Override
public void decorate(World par1World, Random par2Random, int par3, int par4)
{
super.decorate(par1World, par2Random, par3, par4);
WorldGenMoss var5 = new WorldGenMoss();
super(id);
int var55 = 12 + par2Random.nextInt(6);
//TODO: setHeight()
this.func_150570_a(biomeHeight);
//TODO: setColor()
this.setColor(12240001);
this.setTemperatureRainfall(0.4F, 0.4F);
this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 1, 3));
for (int var66 = 0; var66 < var55; ++var66)
this.theBiomeDecorator.treesPerChunk = 10;
this.theBiomeDecorator.mushroomsPerChunk = 8;
this.theBiomeDecorator.grassPerChunk = 15;
this.theBiomeDecorator.sandPerChunk = -999;
this.theBiomeDecorator.sandPerChunk2 = -999;
this.bopWorldFeatures.doubleTallGrassPerChunk = 1;
this.bopWorldFeatures.cattailsPerChunk = 1;
this.bopWorldFeatures.highCattailsPerChunk = 1;
this.bopWorldFeatures.waterPoolsPerChunk = 99;
this.bopWorldFeatures.toadstoolsPerChunk = 2;
this.bopWorldFeatures.mudPerChunk = 1;
this.bopWorldFeatures.riverCanePerChunk = 5;
this.bopWorldFeatures.algaePerChunk = 1;
this.bopWorldFeatures.portobellosPerChunk = 1;
this.bopWorldFeatures.waterReedsPerChunk = 10;
this.bopWorldFeatures.koruPerChunk = 1;
this.bopWorldFeatures.shrubsPerChunk = 7;
}
@Override
//TODO: getRandomWorldGenForTrees()
public WorldGenAbstractTree func_150567_a(Random random)
{
return random.nextInt(3) == 0 ? new WorldGenBOPTaiga2(Blocks.log, BOPBlockHelper.get("leaves2"), 0, 0, false, 10, 12, 3) :
(random.nextInt(20) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("mud")) :
new WorldGenBOPTaiga1(Blocks.log, Blocks.leaves, 0, 0, false, 7, 5, 1));
}
@Override
public HashMap<WorldGenerator, Double> getWeightedWorldGenForGrass()
{
HashMap<WorldGenerator, Double> grassMap = new HashMap();
grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 0.5D);
grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 1), 1D);
grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 2), 0.5D);
grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D);
grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D);
return grassMap;
}
@Override
public void decorate(World world, Random random, int chunkX, int chunkZ)
{
super.decorate(world, random, chunkX, chunkZ);
int var5 = 12 + random.nextInt(6);
for (int i = 0; i < var5; ++i)
{
int var77 = par3 + par2Random.nextInt(16);
int var88 = par2Random.nextInt(28) + 4;
int var99 = par4 + par2Random.nextInt(16);
int var100 = par1World.getBlockId(var77, var88, var99);
int x = chunkX + random.nextInt(16);
int y = random.nextInt(28) + 4;
int z = chunkZ + random.nextInt(16);
if (var100 == Block.stone.blockID)
//TODO: getBlock()
Block block = world.func_147439_a(x, y, z);
if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone))
{
par1World.setBlock(var77, var88, var99, Blocks.amethystOre.get().blockID, 10, 2);
//TODO: setBlock()
world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 10, 2);
}
}
for (int var6 = 0; var6 < 20; ++var6)
for (int i = 0; i < 20; i++)
{
int var7 = par3 + par2Random.nextInt(16) + 8;
byte var8 = 58;
int var9 = par4 + par2Random.nextInt(16) + 8;
var5.generate(par1World, par2Random, var7, var8, var9);
int x = chunkX + random.nextInt(16) + 8;
short y = 58;
int z = chunkZ + random.nextInt(16) + 8;
new WorldGenMoss().generate(world, random, x, y, z);
}
}
*/
/**
* Gets a WorldGen appropriate for this biome.
*/
/*
@Override
public WorldGenerator getRandomWorldGenForGrass(Random par1Random)
{
return (par1Random.nextInt(4) == 0 ? new WorldGenTallGrass(Block.tallGrass.blockID, 1) : (par1Random.nextInt(3) == 0 ? new WorldGenTallGrass(Blocks.foliage.get().blockID, 2) : new WorldGenTallGrass(Blocks.foliage.get().blockID, 1)));
}
*/
/**
* Provides the basic grass color based on the biome temperature and rainfall
*/
/*
@Override
public int getBiomeGrassColor()
{
return 12240001;
}
*/
/**
* Provides the basic foliage color based on the biome temperature and rainfall
*/
/*
@Override
public int getBiomeFoliageColor()
{
return 13547897;
}
@Override
//TODO: getBiomeGrassColor()
public int func_150558_b(int p_150558_1_, int p_150558_2_, int p_150558_3_)
{
return 12240001;
}
@Override
//TODO: getBiomeFoliageColor()
public int func_150571_c(int x, int y, int z)
{
return 13547897;
}
/*@Override
public int getFogColour()
{
return 12638463;

View File

@ -42,7 +42,7 @@ public class BiomeGenGrassland extends BOPBiome
this.theBiomeDecorator.reedsPerChunk = 35;
this.theBiomeDecorator.mushroomsPerChunk = 20;
this.bopWorldFeatures.waterPondsPerChunk = 15;
this.bopWorldFeatures.waterLakesPerChunk = 15;
this.bopWorldFeatures.portobellosPerChunk = 3;
this.bopWorldFeatures.riverCanePerChunk = 5;
this.bopWorldFeatures.waterReedsPerChunk = 2;

View File

@ -41,7 +41,7 @@ public class BiomeGenMarsh extends BOPBiome
this.bopWorldFeatures.koruPerChunk = 1;
this.bopWorldFeatures.doubleTallGrassPerChunk = 50;
this.bopWorldFeatures.mudPerChunk = 1;
this.bopWorldFeatures.waterPondsPerChunk = 100;
this.bopWorldFeatures.waterLakesPerChunk = 100;
this.bopWorldFeatures.waterReedsPerChunk = 10;
this.bopWorldFeatures.generatePumpkins = false;
}

View File

@ -59,7 +59,7 @@ public class BiomeGenOminousWoods extends BOPBiome
//TODO: getRandomWorldGenForTrees()
public WorldGenAbstractTree func_150567_a(Random random)
{
return random.nextInt(2) == 0 ? new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, false, 14, 6) : (random.nextInt(6) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("holyGrass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock")) : new WorldGenBOPSwampTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, 5, 4));
return random.nextInt(2) == 0 ? new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, false, 14, 6, 0) : (random.nextInt(6) == 0 ? new WorldGenDeadTree1(false, Blocks.dirt, Blocks.grass, BOPBlockHelper.get("holyGrass"), BOPBlockHelper.get("driedDirt"), BOPBlockHelper.get("redRock")) : new WorldGenBOPSwampTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, 5, 4));
}
@Override

View File

@ -1,5 +1,6 @@
package biomesoplenty.common.biomes;
import biomesoplenty.common.world.features.WorldGenMoss;
import net.minecraft.world.biome.BiomeGenBase;
public class BiomeGenShield extends BOPBiome
@ -39,15 +40,15 @@ public class BiomeGenShield extends BOPBiome
public void decorate(World par1World, Random par2Random, int par3, int par4)
{
super.decorate(par1World, par2Random, par3, par4);
WorldGenMoss var5 = new WorldGenMoss();
for (int var6 = 0; var6 < 20; ++var6)
{
int var7 = par3 + par2Random.nextInt(16) + 8;
byte var8 = 58;
int var9 = par4 + par2Random.nextInt(16) + 8;
var5.generate(par1World, par2Random, var7, var8, var9);
}
for (int i = 0; i < 20; i++)
{
int x = chunkX + random.nextInt(16) + 8;
short y = 58;
int z = chunkZ + random.nextInt(16) + 8;
new WorldGenMoss().generate(world, random, x, y, z);
}
}
*/

View File

@ -162,7 +162,7 @@ public class BlockBOPSapling extends BlockSapling
if (rnd == 0) {
obj = new WorldGenBOPSwampTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, 5, 4);
} else {
obj = new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, false, 14, 6);
obj = new WorldGenBOPTaiga2(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves1"), 2, 3, false, 14, 6, 0);
}
break;

View File

@ -15,6 +15,7 @@ import biomesoplenty.common.biomes.BiomeGenCrag;
import biomesoplenty.common.biomes.BiomeGenDeadForest;
import biomesoplenty.common.biomes.BiomeGenDeciduousForest;
import biomesoplenty.common.biomes.BiomeGenDunes;
import biomesoplenty.common.biomes.BiomeGenFen;
import biomesoplenty.common.biomes.BiomeGenFlowerField;
import biomesoplenty.common.biomes.BiomeGenFrostForest;
import biomesoplenty.common.biomes.BiomeGenGrassland;
@ -87,7 +88,7 @@ public class BOPBiomes
//registerBiome(new BOPBiomeListEntry(new BiomeGenDeadSwamp(BOPConfigurationIDs.deadSwampID).setBiomeName("Dead Swamp"), BOPBiomeTemperatureType.WARM));*/
registerBiome(new BOPBiomeListEntry(new BiomeGenDeciduousForest(BOPConfigurationIDs.deciduousForestID).setBiomeName("Deciduous Forest"), BOPBiomeTemperatureType.WARM));
registerBiome(new BOPBiomeListEntry(new BiomeGenDunes(BOPConfigurationIDs.dunesID).setBiomeName("Dunes"), BOPBiomeTemperatureType.HOT));
/*registerBiome(new BOPBiomeListEntry(new BiomeGenFen(BOPConfigurationIDs.fenID).setBiomeName("Fen"), BOPBiomeTemperatureType.WARM));*/;
registerBiome(new BOPBiomeListEntry(new BiomeGenFen(BOPConfigurationIDs.fenID).setBiomeName("Fen"), BOPBiomeTemperatureType.WARM));
registerBiome(new BOPBiomeListEntry(new BiomeGenFlowerField(BOPConfigurationIDs.flowerFieldID).setBiomeName("Flower Field"), BOPBiomeTemperatureType.WARM));
registerBiome(new BOPBiomeListEntry(new BiomeGenFrostForest(BOPConfigurationIDs.frostForestID).setBiomeName("Frost Forest"), BOPBiomeTemperatureType.ICY));
registerBiome(new BOPBiomeListEntry(new BiomeGenGrassland(BOPConfigurationIDs.grasslandID).setBiomeName("Grassland"), BOPBiomeTemperatureType.WARM));

View File

@ -23,7 +23,7 @@ import cpw.mods.fml.relauncher.ReflectionHelper;
public class DecorateBiomeEventHandler
{
@SubscribeEvent
public void onBiomeDecorate(DecorateBiomeEvent.Post event)
public void onBiomeDecorate(DecorateBiomeEvent.Pre event)
{
World world = event.world;
@ -32,10 +32,10 @@ public class DecorateBiomeEventHandler
Random random = event.rand;
int x = chunkX + 8;
int z = chunkZ + 8;
int x = chunkX;
int z = chunkZ;
BiomeGenBase biome = world.getBiomeGenForCoordsBody(x, z);
BiomeGenBase biome = world.getBiomeGenForCoordsBody(x + 8, z + 8);
IBOPDecoration bopDecoration = null;

View File

@ -50,6 +50,10 @@ public class DecorationModificationEventHandler
event.setResult(Result.DENY);
}
}
else if (event.type == Decorate.EventType.LAKE)
{
event.setResult(Result.DENY);
}
}
}
@ -79,42 +83,7 @@ public class DecorationModificationEventHandler
}
if (bopDecoration != null)
{
if (event.type == Populate.EventType.LAKE)
{
event.setResult(Result.DENY);
for (int i = 0; i < bopDecoration.getWorldFeatures().waterPondsPerChunk; i++)
{
if (random.nextInt(4) == 0)
{
int randX = x + random.nextInt(16);
int randY = random.nextInt(256);
int randZ = z + random.nextInt(16);
(new WorldGenLakes(Blocks.water)).generate(world, random, randX, randY, randZ);
}
}
}
else if (event.type == Populate.EventType.LAVA)
{
event.setResult(Result.DENY);
for (int i = 0; i < bopDecoration.getWorldFeatures().lavaPondsPerChunk; i++)
{
if (random.nextInt(8) == 0)
{
int randX = x + random.nextInt(16);
int randY = random.nextInt(random.nextInt(248) + 8);
int randZ = z + random.nextInt(16);
if (randY < 63 || random.nextInt(10) == 0)
{
(new WorldGenLakes(Blocks.lava)).generate(world, random, randX, randY, randZ);
}
}
}
}
{
}
}
}

View File

@ -6,8 +6,11 @@ public class BOPWorldFeatures
public boolean generateQuicksand = false;
public boolean generateCanyon = false;
public int waterPondsPerChunk = 0;
public int lavaPondsPerChunk = 0;
public int waterPoolsPerChunk = 0;
public int lavaPoolsPerChunk = 0;
public int waterLakesPerChunk = 0;
public int lavaLakesPerChunk = 0;
public int mudPerChunk = 0;
public int riverCanePerChunk = 0;
@ -29,6 +32,9 @@ public class BOPWorldFeatures
public int koruPerChunk = 0;
public int toadstoolsPerChunk = 0;
public int blueMilksPerChunk = 0;
public int cattailsPerChunk = 0;
public int highCattailsPerChunk = 0;
public int algaePerChunk = 0;
public int bopFlowersPerChunk = 0;
}

View File

@ -0,0 +1,72 @@
package biomesoplenty.common.world.features;
import java.lang.reflect.Field;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.common.world.decoration.IBOPDecoration;
import biomesoplenty.common.world.generation.WorldGeneratorBOP;
public class WorldGenBOPDoubleFlora extends WorldGeneratorBOP
{
private Block bottomFlora;
private Block topFlora;
private int bottomFloraMeta;
private int topFloraMeta;
private int groupCount;
public WorldGenBOPDoubleFlora(Block bottomFlora, Block topFlora, int bottomFloraMeta, int topFloraMeta)
{
this(bottomFlora, topFlora, bottomFloraMeta, topFloraMeta, 64);
}
public WorldGenBOPDoubleFlora(Block bottomFlora, Block topFlora, int bottomFloraMeta, int topFloraMeta, int groupCount)
{
this.bottomFlora = bottomFlora;
this.topFlora = topFlora;
this.bottomFloraMeta = bottomFloraMeta;
this.topFloraMeta = topFloraMeta;
this.groupCount = groupCount;
}
@Override
public boolean generate(World world, Random random, int x, int y, int z)
{
for (int l = 0; l < groupCount; ++l)
{
int i1 = x + random.nextInt(8) - random.nextInt(8);
int j1 = y + random.nextInt(4) - random.nextInt(4);
int k1 = z + random.nextInt(8) - random.nextInt(8);
//TODO: isAirBlock() canReplace()
if (world.func_147437_c(i1, j1, k1) && (!world.provider.hasNoSky || j1 < 255) && this.bottomFlora.func_149705_a(world, i1, j1, k1, 0, new ItemStack(bottomFlora, 1, bottomFloraMeta)))
{
//TODO: setBlock()
world.func_147465_d(i1, j1, k1, this.bottomFlora, this.bottomFloraMeta, 2);
//TODO: setBlock()
world.func_147465_d(i1, j1 + 1, k1, this.topFlora, this.topFloraMeta, 2);
}
}
return true;
}
@Override
public void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int x, int z) throws Exception
{
for (int i = 0; i < worldGeneratorField.getInt(bopDecoration.getWorldFeatures()); i++)
{
int randX = x + random.nextInt(16) + 8;
int randZ = z + random.nextInt(16) + 8;
int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2);
worldGenerator.generate(world, random, randX, randY, randZ);
}
}
}

View File

@ -55,9 +55,9 @@ public class WorldGenBOPFlora extends WorldGeneratorBOP
{
for (int i = 0; i < worldGeneratorField.getInt(bopDecoration.getWorldFeatures()); i++)
{
int randX = x + random.nextInt(16);
int randZ = z + random.nextInt(16);
int randY = random.nextInt(world.getHeightValue(randX, randZ));
int randX = x + random.nextInt(16) + 8;
int randZ = z + random.nextInt(16) + 8;
int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2);
worldGenerator.generate(world, random, randX, randY, randZ);
}

View File

@ -58,9 +58,9 @@ public class WorldGenBOPTallGrass extends WorldGeneratorBOP
{
for (int i = 0; i < worldGeneratorField.getInt(bopDecoration.getWorldFeatures()); i++)
{
int randX = x + random.nextInt(16);
int randZ = z + random.nextInt(16);
int randY = random.nextInt(world.getHeightValue(randX, randZ));
int randX = x + random.nextInt(16) + 8;
int randZ = z + random.nextInt(16) + 8;
int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2);
worldGenerator.generate(world, random, randX, randY, randZ);
}

View File

@ -15,26 +15,26 @@ import biomesoplenty.common.world.generation.WorldGeneratorBOP;
public class WorldGenMoss extends WorldGeneratorBOP
{
@Override
public boolean generate(World world, Random par2Random, int par3, int par4, int par5)
public boolean generate(World world, Random random, int x, int y, int z)
{
int var6 = par3;
int var6 = x;
for (int var7 = par5; par4 < 80; ++par4)
for (int var7 = z; y < 80; ++y)
{
//TODO: isAirBlock()
if (world.func_147437_c(par3, par4, par5))
if (world.func_147437_c(x, y, z))
{
for (int var8 = 2; var8 <= 5; ++var8)
{
//TODO: canPlaceBlockOnSide()
if (BOPBlockHelper.get("moss").func_149707_d(world, par3, par4, par5, var8))
if (BOPBlockHelper.get("moss").func_149707_d(world, x, y, z, var8))
{
int var999 = par2Random.nextInt(4);
int var999 = random.nextInt(4);
if (var999 == 0)
{
//TODO: setBlock()
world.func_147465_d(par3, par4, par5, BOPBlockHelper.get("moss"), 1 << Direction.facingToDirection[Facing.oppositeSide[var8]], 2);
world.func_147465_d(x, y, z, BOPBlockHelper.get("moss"), 1 << Direction.facingToDirection[Facing.oppositeSide[var8]], 2);
}
break;
}
@ -42,8 +42,8 @@ public class WorldGenMoss extends WorldGeneratorBOP
}
else
{
par3 = var6 + par2Random.nextInt(4) - par2Random.nextInt(4);
par5 = var7 + par2Random.nextInt(4) - par2Random.nextInt(4);
x = var6 + random.nextInt(4) - random.nextInt(4);
z = var7 + random.nextInt(4) - random.nextInt(4);
}
}
@ -55,9 +55,9 @@ public class WorldGenMoss extends WorldGeneratorBOP
{
for (int i = 0; i < worldGeneratorField.getInt(bopDecoration.getWorldFeatures()); i++)
{
int randX = x + random.nextInt(16);
int randZ = z + random.nextInt(16);
int randY = random.nextInt(world.getHeightValue(randX, randZ));
int randX = x + random.nextInt(16) + 8;
int randZ = z + random.nextInt(16) + 8;
int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2);
worldGenerator.generate(world, random, randX, randY, randZ);
}

View File

@ -67,8 +67,8 @@ public class WorldGenMud extends WorldGeneratorBOP
{
for (int i = 0; i < worldGeneratorField.getInt(bopDecoration.getWorldFeatures()); i++)
{
int randX = x + random.nextInt(16);
int randZ = z + random.nextInt(16);
int randX = x + random.nextInt(16) + 8;
int randZ = z + random.nextInt(16) + 8;
worldGenerator.generate(world, random, randX, world.getTopSolidOrLiquidBlock(randX, randZ), randZ);
}

View File

@ -47,9 +47,9 @@ public class WorldGenRiverCane extends WorldGeneratorBOP
{
for (int i = 0; i < worldGeneratorField.getInt(bopDecoration.getWorldFeatures()); i++)
{
int randX = x + random.nextInt(16);
int randZ = z + random.nextInt(16);
int randY = random.nextInt(world.getHeightValue(randX, randZ));
int randX = x + random.nextInt(16) + 8;
int randZ = z + random.nextInt(16) + 8;
int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2);
worldGenerator.generate(world, random, randX, randY, randZ);
}

View File

@ -30,10 +30,10 @@ public class WorldGenSplotches extends WorldGeneratorBOP
public boolean generate(World world, Random random, int x, int y, int z)
{
float var6 = random.nextFloat() * (float)Math.PI;
double var7 = x + MathHelper.sin(var6) * numberOfBlocks / 8.0F;
double var9 = x - MathHelper.sin(var6) * numberOfBlocks / 8.0F;
double var11 = z + MathHelper.cos(var6) * numberOfBlocks / 8.0F;
double var13 = z - MathHelper.cos(var6) * numberOfBlocks / 8.0F;
double var7 = x + 8 + MathHelper.sin(var6) * numberOfBlocks / 8.0F;
double var9 = x + 8 - MathHelper.sin(var6) * numberOfBlocks / 8.0F;
double var11 = z + 8 + MathHelper.cos(var6) * numberOfBlocks / 8.0F;
double var13 = z + 8 - MathHelper.cos(var6) * numberOfBlocks / 8.0F;
double var15 = y + random.nextInt(3) - 2;
double var17 = y + random.nextInt(3) - 2;

View File

@ -28,8 +28,8 @@ public class WorldGenWaterReeds extends WorldGeneratorBOP
{
for (int i = 2; i > -2; --i)
{
//TODO: getBlock() getBlock()
if (world.func_147439_a(i1 - i, j1 - 1, k1 - i) != Blocks.water && world.func_147439_a(i1 - i, j1 - 1, k1 - i) != Blocks.flowing_water)
//TODO: getBlock()
if (world.func_147439_a(i1 - i, j1 - 1, k1 - i) != Blocks.water)
{
//TODO: setBlock()
world.func_147465_d(i1, j1, k1, BOPBlockHelper.get("plants"), 14, 2);
@ -46,9 +46,9 @@ public class WorldGenWaterReeds extends WorldGeneratorBOP
{
for (int i = 0; i < worldGeneratorField.getInt(bopDecoration.getWorldFeatures()); i++)
{
int randX = x + random.nextInt(16);
int randZ = z + random.nextInt(16);
int randY = random.nextInt(world.getHeightValue(randX, randZ));
int randX = x + random.nextInt(16) + 8;
int randZ = z + random.nextInt(16) + 8;
int randY = random.nextInt(world.getHeightValue(randX, randZ) * 2);
worldGenerator.generate(world, random, randX, randY, randZ);
}

View File

@ -0,0 +1,168 @@
package biomesoplenty.common.world.features.trees;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSapling;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import net.minecraftforge.common.util.ForgeDirection;
public class WorldGenBOPTaiga1 extends WorldGenAbstractTree
{
private final Block wood;
private final Block leaves;
private final int metaWood;
private final int metaLeaves;
private final int minTreeHeight;
private final int randomTreeHeight;
private final int altNo;
public WorldGenBOPTaiga1(Block wood, Block leaves, int metaWood, int metaLeaves, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight, int altNo)
{
super(doBlockNotify);
this.wood = wood;
this.leaves = leaves;
this.metaWood = metaWood;
this.metaLeaves = metaLeaves;
this.minTreeHeight = minTreeHeight;
this.randomTreeHeight = randomTreeHeight;
this.altNo = altNo;
}
@Override
public boolean generate(World world, Random random, int x, int y, int z)
{
int l = random.nextInt(randomTreeHeight) + minTreeHeight;
int i1;
int j1;
int k1;
boolean flag = true;
switch (altNo)
{
case 1:
i1 = l - random.nextInt(2) - 3;
j1 = l - i1;
k1 = 1 + random.nextInt(j1 + 1);
break;
default:
i1 = l - random.nextInt(2) - 3;
j1 = l - i1;
k1 = 1 + random.nextInt(j1 + 1);
break;
}
if (y >= 1 && y + l + 1 <= 256)
{
int i2;
int j2;
int i3;
for (int l1 = y; l1 <= y + 1 + l && flag; ++l1)
{
boolean flag1 = true;
if (l1 - y < i1)
{
i3 = 0;
}
else
{
i3 = k1;
}
for (i2 = x - i3; i2 <= x + i3 && flag; ++i2)
{
for (j2 = z - i3; j2 <= z + i3 && flag; ++j2)
{
if (l1 >= 0 && l1 < 256)
{
Block block = world.func_147439_a(i2, l1, j2);
if (!this.isReplaceable(world, i2, l1, j2))
{
flag = false;
}
}
else
{
flag = false;
}
}
}
}
if (!flag)
{
return false;
}
else
{
Block block1 = world.func_147439_a(x, y - 1, z);
boolean isSoil = block1.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling);
if (isSoil && y < 256 - l - 1)
{
block1.onPlantGrow(world, x, y - 1, z, x, y, z);
i3 = 0;
for (i2 = y + l; i2 >= y + i1; --i2)
{
for (j2 = x - i3; j2 <= x + i3; ++j2)
{
int j3 = j2 - x;
for (int k2 = z - i3; k2 <= z + i3; ++k2)
{
int l2 = k2 - z;
if ((Math.abs(j3) != i3 || Math.abs(l2) != i3 || i3 <= 0) && world.func_147439_a(j2, i2, k2).canBeReplacedByLeaves(world, j2, i2, k2))
{
this.func_150516_a(world, j2, i2, k2, leaves, metaLeaves);
}
}
}
if (i3 >= 1 && i2 == y + i1 + 1)
{
--i3;
}
else if (i3 < k1)
{
++i3;
}
}
for (i2 = 0; i2 < l - 1; ++i2)
{
Block block2 = world.func_147439_a(x, y + i2, z);
if (block2.isAir(world, x, y + i2, z) || block2.isLeaves(world, x, y + i2, z))
{
this.func_150516_a(world, x, y + i2, z, wood, metaWood);
}
}
return true;
}
else
{
return false;
}
}
}
else
{
return false;
}
}
}

View File

@ -21,18 +21,9 @@ public class WorldGenBOPTaiga2 extends WorldGenAbstractTree
private final int metaWood;
private final int metaLeaves;
private final int minI;
private final int randomI;
private final int minK;
private final int randomK;
private final int altNo;
public WorldGenBOPTaiga2(Block wood, Block leaves, int metaWood, int metaLeaves, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight)
{
this(wood, leaves, metaWood, metaLeaves, doBlockNotify, minTreeHeight, randomTreeHeight, 1, 2, 2, 2);
}
public WorldGenBOPTaiga2(Block wood, Block leaves, int metaWood, int metaLeaves, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight, int minI, int randomI, int minK, int randomK)
public WorldGenBOPTaiga2(Block wood, Block leaves, int metaWood, int metaLeaves, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight, int altNo)
{
super(doBlockNotify);
@ -43,20 +34,44 @@ public class WorldGenBOPTaiga2 extends WorldGenAbstractTree
this.minTreeHeight = minTreeHeight;
this.randomTreeHeight = randomTreeHeight;
this.minI = minI;
this.randomI = randomI;
this.minK = minK;
this.randomK = randomK;
this.altNo = altNo;
}
@Override
public boolean generate(World world, Random random, int x, int y, int z)
{
int l = random.nextInt(randomTreeHeight) + minTreeHeight;
int i1 = minI + random.nextInt(randomI);
int j1 = l - i1;
int k1 = minK + random.nextInt(randomK);
int i1;
int j1;
int k1;
switch (altNo)
{
case 1:
i1 = 2 + random.nextInt(4);
j1 = l - i1;
k1 = 2 + random.nextInt(4);
break;
case 2:
i1 = 4 + random.nextInt(4);
j1 = l - i1;
k1 = 2;
break;
case 3:
i1 = 1 - random.nextInt(4);
j1 = l - i1;
k1 = 2 + random.nextInt(2);
break;
default:
i1 = 1 + random.nextInt(2);
j1 = l - i1;
k1 = 1 + random.nextInt(2);
break;
}
boolean flag = true;
if (y >= 1 && y + l + 1 <= 256)

View File

@ -0,0 +1,39 @@
package biomesoplenty.common.world.forcedworldgenerators;
import java.lang.reflect.Field;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.common.world.decoration.IBOPDecoration;
import biomesoplenty.common.world.generation.ForcedWorldGeneratorBOP;
public class LakesForcedGenerator extends ForcedWorldGeneratorBOP
{
@Override
public void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int x, int z) throws Exception
{
String fieldName = worldGeneratorField.getName();
for (int i = 0; i < worldGeneratorField.getInt(bopDecoration.getWorldFeatures()); i++)
{
if (fieldName.equals("waterLakesPerChunk"))
{
int randX = x + random.nextInt(16) + 8;
int randY = random.nextInt(random.nextInt(240) + 8);
int randZ = z + random.nextInt(16) + 8;
worldGenerator.generate(world, random, randX, randY, randZ);
}
else
{
int randX = x + random.nextInt(16) + 8;
int randY = random.nextInt(random.nextInt(random.nextInt(112) + 8) + 8);
int randZ = z + random.nextInt(16) + 8;
worldGenerator.generate(world, random, randX, randY, randZ);
}
}
}
}

View File

@ -0,0 +1,38 @@
package biomesoplenty.common.world.forcedworldgenerators;
import java.lang.reflect.Field;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.common.world.decoration.IBOPDecoration;
import biomesoplenty.common.world.generation.ForcedWorldGeneratorBOP;
public class PondForcedGenerator extends ForcedWorldGeneratorBOP
{
@Override
public void doGeneration(World world, Random random, Field worldGeneratorField, WorldGenerator worldGenerator, BiomeGenBase biome, IBOPDecoration bopDecoration, int x, int z) throws Exception
{
if (biome.theBiomeDecorator.generateLakes)
{
for (int i = 0; i < 50 + bopDecoration.getWorldFeatures().waterPoolsPerChunk; ++i)
{
int randX = x + random.nextInt(16);
int randY = random.nextInt(random.nextInt(248) + 8);
int randZ = z + random.nextInt(16);
worldGenerator.generate(world, random, randX, randY, randZ);
}
for (int i = 0; i < 20 + bopDecoration.getWorldFeatures().lavaPoolsPerChunk; ++i)
{
int randX = x + random.nextInt(16);
int randY = random.nextInt(random.nextInt(random.nextInt(240) + 8) + 8);
int randZ = z + random.nextInt(16);
worldGenerator.generate(world, random, randX, randY, randZ);
}
}
}
}

View File

@ -2,8 +2,10 @@ package biomesoplenty.common.world.generation;
import java.util.HashMap;
import biomesoplenty.common.world.decoration.IBOPDecoration;
import biomesoplenty.common.world.forceddecorators.ForcedDecorator;
import net.minecraft.world.gen.feature.WorldGenLakes;
import net.minecraft.world.gen.feature.WorldGenLiquids;
import biomesoplenty.common.world.forcedworldgenerators.LakesForcedGenerator;
import biomesoplenty.common.world.forcedworldgenerators.PondForcedGenerator;
public class ForcedBOPWorldGenerators
{
@ -16,7 +18,8 @@ public class ForcedBOPWorldGenerators
private static void addForcedGenerators()
{
addForcedGenerator(WorldGenLiquids.class, new PondForcedGenerator());
addForcedGenerator(WorldGenLakes.class, new LakesForcedGenerator());
}
public static void addForcedGenerator(Class worldGenClass, ForcedWorldGeneratorBOP generator)

View File

@ -2,14 +2,18 @@ package biomesoplenty.common.world.generation;
import java.util.HashMap;
import net.minecraft.init.Blocks;
import net.minecraft.world.gen.feature.WorldGenDoublePlant;
import net.minecraft.world.gen.feature.WorldGenLakes;
import net.minecraft.world.gen.feature.WorldGenLiquids;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.common.world.features.WorldGenBOPDoubleFlora;
import biomesoplenty.common.world.features.WorldGenBOPFlora;
import biomesoplenty.common.world.features.WorldGenBOPTallGrass;
import biomesoplenty.common.world.features.WorldGenMud;
import biomesoplenty.common.world.features.WorldGenSplotches;
import biomesoplenty.common.world.features.WorldGenRiverCane;
import biomesoplenty.common.world.features.WorldGenSplotches;
import biomesoplenty.common.world.features.WorldGenWaterReeds;
public class WorldGenFieldAssociation
@ -23,7 +27,16 @@ public class WorldGenFieldAssociation
private static void associateFieldsWithGenerators()
{
associateField("mudPerChunk", new WorldGenMud(7));
associateField("generateQuicksand", new WorldGenSplotches(BOPBlockHelper.get("mud"), 1, 24));
associateField("generateCanyon", new WorldGenSplotches(BOPBlockHelper.get("redRock"), 0, 48));
associateField("waterPoolsPerChunk", new WorldGenLiquids(Blocks.flowing_water));
associateField("lavaPoolsPerChunk", new WorldGenLiquids(Blocks.flowing_lava));
associateField("waterLakesPerChunk", new WorldGenLakes(Blocks.water));
associateField("lavaLakesPerChunk", new WorldGenLakes(Blocks.lava));
associateField("mudPerChunk", new WorldGenMud(7));
associateField("riverCanePerChunk", new WorldGenRiverCane());
associateField("shrubsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 9));
associateField("bushesPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 4));
@ -42,9 +55,9 @@ public class WorldGenFieldAssociation
associateField("koruPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 12));
associateField("toadstoolsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("mushrooms"), 0));
associateField("blueMilksPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("mushrooms"), 2));
associateField("generateQuicksand", new WorldGenSplotches(BOPBlockHelper.get("mud"), 1, 24));
associateField("generateCanyon", new WorldGenSplotches(BOPBlockHelper.get("redRock"), 0, 48));
associateField("cattailsPerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("plants"), 7));
associateField("highCattailsPerChunk", new WorldGenBOPDoubleFlora(BOPBlockHelper.get("plants"), BOPBlockHelper.get("plants"), 10, 9));
associateField("algaePerChunk", new WorldGenBOPFlora(BOPBlockHelper.get("foliage"), 0));
WorldGenDoublePlant doubleTallGrass = new WorldGenDoublePlant();
//TODO: setMetadata() ?