diff --git a/src/java/mmm/materials/I_MRock.java b/src/java/mmm/materials/I_MRock.java new file mode 100644 index 0000000..496dab5 --- /dev/null +++ b/src/java/mmm/materials/I_MRock.java @@ -0,0 +1,7 @@ +package mmm.materials; + + +public interface I_MRock +{ + // EMPTY +} diff --git a/src/java/mmm/materials/MRock.java b/src/java/mmm/materials/MRock.java new file mode 100644 index 0000000..8d8b09e --- /dev/null +++ b/src/java/mmm/materials/MRock.java @@ -0,0 +1,66 @@ +package mmm.materials; + + +import java.util.List; + +import mmm.utils.I_UOreGenerationRegistrar; +import mmm.utils.URegistry; +import mmm.world.gen.WGOreCondition; +import net.minecraft.block.Block; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + + + +public class MRock + extends Block + implements I_MRock , I_UOreGenerationRegistrar +{ + + private WGOreCondition[] genConditions; + + + public MRock( final String name , final MapColor mapColor ) + { + this( name , mapColor , 0 , 1.5f , 10f ); + } + + + public MRock( final String name , final MapColor mapColor , final int harvestLevel ) + { + this( name , mapColor , harvestLevel , 1.5f , 10f ); + } + + + public MRock( final String name , final MapColor mapColor , final int harvestLevel , final float hardness , + final float resistance ) + { + super( Material.ROCK , mapColor ); + this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS ); + this.setHardness( hardness ); + this.setResistance( resistance ); + this.setSoundType( SoundType.STONE ); + this.setHarvestLevel( "pickaxe" , harvestLevel ); + URegistry.setIdentifiers( this , "materials" , "rock" , name ); + URegistry.addBlock( this ); + } + + + public MRock setConditions( final WGOreCondition... genConditions ) + { + this.genConditions = genConditions.clone( ); + return this; + } + + + @Override + public void addConditions( final List< WGOreCondition > conditions ) + { + for ( int i = 0 ; i < this.genConditions.length ; i++ ) { + conditions.add( this.genConditions[ i ] ); + } + } + +} diff --git a/src/java/mmm/materials/Materials.java b/src/java/mmm/materials/Materials.java index 50d1418..dda175d 100644 --- a/src/java/mmm/materials/Materials.java +++ b/src/java/mmm/materials/Materials.java @@ -1,6 +1,8 @@ package mmm.materials; +import java.util.List; + import mmm.materials.ore.MOBauxite; import mmm.materials.ore.MOCassiterite; import mmm.materials.ore.MOCinnabar; @@ -10,25 +12,33 @@ import mmm.materials.ore.MOGalena; import mmm.materials.ore.MOMalachite; import mmm.materials.ore.MORockSalt; import mmm.materials.ore.MOSphalerite; -import mmm.materials.rock.MRChalk; -import mmm.materials.rock.MRLimestone; -import mmm.materials.rock.MRSlate; +import mmm.utils.I_UOreGenerationRegistrar; import mmm.utils.I_URecipeRegistrar; import mmm.utils.URegistry; +import mmm.world.WLocation; +import mmm.world.WLocationInBiome; +import mmm.world.gen.WGOreCondition; +import mmm.world.gen.WGOreParameters; +import net.minecraft.block.Block; +import net.minecraft.block.BlockStone; import net.minecraft.block.material.MapColor; +import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.world.biome.BiomePlains; +import net.minecraft.world.biome.BiomeSwamp; public class Materials - implements I_URecipeRegistrar + implements I_URecipeRegistrar , I_UOreGenerationRegistrar { - public static final MRLimestone ROCK_LIMESTONE; - public static final MRChalk ROCK_CHALK; - public static final MRSlate ROCK_SLATE; + public static final MRock ROCK_LIMESTONE; + public static final MRock ROCK_CHALK; + public static final MRock ROCK_SLATE; + public static final MRock ROCK_BASALT; public static final MMetal GOLD; public static final MMetal IRON; @@ -61,9 +71,10 @@ public class Materials static { // Rocks - URegistry.addBlock( ROCK_LIMESTONE = new MRLimestone( ) ); - URegistry.addBlock( ROCK_CHALK = new MRChalk( ) ); - URegistry.addBlock( ROCK_SLATE = new MRSlate( ) ); + ROCK_LIMESTONE = new MRock( "limestone" , MapColor.SNOW , 0 , 1f , 7.5f ); + ROCK_CHALK = new MRock( "chalk" , MapColor.SNOW , 0 , 1f , 5f ); + ROCK_SLATE = new MRock( "slate" , MapColor.BLACK ); + ROCK_BASALT = new MRock( "basalt" , MapColor.BLACK ); // Vanilla metals GOLD = new MMetal( Blocks.GOLD_BLOCK , Items.GOLD_INGOT , Items.GOLD_NUGGET ); @@ -105,8 +116,9 @@ public class Materials ORE_GALENA = new MOGalena( ); ORE_CINNABAR = new MOCinnabar( ); - // Other recipes - URegistry.addRecipeRegistrar( new Materials( ) ); + // Other recipes, ore generation parameters, etc. + final Materials materials = new Materials( ); + URegistry.addRecipeRegistrar( materials ); } @@ -134,6 +146,21 @@ public class Materials } + public static boolean isRock( final IBlockState bs ) + { + final Block block = bs.getBlock( ); + if ( block instanceof BlockStone ) { + final BlockStone.EnumType variant = bs.getValue( BlockStone.VARIANT ); + return variant == BlockStone.EnumType.ANDESITE || variant == BlockStone.EnumType.DIORITE + || variant == BlockStone.EnumType.GRANITE || variant == BlockStone.EnumType.STONE; + } + if ( block == Blocks.COBBLESTONE ) { + return true; + } + return block instanceof I_MRock; + } + + private Materials( ) { // EMPTY @@ -187,4 +214,21 @@ public class Materials .setOutput( Materials.ITEM_COKE ).setSlag( 1 ).register( ); } + + @Override + public void addConditions( final List< WGOreCondition > conditions ) + { + conditions.add( new WGOreCondition( // + WLocation.inOverworld( ) , // + new WGOreParameters( Materials.ROCK_LIMESTONE , 15 , 40 ) ) ); + + conditions.add( new WGOreCondition( // + new WLocationInBiome<>( BiomePlains.class ) , // + new WGOreParameters( Materials.ROCK_SLATE , 15 , 40 ) ) ); + conditions.add( new WGOreCondition( // + new WLocationInBiome<>( BiomeSwamp.class ) , // + new WGOreParameters( Materials.ROCK_SLATE , 20 , 60 ) ) ); + + } + } diff --git a/src/java/mmm/materials/ore/MOCinnabar.java b/src/java/mmm/materials/ore/MOCinnabar.java index bd4f625..7ecef40 100644 --- a/src/java/mmm/materials/ore/MOCinnabar.java +++ b/src/java/mmm/materials/ore/MOCinnabar.java @@ -3,6 +3,7 @@ package mmm.materials.ore; import java.util.List; +import mmm.materials.I_MRock; import mmm.materials.MOre; import mmm.utils.I_UOreGenerationRegistrar; import mmm.world.WLocation; @@ -13,7 +14,7 @@ import mmm.world.gen.WGOreParameters; public class MOCinnabar extends MOre - implements I_UOreGenerationRegistrar + implements I_UOreGenerationRegistrar , I_MRock { public MOCinnabar( ) diff --git a/src/java/mmm/materials/rock/MRChalk.java b/src/java/mmm/materials/rock/MRChalk.java deleted file mode 100644 index e311a27..0000000 --- a/src/java/mmm/materials/rock/MRChalk.java +++ /dev/null @@ -1,28 +0,0 @@ -package mmm.materials.rock; - - -import mmm.utils.URegistry; -import net.minecraft.block.Block; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.MapColor; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; - - - -public class MRChalk - extends Block -{ - - public MRChalk( ) - { - super( Material.ROCK , MapColor.SNOW ); - this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS ); - this.setHardness( 1f ); - this.setResistance( 5f ); - this.setSoundType( SoundType.STONE ); - this.setHarvestLevel( "pickaxe" , 0 ); - URegistry.setIdentifiers( this , "materials" , "rock" , "chalk" ); - } - -} diff --git a/src/java/mmm/materials/rock/MRLimestone.java b/src/java/mmm/materials/rock/MRLimestone.java deleted file mode 100644 index d48237c..0000000 --- a/src/java/mmm/materials/rock/MRLimestone.java +++ /dev/null @@ -1,43 +0,0 @@ -package mmm.materials.rock; - - -import java.util.List; - -import mmm.utils.I_UOreGenerationRegistrar; -import mmm.utils.URegistry; -import mmm.world.WLocation; -import mmm.world.gen.WGOreCondition; -import mmm.world.gen.WGOreParameters; -import net.minecraft.block.Block; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.MapColor; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; - - - -public class MRLimestone - extends Block - implements I_UOreGenerationRegistrar -{ - - public MRLimestone( ) - { - super( Material.ROCK , MapColor.SNOW ); - this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS ); - this.setHardness( 1f ); - this.setResistance( 7.5f ); - this.setSoundType( SoundType.STONE ); - this.setHarvestLevel( "pickaxe" , 0 ); - URegistry.setIdentifiers( this , "materials" , "rock" , "limestone" ); - } - - - @Override - public void addConditions( final List< WGOreCondition > conditions ) - { - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , - new WGOreParameters( this.getDefaultState( ) , 15 , 40 ) ) ); - } - -} diff --git a/src/java/mmm/materials/rock/MRSlate.java b/src/java/mmm/materials/rock/MRSlate.java deleted file mode 100644 index 023e6f6..0000000 --- a/src/java/mmm/materials/rock/MRSlate.java +++ /dev/null @@ -1,49 +0,0 @@ -package mmm.materials.rock; - - -import java.util.List; - -import mmm.utils.I_UOreGenerationRegistrar; -import mmm.utils.URegistry; -import mmm.world.WLocationInBiome; -import mmm.world.gen.WGOreCondition; -import mmm.world.gen.WGOreParameters; -import net.minecraft.block.Block; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.MapColor; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.world.biome.BiomePlains; -import net.minecraft.world.biome.BiomeSwamp; - - - -public class MRSlate - extends Block - implements I_UOreGenerationRegistrar -{ - - public MRSlate( ) - { - super( Material.ROCK , MapColor.BLACK ); - this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS ); - this.setHardness( 1.5f ); - this.setResistance( 10f ); - this.setSoundType( SoundType.STONE ); - this.setHarvestLevel( "pickaxe" , 0 ); - URegistry.setIdentifiers( this , "materials" , "rock" , "slate" ); - } - - - @Override - public void addConditions( final List< WGOreCondition > conditions ) - { - conditions.add( new WGOreCondition( // - new WLocationInBiome<>( BiomePlains.class ) , - new WGOreParameters( this.getDefaultState( ) , 15 , 40 ) ) ); - conditions.add( new WGOreCondition( // - new WLocationInBiome<>( BiomeSwamp.class ) , - new WGOreParameters( this.getDefaultState( ) , 20 , 60 ) ) ); - } - -} diff --git a/src/java/mmm/world/gen/WGBasalt.java b/src/java/mmm/world/gen/WGBasalt.java new file mode 100644 index 0000000..692245a --- /dev/null +++ b/src/java/mmm/world/gen/WGBasalt.java @@ -0,0 +1,25 @@ +package mmm.world.gen; + + +import java.util.Random; + +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkGenerator; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraftforge.fml.common.IWorldGenerator; + + + +public class WGBasalt + implements IWorldGenerator +{ + + @Override + public void generate( final Random random , final int chunkX , final int chunkZ , final World world , + final IChunkGenerator chunkGenerator , final IChunkProvider chunkProvider ) + { + // TODO: prevent basalt from generating in some biomes + + } + +} diff --git a/src/java/mmm/world/gen/WGOreParameters.java b/src/java/mmm/world/gen/WGOreParameters.java index db80155..a405c6a 100644 --- a/src/java/mmm/world/gen/WGOreParameters.java +++ b/src/java/mmm/world/gen/WGOreParameters.java @@ -5,6 +5,7 @@ import java.util.Random; import com.google.common.base.Predicate; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; @@ -28,6 +29,35 @@ public class WGOreParameters private WorldGenMinable generator; + public WGOreParameters( final Block ore , final int clusters , final int clusterSize ) + { + this( ore.getDefaultState( ) , clusters , clusterSize , Integer.MIN_VALUE , Integer.MIN_VALUE , + BlockMatcher.forBlock( Blocks.STONE ) ); + } + + + public WGOreParameters( final Block ore , final int clusters , final int clusterSize , final int minHeight , + final int maxHeight ) + { + this( ore.getDefaultState( ) , clusters , clusterSize , minHeight , maxHeight , + BlockMatcher.forBlock( Blocks.STONE ) ); + } + + + public WGOreParameters( final Block ore , final int clusters , final int clusterSize , + final Predicate< IBlockState > matcher ) + { + this( ore.getDefaultState( ) , clusters , clusterSize , Integer.MIN_VALUE , Integer.MIN_VALUE , matcher ); + } + + + public WGOreParameters( final Block ore , final int clusters , final int clusterSize , final int minHeight , + final int maxHeight , final Predicate< IBlockState > matcher ) + { + this( ore.getDefaultState( ) , clusters , clusterSize , minHeight , maxHeight , matcher ); + } + + public WGOreParameters( final IBlockState ore , final int clusters , final int clusterSize ) { this( ore , clusters , clusterSize , Integer.MIN_VALUE , Integer.MIN_VALUE , @@ -35,8 +65,8 @@ public class WGOreParameters } - public WGOreParameters( final IBlockState ore , final int clusters , final int clusterSize , - final int minHeight , final int maxHeight ) + public WGOreParameters( final IBlockState ore , final int clusters , final int clusterSize , final int minHeight , + final int maxHeight ) { this( ore , clusters , clusterSize , minHeight , maxHeight , BlockMatcher.forBlock( Blocks.STONE ) ); } @@ -49,8 +79,8 @@ public class WGOreParameters } - public WGOreParameters( final IBlockState ore , final int clusters , final int clusterSize , - int minHeight , int maxHeight , final Predicate< IBlockState > matcher ) + public WGOreParameters( final IBlockState ore , final int clusters , final int clusterSize , int minHeight , + int maxHeight , final Predicate< IBlockState > matcher ) { if ( clusters < 1 ) { throw new IllegalArgumentException( "cluster count should be at least 1" ); diff --git a/src/resources/assets/mmm/blockstates/materials/rock/basalt.json b/src/resources/assets/mmm/blockstates/materials/rock/basalt.json new file mode 100644 index 0000000..83e101a --- /dev/null +++ b/src/resources/assets/mmm/blockstates/materials/rock/basalt.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "mmm:materials/rock/basalt" } + } +} diff --git a/src/resources/assets/mmm/lang/en_US.lang b/src/resources/assets/mmm/lang/en_US.lang index b1b5901..75f4bd7 100644 --- a/src/resources/assets/mmm/lang/en_US.lang +++ b/src/resources/assets/mmm/lang/en_US.lang @@ -11,6 +11,7 @@ gui.mmm.tech.base.am.disabled=Deactivated tile.mmm.materials.rock.limestone.name=Limestone tile.mmm.materials.rock.chalk.name=Chalk tile.mmm.materials.rock.slate.name=Slate +tile.mmm.materials.rock.basalt.name=Basalt tile.mmm.materials.ore.rock_salt.name=Rock Salt item.mmm.materials.stone.rock_salt.name=Salt Crystals diff --git a/src/resources/assets/mmm/models/block/materials/rock/basalt.json b/src/resources/assets/mmm/models/block/materials/rock/basalt.json new file mode 100644 index 0000000..388e05b --- /dev/null +++ b/src/resources/assets/mmm/models/block/materials/rock/basalt.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "mmm:blocks/materials/rock/basalt" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/rock/basalt.json b/src/resources/assets/mmm/models/item/materials/rock/basalt.json new file mode 100644 index 0000000..4a72b55 --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/rock/basalt.json @@ -0,0 +1,3 @@ +{ + "parent": "mmm:block/materials/rock/basalt" +} \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/blocks/materials/rock/basalt.png b/src/resources/assets/mmm/textures/blocks/materials/rock/basalt.png new file mode 100644 index 0000000..4ff8fe2 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/materials/rock/basalt.png differ