diff --git a/src/java/mmm/materials/MWood.java b/src/java/mmm/materials/MWood.java new file mode 100644 index 0000000..3e5a243 --- /dev/null +++ b/src/java/mmm/materials/MWood.java @@ -0,0 +1,220 @@ +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; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.registry.GameRegistry; + + + +public class MWood + implements I_URecipeRegistrar +{ + + public final String NAME; + public final MWoodLog LOG; + public final MWoodPlanks PLANKS; + + private MapColor barkColor = MapColor.WOOD; + private MapColor plankColor = MapColor.WOOD; + private int baseFireEncouragement = 5; + private int baseFlammability = 5; + + + public MWood( final String name ) + { + this.NAME = name; + this.LOG = new MWoodLog( this ); + this.PLANKS = new MWoodPlanks( this ); + } + + + public MWood setBarkColor( final MapColor barkColor ) + { + this.barkColor = barkColor; + return this; + } + + + public MWood setPlankColor( final MapColor plankColor ) + { + this.plankColor = plankColor; + return this; + } + + + public MWood setBaseFireInfo( final int encouragement , final int flammability ) + { + this.baseFireEncouragement = encouragement; + this.baseFlammability = flammability; + return this; + } + + + public MWood register( ) + { + URegistry.addBlock( this.LOG ); + Blocks.FIRE.setFireInfo( this.LOG , this.baseFireEncouragement , this.baseFlammability ); + URegistry.addBlock( this.PLANKS ); + Blocks.FIRE.setFireInfo( this.PLANKS , this.baseFireEncouragement , this.baseFlammability * 4 ); + + URegistry.addRecipeRegistrar( this ); + return this; + } + + + public MapColor getBarkColor( ) + { + return this.barkColor; + } + + + public MapColor getPlankColor( ) + { + return this.plankColor; + } + + + @Override + public void registerRecipes( ) + { + // Log -> planks + GameRegistry.addShapelessRecipe( new ItemStack( this.PLANKS , 4 ) , new ItemStack( this.LOG ) ); + // Log -> charcoal + GameRegistry.addSmelting( this.LOG , new ItemStack( Items.COAL , 1 , 1 ) , 0.15f ); + + // Planks can be used to make... + // - crafting tables + GameRegistry.addShapedRecipe( new ItemStack( Blocks.CRAFTING_TABLE ) , // + "PP" , // + "PP" , // + 'P' , new ItemStack( this.PLANKS ) ); + // - chests + GameRegistry.addShapedRecipe( new ItemStack( Blocks.CHEST ) , // + "PPP" , // + "P P" , // + "PPP" , // + 'P' , new ItemStack( this.PLANKS ) ); + // - beds + GameRegistry.addShapedRecipe( new ItemStack( Items.BED ) , // + "WWW" , // + "PPP" , // + 'P' , new ItemStack( this.PLANKS ) , // + 'W' , new ItemStack( Blocks.WOOL , 1 , 32767 ) ); + // - sticks + GameRegistry.addShapedRecipe( new ItemStack( Items.STICK , 4 ) , // + "P" , // + "P" , // + 'P' , new ItemStack( this.PLANKS ) ); + // - trap doors + GameRegistry.addShapedRecipe( new ItemStack( Blocks.TRAPDOOR , 2 ) , // + "PPP" , // + "PPP" , // + 'P' , new ItemStack( this.PLANKS ) ); + // - pressure plates + GameRegistry.addShapedRecipe( new ItemStack( Blocks.WOODEN_PRESSURE_PLATE ) , // + "PP" , // + 'P' , new ItemStack( this.PLANKS ) ); + // - pistons + GameRegistry.addShapedRecipe( new ItemStack( Blocks.PISTON ) , // + "PPP" , // + "CIC" , // + "CRC" , // + 'P' , new ItemStack( this.PLANKS ) , // + 'C' , new ItemStack( Blocks.COBBLESTONE ) , // + 'I' , new ItemStack( Items.IRON_INGOT ) , // + 'R' , new ItemStack( Items.REDSTONE ) ); + // - note blocks + GameRegistry.addShapedRecipe( new ItemStack( Blocks.NOTEBLOCK ) , // + "PPP" , // + "PRP" , // + "PPP" , // + 'P' , new ItemStack( this.PLANKS ) , // + 'R' , new ItemStack( Items.REDSTONE ) ); + // - signs + GameRegistry.addShapedRecipe( new ItemStack( Items.SIGN , 3 ) , // + "PPP" , // + "PPP" , // + " S " , // + 'P' , new ItemStack( this.PLANKS ) , // + 'S' , new ItemStack( Items.STICK ) ); + // - bowls + GameRegistry.addShapedRecipe( new ItemStack( Items.BOWL , 4 ) , // + "P P" , // + " P " , // + 'P' , new ItemStack( this.PLANKS ) ); + // - jukeboxes + GameRegistry.addShapedRecipe( new ItemStack( Blocks.JUKEBOX ) , // + "PPP" , // + "PDP" , // + "PPP" , // + 'P' , new ItemStack( this.PLANKS ) , // + 'D' , new ItemStack( Items.DIAMOND ) ); + // - buttons + GameRegistry.addShapelessRecipe( new ItemStack( Blocks.WOODEN_BUTTON ) , // + new ItemStack( this.PLANKS ) ); + // - bookshelves + GameRegistry.addShapedRecipe( new ItemStack( Blocks.BOOKSHELF ) , // + "PPP" , // + "BBB" , // + "PPP" , // + 'P' , new ItemStack( this.PLANKS ) , // + 'B' , new ItemStack( Items.BOOK ) ); + // - tripwire hooks + GameRegistry.addShapedRecipe( new ItemStack( Blocks.TRIPWIRE_HOOK , 2 ) , // + "I" , // + "S" , // + "P" , // + 'P' , new ItemStack( this.PLANKS ) , // + 'I' , new ItemStack( Items.IRON_INGOT ) , // + 'S' , new ItemStack( Items.STICK ) ); + + // - swords + GameRegistry.addShapedRecipe( new ItemStack( Items.WOODEN_SWORD ) , // + "P" , // + "P" , // + "S" , // + 'P' , new ItemStack( this.PLANKS ) , // + 'S' , new ItemStack( Items.STICK ) ); + // - shovels + GameRegistry.addShapedRecipe( new ItemStack( Items.WOODEN_SHOVEL ) , // + "P" , // + "S" , // + "S" , // + 'P' , new ItemStack( this.PLANKS ) , // + 'S' , new ItemStack( Items.STICK ) ); + // - pickaxes + GameRegistry.addShapedRecipe( new ItemStack( Items.WOODEN_PICKAXE ) , // + "PPP" , // + " S " , // + " S " , // + 'P' , new ItemStack( this.PLANKS ) , // + 'S' , new ItemStack( Items.STICK ) ); + // - axes + GameRegistry.addShapedRecipe( new ItemStack( Items.WOODEN_AXE ) , // + "PP" , // + "PS" , // + " S" , // + 'P' , new ItemStack( this.PLANKS ) , // + 'S' , new ItemStack( Items.STICK ) ); + // - hoes + GameRegistry.addShapedRecipe( new ItemStack( Items.WOODEN_HOE ) , // + "PP" , // + " S" , // + " S" , // + 'P' , new ItemStack( this.PLANKS ) , // + 'S' , new ItemStack( Items.STICK ) ); + // - shields + GameRegistry.addShapedRecipe( new ItemStack( Items.SHIELD ) , // + "PIP" , // + "PPP" , // + " P " , // + 'P' , new ItemStack( this.PLANKS ) , // + 'I' , new ItemStack( Items.IRON_INGOT ) ); + } + +} diff --git a/src/java/mmm/materials/MWoodLog.java b/src/java/mmm/materials/MWoodLog.java new file mode 100644 index 0000000..ce8a817 --- /dev/null +++ b/src/java/mmm/materials/MWoodLog.java @@ -0,0 +1,93 @@ +package mmm.materials; + + +import mmm.utils.URegistry; +import net.minecraft.block.BlockLog; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; + + + +public class MWoodLog + extends BlockLog +{ + + private final MWood wood; + + + public MWoodLog( final MWood wood ) + { + super( ); + this.wood = wood; + + this.setHarvestLevel( "axe" , 0 ); + + this.setDefaultState( this.blockState.getBaseState( )// + .withProperty( BlockLog.LOG_AXIS , BlockLog.EnumAxis.Y ) ); + + URegistry.setIdentifiers( this , "materials" , "log" , wood.NAME ); + } + + + @Override + public MapColor getMapColor( final IBlockState state ) + { + if ( state.getValue( BlockLog.LOG_AXIS ) == BlockLog.EnumAxis.Y ) { + return this.wood.getPlankColor( ); + } + return this.wood.getBarkColor( ); + } + + + @Override + protected BlockStateContainer createBlockState( ) + { + return new BlockStateContainer( this , new IProperty< ? >[] { + BlockLog.LOG_AXIS + } ); + } + + + @Override + public IBlockState getStateFromMeta( final int meta ) + { + final IBlockState iblockstate = this.getDefaultState( ); + + switch ( meta & 12 ) { + case 0: + return iblockstate.withProperty( BlockLog.LOG_AXIS , BlockLog.EnumAxis.Y ); + + case 4: + return iblockstate.withProperty( BlockLog.LOG_AXIS , BlockLog.EnumAxis.X ); + + case 8: + return iblockstate.withProperty( BlockLog.LOG_AXIS , BlockLog.EnumAxis.Z ); + + default: + return iblockstate.withProperty( BlockLog.LOG_AXIS , BlockLog.EnumAxis.NONE ); + } + } + + + @Override + public int getMetaFromState( final IBlockState state ) + { + switch ( state.getValue( BlockLog.LOG_AXIS ) ) { + case X: + return 4; + + case Y: + return 0; + + case Z: + return 8; + + case NONE: + default: + return 12; + } + } + +} diff --git a/src/java/mmm/materials/MWoodPlanks.java b/src/java/mmm/materials/MWoodPlanks.java new file mode 100644 index 0000000..4ed71e6 --- /dev/null +++ b/src/java/mmm/materials/MWoodPlanks.java @@ -0,0 +1,38 @@ +package mmm.materials; + + +import mmm.utils.URegistry; +import net.minecraft.block.Block; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; + + + +public class MWoodPlanks + extends Block +{ + + private MWood wood; + + + public MWoodPlanks( MWood wood ) + { + super( Material.WOOD ); + this.wood = wood; + + this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS ); + this.setHarvestLevel( "axe" , 0 ); + + URegistry.setIdentifiers( this , "materials" , "planks" , wood.NAME ); + } + + + @Override + public MapColor getMapColor( final IBlockState state ) + { + return this.wood.getPlankColor( ); + } + +} diff --git a/src/java/mmm/materials/Materials.java b/src/java/mmm/materials/Materials.java index da5bec2..51c7c5f 100644 --- a/src/java/mmm/materials/Materials.java +++ b/src/java/mmm/materials/Materials.java @@ -34,16 +34,18 @@ public class Materials public static final MRock ROCK_SLATE; public static final MRock ROCK_BASALT; - public static final MMetal GOLD; - public static final MMetal IRON; - public static final MMetal COPPER; - public static final MMetal TIN; - public static final MMetal ZINC; + public static final MMetal METAL_GOLD; + 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 BRONZE; - public static final MMetal STEEL; + 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; @@ -76,21 +78,27 @@ public class Materials ROCK_BASALT = new MRock( "basalt" , MapColor.BLACK ); // Vanilla metals - GOLD = new MMetal( Blocks.GOLD_BLOCK , Items.GOLD_INGOT , Items.GOLD_NUGGET ); - IRON = new MMetal( Blocks.IRON_BLOCK , Items.IRON_INGOT , // + 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 - 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 ); + 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 - BRONZE = new MMetal( "bronze" , 0f , 5f , 1 , MapColor.BROWN ); - STEEL = new MMetal( "steel" , 0f , 7f , 2 , MapColor.LIGHT_BLUE ) // + 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 ) // + .register( ); + // Items that do not correspond to metals or ores ITEM_SLAG = Materials.makeItem( "slag" ); ITEM_COKE = Materials.makeFuel( "coke" , 9600 ); @@ -108,21 +116,21 @@ public class Materials // Actual ores ORE_COPPER = new MOre( "copper" , 1 ) // - .setMetal( Materials.COPPER ); + .setMetal( Materials.METAL_COPPER ); ORE_MALACHITE = new MOre( "malachite" , 1 )// - .setMetal( Materials.COPPER ) // + .setMetal( Materials.METAL_COPPER ) // .setDrops( Materials.ITEM_MALACHITE ) // .setExperience( 1 , 3 ); ORE_CUPRITE = new MOre( "cuprite" , 1 ) // - .setMetal( Materials.COPPER , 2 ) // + .setMetal( Materials.METAL_COPPER , 2 ) // .setDrops( Materials.ITEM_CUPRITE ) // .setExperience( 2 , 5 ); ORE_CASSITERITE = new MOre( "cassiterite" , 0 )// - .setMetal( Materials.TIN , 1 , E_MMetalItemType.NUGGET ) // + .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.ZINC ) // + .setMetal( Materials.METAL_ZINC ) // .setDrops( Materials.ITEM_SPHALERITE ) // .setExperience( 1 , 3 ); ORE_ROCK_SALT = new MOre( "rock_salt" , 0 ) // @@ -208,14 +216,14 @@ public class Materials // Bronze MAlloyRecipe.build( ).setName( "materials/bronze" ).setBurnTime( 400 ) // - .addInput( Materials.COPPER.INGOT ) // - .addInput( Materials.TIN.NUGGET ) // - .setOutput( Materials.BRONZE.INGOT ).setSlag( 1 ) // + .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.IRON.INGOT ) // + .addInput( Materials.METAL_IRON.INGOT ) // .addInput( Materials.ROCK_LIMESTONE ) // .addInput( Materials.ITEM_COKE ) // .setOutput( Materials.ITEM_PIG_IRON_INGOT , 2 ).setSlag( 3 ) // @@ -229,16 +237,16 @@ public class Materials // Steel MAlloyRecipe.build( ).setName( "materials/steel/from_ingot" ).setBurnTime( 3200 ) // - .addInput( Materials.IRON.INGOT ) // + .addInput( Materials.METAL_IRON.INGOT ) // .addInput( Materials.ROCK_LIMESTONE ) // .addInput( Materials.ITEM_PIG_IRON_INGOT ) // - .setOutput( Materials.STEEL.INGOT , 2 ).setSlag( 3 ) // + .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.STEEL.INGOT ).setSlag( 5 ) // + .setOutput( Materials.METAL_STEEL.INGOT ).setSlag( 5 ) // .register( ); // MAlloyRecipe.build( ).setName( "materials/red_copper" ).setBurnTime( 800 ) diff --git a/src/java/mmm/tech/tools/TechTools.java b/src/java/mmm/tech/tools/TechTools.java index f5db81f..4993651 100644 --- a/src/java/mmm/tech/tools/TechTools.java +++ b/src/java/mmm/tech/tools/TechTools.java @@ -18,18 +18,18 @@ public class TechTools public static final TTArmorSet STEEL_ARMOR; static { - COPPER_TOOLS = new TTToolSet( "copper" , Materials.COPPER.INGOT , 2 , 192 , 5.0f , 1.5f , 16 , 7 , -3 ); - COPPER_ARMOR = new TTArmorSet( "copper" , Materials.COPPER.INGOT , 10 , new int[] { + 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[] { 1 , 3 , 4 , 1 } , 15 , SoundEvents.ITEM_ARMOR_EQUIP_GENERIC , 0 ); - BRONZE_TOOLS = new TTToolSet( "bronze" , Materials.BRONZE.INGOT , 2 , 212 , 5.5f , 1.75f , 20 , 7.5f , -3.1f ); - BRONZE_ARMOR = new TTArmorSet( "bronze" , Materials.BRONZE.INGOT , 13 , new int[] { + BRONZE_TOOLS = new TTToolSet( "bronze" , Materials.METAL_BRONZE.INGOT , 2 , 212 , 5.5f , 1.75f , 20 , 7.5f , -3.1f ); + BRONZE_ARMOR = new TTArmorSet( "bronze" , Materials.METAL_BRONZE.INGOT , 13 , new int[] { 1 , 4 , 5 , 2 } , 20 , SoundEvents.ITEM_ARMOR_EQUIP_GENERIC , 0 ); - STEEL_TOOLS = new TTToolSet( "steel" , Materials.STEEL.INGOT , 3 , 800 , 7f , 2.5f , 12 , 8.0f , -3f ); - STEEL_ARMOR = new TTArmorSet( "steel" , Materials.STEEL.INGOT , 22 , new int[] { + STEEL_TOOLS = new TTToolSet( "steel" , Materials.METAL_STEEL.INGOT , 3 , 800 , 7f , 2.5f , 12 , 8.0f , -3f ); + STEEL_ARMOR = new TTArmorSet( "steel" , Materials.METAL_STEEL.INGOT , 22 , new int[] { 2 , 6 , 7 , 3 } , 9 , SoundEvents.ITEM_ARMOR_EQUIP_GENERIC , 1 ); }