Jump to content

Recommended Posts

Posted

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?

Posted

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.

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...

×   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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

×
×
  • Create New...

Important Information

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