Main Mod Class
package mod.snesfan.digdigmine;
import mod.snesfan.digdigmine.Armor.*;
import mod.snesfan.digdigmine.Block.*;
import mod.snesfan.digdigmine.Block.Electrolyser.BlockElectrolyser;
import mod.snesfan.digdigmine.Block.Electrolyser.TileEntityElectrolyser;
import mod.snesfan.digdigmine.Item.*;
import mod.snesfan.digdigmine.Tool.*;
import mod.snesfan.digdigmine.World.*;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.Mod.EventHandler;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.registry.EntityRegistry;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
@Mod(modid="digdigmine", name="DigDigMine", version="0.0.1")
@NetworkMod(clientSideRequired=true, serverSideRequired=false, channels = {"DigDigMine"}, packetHandler = PacketHandler.class)
public class DigDigMine {
// The instance of your mod that Forge uses.
@Instance("digdigmine")
public static DigDigMine instance = new DigDigMine();
private GuiHandler guihandler = new GuiHandler();
// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="mod.snesfan.digdigmine.client.ClientProxy", serverSide="mod.snesfan.digdigmine.CommonProxy")
public static CommonProxy proxy;
public static CreativeTabs tabDigDigMine;
public static Block copperOre;
public static Block copperBlock;
public static Block electrolyserIdle;
public static Block electrolyserActive;
public static Item copperIngot;
public static Item empoweredCoal;
public static Item copperSpade;
public static Item copperHoe;
public static Item copperPickaxe;
public static Item copperAxe;
public static Item copperSword;
public static Item copperOmni;
//[start] ID int Declaration
public static int copperOreID;
public static int copperBlockID;
public static int electrolyserID;
public static int copperIngotID;
public static int empoweredCoalID;
public static int copperSpadeID;
public static int copperHoeID;
public static int copperPickaxeID;
public static int copperAxeID;
public static int copperSwordID;
public static int copperOmniID;
public static int woodOmniID;
public static int stoneOmniID;
public static int goldOmniID;
public static int ironOmniID;
public static int diamondOmniID;
public static int copperHelmetID;
public static int copperChestplateID;
public static int copperLeggingsID;
public static int copperBootsID;
//[end]
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
proxy.registerRenderers();
//[start] Configuration File Setup
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
copperOreID = config.get("Ores", "Copper Ore", 4000).getInt();
copperBlockID = config.get("Other Blocks", "Copper Block", 4001).getInt();
electrolyserID = config.get("Other Blocks", "Electrolyser", 4002).getInt();
config.addCustomCategoryComment("Ingots", "It appears that to avoid ID conflicts the game changes the ids of items. The id of the items in the game will have 256 added to them. Eg Copper Ingot will equal 5256 instead of 5000");
copperIngotID = config.get("Ingots", "Copper Ingot", 5000).getInt();
empoweredCoalID = config.get("Other Items", "Empowered Coal", 5001).getInt();
copperSpadeID = config.get("Tools", "Copper Spade", 6000).getInt();
copperHoeID = config.get("Tools", "Copper Hoe", 6001).getInt();
copperPickaxeID = config.get("Tools", "Copper Pickaxe", 6002).getInt();
copperAxeID = config.get("Tools", "Copper Axe", 6003).getInt();
copperSwordID = config.get("Tools", "Copper Sword", 6004).getInt();
copperOmniID = config.get("Tools", "Copper OmniTool", 6005).getInt();
woodOmniID = config.get("Tools", "Wood OmniTool", 6006).getInt();
stoneOmniID = config.get("Tools", "Stone OmniTool", 6007).getInt();
goldOmniID = config.get("Tools", "Gold OmniTool", 6008).getInt();
ironOmniID = config.get("Tools", "Iron OmniTool", 6009).getInt();
diamondOmniID = config.get("Tools", "Diamond OmniTool", 6010).getInt();
copperHelmetID = config.get("Armor", "Copper Helmet", 7000).getInt();
copperChestplateID = config.get("Armor", "Copper Chestplate", 7001).getInt();
copperLeggingsID = config.get("Armor", "Copper Leggings", 7002).getInt();
copperBootsID = config.get("Armor", "Copper Boots", 7003).getInt();
config.save();
//[end]
}
@EventHandler
public void load(FMLInitializationEvent event) {
proxy.registerRenderers();
//[start] Creative Tabs
tabDigDigMine = new CreativeTabs("tabDigDigMine") {
public ItemStack getIconItemStack() {
return new ItemStack(copperOmni, 1, 0);
}};
//[end]
//[start] Block Register
copperOre = new BlockCopperOre(copperOreID, Material.rock);
GameRegistry.registerBlock(copperOre, "Copper Ore");
copperBlock = new BlockCopperBlock(copperBlockID, Material.iron);
GameRegistry.registerBlock(copperBlock, "Copper Block");
electrolyserIdle = new BlockElectrolyser(electrolyserID, false).setCreativeTab(tabDigDigMine).setUnlocalizedName("electrolyserIdle");
electrolyserActive = new BlockElectrolyser(electrolyserID+1, true).setUnlocalizedName("electrolyserActive");
GameRegistry.registerBlock(electrolyserIdle, "Electrolyser Idle");
GameRegistry.registerBlock(electrolyserActive, "Electrolyser Active");
GameRegistry.registerTileEntity(TileEntityElectrolyser.class, "tileentityelectrolyser");
NetworkRegistry.instance().registerGuiHandler(this, guihandler);
//[end]
//[start] Item Register
copperIngot = new ItemCopperIngot(copperIngotID);
GameRegistry.registerItem(copperIngot, "Copper Ingot");
empoweredCoal = new ItemEmpoweredCoal(empoweredCoalID);
GameRegistry.registerItem(empoweredCoal, "Empowered Coal");
//[end]
//[start] Tool Register
copperSpade = new ToolCopperSpade(copperSpadeID, COPPERTOOL);
GameRegistry.registerItem(copperSpade, "Copper Spade");
copperHoe = new ToolCopperHoe(copperHoeID, COPPERTOOL);
GameRegistry.registerItem(copperHoe, "Copper Hoe");
copperPickaxe = new ToolCopperPickaxe(copperPickaxeID, COPPERTOOL);
GameRegistry.registerItem(copperPickaxe, "Copper Pickaxe");
copperAxe = new ToolCopperAxe(copperAxeID, COPPERTOOL);
GameRegistry.registerItem(copperAxe, "Copper Axe");
copperSword = new ToolCopperSword(copperSwordID, COPPERTOOL);
GameRegistry.registerItem(copperSword, "Copper Sword");
copperOmni = new ToolCopperOmni(copperOmniID, COPPERTOOL);
GameRegistry.registerItem(copperOmni, "Copper OmniTool");
Item woodOmni = new ToolWoodOmni(woodOmniID, EnumToolMaterial.WOOD);
GameRegistry.registerItem(woodOmni, "Wood OmniTool");
Item stoneOmni = new ToolStoneOmni(stoneOmniID, EnumToolMaterial.STONE);
GameRegistry.registerItem(stoneOmni, "Stone OmniTool");
Item goldOmni = new ToolGoldOmni(goldOmniID, EnumToolMaterial.GOLD);
GameRegistry.registerItem(goldOmni, "Gold OmniTool");
Item ironOmni = new ToolIronOmni(ironOmniID, EnumToolMaterial.IRON);
GameRegistry.registerItem(ironOmni, "Iron OmniTool");
Item diamondOmni = new ToolDiamondOmni(diamondOmniID, EnumToolMaterial.EMERALD);
GameRegistry.registerItem(diamondOmni, "Diamond OmniTool");
//[end]
//[start] Armor Register
Item copperHelmet = new ArmorCopperHelmet(copperHelmetID, COPPERARMOR, proxy.addArmor("copper"), 0);
GameRegistry.registerItem(copperHelmet, "Copper Helmet");
Item copperChestplate = new ArmorCopperChestplate(copperChestplateID, COPPERARMOR, proxy.addArmor("copper"), 1);
GameRegistry.registerItem(copperChestplate, "Copper Chestplate");
Item copperLeggings = new ArmorCopperLeggings(copperLeggingsID, COPPERARMOR, proxy.addArmor("copper"), 2);
GameRegistry.registerItem(copperLeggings, "Copper Leggings");
Item copperBoots = new ArmorCopperBoots(copperBootsID, COPPERARMOR, proxy.addArmor("copper"), 3);
GameRegistry.registerItem(copperBoots, "Copper Boots");
//[end]
//[start] Crafting Recipes
GameRegistry.addRecipe(new ItemStack(copperBlock), "ccc", "ccc", "ccc",
'c', copperIngot);
GameRegistry.addRecipe(new ItemStack(copperSpade), " c ", " s ", " s ",
'c', copperIngot, 's', Item.stick);
GameRegistry.addRecipe(new ItemStack(copperHoe), "cc ", " s ", " s ",
'c', copperIngot, 's', Item.stick);
GameRegistry.addRecipe(new ItemStack(copperPickaxe), "ccc", " s ", " s ",
'c', copperIngot, 's', Item.stick);
GameRegistry.addRecipe(new ItemStack(copperAxe), "cc ", "cs ", " s ",
'c', copperIngot, 's', Item.stick);
GameRegistry.addRecipe(new ItemStack(copperSword), " c ", " c ", " s ",
'c', copperIngot, 's', Item.stick);
GameRegistry.addRecipe(new ItemStack(copperOmni), "apd", " sh", " s ",
'd', copperSpade, 's', Item.stick, 'h', copperHoe, 'p', copperPickaxe, 'a', copperAxe);
GameRegistry.addRecipe(new ItemStack(copperHelmet), "ccc", "c c", " ",
'c', copperIngot);
GameRegistry.addRecipe(new ItemStack(copperChestplate), "c c", "ccc", "ccc",
'c', copperIngot);
GameRegistry.addRecipe(new ItemStack(copperLeggings), "ccc", "c c", "c c",
'c', copperIngot);
GameRegistry.addRecipe(new ItemStack(copperBoots), " ", "c c", "c c",
'c', copperIngot);
GameRegistry.addRecipe(new ItemStack(copperBoots), "c c", "c c", " ",
'c', copperIngot);
//[end]
//[start] Smelting Recipes
GameRegistry.addSmelting(copperOre.blockID, new ItemStack(copperIngot), 0.5f);
//[end]
//[start] World Generator Register
GameRegistry.registerWorldGenerator(new OreWorldGenerator());
//[end]
//[start] Set Block Harvest Level
MinecraftForge.setBlockHarvestLevel(copperOre, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(copperBlock, "pickaxe", 1);
//[end]
//[start] Ore Dictionary Register
OreDictionary.registerOre("oreCopper", copperOre);
OreDictionary.registerOre("ingotCopper", copperIngot);
//[end]
//[start] Language Register
LanguageRegistry.addName(copperOre, "Copper Ore");
LanguageRegistry.addName(copperBlock, "Copper Block");
LanguageRegistry.addName(electrolyserIdle, "Electrolyser");
LanguageRegistry.addName(electrolyserActive, "Electrolyser Active");
LanguageRegistry.addName(copperIngot, "Copper Ingot");
LanguageRegistry.addName(empoweredCoal, "Empowered Coal");
LanguageRegistry.addName(copperSpade, "Copper Shovel");
LanguageRegistry.addName(copperHoe, "Copper Hoe");
LanguageRegistry.addName(copperPickaxe, "Copper Pickaxe");
LanguageRegistry.addName(copperAxe, "Copper Axe");
LanguageRegistry.addName(copperSword, "Copper Sword");
LanguageRegistry.addName(copperOmni, "Copper OmniTool");
LanguageRegistry.addName(woodOmni, "Wood OmniTool");
LanguageRegistry.addName(stoneOmni, "Stone OmniTool");
LanguageRegistry.addName(goldOmni, "Gold OmniTool");
LanguageRegistry.addName(ironOmni, "Iron OmniTool");
LanguageRegistry.addName(diamondOmni, "Diamond OmniTool");
LanguageRegistry.addName(copperHelmet, "Copper Helmet");
LanguageRegistry.addName(copperChestplate, "Copper Chestplate");
LanguageRegistry.addName(copperLeggings, "Copper Leggings");
LanguageRegistry.addName(copperBoots, "Copper Boots");
//[end]
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
// Stub Method
}
//[start] Enums
static EnumToolMaterial COPPERTOOL = EnumHelper.addToolMaterial("COPPER", 1, -1, 5F, 1.5F, 7);
static EnumArmorMaterial COPPERARMOR = EnumHelper.addArmorMaterial("COPPER", -1, new int[] { 2, 5, 4, 1 }, 7);
//[end]
}
Item to be damaged in my custom furnace as fuel.