Materials refactoring

Now with stuff like "Materials.ORE.BAUXITE"
This commit is contained in:
Emmanuel BENOîT 2016-07-09 17:43:52 +02:00
parent cd1b6438b5
commit 76e75957f5
19 changed files with 416 additions and 295 deletions

View file

@ -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( );
}
}

View file

@ -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 ) );
}
}

View file

@ -37,10 +37,10 @@ public class MLeaves
implements I_UTintedBlock , I_UTintedItem 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; this.wood = wood;

View file

@ -14,10 +14,10 @@ public class MLog
extends BlockLog extends BlockLog
{ {
public final MWood wood; public final MTree wood;
public MLog( final MWood wood ) public MLog( final MTree wood )
{ {
super( ); super( );
this.wood = wood; this.wood = wood;

View file

@ -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 );
}
}

View file

@ -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 ) ) );
}
}

View file

@ -14,10 +14,10 @@ public class MPlanks
extends Block extends Block
{ {
public final MWood wood; public final MTree wood;
public MPlanks( final MWood wood ) public MPlanks( final MTree wood )
{ {
super( Material.WOOD ); super( Material.WOOD );
this.wood = wood; this.wood = wood;

View file

@ -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 ) ) );
}
}

View file

@ -31,10 +31,10 @@ public class MSapling
{ {
private static final PropertyInteger STAGE = PropertyInteger.create( "stage" , 0 , 15 ); 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 ); super( Material.PLANTS );
this.wood = wood; this.wood = wood;

View file

@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public class MWood public class MTree
implements I_URecipeRegistrar implements I_URecipeRegistrar
{ {
public static interface I_SaplingChecker public static interface I_SaplingChecker
@ -70,7 +70,7 @@ public class MWood
private WorldGenAbstractTree genMega; private WorldGenAbstractTree genMega;
public MWood( final String name ) public MTree( final String name )
{ {
this.NAME = name; this.NAME = name;
this.LOG = new MLog( this ); 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; this.barkColor = barkColor;
return this; return this;
} }
public MWood setPlankColor( final MapColor plankColor ) public MTree setPlankColor( final MapColor plankColor )
{ {
this.plankColor = plankColor; this.plankColor = plankColor;
return this; return this;
} }
public MWood setSaplingDropChance( final int chance ) public MTree setSaplingDropChance( final int chance )
{ {
this.saplingDropChance = chance; this.saplingDropChance = chance;
return this; return this;
} }
public MWood setFruit( final Item fruit , final float dropChance ) public MTree setFruit( final Item fruit , final float dropChance )
{ {
this.fruit = fruit; this.fruit = fruit;
this.fruitDropChance = (int) ( 200 * dropChance ); 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.baseFireEncouragement = encouragement;
this.baseFlammability = flammability; 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; this.saplingGrowthStages = stages;
return this; return this;
} }
public MWood setBonemealChance( final float chance ) public MTree setBonemealChance( final float chance )
{ {
this.bonemealChance = chance; this.bonemealChance = chance;
return this; return this;
} }
public MWood setGrowthChance( final float chance ) public MTree setGrowthChance( final float chance )
{ {
this.growthChance = chance; this.growthChance = chance;
return this; return this;
} }
public MWood setGrowthLightConditions( final int min , final int max ) public MTree setGrowthLightConditions( final int min , final int max )
{ {
this.growthMinLight = min; this.growthMinLight = min;
this.growthMaxLight = max; 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; this.saplingCheck = check;
return this; return this;
} }
public MWood setTreeGenerator( final A_MTreeGenerator generator ) public MTree setTreeGenerator( final A_MTreeGenerator generator )
{ {
this.genNormal = generator; this.genNormal = generator;
if ( generator != null ) { 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 ); 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.genBig = generator;
this.genBigChance = chance; 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; this.genMega = generator;
if ( generator != null ) { if ( generator != null ) {
@ -190,7 +190,7 @@ public class MWood
} }
public MWood register( ) public MTree register( )
{ {
URegistry.addBlock( this.LOG ); URegistry.addBlock( this.LOG );
URegistry.addBlock( this.LEAVES ); URegistry.addBlock( this.LEAVES );

View file

@ -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( );
}
}

View file

@ -1,160 +1,32 @@
package mmm.materials; package mmm.materials;
import java.util.List;
import mmm.utils.I_UOreGenerationRegistrar;
import mmm.utils.I_URecipeRegistrar;
import mmm.utils.URegistry; 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.Block;
import net.minecraft.block.BlockStone; import net.minecraft.block.BlockStone;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.block.state.pattern.BlockMatcher;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item; 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 public class Materials
implements I_URecipeRegistrar , I_UOreGenerationRegistrar
{ {
public static final MRock ROCK_LIMESTONE; public static final MRocks ROCK;
public static final MRock ROCK_CHALK; public static final MMetals METAL;
public static final MRock ROCK_SLATE; public static final MAlloys ALLOY;
public static final MRock ROCK_BASALT; public static final MTrees TREE;
public static final MItems ITEM;
public static final MMetal METAL_GOLD; public static final MOres ORE;
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;
static { static {
// Rocks ROCK = new MRocks( );
ROCK_LIMESTONE = new MRock( "limestone" , MapColor.SNOW , 0 , 1f , 7.5f ); METAL = new MMetals( );
ROCK_CHALK = new MRock( "chalk" , MapColor.SNOW , 0 , 1f , 5f ); ALLOY = new MAlloys( );
ROCK_SLATE = new MRock( "slate" , MapColor.BLACK ); TREE = new MTrees( );
ROCK_BASALT = new MRock( "basalt" , MapColor.BLACK ); ITEM = new MItems( );
ORE = new MOres( );
// 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 );
} }
@ -202,112 +74,4 @@ public class Materials
// EMPTY // 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 ) ) );
}
} }

View file

@ -230,7 +230,7 @@ public class TBAFTileEntity
if ( this.alloyCurrent == 0 ) { if ( this.alloyCurrent == 0 ) {
this.addOutput( this.alloying.output ); this.addOutput( this.alloying.output );
if ( this.alloying.slag != 0 ) { 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; this.alloying = null;
} }
@ -325,7 +325,7 @@ public class TBAFTileEntity
public void cancelAlloying( ) public void cancelAlloying( )
{ {
if ( this.alloying != null ) { 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.alloying = null;
this.alloyCurrent = 0; this.alloyCurrent = 0;
} }

View file

@ -18,18 +18,19 @@ public class TechTools
public static final TTArmorSet STEEL_ARMOR; public static final TTArmorSet STEEL_ARMOR;
static { static {
COPPER_TOOLS = new TTToolSet( "copper" , Materials.METAL_COPPER.INGOT , 2 , 192 , 5.0f , 1.5f , 16 , 7 , -3 ); 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_ARMOR = new TTArmorSet( "copper" , Materials.METAL.COPPER.INGOT , 10 , new int[] {
1 , 3 , 4 , 1 1 , 3 , 4 , 1
} , 15 , SoundEvents.ITEM_ARMOR_EQUIP_GENERIC , 0 ); } , 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_TOOLS = new TTToolSet( "bronze" , Materials.ALLOY.BRONZE.INGOT , 2 , 212 , 5.5f , 1.75f , 20 , 7.5f ,
BRONZE_ARMOR = new TTArmorSet( "bronze" , Materials.METAL_BRONZE.INGOT , 13 , new int[] { -3.1f );
BRONZE_ARMOR = new TTArmorSet( "bronze" , Materials.ALLOY.BRONZE.INGOT , 13 , new int[] {
1 , 4 , 5 , 2 1 , 4 , 5 , 2
} , 20 , SoundEvents.ITEM_ARMOR_EQUIP_GENERIC , 0 ); } , 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_TOOLS = new TTToolSet( "steel" , Materials.ALLOY.STEEL.INGOT , 3 , 800 , 7f , 2.5f , 12 , 8.0f , -3f );
STEEL_ARMOR = new TTArmorSet( "steel" , Materials.METAL_STEEL.INGOT , 22 , new int[] { STEEL_ARMOR = new TTArmorSet( "steel" , Materials.ALLOY.STEEL.INGOT , 22 , new int[] {
2 , 6 , 7 , 3 2 , 6 , 7 , 3
} , 9 , SoundEvents.ITEM_ARMOR_EQUIP_GENERIC , 1 ); } , 9 , SoundEvents.ITEM_ARMOR_EQUIP_GENERIC , 1 );
} }

View file

@ -68,12 +68,12 @@ public abstract class A_WBLimestone
public WGOreParameters[] getBiomeOres( final World worldIn ) public WGOreParameters[] getBiomeOres( final World worldIn )
{ {
final Predicate< IBlockState > stoneOrLimestone = Predicates.or( BlockMatcher.forBlock( Blocks.STONE ) , final Predicate< IBlockState > stoneOrLimestone = Predicates.or( BlockMatcher.forBlock( Blocks.STONE ) ,
BlockMatcher.forBlock( Materials.ROCK_LIMESTONE ) ); BlockMatcher.forBlock( Materials.ROCK.LIMESTONE ) );
return new WGOreParameters[] { return new WGOreParameters[] {
new WGOreParameters( Materials.ROCK_CHALK.getDefaultState( ) , 15 , 20 , // new WGOreParameters( Materials.ROCK.CHALK.getDefaultState( ) , 15 , 20 , //
worldIn.getSeaLevel( ) - 20 , 255 , // worldIn.getSeaLevel( ) - 20 , 255 , //
stoneOrLimestone ) , stoneOrLimestone ) ,
new WGOreParameters( Materials.ORE_BAUXITE.getDefaultState( ) , 10 , 9 , 45 , 255 , stoneOrLimestone ) new WGOreParameters( Materials.ORE.BAUXITE.getDefaultState( ) , 10 , 9 , 45 , 255 , stoneOrLimestone )
}; };
} }

View file

@ -18,7 +18,7 @@ import net.minecraftforge.fml.common.IWorldGenerator;
public class WGBasalt public class WGBasalt
implements IWorldGenerator implements IWorldGenerator
{ {
private static final IBlockState BS_BASALT = Materials.ROCK_BASALT.getDefaultState( ); private static final IBlockState BS_BASALT = Materials.ROCK.BASALT.getDefaultState( );
@Override @Override

View file

@ -18,7 +18,7 @@ public class WGLimestoneChaos
extends WorldGenerator 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_STONE = Blocks.STONE.getDefaultState( );
private static final IBlockState BS_AIR = Blocks.AIR.getDefaultState( ); private static final IBlockState BS_AIR = Blocks.AIR.getDefaultState( );
private static final IBlockState BS_COARSE_DIRT = Blocks.DIRT.getDefaultState( ).withProperty( BlockDirt.VARIANT , 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; final double sqd = dx * dx + dz * dz;
if ( sqd < 1.0D ) { if ( sqd < 1.0D ) {
int rnd = rand.nextInt( 20 ); final int rnd = rand.nextInt( 20 );
int out; int out;
switch ( rnd ) { switch ( rnd ) {
case 0: case 0:
out = SB_DIRT; out = WGLimestoneChaos.SB_DIRT;
break; break;
case 1: case 1:
out = SB_GRAVEL; out = WGLimestoneChaos.SB_GRAVEL;
break; break;
default: default:
out = SB_LIMESTONE; out = WGLimestoneChaos.SB_LIMESTONE;
break; break;
} }
shape[ ( x * 16 + z ) * shapeHeight + y ] = out; shape[ ( x * 16 + z ) * shapeHeight + y ] = out;

View file

@ -32,7 +32,7 @@ public class WGLimestoneLayer
private static final IBlockState BS_GRAVEL = Blocks.GRAVEL.getDefaultState( ); 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 @Override

View file

@ -3,7 +3,7 @@ package mmm.world.trees;
import java.util.Random; import java.util.Random;
import mmm.materials.MWood; import mmm.materials.MTree;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; 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 ) public A_MTreeGenerator( final boolean notify )
@ -135,13 +135,13 @@ public abstract class A_MTreeGenerator
} }
public MWood getWood( ) public MTree getWood( )
{ {
return this.wood; return this.wood;
} }
public void setWood( final MWood wood ) public void setWood( final MTree wood )
{ {
this.wood = wood; this.wood = wood;
} }