Jump to content

Need Help Adding Items To Minecraft


majesticmadman98

Recommended Posts

This is my main mod class files code

package OO.mod.common;

 

import net.minecraft.item.Item;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler; // used in 1.6.2

//import cpw.mods.fml.common.Mod.PreInit;    // used in 1.5.2

//import cpw.mods.fml.common.Mod.Init;      // used in 1.5.2

//import cpw.mods.fml.common.Mod.PostInit;  // used in 1.5.2

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.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

 

@Mod(modid="OOModID", name="Odysseus' Oddity", version="1.0.0")

@NetworkMod(clientSideRequired=true)

public class OOMOD {

 

        // The instance of your mod that Forge uses.

        @Instance(value = "OOModID")

        public static OOMOD instance;

     

        // Says where the client and server 'proxy' code is loaded.

        @SidedProxy(clientSide="OO.mod.common.client.ClientProxy.ClientProxy", serverSide="OO.mod.common.CommonProxy")

        public static CommonProxy proxy;

     

        @EventHandler // used in 1.6.2

        //@PreInit    // used in 1.5.2

        public void preInit(FMLPreInitializationEvent event) {

                // Stub Method

        }

     

        @EventHandler // used in 1.6.2

        //@Init      // used in 1.5.2

        public void load(FMLInitializationEvent event) {

                proxy.registerRenderers();

        }

     

        @EventHandler // used in 1.6.2

        //@PostInit  // used in 1.5.2

        public void postInit(FMLPostInitializationEvent event) {

                // Stub Method

       

       

       

       

        }

}

This is my item class file

package OO.mod.common;

 

import net.minecraft.item.Item;

import net.minecraft.creativetab.CreativeTabs;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

public class CBingot extends Item {

 

public CBingot(int par1) {

super(par1);

final Item CBingot = new CBingot(5000);

// Constructor Configuration

setMaxStackSize(64);

setCreativeTab(CreativeTabs.tabMaterials);

setUnlocalizedName("Celestial Bronze Ingot");

LanguageRegistry.addName(CBingot, "Celestial Bronze Ingot");

 

}

 

 

}

 

Link to comment
Share on other sites

Wow.

 

So.

 

Where are you calling CBingot()?

 

Inside CBingot()

 

You need to go learn Java.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

i followed this http://www.minecraftforge.net/wiki/Basic_Modding and then http://www.minecraftforge.net/wiki/Basic_Items and that's were i'm at. I used to mod a while back but things got in the way so i'm trying to get back into it.

 

And you still thought that it was a good idea to call the class constructor from inside the class constructor.

 

Not to mention that that tutorial in no way has you doing that.

 

Compare:

 

package tutorial.generic;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

public class GenericItem extends Item {

        public GenericItem(int id) {
                super(id);
               
                // Constructor Configuration
                maxStackSize = 64;
                setCreativeTab(CreativeTabs.tabMisc);
                setUnlocalizedName("genericItem");
        }
}

With

public class CBingot extends Item {

   public CBingot(int par1) {
      super(par1);
      final Item CBingot = new CBingot(5000);  //you added this line
      // Constructor Configuration
      setMaxStackSize(64);
      setCreativeTab(CreativeTabs.tabMaterials);
      setUnlocalizedName("Celestial Bronze Ingot");
      LanguageRegistry.addName(CBingot, "Celestial Bronze Ingot");
      
   }

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

ok so i now have this as my code

 

package OO.mod.common;

 

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

 

public class CBingot extends Item {

 

        public CBingot(int id) {

                super(id);

             

                // Constructor Configuration

                maxStackSize = 64;

                setCreativeTab(CreativeTabs.tabMisc);

                setUnlocalizedName("genericItem");

        }

}

 

Link to comment
Share on other sites

Okay this is my code the underlined are errors, so how do i fix?

 

package OO.mod.common;

 

import net.minecraft.item.Item;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler; // used in 1.6.2

//import cpw.mods.fml.common.Mod.PreInit;    // used in 1.5.2

//import cpw.mods.fml.common.Mod.Init;      // used in 1.5.2

//import cpw.mods.fml.common.Mod.PostInit;  // used in 1.5.2

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.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

 

@Mod(modid="OOModID", name="Odysseus' Oddity", version="1.0.0")

@NetworkMod(clientSideRequired=true)

public class OOMOD {

 

        // The instance of your mod that Forge uses.

        @Instance(value = "OOModID")

        public static OOMOD instance;

       

       

        public static Item CBingot;

       

     

        // Says where the client and server 'proxy' code is loaded.

        @SidedProxy(clientSide="OO.mod.common.client.ClientProxy.ClientProxy", serverSide="OO.mod.common.CommonProxy")

        public static CommonProxy proxy;

     

        @EventHandler // used in 1.6.2

        //@PreInit    // used in 1.5.2

        public void preInit(FMLPreInitializationEvent event) {

          {

                CBingot = new CBingot(5000);

                CBingot = new CBingot(5001)

                .setMaxStackSize(16).setUnlocalizedName("genericIngot");

        }

       

        @EventHandler

        public void load(FMLInitializationEvent event) {

                LanguageRegistry.addName(CBItem, "Generic Item");

                LanguageRegistry.addName(CBIngot, "Generic Ingot"); 

        // Stub Method

        }

     

       

                proxy.registerRenderers();

        }

     

        @EventHandler // used in 1.6.2

        //@PostInit  // used in 1.5.2

        public void postInit(FMLPostInitializationEvent event) {

                // Stub Method

       

       

       

       

       

       

       

        }

}

 

and

 

package OO.mod.common;

 

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

 

public class CBingot extends Item {

 

        public CBingot(int id) {

                super(id);

             

                // Constructor Configuration

                maxStackSize = 64;

                setCreativeTab(CreativeTabs.tabMisc);

                setUnlocalizedName("genericItem");

        }

}

 

Link to comment
Share on other sites

        public void preInit(FMLPreInitializationEvent event) {
             {
                 CBingot = new CBingot(5000);
                 CBingot = new CBingot(5001)
                 .setMaxStackSize(16).setUnlocalizedName("genericIngot");
         }
       
         @EventHandler
         public void load(FMLInitializationEvent event) {
                 LanguageRegistry.addName(CBItem, "Generic Item");
                 LanguageRegistry.addName(CBIngot, "Generic Ingot");   
           // Stub Method
        }

 

Ok, first off, don't name your variables the same as your class name.

Second, you never defined nor declared CBItem.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Rename your variables.

Create new variables.

Use your IDE's code hinting and error hinting capabilities.

 

This is BASIC JAVA.  I am not going to help you with that, as you should already know it.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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