Posted March 31, 201312 yr I have been trying to make myself a sword that will work in a server or just normal Minecraft. I have run into many problems but I have been able to fix them. It's the same problem every time but this time I can not fix it. Zanofite Class code package mods.zanofite.common; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Item; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid="Zanofite", name = "Zanofite", version = "0.0.1") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class Zanofite { static Item ZanofiteItem; int itemzanofite = 501; static Block ZanofiteBlock; int blockZanofiteid = 500; @Init public void load(FMLInitializationEvent event){ //Problem ZanofiteItem = new ItemZanofite(Item()).setUnlocalizedName("Itemzanofite"); gameRegisters(); languageRegisters(); } private static void gameRegisters(){ GameRegistry.registerItem((net.minecraft.item.Item) ZanofiteItem, "ItemZanofite"); } private static void languageRegisters(){ LanguageRegistry.addName(ZanofiteBlock, "Zanofite Block"); } } And the ZanofiteItem Code package mods.zanofite.common; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.item.Item; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.Icon; public class ItemZanofite extends Item{ public ItemZanofite(int id) { super(id); this.setMaxStackSize(64); this.setCreativeTab(CreativeTabs.tabMaterials); this.setUnlocalizedName("Zanofite"); } @SideOnly(Side.CLIENT) @Override public void updateIcons(IconRegister par1IconRegister){ this.iconIndex=par1IconRegister.registerIcon("zanofite:zanofite"); } }
March 31, 201312 yr What ender said, please explain in detail your problem and post any errors you have gotten.
March 31, 201312 yr They way you initialize your item's looks weird, why are you casting it to item and so on? If you guys dont get it.. then well ya.. try harder...
March 31, 201312 yr You made this: static Item youritem = new YourItem(id); but every block and item have to be like this: public static Item youritem = new YourItem(id); you forgot the public. that could be your problem^^ and if not i do not know what the problem could be.
April 1, 201312 yr Author sorry the line that has //Problem above it is the one i'm getting red lines under it and it's saying that i need to make it and item.....which it already is but then once i do what it says the hole class goes red.
April 1, 201312 yr Author I don't want to sound like a 12 year old but if someone could show me the code for just a basic item, no crafting or anything just the item it would be great. I hate getting angry at this and that's all that's happening at the moment.
April 1, 201312 yr Sorry I'm posting a doubt instead of a solution but I'm also learning and I must take this oportunity to ask a question: you don't have a constructor for your ItemZanofite that takes an Item as an argument. Is that somehow allowed in Java? Is there like an implicit constructor for a base class that takes an instance of super class as argument? EDIT:You know what, I believe that's the error. I think you have to instantiate your ItemZanofite as in your constructor: by passing It's unique ID (some number you will make up that won't conflict with the other already established IDs in minecraft. I guess something like 1000 would be ok). WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons
April 1, 201312 yr you're giving it Item() as it's ID which is not correct. it needs to be an integer.
April 1, 201312 yr Author okay well changing that now gives me package mods.zanofite.common; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Item; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid="Zanofite", name = "Zanofite", version = "0.0.1") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class Zanofite { public static net.minecraft.item.Item ZanofiteItem; int itemzanofite = 501; public static Block ZanofiteBlock; int blockZanofiteid = 500; @Init public void load(FMLInitializationEvent event){ ZanofiteItem = new ItemZanofite(501).setUnlocalizedName("Itemzanofite"); gameRegisters(); languageRegisters(); } private static void gameRegisters(){ GameRegistry.registerItem((net.minecraft.item.Item) ZanofiteItem, "ItemZanofite"); } private static void languageRegisters(){ LanguageRegistry.addName(ZanofiteBlock, "Zanofite Block"); } } there are no errors now though eclipse, but when I start it I get this. Minecraft has crashed! ---------------------- Minecraft has stopped running because it encountered a problem; Failed to start game A full error report has been saved to A:\Minecraft Mods\forge\mcp\jars\.\crash-reports\crash-2013-04-01_14.07.50-client.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash --- BEGIN ERROR REPORT 64d33ccc -------- Full report at: A:\Minecraft Mods\forge\mcp\jars\.\crash-reports\crash-2013-04-01_14.07.50-client.txt Please show that file to Mojang, NOT just this screen! Generated 1/04/13 2:07 PM -- System Details -- Details: Minecraft Version: 1.5.1 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_17, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 877742800 bytes (837 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Suspicious classes: FML and Forge are installed IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v7.44 FML v5.1.8.611 Minecraft Forge 7.7.1.611 4 mods loaded, 4 mods active mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized Zanofite [Zanofite] (bin) Unloaded->Constructed->Pre-initialized->Errored LWJGL: 2.4.2 OpenGL: Intel® HD Graphics Family GL version 3.1.0 - Build 8.15.10.2559, Intel Is Modded: Definitely; Client brand changed to 'forge,fml' Type: Client (map_client.txt) Texture Pack: Default Profiler Position: N/A (disabled) Vec3 Pool Size: ~~ERROR~~ NullPointerException: null java.lang.IllegalArgumentException: Illegal object for naming null at cpw.mods.fml.common.registry.LanguageRegistry.addNameForObject(LanguageRegistry.java:112) at cpw.mods.fml.common.registry.LanguageRegistry.addName(LanguageRegistry.java:120) at mods.zanofite.common.Zanofite.languageRegisters(Zanofite.java:41) at mods.zanofite.common.Zanofite.load(Zanofite.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:689) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:206) at net.minecraft.client.Minecraft.startGame(Minecraft.java:444) at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44) at net.minecraft.client.Minecraft.run(Minecraft.java:729) at java.lang.Thread.run(Unknown Source) --- END ERROR REPORT 6fe0170e ---------- I now have idea what is happening
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.