Chalk - generated in limestone biomes
This commit is contained in:
parent
479e014f34
commit
e8bb5d1d54
4 changed files with 45 additions and 3 deletions
14
src/java/mmm/world/I_WBiomeWithOres.java
Normal file
14
src/java/mmm/world/I_WBiomeWithOres.java
Normal file
|
@ -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 );
|
||||
|
||||
}
|
|
@ -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( ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ) ) )
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
Reference in a new issue