use of net.tropicraft.core.common.worldgen.WorldGenNormalPalms in project Tropicraft by Tropicraft.
the class BiomeDecoratorTropics method genDecorations.
@Override
public void genDecorations(Biome biome, World world, Random rand) {
super.genDecorations(biome, world, rand);
int i = 0;
int k = 0;
if (BiomeTropicraft.DISABLEDECORATION) {
System.out.println("decoration disabled via BiomeGenTropics.DISABLEDECORATION, " + this);
return;
}
if (GenRates.BAMBOO_CHANCE != 0 && rand.nextInt(GenRates.BAMBOO_CHANCE) == 0) {
i = chunkPos.getX();
k = chunkPos.getZ();
new WorldGenBamboo(world, rand).generate(new BlockPos(i, getTerrainHeightAt(world, i, k), k));
}
if (GenRates.NORMAL_PALM_CHANCE != 0 && rand.nextInt(GenRates.NORMAL_PALM_CHANCE) == 0) {
i = chunkPos.getX() + 13 + rand.nextInt(5);
k = chunkPos.getZ() + 13 + rand.nextInt(5);
new WorldGenNormalPalms(world, rand).generate(new BlockPos(i, this.getTerrainHeightAt(world, i, k), k));
}
if (GenRates.CURVED_PALM_CHANCE != 0 && rand.nextInt(GenRates.CURVED_PALM_CHANCE) == 0) {
i = chunkPos.getX() + 13 + rand.nextInt(5);
k = chunkPos.getZ() + 13 + rand.nextInt(5);
new WorldGenCurvedPalms(world, rand).generate(new BlockPos(i, this.getTerrainHeightAt(world, i, k), k));
}
if (GenRates.EIH_CHANCE != 0 && rand.nextInt(GenRates.EIH_CHANCE) == 0) {
i = randDecorationCoord(rand, chunkPos.getX(), 16);
k = randDecorationCoord(rand, chunkPos.getZ(), 16);
new WorldGenEIH(world, rand).generate(new BlockPos(i, getTerrainHeightAt(world, i, k), k));
}
i = randDecorationCoord(rand, chunkPos.getX(), 16);
k = randDecorationCoord(rand, chunkPos.getZ(), 16);
new WorldGenTropicalFlowers(world, rand, BlockRegistry.flowers).generate(new BlockPos(i, getTerrainHeightAt(world, i, k), k));
if (GenRates.LARGE_PALM_CHANCE != 0 && rand.nextInt(GenRates.LARGE_PALM_CHANCE) == 0) {
// Center in chunk to avoid CCG
i = chunkPos.getX() + 16;
k = chunkPos.getZ() + 16;
new WorldGenLargePalmTrees(world, rand).generate(world, rand, new BlockPos(i, this.getTerrainHeightAt(world, i, k), k));
}
if (GenRates.FRUIT_TREE_CHANCE != 0 && rand.nextInt(GenRates.FRUIT_TREE_CHANCE) == 0) {
int treeType = new Random((long) (chunkPos.getX() >> 2) << 32 | (long) (chunkPos.getZ() >> 2)).nextInt(4);
i = randDecorationCoord(rand, chunkPos.getX(), 16);
k = randDecorationCoord(rand, chunkPos.getZ(), 16);
new WorldGenFruitTrees(world, rand, treeType).generate(new BlockPos(i, getTerrainHeightAt(world, i, k), k));
}
if (GenRates.TALL_GRASS_CHANCE != 0 && rand.nextInt(GenRates.TALL_GRASS_CHANCE) == 0) {
for (int a = 0; a < 10; a++) {
int xRand = rand.nextInt(16) + 8;
int zRand = rand.nextInt(16) + 8;
int yRand = world.getHeight(this.chunkPos.add(xRand, 0, zRand)).getY() * 2;
if (yRand > 0) {
int rando = rand.nextInt(yRand);
biome.getRandomWorldGenForGrass(rand).generate(world, rand, this.chunkPos.add(xRand, rando, zRand));
}
}
}
// Pineapples
if (GenRates.TALL_FLOWERS_CHANCE != 0 && rand.nextInt(GenRates.TALL_FLOWERS_CHANCE) == 0) {
i = chunkPos.getX();
int y = getTerrainHeightAt(world, i, k);
k = chunkPos.getZ();
BlockPos pos = new BlockPos(i, y, k);
(new WorldGenTallFlower(world, rand, BlockRegistry.pineapple.getDefaultState())).generate(pos);
}
// Irises
if (GenRates.TALL_FLOWERS_CHANCE != 0 && rand.nextInt(GenRates.TALL_FLOWERS_CHANCE) == 0) {
i = chunkPos.getX();
int y = getTerrainHeightAt(world, i, k);
k = chunkPos.getZ();
BlockPos pos = new BlockPos(i, y, k);
(new WorldGenTallFlower(world, rand, BlockRegistry.iris.getDefaultState())).generate(pos);
}
// Vanilla Logic
for (int k4 = 0; k4 < reedsPerChunk; ++k4) {
int i9 = rand.nextInt(16) + 8;
int l12 = rand.nextInt(16) + 8;
int i16 = world.getHeight(this.chunkPos.add(i9, 0, l12)).getY() * 2;
if (i16 > 0) {
int l18 = rand.nextInt(i16);
this.reedGen.generate(world, rand, this.chunkPos.add(i9, l18, l12));
}
}
BiomeDecoratorTropicsBeach.decorateForVillage(world, rand, chunkPos);
//
// for(int a = 0; a < ConfigGenRates.WATERFALL_AMOUNT; a++) {
// new WorldGenWaterfall(world, rand).generate(randDecorationCoord(rand, x, 16), WorldProviderTropicraft.MID_HEIGHT + rand.nextInt(WorldProviderTropicraft.INTER_HEIGHT), randDecorationCoord(rand, z, 16));
// }
}
use of net.tropicraft.core.common.worldgen.WorldGenNormalPalms in project Tropicraft by Tropicraft.
the class BiomeDecoratorTropicsBeach method genDecorations.
@Override
public void genDecorations(Biome biome, World world, Random rand) {
super.genDecorations(biome, world, rand);
int i = 0;
int k = 0;
if (GenRates.NORMAL_PALM_CHANCE != 0 && rand.nextInt(GenRates.NORMAL_PALM_CHANCE) == 0) {
i = chunkPos.getX() + 13 + rand.nextInt(5);
k = chunkPos.getZ() + 13 + rand.nextInt(5);
new WorldGenNormalPalms(world, rand).generate(new BlockPos(i, this.getTerrainHeightAt(world, i, k), k));
}
if (GenRates.CURVED_PALM_CHANCE != 0 && rand.nextInt(GenRates.CURVED_PALM_CHANCE) == 0) {
i = chunkPos.getX() + 13 + rand.nextInt(5);
k = chunkPos.getZ() + 13 + rand.nextInt(5);
new WorldGenCurvedPalms(world, rand).generate(new BlockPos(i, this.getTerrainHeightAt(world, i, k), k));
}
if (GenRates.LARGE_PALM_CHANCE != 0 && rand.nextInt(GenRates.LARGE_PALM_CHANCE) == 0) {
i = chunkPos.getX() + 16;
k = chunkPos.getZ() + 16;
new WorldGenLargePalmTrees(world, rand).generate(world, rand, new BlockPos(i, this.getTerrainHeightAt(world, i, k), k));
}
if (rand.nextInt(TREASURE_CHANCE) == 0) {
i = chunkPos.getX() + 13 + rand.nextInt(5);
k = chunkPos.getZ() + 13 + rand.nextInt(5);
new WorldGenTropicsTreasure(world, rand).generate(world, rand, new BlockPos(i, getTerrainHeightAt(world, i, k), k));
}
decorateForVillage(world, rand, chunkPos);
}
use of net.tropicraft.core.common.worldgen.WorldGenNormalPalms in project Tropicraft by Tropicraft.
the class BlockTropicsSapling method grow.
@Override
public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) {
// Change flag (and back) to make it show up when generated
TCGenBase.blockGenNotifyFlag = 3;
WorldGenerator gen;
TropicraftSaplings variant;
switch(variant = state.getValue(VARIANT)) {
case PALM:
int b = rand.nextInt(3);
if (b == 0) {
gen = new WorldGenLargePalmTrees(worldIn, rand);
} else if (b == 1) {
gen = new WorldGenCurvedPalms(worldIn, rand);
} else if (b == 2) {
gen = new WorldGenNormalPalms(worldIn, rand);
} else {
gen = null;
}
break;
case MAHOGANY:
gen = randomRainforestTreeGen(worldIn);
break;
default:
gen = new WorldGenFruitTrees(worldIn, rand, variant.getMeta() - 2);
break;
}
if (gen != null) {
worldIn.setBlockToAir(pos);
if (!gen.generate(worldIn, rand, pos)) {
worldIn.setBlockState(pos, state.withProperty(BlockTropicsSapling.VARIANT, variant), 3);
}
}
TCGenBase.blockGenNotifyFlag = TCGenBase.BLOCK_GEN_NOTIFY_FLAG_DEFAULT;
}
use of net.tropicraft.core.common.worldgen.WorldGenNormalPalms in project Tropicraft by Tropicraft.
the class TCWorldGenerator method generateSurface.
/**
* The generation method used in the older versions of tropicraft to generate things in the
* main world
* @param world World to generate in
* @param random Random!!!
* @param chunkX chunkX
* @param chunkZ chunkZ
*/
public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
Biome biome = world.getBiome(new BlockPos(chunkX, 0, chunkZ));
if (TropicsConfigs.genOverworld) {
// Convert to block coords rather than chunk coords
chunkX *= 16;
chunkZ *= 16;
if (world.provider.getDimension() == 0 && world.getWorldType() != WorldType.FLAT) {
int k = chunkX + random.nextInt(16) + 8;
int l = random.nextInt(62) + 64;
int i1 = chunkZ + random.nextInt(16) + 8;
if (TropicsConfigs.genOverworldFlowers) {
for (int j3 = 0; j3 < 10; j3++) {
l = random.nextInt(62) + 64;
BlockPos flowerPos = new BlockPos(k, l, i1);
(new WorldGenTropicalFlowers(world, random, BlockRegistry.flowers, TropicraftFlowers.OVERWORLD_FLOWERS)).generate(world, random, flowerPos);
}
}
if (TropicsConfigs.genOverworldEIH && random.nextInt(GenRates.EIH_CHANCE) == 0) {
l = random.nextInt(62) + 64;
BlockPos eihPos = new BlockPos(k, l, i1);
(new WorldGenEIH(world, random)).generate(world, random, eihPos);
}
if (biome.getDefaultTemperature() > 0.5F && !biome.getEnableSnow()) {
if (TropicsConfigs.genOverworldPalms && random.nextInt(10) == 0) {
if ((TropicsConfigs.genOverworldPalmsBeachOnly && biome == Biomes.BEACH) || !TropicsConfigs.genOverworldPalmsBeachOnly) {
if (TropicsConfigs.chancePalmOverworld < 0 || random.nextFloat() < (float) (TropicsConfigs.chancePalmOverworld / 100F)) {
for (int j3 = 0; j3 < TropicsConfigs.factorPalmOverworld; j3++) {
l = random.nextInt(62) + 64;
BlockPos pos;
if (random.nextInt(5) == 0) {
pos = new BlockPos(chunkX + 16, l, chunkZ + 16);
(new WorldGenLargePalmTrees(world, random)).generate(world, random, pos);
} else if (random.nextInt(5) < 3) {
int x = chunkX + 13 + random.nextInt(5);
int z = chunkZ + 13 + random.nextInt(5);
pos = new BlockPos(x, l, z);
(new WorldGenCurvedPalms(world, random)).generate(world, random, pos);
} else {
int x = chunkX + 13 + random.nextInt(5);
int z = chunkZ + 13 + random.nextInt(5);
pos = new BlockPos(x, l, z);
(new WorldGenNormalPalms(world, random)).generate(world, random, pos);
}
}
}
}
}
}
// Pineapples
if (biome.getRainfall() > 0.3F && biome.getDefaultTemperature() > 0.0F) {
if (TropicsConfigs.genOverworldPineapples && random.nextInt(TropicsConfigs.tallFlowerGenChanceOverworld) == 0) {
l = world.getHeight(chunkX, chunkZ);
BlockPos pineapplePos = new BlockPos(chunkX, l, chunkZ);
for (int t = 0; t < 3; t++) {
(new WorldGenTallFlower(world, random, BlockRegistry.pineapple.getDefaultState())).generate(pineapplePos);
}
}
}
// Bamboo
if (biome.getDefaultTemperature() > 0.2F) {
if (TropicsConfigs.genOverworldBamboo && random.nextInt(TropicsConfigs.bambooGenChanceOverworld) == 0) {
l = random.nextInt(62) + 64;
BlockPos bambooPos = new BlockPos(chunkX, l, chunkZ);
(new WorldGenBamboo(world, random)).generate(world, random, bambooPos);
}
}
}
}
}
Aggregations