Jump to content

Armor/Proxy Crash


xGamer_Allx

Recommended Posts

Hello All,I have new problem:

Today I do an armor in my mod...

The code that I used is:

public static Item ModdedHelmet = new ItemArmorModdedHelmet(2837, "ModdedHelmet", ModdedArmor1, ModLoader.addArmor("Modded"), 0).setUnlocalizedName("HelmetModded").setCreativeTab(mod_modification.tabus);

It work,but if I start a server with this mod, it crash. I read that the "ModLoader.addArmor" isn't for smp...

Then I search and I find that the proxy can resolve my problem...

But when I do it the mod crash...

Main Code:

@Mod(modid = "moddingmod", name = "Modded Mod", version = "1.0")
@NetworkMod(clientSideRequired = true , serverSideRequired = true)
public class mod_modded {
@SidedProxy(clientSide = "Modding.ClientProxy", serverSide = "Modding.CommonProxy")
@Instance("modding")
public static mod_modded instance;
public static Item ModdedHelmet = new ItemArmorModdedHelmet(2837, "ModdedHelmet", ModdedArmor1, ModLoader.addArmor("Modded"), 0).setUnlocalizedName("HelmetModded").setCreativeTab(mod_modification.tabus);
public void load(){
	GameRegistry.registerItem(ModdedHelmet, "Helmet Armor");
	LanguageRegistry.addName(ModdedHelmet, "HelmetArmor");
}

CommonProxy Code:

public class CommonProxy {
public void registerRenderInformation()
    {
        MinecraftForgeClient.preloadTexture(null);
    }
public int addArmor(String armor)
    {
        return RenderingRegistry.addNewArmourRendererPrefix(armor);
    }
}

ClientProxy Code:

public class ClientProxy extends CommonProxy {
@Override
public void registerRenderInformation()
    {
        MinecraftForgeClient.preloadTexture(null);
    }
@Override
    public int addArmor(String armor)
    {
        return RenderingRegistry.addNewArmourRendererPrefix(armor);
    }
}

 

I try it on the Main Code:

@Mod(modid = "moddingmod", name = "Modded Mod", version = "1.0")
@NetworkMod(clientSideRequired = true , serverSideRequired = true)
public class mod_modded {
@SidedProxy(clientSide = "Modding.ClientProxy", serverSide = "Modding.CommonProxy")
@Instance("modding")
public static mod_modded instance;
public static Item ModdedHelmet = new ItemArmorModdedHelmet(2837, "ModdedHelmet", ModdedArmor1, proxy.addArmor("Modded"), 0).setUnlocalizedName("HelmetModded").setCreativeTab(mod_modification.tabus);
public void load(){
proxy.registerRenderThings();
	GameRegistry.registerItem(ModdedHelmet, "Helmet Armor");
	LanguageRegistry.addName(ModdedHelmet, "HelmetArmor");
}

But Not work

Link to comment
Share on other sites

This is the logs of the console of eclipse:

2013-06-11 12:09:12 [iNFO] [ForgeModLoader] Forge Mod Loader version 5.2.17.716 for Minecraft 1.5.2 loading

2013-06-11 12:09:12 [iNFO] [ForgeModLoader] Java is Java HotSpot 64-Bit Server VM, version 1.7.0_17, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

2013-06-11 12:09:12 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

2013-06-11 12:09:16 [iNFO] [sTDOUT] 229 recipes

2013-06-11 12:09:16 [iNFO] [sTDOUT] 27 achievements

2013-06-11 12:09:16 [iNFO] [Minecraft-Client] Setting user: Player901

2013-06-11 12:09:16 [iNFO] [sTDOUT] (Session ID is -)

2013-06-11 12:09:16 [iNFO] [sTDERR] Client asked for parameter: server

2013-06-11 12:09:16 [iNFO] [Minecraft-Client] LWJGL Version: 2.4.2

2013-06-11 12:09:17 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization

2013-06-11 12:09:17 [iNFO] [sTDOUT] MinecraftForge v7.8.0.716 Initialized

2013-06-11 12:09:17 [iNFO] [ForgeModLoader] MinecraftForge v7.8.0.716 Initialized

2013-06-11 12:09:17 [iNFO] [sTDOUT] Replaced 85 ore recipies

2013-06-11 12:09:17 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization

2013-06-11 12:09:17 [iNFO] [ForgeModLoader] Reading custom logging properties from C:\Users\User\Desktop\Meteorus\jars\config\logging.properties

2013-06-11 12:09:17 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL

2013-06-11 12:09:17 [iNFO] [ForgeModLoader] Searching C:\Users\User\Desktop\Meteorus\jars\mods for mods

2013-06-11 12:09:18 [iNFO] [ForgeModLoader] Attempting to reparse the mod container bin

2013-06-11 12:09:20 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load

2013-06-11 12:09:20 [iNFO] [mcp] Activating mod mcp

2013-06-11 12:09:20 [iNFO] [FML] Activating mod FML

2013-06-11 12:09:20 [iNFO] [Forge] Activating mod Forge

2013-06-11 12:09:20 [iNFO] [moddingmod] Activating mod moddingmod

2013-06-11 12:09:20 [iNFO] [ForgeModLoader] Registering Forge Packet Handler

2013-06-11 12:09:20 [iNFO] [ForgeModLoader] Succeeded registering Forge Packet Handler

2013-06-11 12:09:20 [iNFO] [sTDERR] Exception in thread "Minecraft main thread" java.lang.ExceptionInInitializerError

2013-06-11 12:09:20 [iNFO] [sTDERR] at java.lang.Class.forName0(Native Method)

2013-06-11 12:09:20 [iNFO] [sTDERR] at java.lang.Class.forName(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:425)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-06-11 12:09:20 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-06-11 12:09:20 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)

2013-06-11 12:09:20 [iNFO] [sTDERR] at cpw.mods.fml.common.Loader.loadMods(Loader.java:509)

2013-06-11 12:09:20 [iNFO] [sTDERR] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:163)

2013-06-11 12:09:20 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:411)

2013-06-11 12:09:20 [iNFO] [sTDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)

2013-06-11 12:09:20 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:733)

2013-06-11 12:09:20 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException

2013-06-11 12:09:20 [iNFO] [sTDERR] at Modding.mod_modding.<clinit>(mod_modding.java:72)

2013-06-11 12:09:20 [iNFO] [sTDERR] ... 29 more

2013-06-11 12:10:47 [iNFO] [sTDERR] Someone is closing me!

Link to comment
Share on other sites

On the line 72 there is:

public static Item ModdedHelmet = new ItemArmorModdedHelmet(2837, "ModdedHelmet", ModdedArmor1, proxy.addArmor("Modded"), 0).setUnlocalizedName("HelmetModded").setCreativeTab(mod_modification.tabus);

 

your proxy variable is not instanciatd when you initialize your item that way. You have to initialize in one of your @init methods (preferably the @PreInit one)

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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