From 76e75957f58f14603384fb2f035030ea2d11e618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 9 Jul 2016 17:43:52 +0200 Subject: [PATCH] Materials refactoring Now with stuff like "Materials.ORE.BAUXITE" --- src/java/mmm/materials/MAlloys.java | 77 ++++++ src/java/mmm/materials/MItems.java | 63 +++++ src/java/mmm/materials/MLeaves.java | 4 +- src/java/mmm/materials/MLog.java | 4 +- src/java/mmm/materials/MMetals.java | 30 ++ src/java/mmm/materials/MOres.java | 110 ++++++++ src/java/mmm/materials/MPlanks.java | 4 +- src/java/mmm/materials/MRocks.java | 53 ++++ src/java/mmm/materials/MSapling.java | 4 +- .../mmm/materials/{MWood.java => MTree.java} | 34 +-- src/java/mmm/materials/MTrees.java | 23 ++ src/java/mmm/materials/Materials.java | 260 +----------------- .../base/alloy_furnace/TBAFTileEntity.java | 4 +- src/java/mmm/tech/tools/TechTools.java | 13 +- src/java/mmm/world/biome/A_WBLimestone.java | 6 +- src/java/mmm/world/gen/WGBasalt.java | 2 +- src/java/mmm/world/gen/WGLimestoneChaos.java | 10 +- src/java/mmm/world/gen/WGLimestoneLayer.java | 2 +- .../mmm/world/trees/A_MTreeGenerator.java | 8 +- 19 files changed, 416 insertions(+), 295 deletions(-) create mode 100644 src/java/mmm/materials/MAlloys.java create mode 100644 src/java/mmm/materials/MItems.java create mode 100644 src/java/mmm/materials/MMetals.java create mode 100644 src/java/mmm/materials/MOres.java create mode 100644 src/java/mmm/materials/MRocks.java rename src/java/mmm/materials/{MWood.java => MTree.java} (92%) create mode 100644 src/java/mmm/materials/MTrees.java diff --git a/src/java/mmm/materials/MAlloys.java b/src/java/mmm/materials/MAlloys.java new file mode 100644 index 0000000..1ef6287 --- /dev/null +++ b/src/java/mmm/materials/MAlloys.java @@ -0,0 +1,77 @@ +package mmm.materials; + + +import mmm.utils.I_URecipeRegistrar; +import mmm.utils.URegistry; +import net.minecraft.block.material.MapColor; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; + + + +public class MAlloys + implements I_URecipeRegistrar +{ + public final MMetal BRONZE; + public final MMetal STEEL; + // public static final MMetal RED_COPPER; + + + MAlloys( ) + { + URegistry.addRecipeRegistrar( this ); + + BRONZE = new MMetal( "bronze" , 0f , 5f , 1 , MapColor.BROWN ); + STEEL = new MMetal( "steel" , 0f , 7f , 2 , MapColor.LIGHT_BLUE ) // + .setBlockResistance( 12f ); + // RED_COPPER = new MMetal( "red_copper" , 0f , 2f , 1 , MapColor.RED ); + } + + + @Override + public void registerRecipes( ) + { + // Bronze + MAlloyRecipe.build( ).setName( "materials/bronze" ).setBurnTime( 400 ) // + .addInput( Materials.METAL.COPPER.INGOT ) // + .addInput( Materials.METAL.TIN.NUGGET ) // + .setOutput( this.BRONZE.INGOT ).setSlag( 1 ) // + .register( ); + + // Pig iron + MAlloyRecipe.build( ).setName( "materials/pig_iron/from_ingot" ).setBurnTime( 1600 ) // + .addInput( Materials.METAL.IRON.INGOT ) // + .addInput( Materials.ROCK.LIMESTONE ) // + .addInput( Materials.ITEM.COKE ) // + .setOutput( Materials.ITEM.PIG_IRON_INGOT , 2 ).setSlag( 3 ) // + .register( ); + MAlloyRecipe.build( ).setName( "materials/pig_iron/from_ore" ).setBurnTime( 1600 ) // + .addInput( Blocks.IRON_ORE ) // + .addInput( Materials.ROCK.LIMESTONE ) // + .addInput( Materials.ITEM.COKE ) // + .setOutput( Materials.ITEM.PIG_IRON_INGOT ).setSlag( 5 ) // + .register( ); + + // Steel + MAlloyRecipe.build( ).setName( "materials/steel/from_ingot" ).setBurnTime( 3200 ) // + .addInput( Materials.METAL.IRON.INGOT ) // + .addInput( Materials.ROCK.LIMESTONE ) // + .addInput( Materials.ITEM.PIG_IRON_INGOT ) // + .setOutput( this.STEEL.INGOT , 2 ).setSlag( 3 ) // + .register( ); + MAlloyRecipe.build( ).setName( "materials/steel/from_ore" ).setBurnTime( 3200 ) // + .addInput( Blocks.IRON_ORE ) // + .addInput( Materials.ROCK.LIMESTONE ) // + .addInput( Materials.ITEM.PIG_IRON_INGOT ) // + .setOutput( this.STEEL.INGOT ).setSlag( 5 ) // + .register( ); + + // MAlloyRecipe.build( ).setName( "materials/red_copper" ).setBurnTime( 800 ) + // .addInput( Materials.COPPER.INGOT , 1 ).addInput( Items.REDSTONE , 2 ) + // .setOutput( Materials.RED_COPPER.INGOT ).setSlag( 1 ).register( ); + + // XXX coke is not an alloy + MAlloyRecipe.build( ).setName( "materials/coke" ).setBurnTime( 3200 ).addInput( Items.COAL , 2 ) + .setOutput( Materials.ITEM.COKE ).setSlag( 1 ).register( ); + } +} diff --git a/src/java/mmm/materials/MItems.java b/src/java/mmm/materials/MItems.java new file mode 100644 index 0000000..30e7b8e --- /dev/null +++ b/src/java/mmm/materials/MItems.java @@ -0,0 +1,63 @@ +package mmm.materials; + + +import mmm.utils.I_URecipeRegistrar; +import mmm.utils.URegistry; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.registry.GameRegistry; + + + +public class MItems + implements I_URecipeRegistrar +{ + public final Item SLAG; + public final Item COKE; + public final Item PIG_IRON_INGOT; + public final Item MALACHITE; + public final Item CUPRITE; + public final Item CASSITERITE; + public final Item SPHALERITE; + public final Item ROCK_SALT; + public final Item SULPHUR_POWDER; + public final Item SALTPETER; + + + MItems( ) + { + URegistry.addRecipeRegistrar( this ); + + // Items that do not correspond to metals or ores + SLAG = Materials.makeItem( "slag" ); + COKE = Materials.makeFuel( "coke" , 9600 ); + PIG_IRON_INGOT = new MMetalItem( E_MMetalItemType.INGOT , "pig_iron" ); + URegistry.addItem( PIG_IRON_INGOT ); + + // Ore drops + MALACHITE = Materials.makeItem( "malachite" ); + CUPRITE = Materials.makeItem( "cuprite" ); + CASSITERITE = Materials.makeItem( "cassiterite" ); + SPHALERITE = Materials.makeItem( "sphalerite" ); + ROCK_SALT = Materials.makeItem( "rock_salt" ); + SULPHUR_POWDER = Materials.makeItem( "sulphur_powder" ); + SALTPETER = Materials.makeItem( "saltpeter_powder" ); + } + + + @Override + public void registerRecipes( ) + { + // Green dye from malachite + GameRegistry.addShapelessRecipe( new ItemStack( Items.DYE , 1 , 2 ) , + new ItemStack( Materials.ITEM.MALACHITE ) ); + + // Gunpowder from saltpeter, sulphur and charcoal + GameRegistry.addShapelessRecipe( new ItemStack( Items.GUNPOWDER ) , // + new ItemStack( Materials.ITEM.SALTPETER ) , // + new ItemStack( Materials.ITEM.SULPHUR_POWDER ) , // + new ItemStack( Items.COAL , 1 , 1 ) ); + } + +} diff --git a/src/java/mmm/materials/MLeaves.java b/src/java/mmm/materials/MLeaves.java index 1093440..cd68417 100644 --- a/src/java/mmm/materials/MLeaves.java +++ b/src/java/mmm/materials/MLeaves.java @@ -37,10 +37,10 @@ public class MLeaves implements I_UTintedBlock , I_UTintedItem { - private final MWood wood; + private final MTree wood; - public MLeaves( final MWood wood ) + public MLeaves( final MTree wood ) { this.wood = wood; diff --git a/src/java/mmm/materials/MLog.java b/src/java/mmm/materials/MLog.java index e68e885..3638964 100644 --- a/src/java/mmm/materials/MLog.java +++ b/src/java/mmm/materials/MLog.java @@ -14,10 +14,10 @@ public class MLog extends BlockLog { - public final MWood wood; + public final MTree wood; - public MLog( final MWood wood ) + public MLog( final MTree wood ) { super( ); this.wood = wood; diff --git a/src/java/mmm/materials/MMetals.java b/src/java/mmm/materials/MMetals.java new file mode 100644 index 0000000..160ab7f --- /dev/null +++ b/src/java/mmm/materials/MMetals.java @@ -0,0 +1,30 @@ +package mmm.materials; + + +import net.minecraft.block.material.MapColor; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; + + + +public class MMetals +{ + public final MMetal GOLD; + public final MMetal IRON; + public final MMetal COPPER; + public final MMetal TIN; + public final MMetal ZINC; + + + MMetals( ) + { + GOLD = new MMetal( Blocks.GOLD_BLOCK , Items.GOLD_INGOT , Items.GOLD_NUGGET ); + IRON = new MMetal( Blocks.IRON_BLOCK , Items.IRON_INGOT , // + new MMetalItem( E_MMetalItemType.NUGGET , "iron" ) ); + + COPPER = new MMetal( "copper" , 0.4f , 4f , 1 , MapColor.DIRT ); + TIN = new MMetal( "tin" , 0.6f , 1f , 0 , MapColor.GRAY ); + ZINC = new MMetal( "zinc" , 0.4f , 4f , 1 , MapColor.GRAY ); + + } +} diff --git a/src/java/mmm/materials/MOres.java b/src/java/mmm/materials/MOres.java new file mode 100644 index 0000000..c6aa387 --- /dev/null +++ b/src/java/mmm/materials/MOres.java @@ -0,0 +1,110 @@ +package mmm.materials; + + +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.state.pattern.BlockMatcher; +import net.minecraft.init.Blocks; + + + +public class MOres + implements I_UOreGenerationRegistrar +{ + public final MOre COPPER; + public final MOre MALACHITE; + public final MOre CUPRITE; + public final MOre CASSITERITE; + public final MOre SPHALERITE; + public final MOre ROCK_SALT; + public final MOre BAUXITE; + public final MOre GALENA; + public final MOre CINNABAR; + public final MOre SULPHUR; + public final MOre SILVER; + public final MOre SALTPETER; + + + MOres( ) + { + URegistry.addOreGenerationRegistrar( this ); + + COPPER = new MOre( "copper" , 1 ) // + .setMetal( Materials.METAL.COPPER ); + MALACHITE = new MOre( "malachite" , 1 )// + .setMetal( Materials.METAL.COPPER ) // + .setDrops( Materials.ITEM.MALACHITE ) // + .setExperience( 1 , 3 ); + CUPRITE = new MOre( "cuprite" , 1 ) // + .setMetal( Materials.METAL.COPPER , 2 ) // + .setDrops( Materials.ITEM.CUPRITE ) // + .setExperience( 2 , 5 ); + CASSITERITE = new MOre( "cassiterite" , 0 )// + .setMetal( Materials.METAL.TIN , 1 , E_MMetalItemType.NUGGET ) // + .setDrops( Materials.ITEM.CASSITERITE , 2 , 5 ) // + .setExperience( 2 , 5 ); + SPHALERITE = new MOre( "sphalerite" , 1 ) // + .setMetal( Materials.METAL.ZINC ) // + .setDrops( Materials.ITEM.SPHALERITE ) // + .setExperience( 1 , 3 ); + ROCK_SALT = new MOre( "rock_salt" , 0 ) // + .setDrops( Materials.ITEM.ROCK_SALT , 2 , 5 ) // + .setExperience( 0 , 1 ); + BAUXITE = new MOre( "bauxite" , 1 ); + GALENA = new MOre( "galena" , 1 ); + CINNABAR = new MOre( "cinnabar" , 1 ); + SULPHUR = new MOre( "sulphur" , 0 ) // + .setResistance( 2.0f ) // + .setHardness( 1.0f ) // + .setDrops( Materials.ITEM.SULPHUR_POWDER , 3 , 6 ) // + .setExperience( 1 , 2 ); + SILVER = new MOre( "silver" , 2 ); + SALTPETER = new MOre( "saltpeter" , 0 ) // + .setDrops( Materials.ITEM.SALTPETER , 4 , 8 ) // + .setExperience( 0 , 1 ); + } + + + @Override + public void addConditions( final List< WGOreCondition > conditions ) + { + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( this.COPPER , 20 , 9 , 0 , 128 ) ) ); + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( this.COPPER , 10 , 17 , 40 , 60 ) ) ); + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( this.MALACHITE , 5 , 9 , 80 , 255 ) ) ); + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( this.CUPRITE , 10 , 9 , 0 , 60 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , + new WGOreParameters( this.CASSITERITE , 5 , 9 , 45 , 80 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( this.SPHALERITE , 15 , 15 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( this.ROCK_SALT , 1 , 30 , 45 , 255 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( this.GALENA , 10 , 9 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( this.CINNABAR , 1 , 20 , 0 , 50 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inTheNether( ) , // + new WGOreParameters( this.SULPHUR , 5 , 25 , // + BlockMatcher.forBlock( Blocks.NETHERRACK ) ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( this.SILVER , 3 , 9 , 0 , 40 ) ) ); + + conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // + new WGOreParameters( this.SALTPETER , 10 , 9 , 0 , 80 ) ) ); + } +} diff --git a/src/java/mmm/materials/MPlanks.java b/src/java/mmm/materials/MPlanks.java index 9a4b079..2223290 100644 --- a/src/java/mmm/materials/MPlanks.java +++ b/src/java/mmm/materials/MPlanks.java @@ -14,10 +14,10 @@ public class MPlanks extends Block { - public final MWood wood; + public final MTree wood; - public MPlanks( final MWood wood ) + public MPlanks( final MTree wood ) { super( Material.WOOD ); this.wood = wood; diff --git a/src/java/mmm/materials/MRocks.java b/src/java/mmm/materials/MRocks.java new file mode 100644 index 0000000..f552c86 --- /dev/null +++ b/src/java/mmm/materials/MRocks.java @@ -0,0 +1,53 @@ +package mmm.materials; + + +import java.util.List; + +import mmm.utils.I_UOreGenerationRegistrar; +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.material.MapColor; +import net.minecraft.world.biome.BiomePlains; +import net.minecraft.world.biome.BiomeSwamp; + + + +public class MRocks + implements I_UOreGenerationRegistrar +{ + + public final MRock LIMESTONE; + public final MRock CHALK; + public final MRock SLATE; + public final MRock BASALT; + + + MRocks( ) + { + URegistry.addOreGenerationRegistrar( this ); + + this.LIMESTONE = new MRock( "limestone" , MapColor.SNOW , 0 , 1f , 7.5f ); + this.CHALK = new MRock( "chalk" , MapColor.SNOW , 0 , 1f , 5f ); + this.SLATE = new MRock( "slate" , MapColor.BLACK ); + this.BASALT = new MRock( "basalt" , MapColor.BLACK ); + } + + + @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/MSapling.java b/src/java/mmm/materials/MSapling.java index 1e7ee5f..97c3614 100644 --- a/src/java/mmm/materials/MSapling.java +++ b/src/java/mmm/materials/MSapling.java @@ -31,10 +31,10 @@ public class MSapling { private static final PropertyInteger STAGE = PropertyInteger.create( "stage" , 0 , 15 ); - public final MWood wood; + public final MTree wood; - public MSapling( final MWood wood ) + public MSapling( final MTree wood ) { super( Material.PLANTS ); this.wood = wood; diff --git a/src/java/mmm/materials/MWood.java b/src/java/mmm/materials/MTree.java similarity index 92% rename from src/java/mmm/materials/MWood.java rename to src/java/mmm/materials/MTree.java index 16199e9..adf4730 100644 --- a/src/java/mmm/materials/MWood.java +++ b/src/java/mmm/materials/MTree.java @@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry; -public class MWood +public class MTree implements I_URecipeRegistrar { public static interface I_SaplingChecker @@ -70,7 +70,7 @@ public class MWood private WorldGenAbstractTree genMega; - public MWood( final String name ) + public MTree( final String name ) { this.NAME = name; this.LOG = new MLog( this ); @@ -80,28 +80,28 @@ public class MWood } - public MWood setBarkColor( final MapColor barkColor ) + public MTree setBarkColor( final MapColor barkColor ) { this.barkColor = barkColor; return this; } - public MWood setPlankColor( final MapColor plankColor ) + public MTree setPlankColor( final MapColor plankColor ) { this.plankColor = plankColor; return this; } - public MWood setSaplingDropChance( final int chance ) + public MTree setSaplingDropChance( final int chance ) { this.saplingDropChance = chance; return this; } - public MWood setFruit( final Item fruit , final float dropChance ) + public MTree setFruit( final Item fruit , final float dropChance ) { this.fruit = fruit; this.fruitDropChance = (int) ( 200 * dropChance ); @@ -109,7 +109,7 @@ public class MWood } - public MWood setBaseFireInfo( final int encouragement , final int flammability ) + public MTree setBaseFireInfo( final int encouragement , final int flammability ) { this.baseFireEncouragement = encouragement; this.baseFlammability = flammability; @@ -117,28 +117,28 @@ public class MWood } - public MWood setSaplingGrowthStages( final int stages ) + public MTree setSaplingGrowthStages( final int stages ) { this.saplingGrowthStages = stages; return this; } - public MWood setBonemealChance( final float chance ) + public MTree setBonemealChance( final float chance ) { this.bonemealChance = chance; return this; } - public MWood setGrowthChance( final float chance ) + public MTree setGrowthChance( final float chance ) { this.growthChance = chance; return this; } - public MWood setGrowthLightConditions( final int min , final int max ) + public MTree setGrowthLightConditions( final int min , final int max ) { this.growthMinLight = min; this.growthMaxLight = max; @@ -146,14 +146,14 @@ public class MWood } - public MWood setSaplingCheck( final I_SaplingChecker check ) + public MTree setSaplingCheck( final I_SaplingChecker check ) { this.saplingCheck = check; return this; } - public MWood setTreeGenerator( final A_MTreeGenerator generator ) + public MTree setTreeGenerator( final A_MTreeGenerator generator ) { this.genNormal = generator; if ( generator != null ) { @@ -163,13 +163,13 @@ public class MWood } - public MWood setBigTreeGenerator( final A_MTreeGenerator generator ) + public MTree setBigTreeGenerator( final A_MTreeGenerator generator ) { return this.setBigTreeGenerator( generator , .1f ); } - public MWood setBigTreeGenerator( final A_MTreeGenerator generator , final float chance ) + public MTree setBigTreeGenerator( final A_MTreeGenerator generator , final float chance ) { this.genBig = generator; this.genBigChance = chance; @@ -180,7 +180,7 @@ public class MWood } - public MWood setMegaTreeGenerator( final A_MTreeGenerator generator ) + public MTree setMegaTreeGenerator( final A_MTreeGenerator generator ) { this.genMega = generator; if ( generator != null ) { @@ -190,7 +190,7 @@ public class MWood } - public MWood register( ) + public MTree register( ) { URegistry.addBlock( this.LOG ); URegistry.addBlock( this.LEAVES ); diff --git a/src/java/mmm/materials/MTrees.java b/src/java/mmm/materials/MTrees.java new file mode 100644 index 0000000..02931e7 --- /dev/null +++ b/src/java/mmm/materials/MTrees.java @@ -0,0 +1,23 @@ +package mmm.materials; + + +import mmm.world.trees.MHeveaGenerator; +import net.minecraft.block.material.MapColor; + + + +public class MTrees +{ + + public final MTree HEVEA; + + + MTrees( ) + { + HEVEA = new MTree( "hevea" ) // + .setBarkColor( MapColor.GRAY ) // + .setBaseFireInfo( 5 , 8 ) // + .setTreeGenerator( new MHeveaGenerator( true ) ) // + .register( ); + } +} diff --git a/src/java/mmm/materials/Materials.java b/src/java/mmm/materials/Materials.java index a91bb4d..cf1bab7 100644 --- a/src/java/mmm/materials/Materials.java +++ b/src/java/mmm/materials/Materials.java @@ -1,160 +1,32 @@ package mmm.materials; -import java.util.List; - -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 mmm.world.trees.MHeveaGenerator; 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.block.state.pattern.BlockMatcher; 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; public class Materials - implements I_URecipeRegistrar , I_UOreGenerationRegistrar { - 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 METAL_GOLD; - public static final MMetal METAL_IRON; - public static final MMetal METAL_COPPER; - public static final MMetal METAL_TIN; - public static final MMetal METAL_ZINC; - - public static final MMetal METAL_BRONZE; - public static final MMetal METAL_STEEL; - // public static final MMetal RED_COPPER; - - public static final MWood WOOD_HEVEA; - - public static final Item ITEM_SLAG; - public static final Item ITEM_COKE; - public static final Item ITEM_PIG_IRON_INGOT; - public static final Item ITEM_MALACHITE; - public static final Item ITEM_CUPRITE; - public static final Item ITEM_CASSITERITE; - public static final Item ITEM_SPHALERITE; - public static final Item ITEM_ROCK_SALT; - public static final Item ITEM_SULPHUR_POWDER; - public static final Item ITEM_SALTPETER; - - public static final MOre ORE_COPPER; - public static final MOre ORE_MALACHITE; - public static final MOre ORE_CUPRITE; - public static final MOre ORE_CASSITERITE; - public static final MOre ORE_SPHALERITE; - public static final MOre ORE_ROCK_SALT; - public static final MOre ORE_BAUXITE; - public static final MOre ORE_GALENA; - public static final MOre ORE_CINNABAR; - public static final MOre ORE_SULPHUR; - public static final MOre ORE_SILVER; - public static final MOre ORE_SALTPETER; + public static final MRocks ROCK; + public static final MMetals METAL; + public static final MAlloys ALLOY; + public static final MTrees TREE; + public static final MItems ITEM; + public static final MOres ORE; static { - // Rocks - 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 - METAL_GOLD = new MMetal( Blocks.GOLD_BLOCK , Items.GOLD_INGOT , Items.GOLD_NUGGET ); - METAL_IRON = new MMetal( Blocks.IRON_BLOCK , Items.IRON_INGOT , // - new MMetalItem( E_MMetalItemType.NUGGET , "iron" ) ); - - // Custom metals - pure - METAL_COPPER = new MMetal( "copper" , 0.4f , 4f , 1 , MapColor.DIRT ); - METAL_TIN = new MMetal( "tin" , 0.6f , 1f , 0 , MapColor.GRAY ); - METAL_ZINC = new MMetal( "zinc" , 0.4f , 4f , 1 , MapColor.GRAY ); - - // Custom metals - alloys - METAL_BRONZE = new MMetal( "bronze" , 0f , 5f , 1 , MapColor.BROWN ); - METAL_STEEL = new MMetal( "steel" , 0f , 7f , 2 , MapColor.LIGHT_BLUE ) // - .setBlockResistance( 12f ); - // RED_COPPER = new MMetal( "red_copper" , 0f , 2f , 1 , MapColor.RED ); - - // Custom wood types - WOOD_HEVEA = new MWood( "hevea" ) // - .setBarkColor( MapColor.GRAY ) // - .setBaseFireInfo( 5 , 8 ) // - .setTreeGenerator( new MHeveaGenerator( true ) ) // - .register( ); - - // Items that do not correspond to metals or ores - ITEM_SLAG = Materials.makeItem( "slag" ); - ITEM_COKE = Materials.makeFuel( "coke" , 9600 ); - ITEM_PIG_IRON_INGOT = new MMetalItem( E_MMetalItemType.INGOT , "pig_iron" ); - URegistry.addItem( Materials.ITEM_PIG_IRON_INGOT ); - - // Ore drops - ITEM_MALACHITE = Materials.makeItem( "malachite" ); - ITEM_CUPRITE = Materials.makeItem( "cuprite" ); - ITEM_CASSITERITE = Materials.makeItem( "cassiterite" ); - ITEM_SPHALERITE = Materials.makeItem( "sphalerite" ); - ITEM_ROCK_SALT = Materials.makeItem( "rock_salt" ); - ITEM_SULPHUR_POWDER = Materials.makeItem( "sulphur_powder" ); - ITEM_SALTPETER = Materials.makeItem( "saltpeter_powder" ); - - // Actual ores - ORE_COPPER = new MOre( "copper" , 1 ) // - .setMetal( Materials.METAL_COPPER ); - ORE_MALACHITE = new MOre( "malachite" , 1 )// - .setMetal( Materials.METAL_COPPER ) // - .setDrops( Materials.ITEM_MALACHITE ) // - .setExperience( 1 , 3 ); - ORE_CUPRITE = new MOre( "cuprite" , 1 ) // - .setMetal( Materials.METAL_COPPER , 2 ) // - .setDrops( Materials.ITEM_CUPRITE ) // - .setExperience( 2 , 5 ); - ORE_CASSITERITE = new MOre( "cassiterite" , 0 )// - .setMetal( Materials.METAL_TIN , 1 , E_MMetalItemType.NUGGET ) // - .setDrops( Materials.ITEM_CASSITERITE , 2 , 5 ) // - .setExperience( 2 , 5 ); - ORE_SPHALERITE = new MOre( "sphalerite" , 1 ) // - .setMetal( Materials.METAL_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 ); - ORE_SULPHUR = new MOre( "sulphur" , 0 ) // - .setResistance( 2.0f ) // - .setHardness( 1.0f ) // - .setDrops( Materials.ITEM_SULPHUR_POWDER , 3 , 6 ) // - .setExperience( 1 , 2 ); - ORE_SILVER = new MOre( "silver" , 2 ); - ORE_SALTPETER = new MOre( "saltpeter" , 0 ) // - .setDrops( Materials.ITEM_SALTPETER , 4 , 8 ) // - .setExperience( 0 , 1 ); - - // Other recipes, ore generation parameters, etc. - final Materials materials = new Materials( ); - URegistry.addRecipeRegistrar( materials ); - URegistry.addOreGenerationRegistrar( materials ); + ROCK = new MRocks( ); + METAL = new MMetals( ); + ALLOY = new MAlloys( ); + TREE = new MTrees( ); + ITEM = new MItems( ); + ORE = new MOres( ); } @@ -202,112 +74,4 @@ public class Materials // EMPTY } - - @Override - public void registerRecipes( ) - { - // Green dye from malachite - GameRegistry.addShapelessRecipe( new ItemStack( Items.DYE , 1 , 2 ) , - new ItemStack( Materials.ITEM_MALACHITE ) ); - - // Gunpowder from saltpeter, sulphur and charcoal - GameRegistry.addShapelessRecipe( new ItemStack( Items.GUNPOWDER ) , // - new ItemStack( ITEM_SALTPETER ) , // - new ItemStack( ITEM_SULPHUR_POWDER ) , // - new ItemStack( Items.COAL , 1 , 1 ) ); - - // Bronze - MAlloyRecipe.build( ).setName( "materials/bronze" ).setBurnTime( 400 ) // - .addInput( Materials.METAL_COPPER.INGOT ) // - .addInput( Materials.METAL_TIN.NUGGET ) // - .setOutput( Materials.METAL_BRONZE.INGOT ).setSlag( 1 ) // - .register( ); - - // Pig iron - MAlloyRecipe.build( ).setName( "materials/pig_iron/from_ingot" ).setBurnTime( 1600 ) // - .addInput( Materials.METAL_IRON.INGOT ) // - .addInput( Materials.ROCK_LIMESTONE ) // - .addInput( Materials.ITEM_COKE ) // - .setOutput( Materials.ITEM_PIG_IRON_INGOT , 2 ).setSlag( 3 ) // - .register( ); - MAlloyRecipe.build( ).setName( "materials/pig_iron/from_ore" ).setBurnTime( 1600 ) // - .addInput( Blocks.IRON_ORE ) // - .addInput( Materials.ROCK_LIMESTONE ) // - .addInput( Materials.ITEM_COKE ) // - .setOutput( Materials.ITEM_PIG_IRON_INGOT ).setSlag( 5 ) // - .register( ); - - // Steel - MAlloyRecipe.build( ).setName( "materials/steel/from_ingot" ).setBurnTime( 3200 ) // - .addInput( Materials.METAL_IRON.INGOT ) // - .addInput( Materials.ROCK_LIMESTONE ) // - .addInput( Materials.ITEM_PIG_IRON_INGOT ) // - .setOutput( Materials.METAL_STEEL.INGOT , 2 ).setSlag( 3 ) // - .register( ); - MAlloyRecipe.build( ).setName( "materials/steel/from_ore" ).setBurnTime( 3200 ) // - .addInput( Blocks.IRON_ORE ) // - .addInput( Materials.ROCK_LIMESTONE ) // - .addInput( Materials.ITEM_PIG_IRON_INGOT ) // - .setOutput( Materials.METAL_STEEL.INGOT ).setSlag( 5 ) // - .register( ); - - // MAlloyRecipe.build( ).setName( "materials/red_copper" ).setBurnTime( 800 ) - // .addInput( Materials.COPPER.INGOT , 1 ).addInput( Items.REDSTONE , 2 ) - // .setOutput( Materials.RED_COPPER.INGOT ).setSlag( 1 ).register( ); - - // XXX coke is not an alloy - MAlloyRecipe.build( ).setName( "materials/coke" ).setBurnTime( 3200 ).addInput( Items.COAL , 2 ) - .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 ) ) ); - - 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 , 5 , 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 , 1 , 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 ) ) ); - - conditions.add( new WGOreCondition( WLocation.inTheNether( ) , // - new WGOreParameters( Materials.ORE_SULPHUR , 5 , 25 , // - BlockMatcher.forBlock( Blocks.NETHERRACK ) ) ) ); - - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // - new WGOreParameters( Materials.ORE_SILVER , 3 , 9 , 0 , 40 ) ) ); - - conditions.add( new WGOreCondition( WLocation.inOverworld( ) , // - new WGOreParameters( Materials.ORE_SALTPETER , 10 , 9 , 0 , 80 ) ) ); - } - } diff --git a/src/java/mmm/tech/base/alloy_furnace/TBAFTileEntity.java b/src/java/mmm/tech/base/alloy_furnace/TBAFTileEntity.java index b5af8cb..353d524 100644 --- a/src/java/mmm/tech/base/alloy_furnace/TBAFTileEntity.java +++ b/src/java/mmm/tech/base/alloy_furnace/TBAFTileEntity.java @@ -230,7 +230,7 @@ public class TBAFTileEntity if ( this.alloyCurrent == 0 ) { this.addOutput( this.alloying.output ); if ( this.alloying.slag != 0 ) { - this.addOutput( new ItemStack( Materials.ITEM_SLAG , this.alloying.slag ) ); + this.addOutput( new ItemStack( Materials.ITEM.SLAG , this.alloying.slag ) ); } this.alloying = null; } @@ -325,7 +325,7 @@ public class TBAFTileEntity public void cancelAlloying( ) { if ( this.alloying != null ) { - this.addOutput( new ItemStack( Materials.ITEM_SLAG , this.alloying.getTotalInputItems( ) ) ); + this.addOutput( new ItemStack( Materials.ITEM.SLAG , this.alloying.getTotalInputItems( ) ) ); this.alloying = null; this.alloyCurrent = 0; } diff --git a/src/java/mmm/tech/tools/TechTools.java b/src/java/mmm/tech/tools/TechTools.java index 4993651..367abf3 100644 --- a/src/java/mmm/tech/tools/TechTools.java +++ b/src/java/mmm/tech/tools/TechTools.java @@ -18,18 +18,19 @@ public class TechTools public static final TTArmorSet STEEL_ARMOR; static { - COPPER_TOOLS = new TTToolSet( "copper" , Materials.METAL_COPPER.INGOT , 2 , 192 , 5.0f , 1.5f , 16 , 7 , -3 ); - COPPER_ARMOR = new TTArmorSet( "copper" , Materials.METAL_COPPER.INGOT , 10 , new int[] { + COPPER_TOOLS = new TTToolSet( "copper" , Materials.METAL.COPPER.INGOT , 2 , 192 , 5.0f , 1.5f , 16 , 7 , -3 ); + COPPER_ARMOR = new TTArmorSet( "copper" , Materials.METAL.COPPER.INGOT , 10 , new int[] { 1 , 3 , 4 , 1 } , 15 , SoundEvents.ITEM_ARMOR_EQUIP_GENERIC , 0 ); - BRONZE_TOOLS = new TTToolSet( "bronze" , Materials.METAL_BRONZE.INGOT , 2 , 212 , 5.5f , 1.75f , 20 , 7.5f , -3.1f ); - BRONZE_ARMOR = new TTArmorSet( "bronze" , Materials.METAL_BRONZE.INGOT , 13 , new int[] { + BRONZE_TOOLS = new TTToolSet( "bronze" , Materials.ALLOY.BRONZE.INGOT , 2 , 212 , 5.5f , 1.75f , 20 , 7.5f , + -3.1f ); + BRONZE_ARMOR = new TTArmorSet( "bronze" , Materials.ALLOY.BRONZE.INGOT , 13 , new int[] { 1 , 4 , 5 , 2 } , 20 , SoundEvents.ITEM_ARMOR_EQUIP_GENERIC , 0 ); - STEEL_TOOLS = new TTToolSet( "steel" , Materials.METAL_STEEL.INGOT , 3 , 800 , 7f , 2.5f , 12 , 8.0f , -3f ); - STEEL_ARMOR = new TTArmorSet( "steel" , Materials.METAL_STEEL.INGOT , 22 , new int[] { + STEEL_TOOLS = new TTToolSet( "steel" , Materials.ALLOY.STEEL.INGOT , 3 , 800 , 7f , 2.5f , 12 , 8.0f , -3f ); + STEEL_ARMOR = new TTArmorSet( "steel" , Materials.ALLOY.STEEL.INGOT , 22 , new int[] { 2 , 6 , 7 , 3 } , 9 , SoundEvents.ITEM_ARMOR_EQUIP_GENERIC , 1 ); } diff --git a/src/java/mmm/world/biome/A_WBLimestone.java b/src/java/mmm/world/biome/A_WBLimestone.java index d49f57e..23c50ef 100644 --- a/src/java/mmm/world/biome/A_WBLimestone.java +++ b/src/java/mmm/world/biome/A_WBLimestone.java @@ -68,12 +68,12 @@ public abstract class A_WBLimestone public WGOreParameters[] getBiomeOres( final World worldIn ) { final Predicate< IBlockState > stoneOrLimestone = Predicates.or( BlockMatcher.forBlock( Blocks.STONE ) , - BlockMatcher.forBlock( Materials.ROCK_LIMESTONE ) ); + BlockMatcher.forBlock( Materials.ROCK.LIMESTONE ) ); return new WGOreParameters[] { - new WGOreParameters( Materials.ROCK_CHALK.getDefaultState( ) , 15 , 20 , // + new WGOreParameters( Materials.ROCK.CHALK.getDefaultState( ) , 15 , 20 , // worldIn.getSeaLevel( ) - 20 , 255 , // stoneOrLimestone ) , - new WGOreParameters( Materials.ORE_BAUXITE.getDefaultState( ) , 10 , 9 , 45 , 255 , stoneOrLimestone ) + new WGOreParameters( Materials.ORE.BAUXITE.getDefaultState( ) , 10 , 9 , 45 , 255 , stoneOrLimestone ) }; } diff --git a/src/java/mmm/world/gen/WGBasalt.java b/src/java/mmm/world/gen/WGBasalt.java index 8b9181d..435ab27 100644 --- a/src/java/mmm/world/gen/WGBasalt.java +++ b/src/java/mmm/world/gen/WGBasalt.java @@ -18,7 +18,7 @@ import net.minecraftforge.fml.common.IWorldGenerator; public class WGBasalt implements IWorldGenerator { - private static final IBlockState BS_BASALT = Materials.ROCK_BASALT.getDefaultState( ); + private static final IBlockState BS_BASALT = Materials.ROCK.BASALT.getDefaultState( ); @Override diff --git a/src/java/mmm/world/gen/WGLimestoneChaos.java b/src/java/mmm/world/gen/WGLimestoneChaos.java index 9e577ed..3e51f73 100644 --- a/src/java/mmm/world/gen/WGLimestoneChaos.java +++ b/src/java/mmm/world/gen/WGLimestoneChaos.java @@ -18,7 +18,7 @@ public class WGLimestoneChaos extends WorldGenerator { - private static final IBlockState BS_LIMESTONE = Materials.ROCK_LIMESTONE.getDefaultState( ); + private static final IBlockState BS_LIMESTONE = Materials.ROCK.LIMESTONE.getDefaultState( ); private static final IBlockState BS_STONE = Blocks.STONE.getDefaultState( ); private static final IBlockState BS_AIR = Blocks.AIR.getDefaultState( ); private static final IBlockState BS_COARSE_DIRT = Blocks.DIRT.getDefaultState( ).withProperty( BlockDirt.VARIANT , @@ -102,17 +102,17 @@ public class WGLimestoneChaos final double sqd = dx * dx + dz * dz; if ( sqd < 1.0D ) { - int rnd = rand.nextInt( 20 ); + final int rnd = rand.nextInt( 20 ); int out; switch ( rnd ) { case 0: - out = SB_DIRT; + out = WGLimestoneChaos.SB_DIRT; break; case 1: - out = SB_GRAVEL; + out = WGLimestoneChaos.SB_GRAVEL; break; default: - out = SB_LIMESTONE; + out = WGLimestoneChaos.SB_LIMESTONE; break; } shape[ ( x * 16 + z ) * shapeHeight + y ] = out; diff --git a/src/java/mmm/world/gen/WGLimestoneLayer.java b/src/java/mmm/world/gen/WGLimestoneLayer.java index 0910f85..1782d3b 100644 --- a/src/java/mmm/world/gen/WGLimestoneLayer.java +++ b/src/java/mmm/world/gen/WGLimestoneLayer.java @@ -32,7 +32,7 @@ public class WGLimestoneLayer private static final IBlockState BS_GRAVEL = Blocks.GRAVEL.getDefaultState( ); - private static final IBlockState BS_LIMESTONE = Materials.ROCK_LIMESTONE.getDefaultState( ); + private static final IBlockState BS_LIMESTONE = Materials.ROCK.LIMESTONE.getDefaultState( ); @Override diff --git a/src/java/mmm/world/trees/A_MTreeGenerator.java b/src/java/mmm/world/trees/A_MTreeGenerator.java index 2044467..2b17ff0 100644 --- a/src/java/mmm/world/trees/A_MTreeGenerator.java +++ b/src/java/mmm/world/trees/A_MTreeGenerator.java @@ -3,7 +3,7 @@ package mmm.world.trees; import java.util.Random; -import mmm.materials.MWood; +import mmm.materials.MTree; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -126,7 +126,7 @@ public abstract class A_MTreeGenerator } - private MWood wood; + private MTree wood; public A_MTreeGenerator( final boolean notify ) @@ -135,13 +135,13 @@ public abstract class A_MTreeGenerator } - public MWood getWood( ) + public MTree getWood( ) { return this.wood; } - public void setWood( final MWood wood ) + public void setWood( final MTree wood ) { this.wood = wood; }