diff --git a/src/java/mmm/materials/E_MMetalItemType.java b/src/java/mmm/materials/E_MMetalItemType.java index 137251f..5be0a17 100644 --- a/src/java/mmm/materials/E_MMetalItemType.java +++ b/src/java/mmm/materials/E_MMetalItemType.java @@ -1,5 +1,6 @@ package mmm.materials; + public enum E_MMetalItemType { INGOT( "ingot" ) , NUGGET( "nugget" ); diff --git a/src/java/mmm/materials/MMetal.java b/src/java/mmm/materials/MMetal.java index c342b9f..f57accc 100644 --- a/src/java/mmm/materials/MMetal.java +++ b/src/java/mmm/materials/MMetal.java @@ -3,6 +3,8 @@ package mmm.materials; import mmm.utils.I_URecipeRegistrar; import mmm.utils.URegistry; +import net.minecraft.block.Block; +import net.minecraft.block.material.MapColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.registry.GameRegistry; @@ -14,43 +16,53 @@ public class MMetal { public final float SMELTING_XP; + public final Block BLOCK; public final Item INGOT; public final Item NUGGET; - public MMetal( final String name , float baseSmeltingXP ) + public MMetal( final String name , final float baseSmeltingXP , float hardness , int harvestLevel , + MapColor mapColor ) { - this( baseSmeltingXP , // + this( baseSmeltingXP , new MMetalBlock( name , hardness , harvestLevel , mapColor ) , // new MMetalItem( E_MMetalItemType.INGOT , name ) , // new MMetalItem( E_MMetalItemType.NUGGET , name ) ); } - public MMetal( final Item ingot , final Item nugget ) + public MMetal( final Block block , final Item ingot , final Item nugget ) { - this( 0 , ingot , nugget ); + this( 0 , block , ingot , nugget ); } - protected MMetal( float baseSmeltingXP , Item ingot , Item nugget ) + protected MMetal( final float baseSmeltingXP , final Block block , final Item ingot , final Item nugget ) { - SMELTING_XP = baseSmeltingXP; - INGOT = ingot; - NUGGET = nugget; + this.SMELTING_XP = baseSmeltingXP; + this.BLOCK = block; + this.INGOT = ingot; + this.NUGGET = nugget; this.register( ); } protected MMetal register( ) { + boolean custom = false; + if ( this.BLOCK instanceof MMetalBlock ) { + URegistry.addBlock( this.BLOCK ); + custom = true; + } if ( this.INGOT instanceof MMetalItem ) { URegistry.addItem( this.INGOT ); + custom = true; } if ( this.NUGGET instanceof MMetalItem ) { URegistry.addItem( this.NUGGET ); + custom = true; } - if ( this.INGOT instanceof MMetalItem || this.NUGGET instanceof MMetalItem ) { - this.registerRecipes( ); + if ( custom ) { + URegistry.addRecipeRegistrar( this ); } return this; } @@ -59,10 +71,18 @@ public class MMetal @Override public void registerRecipes( ) { - GameRegistry.addShapelessRecipe( new ItemStack( this.NUGGET , 9 ) , this.INGOT ); - GameRegistry.addRecipe( new ItemStack( this.INGOT ) , // - "NNN" , "NNN" , "NNN" , // - 'N' , this.NUGGET ); + if ( this.INGOT instanceof MMetalItem || this.NUGGET instanceof MMetalItem ) { + GameRegistry.addShapelessRecipe( new ItemStack( this.NUGGET , 9 ) , this.INGOT ); + GameRegistry.addRecipe( new ItemStack( this.INGOT ) , // + "NNN" , "NNN" , "NNN" , // + 'N' , this.NUGGET ); + } + if ( this.INGOT instanceof MMetalItem || this.BLOCK instanceof MMetalBlock ) { + GameRegistry.addShapelessRecipe( new ItemStack( this.INGOT , 9 ) , this.BLOCK ); + GameRegistry.addRecipe( new ItemStack( this.BLOCK ) , // + "III" , "III" , "III" , // + 'I' , this.INGOT ); + } } } diff --git a/src/java/mmm/materials/MMetalBlock.java b/src/java/mmm/materials/MMetalBlock.java new file mode 100644 index 0000000..281df23 --- /dev/null +++ b/src/java/mmm/materials/MMetalBlock.java @@ -0,0 +1,28 @@ +package mmm.materials; + + +import mmm.utils.URegistry; +import net.minecraft.block.Block; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + + + +public class MMetalBlock + extends Block +{ + + public MMetalBlock( String name , float hardness , int harvestLevel , MapColor mapColor ) + { + super( Material.IRON , mapColor ); + this.setHardness( hardness ); + this.setResistance( 10f ); + this.setSoundType( SoundType.METAL ); + this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS ); + this.setHarvestLevel( "pickaxe" , harvestLevel ); + URegistry.setIdentifiers( this , "materials" , "block" , name ); + } + +} diff --git a/src/java/mmm/materials/Materials.java b/src/java/mmm/materials/Materials.java index a624113..0f7aa22 100644 --- a/src/java/mmm/materials/Materials.java +++ b/src/java/mmm/materials/Materials.java @@ -5,7 +5,9 @@ import mmm.materials.ore.MOCopper; import mmm.materials.ore.MOCuprite; import mmm.materials.ore.MOMalachite; import mmm.utils.URegistry; +import net.minecraft.block.material.MapColor; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -26,13 +28,19 @@ public class Materials public static final MOre ORE_CUPRITE; static { - GOLD = new MMetal( Items.GOLD_INGOT , Items.GOLD_NUGGET ); - IRON = new MMetal( Items.IRON_INGOT , new MMetalItem( E_MMetalItemType.NUGGET , "iron" ) ); - COPPER = new MMetal( "copper" , 0.4f ); + // Vanilla metals + 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" ) ); + // Custom metals + COPPER = new MMetal( "copper" , 0.4f , 4f , 1 , MapColor.DIRT ); + + // Stones extracted from ores URegistry.addItem( STONE_MALACHITE = makeStone( "malachite" ) ); URegistry.addItem( STONE_CUPRITE = makeStone( "cuprite" ) ); + // Actual ores URegistry.addBlock( ORE_COPPER = new MOCopper( ) ); URegistry.addBlock( ORE_MALACHITE = new MOMalachite( ) ); URegistry.addBlock( ORE_CUPRITE = new MOCuprite( ) ); diff --git a/src/resources/assets/mmm/blockstates/materials/block/copper.json b/src/resources/assets/mmm/blockstates/materials/block/copper.json new file mode 100644 index 0000000..61c748c --- /dev/null +++ b/src/resources/assets/mmm/blockstates/materials/block/copper.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "mmm:materials/block/copper" } + } +} diff --git a/src/resources/assets/mmm/lang/en_US.lang b/src/resources/assets/mmm/lang/en_US.lang index bdc3c3f..0ceb438 100644 --- a/src/resources/assets/mmm/lang/en_US.lang +++ b/src/resources/assets/mmm/lang/en_US.lang @@ -25,11 +25,10 @@ item.mmm.materials.nugget.iron.name=Iron Nugget item.mmm.materials.ingot.copper.name=Copper Ingot item.mmm.materials.nugget.copper.name=Copper Nugget +tile.mmm.materials.block.copper.name=Copper Block tile.mmm.materials.ore.copper.name=Native Copper - item.mmm.materials.stone.malachite.name=Malachite tile.mmm.materials.ore.malachite.name=Malachite Ore - item.mmm.materials.stone.cuprite.name=Cuprite tile.mmm.materials.ore.cuprite.name=Cuprite Ore diff --git a/src/resources/assets/mmm/models/block/materials/block/copper.json b/src/resources/assets/mmm/models/block/materials/block/copper.json new file mode 100644 index 0000000..2d973d6 --- /dev/null +++ b/src/resources/assets/mmm/models/block/materials/block/copper.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "mmm:blocks/materials/block/copper" + } +} \ No newline at end of file diff --git a/src/resources/assets/mmm/models/item/materials/block/copper.json b/src/resources/assets/mmm/models/item/materials/block/copper.json new file mode 100644 index 0000000..21c92bf --- /dev/null +++ b/src/resources/assets/mmm/models/item/materials/block/copper.json @@ -0,0 +1,3 @@ +{ + "parent": "mmm:block/materials/block/copper" +} \ No newline at end of file diff --git a/src/resources/assets/mmm/textures/blocks/materials/block/copper.png b/src/resources/assets/mmm/textures/blocks/materials/block/copper.png new file mode 100644 index 0000000..f293a82 Binary files /dev/null and b/src/resources/assets/mmm/textures/blocks/materials/block/copper.png differ