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.ore No Rock salt
materials.ore No Tin (cassiterite)
materials.ore No Zinc (sphalerite)
materials.ore No Aluminium (bauxite)
materials.ore No Silver (native, horn silver)

View file

@ -34,7 +34,8 @@ public class MOre
private int expMin , expMax;
private MMetal metal;
private int genIngots;
private int genQuantity;
private E_MMetalItemType smeltingOutput;
public MOre( final String name , final int harvestLevel )
@ -55,7 +56,8 @@ public class MOre
this.dropMin = this.dropMax = 1;
this.expMin = this.expMax = 0;
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 )
{
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.genIngots = ingots;
this.genQuantity = quantity;
this.smeltingOutput = type;
return this;
}
@ -181,8 +190,22 @@ public class MOre
public void registerRecipes( )
{
if ( this.metal != null ) {
final ItemStack output = new ItemStack( this.metal.INGOT , this.genIngots );
final float xp = this.metal.SMELTING_XP * this.genIngots;
final ItemStack output;
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 ) {
GameRegistry.addSmelting( this , output , xp );
} else {

View file

@ -1,6 +1,7 @@
package mmm.materials;
import mmm.materials.ore.MOCassiterite;
import mmm.materials.ore.MOCopper;
import mmm.materials.ore.MOCuprite;
import mmm.materials.ore.MOMalachite;
@ -23,16 +24,19 @@ public class Materials
public static final MMetal GOLD;
public static final MMetal IRON;
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_MALACHITE;
public static final Item ITEM_CUPRITE;
public static final Item ITEM_COKE;
public static final Item ITEM_CASSITERITE;
public static final MOre ORE_COPPER;
public static final MOre ORE_MALACHITE;
public static final MOre ORE_CUPRITE;
public static final MOre ORE_CASSITERITE;
static {
// Rocks
@ -45,18 +49,21 @@ public class Materials
// Custom metals
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
URegistry.addItem( ITEM_SLAG = Materials.makeItem( "slag" ) );
URegistry.addItem( ITEM_MALACHITE = Materials.makeItem( "malachite" ) );
URegistry.addItem( ITEM_CUPRITE = Materials.makeItem( "cuprite" ) );
URegistry.addItem( ITEM_COKE = Materials.makeFuel( "coke" , 9600 ) );
ITEM_SLAG = Materials.makeItem( "slag" );
ITEM_MALACHITE = Materials.makeItem( "malachite" );
ITEM_CUPRITE = Materials.makeItem( "cuprite" );
ITEM_COKE = Materials.makeFuel( "coke" , 9600 );
ITEM_CASSITERITE = Materials.makeItem( "cassiterite" );
// Actual ores
URegistry.addBlock( ORE_COPPER = new MOCopper( ) );
URegistry.addBlock( ORE_MALACHITE = new MOMalachite( ) );
URegistry.addBlock( ORE_CUPRITE = new MOCuprite( ) );
ORE_COPPER = new MOCopper( );
ORE_MALACHITE = new MOMalachite( );
ORE_CUPRITE = new MOCuprite( );
ORE_CASSITERITE = new MOCassiterite( );
// Other recipes
URegistry.addRecipeRegistrar( new Materials( ) );
@ -76,6 +83,7 @@ public class Materials
final Item stone = new Item( );
URegistry.setIdentifiers( stone , "materials" , "stone" , name );
stone.setCreativeTab( CreativeTabs.MATERIALS );
URegistry.addItem( stone );
return stone;
}

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.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.slag.name=Slag
@ -16,11 +23,12 @@ tile.mmm.materials.ore.malachite.name=Malachite Ore
item.mmm.materials.stone.cuprite.name=Cuprite
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
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