From a0fe4b551142befe1ed99bc37e72b34adc030d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Wed, 29 Jun 2016 15:32:49 +0200 Subject: [PATCH] Tin and cassiterite --- TODO.txt | 1 - src/java/mmm/materials/MOre.java | 39 ++++++++++++++---- src/java/mmm/materials/Materials.java | 30 +++++++++----- src/java/mmm/materials/ore/MOCassiterite.java | 37 +++++++++++++++++ .../mmm/blockstates/materials/block/tin.json | 5 +++ .../materials/ore/cassiterite.json | 5 +++ src/resources/assets/mmm/lang/en_US.lang | 16 +++++-- .../mmm/models/block/materials/block/tin.json | 6 +++ .../block/materials/ore/cassiterite.json | 6 +++ .../mmm/models/item/materials/block/tin.json | 3 ++ .../mmm/models/item/materials/ingot/tin.json | 6 +++ .../mmm/models/item/materials/nugget/tin.json | 6 +++ .../item/materials/ore/cassiterite.json | 3 ++ .../item/materials/stone/cassiterite.json | 6 +++ .../textures/blocks/materials/block/tin.png | Bin 0 -> 387 bytes .../blocks/materials/ore/cassiterite.png | Bin 0 -> 349 bytes .../textures/items/materials/ingots/tin.png | Bin 0 -> 242 bytes .../textures/items/materials/nuggets/tin.png | Bin 0 -> 176 bytes .../items/materials/stone/cassiterite.png | Bin 0 -> 606 bytes 19 files changed, 145 insertions(+), 24 deletions(-) create mode 100644 src/java/mmm/materials/ore/MOCassiterite.java create mode 100644 src/resources/assets/mmm/blockstates/materials/block/tin.json create mode 100644 src/resources/assets/mmm/blockstates/materials/ore/cassiterite.json create mode 100644 src/resources/assets/mmm/models/block/materials/block/tin.json create mode 100644 src/resources/assets/mmm/models/block/materials/ore/cassiterite.json create mode 100644 src/resources/assets/mmm/models/item/materials/block/tin.json create mode 100644 src/resources/assets/mmm/models/item/materials/ingot/tin.json create mode 100644 src/resources/assets/mmm/models/item/materials/nugget/tin.json create mode 100644 src/resources/assets/mmm/models/item/materials/ore/cassiterite.json create mode 100644 src/resources/assets/mmm/models/item/materials/stone/cassiterite.json create mode 100644 src/resources/assets/mmm/textures/blocks/materials/block/tin.png create mode 100644 src/resources/assets/mmm/textures/blocks/materials/ore/cassiterite.png create mode 100644 src/resources/assets/mmm/textures/items/materials/ingots/tin.png create mode 100644 src/resources/assets/mmm/textures/items/materials/nuggets/tin.png create mode 100644 src/resources/assets/mmm/textures/items/materials/stone/cassiterite.png diff --git a/TODO.txt b/TODO.txt index 5f2e81b..7ce1afb 100644 --- a/TODO.txt +++ b/TODO.txt @@ -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) diff --git a/src/java/mmm/materials/MOre.java b/src/java/mmm/materials/MOre.java index 87a0bab..d0d10f7 100644 --- a/src/java/mmm/materials/MOre.java +++ b/src/java/mmm/materials/MOre.java @@ -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 { diff --git a/src/java/mmm/materials/Materials.java b/src/java/mmm/materials/Materials.java index 9f144af..780cf66 100644 --- a/src/java/mmm/materials/Materials.java +++ b/src/java/mmm/materials/Materials.java @@ -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; } @@ -97,8 +105,8 @@ public class Materials { // Alloy recipes // 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( ); + // .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/ore/MOCassiterite.java b/src/java/mmm/materials/ore/MOCassiterite.java new file mode 100644 index 0000000..25d1297 --- /dev/null +++ b/src/java/mmm/materials/ore/MOCassiterite.java @@ -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 ) ) ); + } + +} diff --git a/src/resources/assets/mmm/blockstates/materials/block/tin.json b/src/resources/assets/mmm/blockstates/materials/block/tin.json new file mode 100644 index 0000000..e8fc96e --- /dev/null +++ b/src/resources/assets/mmm/blockstates/materials/block/tin.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "mmm:materials/block/tin" } + } +} diff --git a/src/resources/assets/mmm/blockstates/materials/ore/cassiterite.json b/src/resources/assets/mmm/blockstates/materials/ore/cassiterite.json new file mode 100644 index 0000000..321f3b9 --- /dev/null +++ b/src/resources/assets/mmm/blockstates/materials/ore/cassiterite.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "mmm:materials/ore/cassiterite" } + } +} diff --git a/src/resources/assets/mmm/lang/en_US.lang b/src/resources/assets/mmm/lang/en_US.lang index a0e5426..7e2b284 100644 --- a/src/resources/assets/mmm/lang/en_US.lang +++ b/src/resources/assets/mmm/lang/en_US.lang @@ -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 diff --git a/src/resources/assets/mmm/models/block/materials/block/tin.json b/src/resources/assets/mmm/models/block/materials/block/tin.json new file mode 100644 index 0000000..759c290 --- /dev/null +++ b/src/resources/assets/mmm/models/block/materials/block/tin.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "mmm:blocks/materials/block/tin" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/block/materials/ore/cassiterite.json b/src/resources/assets/mmm/models/block/materials/ore/cassiterite.json new file mode 100644 index 0000000..40aa470 --- /dev/null +++ b/src/resources/assets/mmm/models/block/materials/ore/cassiterite.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "mmm:blocks/materials/ore/cassiterite" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/block/tin.json b/src/resources/assets/mmm/models/item/materials/block/tin.json new file mode 100644 index 0000000..29fd14b --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/block/tin.json @@ -0,0 +1,3 @@ +{ + "parent": "mmm:block/materials/block/tin" +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/ingot/tin.json b/src/resources/assets/mmm/models/item/materials/ingot/tin.json new file mode 100644 index 0000000..c0094d9 --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/ingot/tin.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "mmm:items/materials/ingots/tin" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/nugget/tin.json b/src/resources/assets/mmm/models/item/materials/nugget/tin.json new file mode 100644 index 0000000..399a4a7 --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/nugget/tin.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "mmm:items/materials/nuggets/tin" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/ore/cassiterite.json b/src/resources/assets/mmm/models/item/materials/ore/cassiterite.json new file mode 100644 index 0000000..5b21d38 --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/ore/cassiterite.json @@ -0,0 +1,3 @@ +{ + "parent": "mmm:block/materials/ore/cassiterite" +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/stone/cassiterite.json b/src/resources/assets/mmm/models/item/materials/stone/cassiterite.json new file mode 100644 index 0000000..019ff3e --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/stone/cassiterite.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "mmm:items/materials/stone/cassiterite" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/blocks/materials/block/tin.png b/src/resources/assets/mmm/textures/blocks/materials/block/tin.png new file mode 100644 index 0000000000000000000000000000000000000000..889fd200ca84580c827f488a7fd3782ec0539dc3 GIT binary patch literal 387 zcmV-}0et?6P)5z;L|Ck*S#SFnGZcWn!vU$ zY3AGHzgY$5GnHfdYSLuBqyu=%7NFo~^F+Vf5reZ3uG}021)W%d zr|@u3*8gUSoAkahtIAXkPbYeBkGrhu2}lrCU~46H9Qf$XYcbzu*M hLc2J|VD$xj0XzO60g<=@5WfHb002ovPDHLkV1mjbqE`R_ literal 0 HcmV?d00001 diff --git a/src/resources/assets/mmm/textures/blocks/materials/ore/cassiterite.png b/src/resources/assets/mmm/textures/blocks/materials/ore/cassiterite.png new file mode 100644 index 0000000000000000000000000000000000000000..1f9116ce849881ede59c01ea7feb982213e3a542 GIT binary patch literal 349 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPNn=Frvp{GFpVW7|}PZ!4!i_^8i)_ko7Jg*ZOI6q1X zc<7voS<0S}pMPLtWs&N16U}^sjuW15RCWj)Dvk|jJo4_h--mn4zl)!LXn4NZPeCQ{ zSfGHV&I~REk59YS`Cl(}HQFuMk$d}_)&iHNSONJq#d7K68}k;bMKg8YQhI9<$vb12 zrn=tgAdN}QDQ7lH*(LSNRCz4)Ax>jO={1Ip@2el*Kht2%&bWGN@c*XOvK$w-t^HU( zFMZ>^H4U*}9tP~QTed7Sj(gMLLYZe74%ZHwI6qlun3((Ye(wxLuNOBL+}`)zt#$Gx rk7@s#{3h&KvS8ci^~$U69^~J=G5J<{XE z)7O>#0h=tZxP1ACiyweO6FprVLo7}wCrB6_IOO!+o@4S-&X($3-3MnZP<%0KU0mG% z`qRra3wo{!_IJA>_VD$sEZp00i_>zopr0F~TPqW}N^ literal 0 HcmV?d00001 diff --git a/src/resources/assets/mmm/textures/items/materials/nuggets/tin.png b/src/resources/assets/mmm/textures/items/materials/nuggets/tin.png new file mode 100644 index 0000000000000000000000000000000000000000..83598c41dc8cf34ef05fd1e7a5187167245eb51f GIT binary patch literal 176 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#0h=tZ1oM;3i3LC*e@_?35R22v2@Hqa{asTU2FVp;A zS{nL)at?z}alHS@|F2esT;g#wSFqHaU=uze)p`@7!r7FYexl3?Z4=g3vM@4C4)BTT$X?><>&pIsO_rBUEcUCH3sA^EGbEzKIX^cyHLnE7Wngg2%t=)! z&Mz%WPPJ0VC@Cqh($`N0%ID`5>y>9_XXd7+WG3q67p3cic={maR?dmV#hE3kML?{V zRgnJedgVz52F3}VE{-7QO{k$%ur1{?E zoz)|MF>`yMo>-uk$cnBdDy=C>jTJh6+cd=OYHQoWiLV2o>F! zA(FPdReNz?@UIAgiVrgE=bkp5e%YeI@uAXYHiM?z;ti)}*!h0^^~WhuRZ#UL)A`G9 zl`NV*$mD-t`zc&ryJqdRh%;gm{Ot*4Om*^=-yBp$LaYYwW{WW(udI zuuF3MI9c9N#369u|9`m+s#0HmC)Aoq+&VAL*FI69yE^~z-qeNF=?}ME-E@5>YxRf! l2{YBCzFMgSJ+OH8llfuB#+wt@=fr}d+0)g}Wt~$(69Bc9^;G}> literal 0 HcmV?d00001