From bfc69183fc76acff2bc5d1ce9fbfef446bbdbeb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Thu, 30 Jun 2016 15:27:35 +0200 Subject: [PATCH] First attempt at a limestone hill / mountain biome --- src/java/mmm/proxy/PCommon.java | 2 + src/java/mmm/world/World.java | 55 +++++++++++++++++++ .../mmm/world/biome/BiomeLimestoneHills.java | 48 ++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 src/java/mmm/world/World.java create mode 100644 src/java/mmm/world/biome/BiomeLimestoneHills.java diff --git a/src/java/mmm/proxy/PCommon.java b/src/java/mmm/proxy/PCommon.java index 605bc51..dbf5860 100644 --- a/src/java/mmm/proxy/PCommon.java +++ b/src/java/mmm/proxy/PCommon.java @@ -10,6 +10,7 @@ import mmm.utils.UAccessors; import mmm.utils.URegistry; import mmm.utils.USeat; import mmm.world.WOreGenerator; +import mmm.world.World; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @@ -23,6 +24,7 @@ public abstract class PCommon UAccessors.preInit( ); Materials.preInit( ); + World.preInit( ); Tech.preInit( ); Food.preInit( ); DecorativeBlocks.preInit( ); diff --git a/src/java/mmm/world/World.java b/src/java/mmm/world/World.java new file mode 100644 index 0000000..b5efb76 --- /dev/null +++ b/src/java/mmm/world/World.java @@ -0,0 +1,55 @@ +package mmm.world; + + +import mmm.world.biome.BiomeLimestoneHills; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.BiomeHills; +import net.minecraftforge.common.BiomeDictionary; +import net.minecraftforge.common.BiomeManager; +import net.minecraftforge.common.BiomeManager.BiomeType; +import net.minecraftforge.fml.common.registry.GameRegistry; + + + +public class World +{ + public static final BiomeLimestoneHills BIOME_LIMESTONE_HILLS; + public static final BiomeLimestoneHills BIOME_LIMESTONE_HILLS_M; + public static final BiomeLimestoneHills BIOME_LIMESTONE_HILLS_EDGE; + + static { + BIOME_LIMESTONE_HILLS = new BiomeLimestoneHills( BiomeHills.Type.NORMAL , + new Biome.BiomeProperties( "Limestone Hills" ).setBaseHeight( 1.0F ).setHeightVariation( 0.5F ) + .setTemperature( 0.2F ).setRainfall( 0.3F ) ); + World.BIOME_LIMESTONE_HILLS.setRegistryName( "mmm:biome/limestone_hills" ); + GameRegistry.register( World.BIOME_LIMESTONE_HILLS ); + BiomeManager.addBiome( BiomeType.COOL , new BiomeManager.BiomeEntry( BIOME_LIMESTONE_HILLS , 2 ) ); + BiomeManager.addBiome( BiomeType.WARM , new BiomeManager.BiomeEntry( BIOME_LIMESTONE_HILLS , 2 ) ); + BiomeDictionary.makeBestGuess( World.BIOME_LIMESTONE_HILLS ); + + BIOME_LIMESTONE_HILLS_M = new BiomeLimestoneHills( BiomeHills.Type.MUTATED , + new Biome.BiomeProperties( "Limestone Hills M" ).setBaseBiome( "mmm:biome/limestone_hills" ) + .setBaseHeight( 1.0F ).setHeightVariation( 0.5F ).setTemperature( 0.2F ).setRainfall( 0.3F ) ); + World.BIOME_LIMESTONE_HILLS_M.setRegistryName( "mmm:biome/limestone_hills_m" ); + GameRegistry.register( World.BIOME_LIMESTONE_HILLS_M ); + BiomeManager.addBiome( BiomeType.COOL , new BiomeManager.BiomeEntry( BIOME_LIMESTONE_HILLS_M , 2 ) ); + BiomeManager.addBiome( BiomeType.WARM , new BiomeManager.BiomeEntry( BIOME_LIMESTONE_HILLS_M , 2 ) ); + BiomeDictionary.makeBestGuess( World.BIOME_LIMESTONE_HILLS_M ); + + BIOME_LIMESTONE_HILLS_EDGE = new BiomeLimestoneHills( BiomeHills.Type.EXTRA_TREES , + ( new Biome.BiomeProperties( "Limestone Hills Edge" ) ).setBaseHeight( 0.8F ).setHeightVariation( 0.3F ) + .setTemperature( 0.2F ).setRainfall( 0.3F ) ); + World.BIOME_LIMESTONE_HILLS_EDGE.setRegistryName( "mmm:biome/limestone_hills_edge" ); + GameRegistry.register( World.BIOME_LIMESTONE_HILLS_EDGE ); + BiomeManager.addBiome( BiomeType.COOL , new BiomeManager.BiomeEntry( BIOME_LIMESTONE_HILLS_EDGE , 5 ) ); + BiomeManager.addBiome( BiomeType.WARM , new BiomeManager.BiomeEntry( BIOME_LIMESTONE_HILLS_EDGE , 5 ) ); + BiomeDictionary.makeBestGuess( World.BIOME_LIMESTONE_HILLS_EDGE ); + } + + + public static void preInit( ) + { + // EMPTY + } + +} diff --git a/src/java/mmm/world/biome/BiomeLimestoneHills.java b/src/java/mmm/world/biome/BiomeLimestoneHills.java new file mode 100644 index 0000000..353abd4 --- /dev/null +++ b/src/java/mmm/world/biome/BiomeLimestoneHills.java @@ -0,0 +1,48 @@ +package mmm.world.biome; + + +import java.util.Random; + +import mmm.materials.Materials; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.BiomeHills; +import net.minecraft.world.chunk.ChunkPrimer; + + + +public class BiomeLimestoneHills + extends BiomeHills +{ + + private final Type type; + + + public BiomeLimestoneHills( final BiomeHills.Type type , final Biome.BiomeProperties properties ) + { + super( type , properties ); + this.type = type; + } + + + @Override + public void genTerrainBlocks( final World worldIn , final Random rand , final ChunkPrimer chunkPrimerIn , + final int x , final int z , final double noiseVal ) + { + System.err.println( "gen at " + x + " / " + z ); + if ( this.type == BiomeHills.Type.EXTRA_TREES ) { + this.topBlock = Blocks.GRASS.getDefaultState( ); + this.fillerBlock = Materials.ROCK_LIMESTONE.getDefaultState( ); + } else if ( ( noiseVal < -1.0D || noiseVal > 2.0D ) && this.type == BiomeHills.Type.MUTATED ) { + this.topBlock = Blocks.GRAVEL.getDefaultState( ); + this.fillerBlock = Blocks.GRAVEL.getDefaultState( ); + } else { + this.topBlock = Materials.ROCK_LIMESTONE.getDefaultState( ); + this.fillerBlock = Materials.ROCK_LIMESTONE.getDefaultState( ); + } + + this.generateBiomeTerrain( worldIn , rand , chunkPrimerIn , x , z , noiseVal ); + } + +}