Added a config option to generate pumpkins without faces (Enabled by default)

This commit is contained in:
Matt Caughey 2013-08-08 21:52:02 -04:00
parent 0aa572cdea
commit d6dfa00013
3 changed files with 39 additions and 1 deletions

View file

@ -44,10 +44,12 @@ import net.minecraftforge.event.terraingen.OreGenEvent;
import net.minecraftforge.event.terraingen.TerrainGen;
import biomesoplenty.api.Blocks;
import biomesoplenty.api.Fluids;
import biomesoplenty.configuration.BOPConfiguration;
import biomesoplenty.worldgen.WorldGenAlgae;
import biomesoplenty.worldgen.WorldGenAsh;
import biomesoplenty.worldgen.WorldGenBOPBush;
import biomesoplenty.worldgen.WorldGenBOPFlowers;
import biomesoplenty.worldgen.WorldGenBOPPumpkin;
import biomesoplenty.worldgen.WorldGenBadlands;
import biomesoplenty.worldgen.WorldGenBadlands2;
import biomesoplenty.worldgen.WorldGenBadlands3;
@ -1366,7 +1368,15 @@ public class BiomeDecoratorBOP extends BiomeDecorator
var2 = chunk_X + randomGenerator.nextInt(16) + 8;
var3 = randomGenerator.nextInt(256);
var4 = chunk_Z + randomGenerator.nextInt(16) + 8;
(new WorldGenPumpkin()).generate(currentWorld, randomGenerator, var2, var3, var4);
if (BOPConfiguration.TerrainGen.pumpkinGen)
{
(new WorldGenBOPPumpkin()).generate(currentWorld, randomGenerator, var2, var3, var4);
}
else
{
(new WorldGenPumpkin()).generate(currentWorld, randomGenerator, var2, var3, var4);
}
}
if (generateMelons && randomGenerator.nextInt(32) == 0)

View file

@ -304,6 +304,7 @@ public class BOPConfiguration
public static boolean addToDefault;
public static boolean vanillaEnhanced;
public static boolean netherOverride;
public static boolean pumpkinGen;
public static int villageDistance;
@ -403,6 +404,7 @@ public class BOPConfiguration
addToDefault = config.get("Biome Settings", "Add Biomes To Default World", false).getBoolean(true);
vanillaEnhanced = config.get("Biome Settings", "Enhanced Vanilla Biomes", true).getBoolean(false);
netherOverride = config.get("Dimension Settings", "Enable Nether Override", true).getBoolean(true);
pumpkinGen = config.get("Decoration Settings", "Generate Pumpkins Without Faces", true).getBoolean(true);
villageDistance = config.get("Biomes O\' Plenty World Type Settings", "Distance between villages", 32, "In Vanilla it is set to 32").getInt();
if (villageDistance < 8)

View file

@ -0,0 +1,26 @@
package biomesoplenty.worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
public class WorldGenBOPPumpkin extends WorldGenerator
{
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
for (int l = 0; l < 64; ++l)
{
int i1 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
int j1 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
int k1 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
if (par1World.isAirBlock(i1, j1, k1) && par1World.getBlockId(i1, j1 - 1, k1) == Block.grass.blockID && Block.pumpkin.canPlaceBlockAt(par1World, i1, j1, k1))
{
par1World.setBlock(i1, j1, k1, Block.pumpkin.blockID, 15, 2);
}
}
return true;
}
}