Better limestone mountains
This commit is contained in:
parent
6b7e5c6e28
commit
033b927dc0
6 changed files with 305 additions and 196 deletions
|
@ -1,56 +1,41 @@
|
|||
package mmm.world;
|
||||
|
||||
|
||||
import mmm.world.biome.BiomeLimestoneHills;
|
||||
import mmm.world.biome.WBLimestoneMountains;
|
||||
import mmm.world.biome.WBLimestonePlateau;
|
||||
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.MinecraftForge;
|
||||
import net.minecraftforge.common.BiomeManager.BiomeType;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
|
||||
|
||||
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 {
|
||||
MinecraftForge.TERRAIN_GEN_BUS.register( new WDefaultGenWatcher( ) );
|
||||
WBiomeHelper helper;
|
||||
|
||||
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 );
|
||||
helper = new WBiomeHelper( WBLimestoneMountains::new );
|
||||
helper.setNames( "Limestone Mountains" , "limestone/mountains" ) //
|
||||
.setElevation( 1f , .5f ) //
|
||||
.setWeather( .3f , .2f ) //
|
||||
.setWaterColor( 0xe0ff7f ) //
|
||||
.setType( BiomeType.COOL , 5 ) //
|
||||
.setType( BiomeType.WARM , 2 ) //
|
||||
.register( );
|
||||
helper.startMutation( );
|
||||
helper.setNames( "Limestone Mountains (T)" , "limestone/mountains/t" ) //
|
||||
.setExtraProperty( "Trees" ) //
|
||||
.register( );
|
||||
helper.setNames( "Limestone Mountains (TC)" , "limestone/mountains/tc" ) //
|
||||
.setExtraProperty( "Chaos" ) //
|
||||
.register( );
|
||||
helper.setNames( "Limestone Mountains (C)" , "limestone/mountains/c" ) //
|
||||
.removeExtraProperty( "Trees" ) //
|
||||
.register( );
|
||||
|
||||
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 );
|
||||
|
||||
WBiomeHelper helper = new WBiomeHelper( WBLimestonePlateau::new );
|
||||
helper.setNames( "Limestone Plateau" , "limestone_plateau" ) //
|
||||
helper = new WBiomeHelper( WBLimestonePlateau::new );
|
||||
helper.setNames( "Limestone Plateau" , "limestone/plateau" ) //
|
||||
.setElevation( .5f , .02f ) //
|
||||
.setWeather( .6f , .5f ) //
|
||||
.setWaterColor( 0xe0ff7f ) //
|
||||
|
@ -58,23 +43,17 @@ public class World
|
|||
.setType( BiomeType.WARM , 5 ) //
|
||||
.register( );
|
||||
helper.startMutation( );
|
||||
helper.setNames( "Chaotic Limestone Plateau" , "limestone_plateau/chaos" )//
|
||||
helper.setNames( "Chaotic Limestone Plateau" , "limestone/plateau/chaotic" )//
|
||||
.setWeather( .8f , .5f ) //
|
||||
.setElevation( .6f , .07f ) //
|
||||
.setType( BiomeType.COOL , 1 ) //
|
||||
.setType( BiomeType.WARM , 1 ) //
|
||||
.setExtraProperty( "ChaosChance" , 4 ) //
|
||||
.register( );
|
||||
helper.setNames( "Chaotic Limestone Forest" , "limestone_plateau/chaos_forest" ) //
|
||||
helper.setNames( "Chaotic Limestone Forest" , "limestone/forest/chaotic" ) //
|
||||
.setExtraProperty( "Trees" )//
|
||||
.setType( BiomeType.COOL , 5 ) //
|
||||
.setType( BiomeType.WARM , 5 ) //
|
||||
.register( );
|
||||
helper.setNames( "Limestone Forest" , "limestone_plateau/forest" ) //
|
||||
helper.setNames( "Limestone Forest" , "limestone/forest" ) //
|
||||
.setElevation( .5f , .02f ) //
|
||||
.setWeather( .7f , .5f ) //
|
||||
.setType( BiomeType.COOL , 5 ) //
|
||||
.setType( BiomeType.WARM , 5 ) //
|
||||
.removeExtraProperty( "ChaosChance" )//
|
||||
.register( );
|
||||
}
|
||||
|
|
59
src/java/mmm/world/biome/A_WBLimestone.java
Normal file
59
src/java/mmm/world/biome/A_WBLimestone.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
package mmm.world.biome;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mmm.world.I_WDefaultPopulateHandler;
|
||||
import mmm.world.gen.WGLimestoneLayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.feature.WorldGenLakes;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||
|
||||
|
||||
|
||||
public abstract class A_WBLimestone
|
||||
extends Biome
|
||||
implements I_WDefaultPopulateHandler
|
||||
{
|
||||
|
||||
public A_WBLimestone( BiomeProperties properties )
|
||||
{
|
||||
super( properties );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void decorate( final World worldIn , final Random rand , final BlockPos pos )
|
||||
{
|
||||
System.err.println( "GEN " + this.getBiomeName( ) + " AT " + pos );
|
||||
super.decorate( worldIn , rand , pos );
|
||||
new WGLimestoneLayer( ).generate( worldIn , rand , pos );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onDefaultPopulate( final PopulateChunkEvent.Populate event )
|
||||
{
|
||||
// No lava lakes inside the limestone
|
||||
if ( event.getType( ) == PopulateChunkEvent.Populate.EventType.LAVA ) {
|
||||
final Random rand = event.getRand( );
|
||||
final World world = event.getWorld( );
|
||||
final int x = rand.nextInt( 16 ) + 8;
|
||||
final int y = rand.nextInt( rand.nextInt( 248 ) + 8 );
|
||||
final int z = rand.nextInt( 16 ) + 8;
|
||||
|
||||
if ( y < world.getSeaLevel( ) - 20 ) {
|
||||
new WorldGenLakes( Blocks.LAVA ).generate( world , rand ,
|
||||
new BlockPos( event.getChunkX( ) * 16 + x , y , event.getChunkZ( ) * 16 + z ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
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 )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
}
|
129
src/java/mmm/world/biome/WBLimestoneMountains.java
Normal file
129
src/java/mmm/world/biome/WBLimestoneMountains.java
Normal file
|
@ -0,0 +1,129 @@
|
|||
package mmm.world.biome;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mmm.world.WBiomeHelper;
|
||||
import net.minecraft.block.BlockDirt;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.ChunkPrimer;
|
||||
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
||||
import net.minecraft.world.gen.feature.WorldGenTaiga2;
|
||||
|
||||
|
||||
|
||||
public class WBLimestoneMountains
|
||||
extends A_WBLimestone
|
||||
{
|
||||
private static final WorldGenTaiga2 SPRUCE_GENERATOR = new WorldGenTaiga2( false );
|
||||
|
||||
private static final IBlockState BS_GRASS = Blocks.GRASS.getDefaultState( );
|
||||
private static final IBlockState BS_DIRT = Blocks.DIRT.getDefaultState( );
|
||||
private static final IBlockState BS_COARSE_DIRT = Blocks.DIRT.getDefaultState( )//
|
||||
.withProperty( BlockDirt.VARIANT , BlockDirt.DirtType.COARSE_DIRT );
|
||||
private static final IBlockState BS_GRAVEL = Blocks.GRAVEL.getDefaultState( );
|
||||
private static final IBlockState BS_STONE = Blocks.STONE.getDefaultState( );
|
||||
|
||||
private final boolean chaoticAreas;
|
||||
|
||||
|
||||
public WBLimestoneMountains( final WBiomeHelper helper )
|
||||
{
|
||||
super( helper.getProperties( ) );
|
||||
|
||||
if ( helper.hasExtraProperty( "Trees" ) ) {
|
||||
this.theBiomeDecorator.treesPerChunk = 2;
|
||||
this.theBiomeDecorator.flowersPerChunk = 2;
|
||||
this.theBiomeDecorator.grassPerChunk = 2;
|
||||
} else {
|
||||
this.theBiomeDecorator.treesPerChunk = 0;
|
||||
this.theBiomeDecorator.flowersPerChunk = 2;
|
||||
this.theBiomeDecorator.grassPerChunk = 2;
|
||||
}
|
||||
this.theBiomeDecorator.field_189870_A = 0.1f;
|
||||
|
||||
this.chaoticAreas = helper.hasExtraProperty( "Chaos" );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WorldGenAbstractTree genBigTreeChance( final Random rand )
|
||||
{
|
||||
return rand.nextInt( 3 ) > 0 ? WBLimestoneMountains.SPRUCE_GENERATOR : super.genBigTreeChance( rand );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void genTerrainBlocks( final World worldIn , final Random rand , final ChunkPrimer chunkPrimerIn ,
|
||||
final int x , final int z , final double noiseVal )
|
||||
{
|
||||
if ( noiseVal > 1. && ( noiseVal <= 2. || !this.chaoticAreas ) ) {
|
||||
this.topBlock = this.fillerBlock = WBLimestoneMountains.BS_STONE;
|
||||
} else {
|
||||
this.topBlock = WBLimestoneMountains.BS_GRASS;
|
||||
this.fillerBlock = WBLimestoneMountains.BS_DIRT;
|
||||
}
|
||||
this.generateBiomeTerrain( worldIn , rand , chunkPrimerIn , x , z , noiseVal );
|
||||
|
||||
if ( noiseVal < -1. && this.chaoticAreas ) {
|
||||
this.genChaoticArea( rand , chunkPrimerIn , x , z );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void genChaoticArea( final Random rand , final ChunkPrimer chunkPrimerIn , final int x , final int z )
|
||||
{
|
||||
final int chunkX = x & 15 , chunkZ = z & 15;
|
||||
final int groundY = this.findGround( chunkPrimerIn , chunkX , chunkZ );
|
||||
if ( groundY == -1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int stoneY = this.findStone( chunkPrimerIn , chunkX , groundY , chunkZ );
|
||||
if ( stoneY == -1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int topY = groundY + rand.nextInt( 3 );
|
||||
for ( int y = stoneY ; y <= topY ; y++ ) {
|
||||
final int v = rand.nextInt( 20 );
|
||||
IBlockState randBlock;
|
||||
if ( v < 1 ) {
|
||||
randBlock = WBLimestoneMountains.BS_GRAVEL;
|
||||
} else if ( v < 3 ) {
|
||||
randBlock = WBLimestoneMountains.BS_COARSE_DIRT;
|
||||
} else {
|
||||
randBlock = WBLimestoneMountains.BS_STONE;
|
||||
}
|
||||
chunkPrimerIn.setBlockState( chunkX , y , chunkZ , randBlock );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int findGround( final ChunkPrimer chunkPrimerIn , final int x , final int z )
|
||||
{
|
||||
for ( int y = 255 ; y >= 0 ; --y ) {
|
||||
if ( chunkPrimerIn.getBlockState( x , y , z ).getMaterial( ) != Material.AIR ) {
|
||||
return y;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
private int findStone( final ChunkPrimer chunkPrimerIn , final int x , final int fromY , final int z )
|
||||
{
|
||||
for ( int y = fromY ; y >= 0 ; --y ) {
|
||||
if ( chunkPrimerIn.getBlockState( x , y , z ).getMaterial( ) == Material.AIR ) {
|
||||
return -1;
|
||||
}
|
||||
if ( chunkPrimerIn.getBlockState( x , y , z ) == WBLimestoneMountains.BS_STONE ) {
|
||||
return y;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -3,33 +3,21 @@ package mmm.world.biome;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import mmm.materials.Materials;
|
||||
import mmm.world.I_WDefaultPopulateHandler;
|
||||
import mmm.world.WBiomeHelper;
|
||||
import mmm.world.gen.WGLimestoneChaos;
|
||||
import net.minecraft.block.BlockDirt;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
||||
import net.minecraft.world.gen.feature.WorldGenLakes;
|
||||
import net.minecraft.world.gen.feature.WorldGenTaiga1;
|
||||
import net.minecraft.world.gen.feature.WorldGenTaiga2;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||
|
||||
|
||||
|
||||
public class WBLimestonePlateau
|
||||
extends Biome
|
||||
implements I_WDefaultPopulateHandler
|
||||
extends A_WBLimestone
|
||||
{
|
||||
private static final IBlockState BS_COARSE_DIRT = Blocks.DIRT.getDefaultState( ).withProperty( BlockDirt.VARIANT ,
|
||||
BlockDirt.DirtType.COARSE_DIRT );
|
||||
private static final IBlockState BS_LIMESTONE = Materials.ROCK_LIMESTONE.getDefaultState( );
|
||||
|
||||
private static final WorldGenTaiga1 PINE_GENERATOR = new WorldGenTaiga1( );
|
||||
private static final WorldGenTaiga2 SPRUCE_GENERATOR = new WorldGenTaiga2( false );
|
||||
|
||||
|
@ -77,97 +65,9 @@ public class WBLimestonePlateau
|
|||
public void decorate( final World worldIn , final Random rand , final BlockPos pos )
|
||||
{
|
||||
if ( rand.nextInt( this.chaosChance ) == 0 ) {
|
||||
final BlockPos.MutableBlockPos mbp = new BlockPos.MutableBlockPos(
|
||||
pos.add( rand.nextInt( 16 ) + 8 , 0 , rand.nextInt( 16 ) + 8 ) );
|
||||
boolean found = false;
|
||||
for ( int y = 255 ; y >= worldIn.getSeaLevel( ) - 20 ; y-- ) {
|
||||
mbp.setY( y );
|
||||
if ( worldIn.getBlockState( mbp ).getMaterial( ) != Material.AIR ) {
|
||||
found = true;
|
||||
mbp.setY( y + 2 - rand.nextInt( 4 ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( found ) {
|
||||
System.err.println( "PIT AT " + mbp );
|
||||
new WGLimestoneChaos( ).generate( worldIn , rand , mbp );
|
||||
}
|
||||
new WGLimestoneChaos( ).generate( worldIn , rand , pos );
|
||||
}
|
||||
|
||||
super.decorate( worldIn , rand , pos );
|
||||
this.makeLimestoneLayer( worldIn , rand , pos );
|
||||
}
|
||||
|
||||
|
||||
private void makeLimestoneLayer( final World worldIn , final Random rand , final BlockPos pos )
|
||||
{
|
||||
final BlockPos.MutableBlockPos mbp = new BlockPos.MutableBlockPos( pos );
|
||||
for ( int i = 0 ; i < 16 ; i++ ) {
|
||||
for ( int j = 0 ; j < 16 ; j++ ) {
|
||||
mbp.setPos( pos.getX( ) + i , 255 , pos.getZ( ) + j );
|
||||
|
||||
int toDepth = -1;
|
||||
for ( int y = 255 ; y >= 0 ; y-- ) {
|
||||
mbp.setY( y );
|
||||
|
||||
final IBlockState bs = worldIn.getBlockState( mbp );
|
||||
if ( bs.getBlock( ) == Blocks.STONE ) {
|
||||
if ( toDepth == -1 ) {
|
||||
toDepth = 15 + rand.nextInt( 4 );
|
||||
this.replaceWithLimestone( worldIn , rand , mbp );
|
||||
} else if ( toDepth != 0 ) {
|
||||
toDepth--;
|
||||
this.replaceWithLimestone( worldIn , rand , mbp );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ( bs.getBlock( ) == Blocks.DIRT || bs.getBlock( ) == Blocks.GRASS
|
||||
|| bs.getBlock( ) == Blocks.GRAVEL ) {
|
||||
this.replaceWithCoarseDirt( worldIn , rand , mbp );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void replaceWithLimestone( final World worldIn , final Random rand , final BlockPos.MutableBlockPos mbp )
|
||||
{
|
||||
if ( rand.nextInt( 8 ) != 0 ) {
|
||||
worldIn.setBlockState( mbp , WBLimestonePlateau.BS_LIMESTONE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void replaceWithCoarseDirt( final World worldIn , final Random rand , final BlockPos.MutableBlockPos mbp )
|
||||
{
|
||||
if ( rand.nextInt( 16 ) == 0 ) {
|
||||
worldIn.setBlockState( mbp , WBLimestonePlateau.BS_COARSE_DIRT );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onDefaultPopulate( final PopulateChunkEvent.Populate event )
|
||||
{
|
||||
// No lava lakes at the surface of limestone plateaus or inside the limestone
|
||||
if ( event.getType( ) == PopulateChunkEvent.Populate.EventType.LAVA ) {
|
||||
final Random rand = event.getRand( );
|
||||
final World world = event.getWorld( );
|
||||
final int x = rand.nextInt( 16 ) + 8;
|
||||
final int y = rand.nextInt( rand.nextInt( 248 ) + 8 );
|
||||
final int z = rand.nextInt( 16 ) + 8;
|
||||
|
||||
if ( y < world.getSeaLevel( ) - 20 ) {
|
||||
new WorldGenLakes( Blocks.LAVA ).generate( world , rand ,
|
||||
new BlockPos( event.getChunkX( ) * 16 + x , y , event.getChunkZ( ) * 16 + z ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
89
src/java/mmm/world/gen/WGLimestoneLayer.java
Normal file
89
src/java/mmm/world/gen/WGLimestoneLayer.java
Normal file
|
@ -0,0 +1,89 @@
|
|||
package mmm.world.gen;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mmm.materials.Materials;
|
||||
import net.minecraft.block.BlockDirt;
|
||||
import net.minecraft.block.BlockStone;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
|
||||
|
||||
public class WGLimestoneLayer
|
||||
extends WorldGenerator
|
||||
{
|
||||
private static final IBlockState BS_DIRT = Blocks.DIRT.getDefaultState( );
|
||||
private static final IBlockState BS_COARSE_DIRT = Blocks.DIRT.getDefaultState( )//
|
||||
.withProperty( BlockDirt.VARIANT , BlockDirt.DirtType.COARSE_DIRT );
|
||||
private static final IBlockState BS_GRASS = Blocks.GRASS.getDefaultState( );
|
||||
|
||||
private static final IBlockState BS_STONE = Blocks.STONE.getDefaultState( );
|
||||
private static final IBlockState BS_GRANITE = Blocks.STONE.getDefaultState( )//
|
||||
.withProperty( BlockStone.VARIANT , BlockStone.EnumType.GRANITE );
|
||||
private static final IBlockState BS_DIORITE = Blocks.STONE.getDefaultState( )//
|
||||
.withProperty( BlockStone.VARIANT , BlockStone.EnumType.DIORITE );
|
||||
private static final IBlockState BS_ANDESITE = Blocks.STONE.getDefaultState( )//
|
||||
.withProperty( BlockStone.VARIANT , BlockStone.EnumType.ANDESITE );
|
||||
|
||||
private static final IBlockState BS_GRAVEL = Blocks.GRAVEL.getDefaultState( );
|
||||
|
||||
private static final IBlockState BS_LIMESTONE = Materials.ROCK_LIMESTONE.getDefaultState( );
|
||||
|
||||
|
||||
@Override
|
||||
public boolean generate( final World worldIn , final Random rand , final BlockPos pos )
|
||||
{
|
||||
final BlockPos.MutableBlockPos mbp = new BlockPos.MutableBlockPos( pos );
|
||||
for ( int i = 0 ; i < 16 ; i++ ) {
|
||||
for ( int j = 0 ; j < 16 ; j++ ) {
|
||||
mbp.setPos( pos.getX( ) + i , 255 , pos.getZ( ) + j );
|
||||
|
||||
int toY = -1;
|
||||
for ( int y = 255 ; y >= 0 ; y-- ) {
|
||||
mbp.setY( y );
|
||||
|
||||
final IBlockState bs = worldIn.getBlockState( mbp );
|
||||
if ( bs == WGLimestoneLayer.BS_STONE || bs == WGLimestoneLayer.BS_GRANITE
|
||||
|| bs == WGLimestoneLayer.BS_DIORITE || bs == WGLimestoneLayer.BS_ANDESITE ) {
|
||||
if ( y < toY ) {
|
||||
continue;
|
||||
}
|
||||
this.replaceWithLimestone( worldIn , rand , mbp );
|
||||
if ( toY == -1 ) {
|
||||
toY = worldIn.getSeaLevel( ) - 15 - rand.nextInt( 5 );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( bs == WGLimestoneLayer.BS_DIRT || bs == WGLimestoneLayer.BS_GRAVEL
|
||||
|| bs == WGLimestoneLayer.BS_GRASS ) {
|
||||
this.replaceWithCoarseDirt( worldIn , rand , mbp );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void replaceWithLimestone( final World worldIn , final Random rand , final BlockPos.MutableBlockPos mbp )
|
||||
{
|
||||
if ( rand.nextInt( 8 ) != 0 ) {
|
||||
worldIn.setBlockState( mbp , WGLimestoneLayer.BS_LIMESTONE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void replaceWithCoarseDirt( final World worldIn , final Random rand , final BlockPos.MutableBlockPos mbp )
|
||||
{
|
||||
if ( rand.nextInt( 16 ) == 0 ) {
|
||||
worldIn.setBlockState( mbp , WGLimestoneLayer.BS_COARSE_DIRT );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue