diff --git a/src/java/mmm/world/WDefaultGenWatcher.java b/src/java/mmm/world/WDefaultGenWatcher.java index 465633e..f556f25 100644 --- a/src/java/mmm/world/WDefaultGenWatcher.java +++ b/src/java/mmm/world/WDefaultGenWatcher.java @@ -1,7 +1,10 @@ package mmm.world; +import java.util.Random; + import mmm.world.biome.I_WBTrappedBiome; +import mmm.world.gen.WGBasalt; import mmm.world.gen.WGTrapBlocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.Biome; @@ -37,9 +40,12 @@ public class WDefaultGenWatcher final BlockPos bp = new BlockPos( event.getChunkX( ) * 16 , 0 , event.getChunkZ( ) * 16 ); final net.minecraft.world.World world = event.getWorld( ); + final Random rand = event.getRand( ); + + new WGBasalt( false ).generate( world , rand , bp ); + final Biome biome = world.getBiomeGenForCoords( bp ); // FIXME hardcoding is bad - final WGTrapBlocks traps; if ( biome instanceof BiomeDesert ) { traps = new WGTrapBlocks( false , .05f ); @@ -51,7 +57,7 @@ public class WDefaultGenWatcher return; } - traps.generate( world , event.getRand( ) , bp ); + traps.generate( world , rand , bp ); } } diff --git a/src/java/mmm/world/World.java b/src/java/mmm/world/World.java index aa60a40..e205656 100644 --- a/src/java/mmm/world/World.java +++ b/src/java/mmm/world/World.java @@ -9,7 +9,6 @@ import mmm.world.biome.WBBambooForest; import mmm.world.biome.WBLimestoneMountains; import mmm.world.biome.WBLimestonePlateau; import mmm.world.biome.WBTropicalSwamp; -import mmm.world.gen.WGBasalt; import mmm.world.gen.WGOre; import mmm.world.gen.WGOreCondition; import net.minecraftforge.common.BiomeManager.BiomeType; @@ -22,7 +21,7 @@ public class World { static { - WDefaultGenWatcher dgw = new WDefaultGenWatcher( ); + final WDefaultGenWatcher dgw = new WDefaultGenWatcher( ); MinecraftForge.TERRAIN_GEN_BUS.register( dgw ); MinecraftForge.EVENT_BUS.register( dgw ); @@ -86,9 +85,8 @@ public class World .register( ); helper.startMutation( ); helper.setNames( "Dense Bamboo Forest" , "forest/bamboo/dense" ) // - .setType( BiomeType.WARM , 1 ) // - .setExtraProperty( "Dense" ) - .register( ); + .setType( BiomeType.WARM , 1 ) // + .setExtraProperty( "Dense" ).register( ); } @@ -105,7 +103,6 @@ public class World registrar.addConditions( conditions ); } GameRegistry.registerWorldGenerator( new WGOre( conditions ) , 0 ); - GameRegistry.registerWorldGenerator( new WGBasalt( ) , 1000 ); } } diff --git a/src/java/mmm/world/biome/WBBambooForest.java b/src/java/mmm/world/biome/WBBambooForest.java index b0636e7..3f71ec5 100644 --- a/src/java/mmm/world/biome/WBBambooForest.java +++ b/src/java/mmm/world/biome/WBBambooForest.java @@ -80,7 +80,6 @@ public class WBBambooForest @Override public void decorate( final World worldIn , final Random rand , final BlockPos pos ) { - System.err.println( pos.toString( ) ); for ( int cx = pos.getX( ) ; cx < pos.getX( ) + 16 ; cx++ ) { for ( int cz = pos.getZ( ) ; cz < pos.getZ( ) + 16 ; cz++ ) { final double noise = Biome.GRASS_COLOR_NOISE.getValue( cz * 0.25D , cx * 0.25D ); diff --git a/src/java/mmm/world/gen/WGBasalt.java b/src/java/mmm/world/gen/WGBasalt.java index 435ab27..b91ed19 100644 --- a/src/java/mmm/world/gen/WGBasalt.java +++ b/src/java/mmm/world/gen/WGBasalt.java @@ -9,24 +9,27 @@ import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.DimensionType; import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkGenerator; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraftforge.fml.common.IWorldGenerator; +import net.minecraft.world.gen.feature.WorldGenerator; public class WGBasalt - implements IWorldGenerator + extends WorldGenerator { private static final IBlockState BS_BASALT = Materials.ROCK.BASALT.getDefaultState( ); + public WGBasalt( final boolean notify ) + { + super( notify ); + } + + @Override - public void generate( final Random random , final int chunkX , final int chunkZ , final World world , - final IChunkGenerator chunkGenerator , final IChunkProvider chunkProvider ) + public boolean generate( final World world , final Random rand , final BlockPos position ) { if ( world.provider.getDimensionType( ) != DimensionType.OVERWORLD ) { - return; + return false; } // TODO: prevent basalt from generating in some biomes @@ -36,7 +39,7 @@ public class WGBasalt final BlockPos.MutableBlockPos mbp = new BlockPos.MutableBlockPos( ); for ( int x = 0 ; x < 16 ; x++ ) { for ( int z = 0 ; z < 16 ; z++ ) { - mbp.setPos( chunkX * 16 + x , 0 , chunkZ * 16 + z ); + mbp.setPos( position.getX( ) + x , 0 , position.getZ( ) + z ); for ( int y = 0 ; y < 256 ; y++ ) { mbp.setY( y ); final IBlockState bs = world.getBlockState( mbp ); @@ -52,15 +55,17 @@ public class WGBasalt int offset = 0; for ( int x = 0 ; x < 16 ; x++ ) { for ( int z = 0 ; z < 16 ; z++ ) { - mbp.setPos( chunkX * 16 + x , 0 , chunkZ * 16 + z ); + mbp.setPos( position.getX( ) + x , 0 , position.getZ( ) + z ); for ( int y = 0 ; y < 256 ; y++ ) { - if ( rockNearLava[ offset++ ] && random.nextInt( 5 ) != 4 ) { + if ( rockNearLava[ offset++ ] && rand.nextInt( 5 ) != 4 ) { mbp.setY( y ); world.setBlockState( mbp , WGBasalt.BS_BASALT ); } } } } + + return true; } @@ -94,5 +99,4 @@ public class WGBasalt } } } - }