From 570e27300426d85eadcab097a52269f3a144fea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Fri, 8 Jul 2016 13:14:35 +0200 Subject: [PATCH] Removed specific classes for the various ores --- src/java/mmm/materials/MMetal.java | 7 ++ src/java/mmm/materials/Materials.java | 75 ++++++++++++++----- src/java/mmm/materials/ore/MOBauxite.java | 17 ----- src/java/mmm/materials/ore/MOCassiterite.java | 37 --------- src/java/mmm/materials/ore/MOCinnabar.java | 33 -------- src/java/mmm/materials/ore/MOCopper.java | 36 --------- src/java/mmm/materials/ore/MOCuprite.java | 36 --------- src/java/mmm/materials/ore/MOGalena.java | 32 -------- src/java/mmm/materials/ore/MOMalachite.java | 48 ------------ src/java/mmm/materials/ore/MORockSalt.java | 35 --------- src/java/mmm/materials/ore/MOSphalerite.java | 36 --------- 11 files changed, 62 insertions(+), 330 deletions(-) delete mode 100644 src/java/mmm/materials/ore/MOBauxite.java delete mode 100644 src/java/mmm/materials/ore/MOCassiterite.java delete mode 100644 src/java/mmm/materials/ore/MOCinnabar.java delete mode 100644 src/java/mmm/materials/ore/MOCopper.java delete mode 100644 src/java/mmm/materials/ore/MOCuprite.java delete mode 100644 src/java/mmm/materials/ore/MOGalena.java delete mode 100644 src/java/mmm/materials/ore/MOMalachite.java delete mode 100644 src/java/mmm/materials/ore/MORockSalt.java delete mode 100644 src/java/mmm/materials/ore/MOSphalerite.java diff --git a/src/java/mmm/materials/MMetal.java b/src/java/mmm/materials/MMetal.java index 8eb644c..38b80b8 100644 --- a/src/java/mmm/materials/MMetal.java +++ b/src/java/mmm/materials/MMetal.java @@ -36,6 +36,13 @@ public class MMetal } + public MMetal setBlockResistance( float resistance ) + { + this.BLOCK.setResistance( resistance ); + return this; + } + + protected MMetal( final float baseSmeltingXP , final Block block , final Item ingot , final Item nugget ) { this.SMELTING_XP = baseSmeltingXP; diff --git a/src/java/mmm/materials/Materials.java b/src/java/mmm/materials/Materials.java index dda175d..ccf814a 100644 --- a/src/java/mmm/materials/Materials.java +++ b/src/java/mmm/materials/Materials.java @@ -3,15 +3,6 @@ package mmm.materials; import java.util.List; -import mmm.materials.ore.MOBauxite; -import mmm.materials.ore.MOCassiterite; -import mmm.materials.ore.MOCinnabar; -import mmm.materials.ore.MOCopper; -import mmm.materials.ore.MOCuprite; -import mmm.materials.ore.MOGalena; -import mmm.materials.ore.MOMalachite; -import mmm.materials.ore.MORockSalt; -import mmm.materials.ore.MOSphalerite; import mmm.utils.I_UOreGenerationRegistrar; import mmm.utils.I_URecipeRegistrar; import mmm.utils.URegistry; @@ -27,8 +18,10 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.world.biome.BiomePlains; import net.minecraft.world.biome.BiomeSwamp; +import net.minecraftforge.fml.common.registry.GameRegistry; @@ -88,8 +81,8 @@ public class Materials // Custom metals - alloys BRONZE = new MMetal( "bronze" , 0f , 5f , 1 , MapColor.BROWN ); - STEEL = new MMetal( "steel" , 0f , 7f , 2 , MapColor.LIGHT_BLUE ); - Materials.STEEL.BLOCK.setResistance( 12f ); + STEEL = new MMetal( "steel" , 0f , 7f , 2 , MapColor.LIGHT_BLUE ) // + .setBlockResistance( 12f ); // RED_COPPER = new MMetal( "red_copper" , 0f , 2f , 1 , MapColor.RED ); // Items that do not correspond to metals or ores @@ -106,15 +99,30 @@ public class Materials ITEM_ROCK_SALT = Materials.makeItem( "rock_salt" ); // Actual ores - ORE_COPPER = new MOCopper( ); - ORE_MALACHITE = new MOMalachite( ); - ORE_CUPRITE = new MOCuprite( ); - ORE_CASSITERITE = new MOCassiterite( ); - ORE_SPHALERITE = new MOSphalerite( ); - ORE_ROCK_SALT = new MORockSalt( ); - ORE_BAUXITE = new MOBauxite( ); - ORE_GALENA = new MOGalena( ); - ORE_CINNABAR = new MOCinnabar( ); + ORE_COPPER = new MOre( "copper" , 1 ) // + .setMetal( Materials.COPPER ); + ORE_MALACHITE = new MOre( "malachite" , 1 )// + .setMetal( Materials.COPPER ) // + .setDrops( Materials.ITEM_MALACHITE ) // + .setExperience( 1 , 3 ); + ORE_CUPRITE = new MOre( "cuprite" , 1 ) // + .setMetal( Materials.COPPER , 2 ) // + .setDrops( Materials.ITEM_CUPRITE ) // + .setExperience( 2 , 5 ); + ORE_CASSITERITE = new MOre( "cassiterite" , 0 )// + .setMetal( Materials.TIN , 1 , E_MMetalItemType.NUGGET ) // + .setDrops( Materials.ITEM_CASSITERITE , 2 , 5 ) // + .setExperience( 2 , 5 ); + ORE_SPHALERITE = new MOre( "sphalerite" , 1 ) // + .setMetal( Materials.ZINC ) // + .setDrops( Materials.ITEM_SPHALERITE ) // + .setExperience( 1 , 3 ); + ORE_ROCK_SALT = new MOre( "rock_salt" , 0 ) // + .setDrops( Materials.ITEM_ROCK_SALT , 2 , 5 ) // + .setExperience( 0 , 1 ); + ORE_BAUXITE = new MOre( "bauxite" , 1 ); + ORE_GALENA = new MOre( "galena" , 1 ); + ORE_CINNABAR = new MOre( "cinnabar" , 1 ); // Other recipes, ore generation parameters, etc. final Materials materials = new Materials( ); @@ -170,6 +178,10 @@ public class Materials @Override public void registerRecipes( ) { + // Green dye from malachite + GameRegistry.addShapelessRecipe( new ItemStack( Items.DYE , 1 , 2 ) , + new ItemStack( Materials.ITEM_MALACHITE ) ); + // Bronze MAlloyRecipe.build( ).setName( "materials/bronze" ).setBurnTime( 400 ) // .addInput( Materials.COPPER.INGOT ) // @@ -229,6 +241,29 @@ public class Materials new WLocationInBiome<>( BiomeSwamp.class ) , // new WGOreParameters( Materials.ROCK_SLATE , 20 , 60 ) ) ); + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( Materials.ORE_COPPER , 20 , 9 , 0 , 128 ) ) ); + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( Materials.ORE_COPPER , 10 , 17 , 40 , 60 ) ) ); + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( Materials.ORE_MALACHITE , 5 , 9 , 80 , 255 ) ) ); + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( Materials.ORE_CUPRITE , 10 , 9 , 0 , 60 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , + new WGOreParameters( Materials.ORE_CASSITERITE , 10 , 9 , 45 , 80 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( Materials.ORE_SPHALERITE , 15 , 15 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( Materials.ORE_ROCK_SALT , 5 , 30 , 45 , 255 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( Materials.ORE_GALENA , 10 , 9 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( Materials.ORE_CINNABAR , 1 , 20 , 0 , 50 ) ) ); } } diff --git a/src/java/mmm/materials/ore/MOBauxite.java b/src/java/mmm/materials/ore/MOBauxite.java deleted file mode 100644 index 5c25dc8..0000000 --- a/src/java/mmm/materials/ore/MOBauxite.java +++ /dev/null @@ -1,17 +0,0 @@ -package mmm.materials.ore; - - -import mmm.materials.MOre; - - - -public class MOBauxite - extends MOre -{ - - public MOBauxite( ) - { - super( "bauxite" , 1 ); - } - -} diff --git a/src/java/mmm/materials/ore/MOCassiterite.java b/src/java/mmm/materials/ore/MOCassiterite.java deleted file mode 100644 index 93c3f2a..0000000 --- a/src/java/mmm/materials/ore/MOCassiterite.java +++ /dev/null @@ -1,37 +0,0 @@ -package mmm.materials.ore; - - -import java.util.List; - -import mmm.materials.E_MMetalItemType; -import mmm.materials.MOre; -import mmm.materials.Materials; -import mmm.utils.I_UOreGenerationRegistrar; -import mmm.world.WLocation; -import mmm.world.gen.WGOreCondition; -import mmm.world.gen.WGOreParameters; - - - -public class MOCassiterite - extends MOre - implements I_UOreGenerationRegistrar -{ - - public MOCassiterite( ) - { - super( "cassiterite" , 0 ); - this.setMetal( Materials.TIN , 1 , E_MMetalItemType.NUGGET ); - this.setDrops( Materials.ITEM_CASSITERITE , 2 , 5 ); - this.setExperience( 2 , 5 ); - } - - - @Override - public void addConditions( final List< WGOreCondition > conditions ) - { - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , - new WGOreParameters( this.getDefaultState( ) , 10 , 9 , 45 , 80 ) ) ); - } - -} diff --git a/src/java/mmm/materials/ore/MOCinnabar.java b/src/java/mmm/materials/ore/MOCinnabar.java deleted file mode 100644 index 7ecef40..0000000 --- a/src/java/mmm/materials/ore/MOCinnabar.java +++ /dev/null @@ -1,33 +0,0 @@ -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; -import mmm.world.gen.WGOreCondition; -import mmm.world.gen.WGOreParameters; - - - -public class MOCinnabar - extends MOre - implements I_UOreGenerationRegistrar , I_MRock -{ - - public MOCinnabar( ) - { - super( "cinnabar" , 1 ); - } - - - @Override - public void addConditions( final List< WGOreCondition > conditions ) - { - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , - new WGOreParameters( this.getDefaultState( ) , 1 , 20 , 0 , 50 ) ) ); - } - -} diff --git a/src/java/mmm/materials/ore/MOCopper.java b/src/java/mmm/materials/ore/MOCopper.java deleted file mode 100644 index 4f202fb..0000000 --- a/src/java/mmm/materials/ore/MOCopper.java +++ /dev/null @@ -1,36 +0,0 @@ -package mmm.materials.ore; - - -import java.util.List; - -import mmm.materials.MOre; -import mmm.materials.Materials; -import mmm.utils.I_UOreGenerationRegistrar; -import mmm.world.WLocation; -import mmm.world.gen.WGOreCondition; -import mmm.world.gen.WGOreParameters; - - - -public class MOCopper - extends MOre - implements I_UOreGenerationRegistrar -{ - - public MOCopper( ) - { - super( "copper" , 1 ); - this.setMetal( Materials.COPPER ); - } - - - @Override - public void addConditions( final List< WGOreCondition > conditions ) - { - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , - new WGOreParameters( this.getDefaultState( ) , 20 , 9 , 0 , 128 ) ) ); - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , - new WGOreParameters( this.getDefaultState( ) , 10 , 17 , 40 , 60 ) ) ); - } - -} diff --git a/src/java/mmm/materials/ore/MOCuprite.java b/src/java/mmm/materials/ore/MOCuprite.java deleted file mode 100644 index 1db2b6f..0000000 --- a/src/java/mmm/materials/ore/MOCuprite.java +++ /dev/null @@ -1,36 +0,0 @@ -package mmm.materials.ore; - - -import java.util.List; - -import mmm.materials.MOre; -import mmm.materials.Materials; -import mmm.utils.I_UOreGenerationRegistrar; -import mmm.world.WLocation; -import mmm.world.gen.WGOreCondition; -import mmm.world.gen.WGOreParameters; - - - -public class MOCuprite - extends MOre - implements I_UOreGenerationRegistrar -{ - - public MOCuprite( ) - { - super( "cuprite" , 1 ); - this.setMetal( Materials.COPPER , 2 ); - this.setDrops( Materials.ITEM_CUPRITE ); - this.setExperience( 2 , 5 ); - } - - - @Override - public void addConditions( final List< WGOreCondition > conditions ) - { - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , - new WGOreParameters( this.getDefaultState( ) , 10 , 9 , 0 , 60 ) ) ); - } - -} diff --git a/src/java/mmm/materials/ore/MOGalena.java b/src/java/mmm/materials/ore/MOGalena.java deleted file mode 100644 index 1bd242a..0000000 --- a/src/java/mmm/materials/ore/MOGalena.java +++ /dev/null @@ -1,32 +0,0 @@ -package mmm.materials.ore; - - -import java.util.List; - -import mmm.materials.MOre; -import mmm.utils.I_UOreGenerationRegistrar; -import mmm.world.WLocation; -import mmm.world.gen.WGOreCondition; -import mmm.world.gen.WGOreParameters; - - - -public class MOGalena - extends MOre - implements I_UOreGenerationRegistrar -{ - - public MOGalena( ) - { - super( "galena" , 1 ); - } - - - @Override - public void addConditions( final List< WGOreCondition > conditions ) - { - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , - new WGOreParameters( this.getDefaultState( ) , 10 , 9 ) ) ); - } - -} diff --git a/src/java/mmm/materials/ore/MOMalachite.java b/src/java/mmm/materials/ore/MOMalachite.java deleted file mode 100644 index 84fdd31..0000000 --- a/src/java/mmm/materials/ore/MOMalachite.java +++ /dev/null @@ -1,48 +0,0 @@ -package mmm.materials.ore; - - -import java.util.List; - -import mmm.materials.MOre; -import mmm.materials.Materials; -import mmm.utils.I_UOreGenerationRegistrar; -import mmm.world.WLocation; -import mmm.world.gen.WGOreCondition; -import mmm.world.gen.WGOreParameters; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.registry.GameRegistry; - - - -public class MOMalachite - extends MOre - implements I_UOreGenerationRegistrar -{ - - public MOMalachite( ) - { - super( "malachite" , 1 ); - this.setMetal( Materials.COPPER ); - this.setDrops( Materials.ITEM_MALACHITE ); - this.setExperience( 1 , 3 ); - } - - - @Override - public void addConditions( final List< WGOreCondition > conditions ) - { - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , - new WGOreParameters( this.getDefaultState( ) , 5 , 9 , 80 , 255 ) ) ); - } - - - @Override - public void registerRecipes( ) - { - super.registerRecipes( ); - GameRegistry.addShapelessRecipe( new ItemStack( Items.DYE , 1 , 2 ) , - new ItemStack( Materials.ITEM_MALACHITE ) ); - } - -} diff --git a/src/java/mmm/materials/ore/MORockSalt.java b/src/java/mmm/materials/ore/MORockSalt.java deleted file mode 100644 index 3a7c670..0000000 --- a/src/java/mmm/materials/ore/MORockSalt.java +++ /dev/null @@ -1,35 +0,0 @@ -package mmm.materials.ore; - - -import java.util.List; - -import mmm.materials.MOre; -import mmm.materials.Materials; -import mmm.utils.I_UOreGenerationRegistrar; -import mmm.world.WLocation; -import mmm.world.gen.WGOreCondition; -import mmm.world.gen.WGOreParameters; - - - -public class MORockSalt - extends MOre - implements I_UOreGenerationRegistrar -{ - - public MORockSalt( ) - { - super( "rock_salt" , 0 ); - this.setDrops( Materials.ITEM_ROCK_SALT , 2 , 5 ); - this.setExperience( 0 , 1 ); - } - - - @Override - public void addConditions( final List< WGOreCondition > conditions ) - { - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , - new WGOreParameters( this.getDefaultState( ) , 5 , 30 , 45 , 255 ) ) ); - } - -} diff --git a/src/java/mmm/materials/ore/MOSphalerite.java b/src/java/mmm/materials/ore/MOSphalerite.java deleted file mode 100644 index af83c93..0000000 --- a/src/java/mmm/materials/ore/MOSphalerite.java +++ /dev/null @@ -1,36 +0,0 @@ -package mmm.materials.ore; - - -import java.util.List; - -import mmm.materials.MOre; -import mmm.materials.Materials; -import mmm.utils.I_UOreGenerationRegistrar; -import mmm.world.WLocation; -import mmm.world.gen.WGOreCondition; -import mmm.world.gen.WGOreParameters; - - - -public class MOSphalerite - extends MOre - implements I_UOreGenerationRegistrar -{ - - public MOSphalerite( ) - { - super( "sphalerite" , 1 ); - this.setMetal( Materials.ZINC ); - this.setDrops( Materials.ITEM_SPHALERITE ); - this.setExperience( 1 , 3 ); - } - - - @Override - public void addConditions( final List< WGOreCondition > conditions ) - { - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , - new WGOreParameters( this.getDefaultState( ) , 15 , 15 ) ) ); - } - -}