Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class darkgems {
/*
* ToolMaterial
*/
//Telling forge that we are creating these
//items
public static Item darkgem;

//tools

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

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

//blocks
//crafting
}
}

 

 

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
}

}
}

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.