diff --git a/src/java/mmm/world/I_WBiomeWithOres.java b/src/java/mmm/world/I_WBiomeWithOres.java new file mode 100644 index 0000000..62ef805 --- /dev/null +++ b/src/java/mmm/world/I_WBiomeWithOres.java @@ -0,0 +1,14 @@ +package mmm.world; + + +import mmm.world.gen.WGOreParameters; +import net.minecraft.world.World; + + + +public interface I_WBiomeWithOres +{ + + public WGOreParameters[] getBiomeOres( final World world ); + +} diff --git a/src/java/mmm/world/WLocationInBiome.java b/src/java/mmm/world/WLocationInBiome.java index 65f9400..f56c1b3 100644 --- a/src/java/mmm/world/WLocationInBiome.java +++ b/src/java/mmm/world/WLocationInBiome.java @@ -24,7 +24,7 @@ public class WLocationInBiome< T extends Biome > public boolean checkLocation( final World world , final int chunkX , final int chunkZ , final IChunkProvider provider ) { - final Biome biome = world.getBiomeGenForCoords( new BlockPos( chunkX , 0 , chunkZ ) ); + final Biome biome = world.getBiomeGenForCoords( new BlockPos( chunkX * 16 , 0 , chunkZ * 16 ) ); return this.biomeType.isAssignableFrom( biome.getClass( ) ); } diff --git a/src/java/mmm/world/biome/A_WBLimestone.java b/src/java/mmm/world/biome/A_WBLimestone.java index a7095a7..05a92e0 100644 --- a/src/java/mmm/world/biome/A_WBLimestone.java +++ b/src/java/mmm/world/biome/A_WBLimestone.java @@ -3,8 +3,14 @@ package mmm.world.biome; import java.util.Random; +import com.google.common.base.Predicates; + +import mmm.materials.Materials; +import mmm.world.I_WBiomeWithOres; import mmm.world.I_WDefaultPopulateHandler; import mmm.world.gen.WGLimestoneLayer; +import mmm.world.gen.WGOreParameters; +import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -16,7 +22,7 @@ import net.minecraftforge.event.terraingen.PopulateChunkEvent; public abstract class A_WBLimestone extends Biome - implements I_WDefaultPopulateHandler + implements I_WDefaultPopulateHandler , I_WBiomeWithOres { public A_WBLimestone( BiomeProperties properties ) @@ -28,7 +34,6 @@ public abstract class A_WBLimestone @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 ); } @@ -56,4 +61,16 @@ public abstract class A_WBLimestone return true; } + + @Override + public WGOreParameters[] getBiomeOres( final World worldIn ) + { + return new WGOreParameters[] { + new WGOreParameters( Materials.ROCK_CHALK.getDefaultState( ) , 15 , 20 , // + worldIn.getSeaLevel( ) - 20 , 255 , // + Predicates.or( BlockMatcher.forBlock( Blocks.STONE ) , + BlockMatcher.forBlock( Materials.ROCK_LIMESTONE ) ) ) + }; + } + } diff --git a/src/java/mmm/world/gen/WGOre.java b/src/java/mmm/world/gen/WGOre.java index 9fc2a49..9a80fbe 100644 --- a/src/java/mmm/world/gen/WGOre.java +++ b/src/java/mmm/world/gen/WGOre.java @@ -4,7 +4,10 @@ package mmm.world.gen; import java.util.ArrayList; import java.util.Random; +import mmm.world.I_WBiomeWithOres; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.fml.common.IWorldGenerator; @@ -28,6 +31,14 @@ public class WGOre public void generate( final Random random , final int chunkX , final int chunkZ , final World world , final IChunkGenerator chunkGenerator , final IChunkProvider chunkProvider ) { + System.err.println( "GEN ORES " + chunkX + " / " + chunkZ ); + final Biome biome = world.getBiomeGenForCoords( new BlockPos( chunkX * 16 , 0 , chunkZ * 16 ) ); + if ( biome instanceof I_WBiomeWithOres ) { + for ( final WGOreParameters parameters : ( (I_WBiomeWithOres) biome ).getBiomeOres( world ) ) { + parameters.generate( world , random , chunkX , chunkZ ); + } + } + final int n = this.conditions.size( ); for ( int i = 0 ; i < n ; i++ ) { final WGOreCondition cond = this.conditions.get( i );