Posted August 27, 201312 yr I programmed my first mod. This si code: FILE: CZSKtrainmod.class package XtraEdge.mod.CZSKtrainmod.common; import XtraEdge.mod.CZSKtrainmod.item.ItemRedLight; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = "CZSKtrainmod", name = "CZ/SK Train mod", version = "v0.1 Beta") @NetworkMod(clientSideRequired=true,serverSideRequired=false) public class CZSKtrainmod { public static Item RedLight; public static Item BlueLight; public CZSKtrainmod() { RedLight = new ItemRedLight(1000).setUnlocalizedName("RedLight").setCreativeTab(CreativeTabs.tabTools); BlueLight = new ItemRedLight(1001).setUnlocalizedName("BlueLight").setCreativeTab(CreativeTabs.tabTools); LanguageRegistry.addName(RedLight, "Červené svetlo"); LanguageRegistry.addName(BlueLight, "Modré svetlo"); GameRegistry.addRecipe(new ItemStack(RedLight, 2), new Object [] { " X ", " X ", " X ", RedLight }); GameRegistry.addRecipe(new ItemStack(BlueLight, 2), new Object [] { " X ", " X ", " X ", BlueLight }); } } FILE ItemRedLight.class package XtraEdge.mod.CZSKtrainmod.item; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.item.Item; public class ItemRedLight extends Item { public ItemRedLight(int par1) { super(par1); // TODO Auto-generated constructor stub } public void registerIcons(IconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("CZSKtrainmod:Redlight"); } } FILE ItemBlueLight.class package XtraEdge.mod.CZSKtrainmod.item; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.item.Item; public class ItemBlueLight extends Item { public ItemBlueLight(int par1) { super(par1); // TODO Auto-generated constructor stub } public void registerIcons(IconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("CZSKtrainmod:Bluelight"); } } But when I run minecraft I´ve this message: Minecraft has crashed! ---------------------- Minecraft has stopped running because it encountered a problem; Failed to start game A full error report has been saved to F:\DATA\eclipse\1.5.2\mcp751\jars\.\crash-reports\crash-2013-08-27_16.33.20-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 87131c4e -------- Full report at: F:\DATA\eclipse\1.5.2\mcp751\jars\.\crash-reports\crash-2013-08-27_16.33.20-client.txt Please show that file to Mojang, NOT just this screen! Generated 27.8.2013 16:33 -- System Details -- Details: Minecraft Version: 1.5.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_25, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 950267928 bytes (906 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 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.51 FML v5.2.23.737 Minecraft Forge 7.8.1.737 4 mods loaded, 4 mods active mcp{7.51} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed FML{5.2.23.737} [Forge Mod Loader] (coremods) Unloaded->Constructed Forge{7.8.1.737} [Minecraft Forge] (coremods) Unloaded->Constructed CZSKtrainmod{v0.1 Beta} [CZ/SK Train mod] (bin) Unloaded->Errored LWJGL: 2.4.2 OpenGL: GeForce GT 430/PCIe/SSE2 GL version 4.3.0, NVIDIA Corporation Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Texture Pack: Default Profiler Position: N/A (disabled) Vec3 Pool Size: ~~ERROR~~ NullPointerException: null java.lang.ClassCastException: XtraEdge.mod.CZSKtrainmod.item.ItemRedLight cannot be cast to java.lang.Character at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:186) at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:244) at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:239) at XtraEdge.mod.CZSKtrainmod.common.CZSKtrainmod.<init>(CZSKtrainmod.java:36) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:168) at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:466) 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.sendEventToModContainer(LoadController.java:192) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:172) 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:103) at cpw.mods.fml.common.Loader.loadMods(Loader.java:504) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:163) at net.minecraft.client.Minecraft.startGame(Minecraft.java:411) at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44) at net.minecraft.client.Minecraft.run(Minecraft.java:733) at java.lang.Thread.run(Unknown Source) --- END ERROR REPORT 885d8b42 ---------- Can you help me with this please?
August 27, 201312 yr GameRegistry.addRecipe(new ItemStack(RedLight, 2), new Object [] { " X ", " X ", " X ", 'X', RedLight }); GameRegistry.addRecipe(new ItemStack(BlueLight, 2), new Object [] { " X ", " X ", " X ", 'X', BlueLight }); Go learn how add a recipe.
August 27, 201312 yr Heres a nice place to learn modding from the start, it's made by the creator of the famous Steve's Carts mod Vswe! courses.vswe.se If you guys dont get it.. then well ya.. try harder...
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.