Jump to content

Can't Import things..


Recommended Posts

Hey guys! I am new to making forge mods and I need some help.

I cannot import the "Init" items.

 import cpw.mods.fml.common.Mod.Init;

I cannot import any items using Init.

It says it can not be resolved.

If you want my code for the item I am making:



My darkgems.java

package com.example.Darkgemsmod;

* Basic importing
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
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.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
* Basic needed forge stuff
@Mod(modid="ModTutorial",name="Mod Tutorial",version="v1")
public class darkgems {
* ToolMaterial
//Telling forge that we are creating these
public static Item darkgem;


//Declaring Init
public void load(FMLInitializationEvent event){
// define items
darkgem = new Darkgem(2000).setUnlocalizedName("darkgem");
// define blocks

//adding names
LanguageRegistry.addName(darkgem, "Dark Gem");




The Darkgem.java


package com.example.Darkgemsmod;

import net.minecraft.item.Item;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;

public class Darkgem extends Item {

public Darkgem(int par1) {
super(par1); //Returns super constructor: par1 is ID
setCreativeTab(CreativeTabs.tabMaterials); }//Tells the game what creative mode tab it goes in

public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
if (itemID == darkgems.darkgem.itemID) {
this.itemIcon = reg.registerIcon("darkgem"); // You can also replace blockID and blockIcon with itemID and itemIcon


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.