Rubber Trees
This commit is contained in:
parent
f8ca41a9ce
commit
a76384504f
9 changed files with 187 additions and 10 deletions
|
@ -7,6 +7,8 @@ import net.minecraft.world.biome.BiomeGenBase;
|
|||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -15,23 +17,21 @@ import java.util.Random;
|
|||
*/
|
||||
public class TreeGenerator implements IWorldGenerator {
|
||||
|
||||
RubberTreeGenerator treeGenerator = new RubberTreeGenerator(false, 6, Blocks.log.getDefaultState(), Blocks.leaves.getDefaultState(), false);
|
||||
|
||||
RubberTreeGenerator treeGenerator = new RubberTreeGenerator(false, 10, ModBlocks.rubberLog.getDefaultState(), ModBlocks.rubberLeaves.getDefaultState(), false);
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
|
||||
int chance = 0;
|
||||
BiomeGenBase biomeGenBase = world.getBiomeGenForCoords( new BlockPos(chunkX * 16 + 16, 72, chunkZ * 16 + 16));
|
||||
if(BiomeDictionary.isBiomeOfType(biomeGenBase, BiomeDictionary.Type.SWAMP)){
|
||||
chance += random.nextInt(10) + 5;
|
||||
}
|
||||
if(BiomeDictionary.isBiomeOfType(biomeGenBase, BiomeDictionary.Type.FOREST) || BiomeDictionary.isBiomeOfType(biomeGenBase, BiomeDictionary.Type.JUNGLE)){
|
||||
chance += random.nextInt(5) + 1;
|
||||
}
|
||||
// if(BiomeDictionary.isBiomeOfType(biomeGenBase, BiomeDictionary.Type.SWAMP)){
|
||||
// chance += random.nextInt(10) + 5;
|
||||
// }
|
||||
// if(BiomeDictionary.isBiomeOfType(biomeGenBase, BiomeDictionary.Type.FOREST) || BiomeDictionary.isBiomeOfType(biomeGenBase, BiomeDictionary.Type.JUNGLE)){
|
||||
// chance += random.nextInt(5) + 1;
|
||||
// }
|
||||
chance = 10;
|
||||
if(world.provider.isSurfaceWorld()){
|
||||
if(random.nextInt(100) + 1 <= chance * 2){
|
||||
|
||||
|
||||
treeGenerator.generate(world, random, new BlockPos(chunkX * 16 + random.nextInt(16), 72, chunkZ * 16 + random.nextInt(16)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue