83 lines
3 KiB
Java
Executable file
83 lines
3 KiB
Java
Executable file
package common.biome;
|
|
|
|
import common.block.BlockTallGrass;
|
|
import common.entity.animal.EntityChicken;
|
|
import common.entity.animal.EntityOcelot;
|
|
import common.init.Blocks;
|
|
import common.rng.Random;
|
|
import common.world.BlockPos;
|
|
import common.world.State;
|
|
import common.world.WorldServer;
|
|
import common.worldgen.FeatureGenerator;
|
|
import common.worldgen.foliage.WorldGenMelon;
|
|
import common.worldgen.foliage.WorldGenShrub;
|
|
import common.worldgen.foliage.WorldGenTallGrass;
|
|
import common.worldgen.foliage.WorldGenVines;
|
|
import common.worldgen.tree.WorldGenBaseTree;
|
|
import common.worldgen.tree.WorldGenJungle;
|
|
import common.worldgen.tree.WorldGenTree;
|
|
|
|
public class BiomeJungle extends Biome
|
|
{
|
|
private static final State LOG = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE);
|
|
private static final State LEAVES = Blocks.jungle_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
|
|
private static final State BUSH = Blocks.oak_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
|
|
|
|
private final boolean edge;
|
|
|
|
public BiomeJungle(int id, boolean edge)
|
|
{
|
|
super(id);
|
|
this.edge = edge;
|
|
|
|
if (edge)
|
|
{
|
|
this.treesPerChunk = 2;
|
|
}
|
|
else
|
|
{
|
|
this.treesPerChunk = 50;
|
|
}
|
|
|
|
this.grassPerChunk = 25;
|
|
this.flowersPerChunk = 4;
|
|
|
|
if (!edge)
|
|
{
|
|
this.mobs.add(new RngSpawn(EntityOcelot.class, 2, 1, 1));
|
|
}
|
|
|
|
this.mobs.add(new RngSpawn(EntityChicken.class, 10, 4, 4));
|
|
}
|
|
|
|
public WorldGenTree genBigTreeChance(Random rand)
|
|
{
|
|
return (WorldGenTree)(rand.chance(10) ? this.worldGeneratorBigTree : (rand.chance(2) ? new WorldGenShrub(LOG, BUSH) : (!this.edge && rand.chance(3) ? new WorldGenJungle(false, 10, 20, LOG, LEAVES) : new WorldGenBaseTree(false, rand.range(4, 10), LOG, LEAVES, true))));
|
|
}
|
|
|
|
/**
|
|
* Gets a WorldGen appropriate for this biome.
|
|
*/
|
|
public FeatureGenerator getRandomWorldGenForGrass(Random rand)
|
|
{
|
|
return rand.chance(4) ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
|
|
}
|
|
|
|
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
|
|
{
|
|
super.decorate(worldIn, rand, pos);
|
|
int i = rand.chOffset();
|
|
int j = rand.chOffset();
|
|
int k = rand.zrange(worldIn.getHeight(pos.add(i, 0, j)).getY() * 2);
|
|
(new WorldGenMelon()).generate(worldIn, rand, pos.add(i, k, j));
|
|
WorldGenVines worldgenvines = new WorldGenVines();
|
|
|
|
for (j = 0; j < 50; ++j)
|
|
{
|
|
k = rand.chOffset();
|
|
int l = 128;
|
|
int i1 = rand.chOffset();
|
|
worldgenvines.generate(worldIn, rand, pos.add(k, 128, i1));
|
|
}
|
|
}
|
|
}
|