Tin and cassiterite

This commit is contained in:
Emmanuel BENOîT 2016-06-29 15:32:49 +02:00
parent c6155b176e
commit a0fe4b5511
19 changed files with 145 additions and 24 deletions

View file

@ -46,7 +46,6 @@ materials No Metal from slag
materials.rock No Smooth limestone materials.rock No Smooth limestone
------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------
materials.ore No Rock salt materials.ore No Rock salt
materials.ore No Tin (cassiterite)
materials.ore No Zinc (sphalerite) materials.ore No Zinc (sphalerite)
materials.ore No Aluminium (bauxite) materials.ore No Aluminium (bauxite)
materials.ore No Silver (native, horn silver) materials.ore No Silver (native, horn silver)

View file

@ -34,7 +34,8 @@ public class MOre
private int expMin , expMax; private int expMin , expMax;
private MMetal metal; private MMetal metal;
private int genIngots; private int genQuantity;
private E_MMetalItemType smeltingOutput;
public MOre( final String name , final int harvestLevel ) public MOre( final String name , final int harvestLevel )
@ -55,7 +56,8 @@ public class MOre
this.dropMin = this.dropMax = 1; this.dropMin = this.dropMax = 1;
this.expMin = this.expMax = 0; this.expMin = this.expMax = 0;
this.metal = null; this.metal = null;
this.genIngots = 0; this.genQuantity = 0;
URegistry.addBlock( this );
} }
@ -107,15 +109,22 @@ public class MOre
public MOre setMetal( final MMetal metal ) public MOre setMetal( final MMetal metal )
{ {
return this.setMetal( metal , 1 ); return this.setMetal( metal , 1 , E_MMetalItemType.INGOT );
} }
public MOre setMetal( final MMetal metal , final int ingots ) public MOre setMetal( final MMetal metal , int count )
{ {
assert metal != null && ingots > 0; return this.setMetal( metal , count , E_MMetalItemType.INGOT );
}
public MOre setMetal( final MMetal metal , final int quantity , final E_MMetalItemType type )
{
assert metal != null && quantity > 0;
this.metal = metal; this.metal = metal;
this.genIngots = ingots; this.genQuantity = quantity;
this.smeltingOutput = type;
return this; return this;
} }
@ -181,8 +190,22 @@ public class MOre
public void registerRecipes( ) public void registerRecipes( )
{ {
if ( this.metal != null ) { if ( this.metal != null ) {
final ItemStack output = new ItemStack( this.metal.INGOT , this.genIngots ); final ItemStack output;
final float xp = this.metal.SMELTING_XP * this.genIngots; final float xpMul;
switch ( this.smeltingOutput ) {
case INGOT:
output = new ItemStack( this.metal.INGOT , this.genQuantity );
xpMul = 1;
break;
case NUGGET:
output = new ItemStack( this.metal.NUGGET , this.genQuantity );
xpMul = 1 / 9f;
break;
default:
throw new IllegalStateException( this.smeltingOutput.toString( ) );
}
final float xp = this.metal.SMELTING_XP * this.genQuantity * xpMul;
if ( this.dropItems == null ) { if ( this.dropItems == null ) {
GameRegistry.addSmelting( this , output , xp ); GameRegistry.addSmelting( this , output , xp );
} else { } else {

View file

@ -1,6 +1,7 @@
package mmm.materials; package mmm.materials;
import mmm.materials.ore.MOCassiterite;
import mmm.materials.ore.MOCopper; import mmm.materials.ore.MOCopper;
import mmm.materials.ore.MOCuprite; import mmm.materials.ore.MOCuprite;
import mmm.materials.ore.MOMalachite; import mmm.materials.ore.MOMalachite;
@ -23,16 +24,19 @@ public class Materials
public static final MMetal GOLD; public static final MMetal GOLD;
public static final MMetal IRON; public static final MMetal IRON;
public static final MMetal COPPER; public static final MMetal COPPER;
//public static final MMetal RED_COPPER; public static final MMetal TIN;
// public static final MMetal RED_COPPER;
public static final Item ITEM_SLAG; public static final Item ITEM_SLAG;
public static final Item ITEM_MALACHITE; public static final Item ITEM_MALACHITE;
public static final Item ITEM_CUPRITE; public static final Item ITEM_CUPRITE;
public static final Item ITEM_COKE; public static final Item ITEM_COKE;
public static final Item ITEM_CASSITERITE;
public static final MOre ORE_COPPER; public static final MOre ORE_COPPER;
public static final MOre ORE_MALACHITE; public static final MOre ORE_MALACHITE;
public static final MOre ORE_CUPRITE; public static final MOre ORE_CUPRITE;
public static final MOre ORE_CASSITERITE;
static { static {
// Rocks // Rocks
@ -45,18 +49,21 @@ public class Materials
// Custom metals // Custom metals
COPPER = new MMetal( "copper" , 0.4f , 4f , 1 , MapColor.DIRT ); COPPER = new MMetal( "copper" , 0.4f , 4f , 1 , MapColor.DIRT );
//RED_COPPER = new MMetal( "red_copper" , 0f , 2f , 1 , MapColor.RED ); TIN = new MMetal( "tin" , 0.6f , 1f , 0 , MapColor.GRAY );
// RED_COPPER = new MMetal( "red_copper" , 0f , 2f , 1 , MapColor.RED );
// Items that do not correspond to metals or ores // Items that do not correspond to metals or ores
URegistry.addItem( ITEM_SLAG = Materials.makeItem( "slag" ) ); ITEM_SLAG = Materials.makeItem( "slag" );
URegistry.addItem( ITEM_MALACHITE = Materials.makeItem( "malachite" ) ); ITEM_MALACHITE = Materials.makeItem( "malachite" );
URegistry.addItem( ITEM_CUPRITE = Materials.makeItem( "cuprite" ) ); ITEM_CUPRITE = Materials.makeItem( "cuprite" );
URegistry.addItem( ITEM_COKE = Materials.makeFuel( "coke" , 9600 ) ); ITEM_COKE = Materials.makeFuel( "coke" , 9600 );
ITEM_CASSITERITE = Materials.makeItem( "cassiterite" );
// Actual ores // Actual ores
URegistry.addBlock( ORE_COPPER = new MOCopper( ) ); ORE_COPPER = new MOCopper( );
URegistry.addBlock( ORE_MALACHITE = new MOMalachite( ) ); ORE_MALACHITE = new MOMalachite( );
URegistry.addBlock( ORE_CUPRITE = new MOCuprite( ) ); ORE_CUPRITE = new MOCuprite( );
ORE_CASSITERITE = new MOCassiterite( );
// Other recipes // Other recipes
URegistry.addRecipeRegistrar( new Materials( ) ); URegistry.addRecipeRegistrar( new Materials( ) );
@ -76,6 +83,7 @@ public class Materials
final Item stone = new Item( ); final Item stone = new Item( );
URegistry.setIdentifiers( stone , "materials" , "stone" , name ); URegistry.setIdentifiers( stone , "materials" , "stone" , name );
stone.setCreativeTab( CreativeTabs.MATERIALS ); stone.setCreativeTab( CreativeTabs.MATERIALS );
URegistry.addItem( stone );
return stone; return stone;
} }
@ -97,8 +105,8 @@ public class Materials
{ {
// Alloy recipes // Alloy recipes
// MAlloyRecipe.build( ).setName( "materials/red_copper" ).setBurnTime( 800 ) // MAlloyRecipe.build( ).setName( "materials/red_copper" ).setBurnTime( 800 )
// .addInput( Materials.COPPER.INGOT , 1 ).addInput( Items.REDSTONE , 2 ) // .addInput( Materials.COPPER.INGOT , 1 ).addInput( Items.REDSTONE , 2 )
// .setOutput( Materials.RED_COPPER.INGOT ).setSlag( 1 ).register( ); // .setOutput( Materials.RED_COPPER.INGOT ).setSlag( 1 ).register( );
// XXX coke is not an alloy // XXX coke is not an alloy
MAlloyRecipe.build( ).setName( "materials/coke" ).setBurnTime( 3200 ).addInput( Items.COAL , 2 ) MAlloyRecipe.build( ).setName( "materials/coke" ).setBurnTime( 3200 ).addInput( Items.COAL , 2 )
.setOutput( Materials.ITEM_COKE ).setSlag( 1 ).register( ); .setOutput( Materials.ITEM_COKE ).setSlag( 1 ).register( );

View file

@ -0,0 +1,37 @@
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.WOreGenerationCondition;
import mmm.world.WOreGenerationParameters;
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< WOreGenerationCondition > conditions )
{
conditions.add( new WOreGenerationCondition( WLocation.inOverworld( ) ,
new WOreGenerationParameters( this.getDefaultState( ) , 10 , 9 , 45 , 80 ) ) );
}
}

View file

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "mmm:materials/block/tin" }
}
}

View file

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "mmm:materials/ore/cassiterite" }
}
}

View file

@ -2,6 +2,13 @@ gui.mmm.configure=Configure
gui.mmm.configure.hoppers=Hoppers gui.mmm.configure.hoppers=Hoppers
gui.mmm.configure.comparator=Comparator Output gui.mmm.configure.comparator=Comparator Output
gui.mmm.tech.base.am.always_active=Always Active
gui.mmm.tech.base.am.powered=Redstone Activates
gui.mmm.tech.base.am.unpowered=Redstone Disables
gui.mmm.tech.base.am.disabled=Deactivated
tile.mmm.materials.rock.limestone.name=Limestone
item.mmm.materials.stone.coke.name=Coke item.mmm.materials.stone.coke.name=Coke
item.mmm.materials.stone.slag.name=Slag item.mmm.materials.stone.slag.name=Slag
@ -16,11 +23,12 @@ tile.mmm.materials.ore.malachite.name=Malachite Ore
item.mmm.materials.stone.cuprite.name=Cuprite item.mmm.materials.stone.cuprite.name=Cuprite
tile.mmm.materials.ore.cuprite.name=Cuprite Ore tile.mmm.materials.ore.cuprite.name=Cuprite Ore
item.mmm.materials.ingot.tin.name=Tin Ingot
item.mmm.materials.nugget.tin.name=Tin Nugget
tile.mmm.materials.block.tin.name=Tin Block
tile.mmm.materials.ore.cassiterite.name=Cassiterite Ore
item.mmm.materials.stone.cassiterite.name=Cassiterite
gui.mmm.tech.base.am.always_active=Always Active
gui.mmm.tech.base.am.powered=Redstone Activates
gui.mmm.tech.base.am.unpowered=Redstone Disables
gui.mmm.tech.base.am.disabled=Deactivated
tile.mmm.tech.base.alloy_furnace.inactive.name=Alloy Furnace tile.mmm.tech.base.alloy_furnace.inactive.name=Alloy Furnace
container.mmm.alloy_furnace.contents=Furnace Contents container.mmm.alloy_furnace.contents=Furnace Contents

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "mmm:blocks/materials/block/tin"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "mmm:blocks/materials/ore/cassiterite"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "mmm:block/materials/block/tin"
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "mmm:items/materials/ingots/tin"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "mmm:items/materials/nuggets/tin"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "mmm:block/materials/ore/cassiterite"
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "mmm:items/materials/stone/cassiterite"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B