Jump to content

[1.7.2]NetworkRegistry


Z@Nka

Recommended Posts

I have this problem where I cant register my "GuiHandler". I am not sure if its just something i missed or what but i cant test by new code because the game cant start.

The code i am using is:

NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());

I have tried putting it into Init/Load and i did put it in normally. None of it worked. :'(

If I helped then you help, hit that Thank You button or Applaud.

Link to comment
Share on other sites

u need to say this, because u r giving an instance of its own class

 

NetworkRegistry.instance().registerGuiHandler(this, new GuiHandler());

*********************************

**  Always remember you are unique,  **

**  just like everyone else                   **     

**********************************

Was my post helpful? Say thanks and

press the thank you button, on my post!!

God, damn it!

Link to comment
Share on other sites

Crash report:

---- Minecraft Crash Report ----
// Surprise! Haha. Well, this is awkward.

Time: 07.03.14 22:01
Description: Initializing game

java.lang.RuntimeException: Invalid attempt to create a GUI during mod construction. Use an EventHandler instead
at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:218)
at bulkyzanka.electro.mod.Electrocuted.<init>(Electrocuted.java:143)
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.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:173)
at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:509)
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:47)
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:209)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)
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:47)
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:119)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:484)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:564)
at net.minecraft.client.Minecraft.run(Minecraft.java:934)
at net.minecraft.client.main.Main.main(Main.java:112)
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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:218)
at bulkyzanka.electro.mod.Electrocuted.<init>(Electrocuted.java:143)
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.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:173)
at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:509)
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:47)
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:209)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)
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:47)
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:119)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:484)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:564)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:934)
at net.minecraft.client.main.Main.main(Main.java:112)
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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_21, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 197018256 bytes (187 MB) / 378011648 bytes (360 MB) up to 1905197056 bytes (1816 MB)
JVM Flags: 0 total; 
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.01-pre FML v7.2.125.1031 Minecraft Forge 10.12.0.1031 5 mods loaded, 5 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed
FML{7.2.125.1031} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1031.jar) Unloaded->Constructed
Forge{10.12.0.1031} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1031.jar) Unloaded->Constructed
examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed
electro{1.0A} [Electrocuted] (bin) Unloaded->Errored
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: AMD Radeon HD 6800 Series GL version 4.2.12422 Compatibility Profile Context 13.152.0.0, ATI Technologies Inc.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: ~~ERROR~~ NullPointerException: null
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
Anisotropic Filtering: Off (1)

 

Main class:

package bulkyzanka.electro.mod;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.util.EnumHelper;
import bulkyzanka.electro.mod.blocks.BlockCompressionFurnace;
import bulkyzanka.electro.mod.blocks.Test;
import bulkyzanka.electro.mod.creativetabs.ElectrocutedTab;
import bulkyzanka.electro.mod.gui.GuiHandler;
import bulkyzanka.electro.mod.items.BoneIngot;
import bulkyzanka.electro.mod.items.BonePlate;
import bulkyzanka.electro.mod.items.CoalMotor;
import bulkyzanka.electro.mod.items.ElectricMotor;
import bulkyzanka.electro.mod.items.Generator;
import bulkyzanka.electro.mod.items.armor.BoneArmor;
import bulkyzanka.electro.mod.items.tools.BoneAxe;
import bulkyzanka.electro.mod.items.tools.BoneHoe;
import bulkyzanka.electro.mod.items.tools.BonePickaxe;
import bulkyzanka.electro.mod.items.tools.BoneSpade;
import bulkyzanka.electro.mod.items.tools.BoneSword;
import bulkyzanka.electro.mod.lib.Referance;
import bulkyzanka.electro.mod.proxy.ProxyCommon;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;



@Mod(modid = Referance.MODID, version = Referance.VERSION)
public class Electrocuted
{

//Instance
@Instance(Referance.MODID)
    public static Electrocuted instance;

//Proxy Stuff
@SidedProxy(clientSide = "electro.proxy.ProxyClient" , serverSide = "electro.proxy.ProxyCommon")
public static ProxyCommon proxy;

//GuiIDs
public static final int guiIdCompressionFurnace = 1;
//CreativeTabs
public static CreativeTabs  ElectrocutedTab = new ElectrocutedTab(CreativeTabs.getNextID(), "ElectrocutedTab");

//Material
	//ToolMaterial
public static ToolMaterial Bone = EnumHelper.addToolMaterial("Bone", 2, 175, 6.0F, 2.5F, 19);

	//ArmorMaterial
public static ArmorMaterial BoneArmor = EnumHelper.addArmorMaterial("BONEARMOR", 7, new int[]{3, 7, 6, 3}, 20);

//Items
public static Item BonePlate = new BonePlate().setUnlocalizedName("BonePlate").setTextureName("electrocuted:BonePlate");
public static Item BoneIngot = new BoneIngot().setUnlocalizedName("BoneIngot").setTextureName("electrocuted:BoneIngot");
public static Item CoalMotor = new CoalMotor().setUnlocalizedName("CoalMotor").setTextureName("electrocted:CoalMotor");
public static Item ElectricMotor = new ElectricMotor().setUnlocalizedName("ElectricMotor").setTextureName("electrocted:ElectricMotor");
public static Item Generator = new Generator().setUnlocalizedName("Generator").setTextureName("electrocted:Generator");

//Blocks
public static Block CompressionFurnaceIdle = new BlockCompressionFurnace(false).setBlockName("CompressionFurnaceIdle").setBlockTextureName("electrocuted:CompressionFurnace_Idle_front");
public static Block CompressionFurnaceActive = new BlockCompressionFurnace(true).setBlockName("CompressionFurnaceActive").setBlockTextureName("electrocuted:CompressionFurnace_Idle_front");

//Tools
public static Item BoneSword = new BoneSword(Bone).setUnlocalizedName("BoneSword").setTextureName("electrocuted:BoneSword");
public static Item BoneSpade = new BoneSpade(Bone).setUnlocalizedName("BoneSpade").setTextureName("electrocuted:BoneSpade");
public static Item BonePickaxe = new BonePickaxe(Bone).setUnlocalizedName("BonePickaxe").setTextureName("electrocuted:BonePickaxe");
public static Item BoneAxe = new BoneAxe(Bone).setUnlocalizedName("BoneAxe").setTextureName("electrocuted:BoneAxe");
public static Item BoneHoe = new BoneHoe(Bone).setUnlocalizedName("BoneHoe").setTextureName("electrocuted:BoneHoe");

//Armor
public static Item BoneHelmet = new BoneArmor(BoneArmor, 0).setUnlocalizedName("BoneHelmet").setTextureName("electrocuted:BoneHelmet");
public static Item BoneChestPlate = new BoneArmor(BoneArmor, 1).setUnlocalizedName("BoneChestPlate").setTextureName("electrocuted:BoneChestPlate");
public static Item BoneLeggings = new BoneArmor(BoneArmor, 2).setUnlocalizedName("BoneLeggings").setTextureName("electrocuted:BoneLeggings");
public static Item BoneBoots = new BoneArmor(BoneArmor, 3).setUnlocalizedName("BoneBoots").setTextureName("electrocuted:BoneBoots");

 //EventHandler
	//PreInit
@EventHandler
 public void preinit(FMLPreInitializationEvent event)
{
	//Config
	Configuration config = new Configuration(
			event.getSuggestedConfigurationFile());
			config.load();

			config.save();
 }

//Init
 @EventHandler
 public void init(FMLInitializationEvent event)
 {
	 proxy.registerRenderInformation();
	 proxy.registerTileEntities();
 }	 

 	//PostInit
 @EventHandler
 public void postinit(FMLPostInitializationEvent event)
 {

 }
public Electrocuted()
{

//Registry
 GameRegistry.registerItem(BonePlate, "BonePlate");
 GameRegistry.registerItem(BoneIngot, "BoneIngot");
 GameRegistry.registerItem(CoalMotor, "CoalMotor");
 GameRegistry.registerItem(ElectricMotor, "ElectricMotor");
 GameRegistry.registerItem(Generator, "Generator");

 GameRegistry.registerBlock(CompressionFurnaceIdle, "CompressionFurnaceIdle");
 GameRegistry.registerBlock(CompressionFurnaceActive, "CompressionFurnaceActive");

 GameRegistry.registerItem(BoneSword, "BoneSword");
 GameRegistry.registerItem(BoneSpade, "BoneSpade");
 GameRegistry.registerItem(BonePickaxe, "BonePickaxe");
 GameRegistry.registerItem(BoneAxe, "BoneAxe");
 GameRegistry.registerItem(BoneHoe, "BoneHoe");

 GameRegistry.registerItem(BoneHelmet, "BoneHelmet");
 GameRegistry.registerItem(BoneChestPlate, "BoneChestPlate");
 GameRegistry.registerItem(BoneLeggings, "BoneLeggings");
 GameRegistry.registerItem(BoneBoots, "BoneBoots");

 GuiHandler GuiHandler = new GuiHandler();
 LanguageRegistry.instance().addStringLocalization("container.CompressionFurnace", "Compression Furnace");
 NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());

//Recipe
 	//Items
 GameRegistry.addRecipe(new ItemStack(BonePlate, 2), new Object []
 {
		"XX ", "XX ", 'X', Items.bone
 });
 GameRegistry.addRecipe(new ItemStack(BoneIngot, 3), new Object []
 {
	"XXX", "XYX", "XXX", 'X', Items.bone, 'Y', Items.iron_ingot
 });

 	//Tools
 GameRegistry.addRecipe(new ItemStack(BoneSword, 1), new Object []
 {
	 " X ", " X ", " Y ", 'X', BoneIngot, 'Y', Items.stick
 });
 GameRegistry.addRecipe(new ItemStack(BoneSpade, 1), new Object []
 {
	 " X ", " Y ", " Y ", 'X', BoneIngot, 'Y', Items.stick
 });
 GameRegistry.addRecipe(new ItemStack(BonePickaxe, 1), new Object []
 {
	 "XXX", " Y ", " Y ", 'X', BoneIngot, 'Y', Items.stick
 });
 GameRegistry.addRecipe(new ItemStack(BoneAxe, 1), new Object []
 {
	 "XX ", "XY ", " Y ", 'X', BoneIngot, 'Y', Items.stick
 });
 GameRegistry.addRecipe(new ItemStack(BoneHoe, 1), new Object []
 {
	 " XX", " Y ", " Y ", 'X', BoneIngot, 'Y', Items.stick
 });


 	//Armor
 GameRegistry.addRecipe(new ItemStack(BoneHelmet, 1), new Object []
 {
	 "XXX", "X X", 'X', BonePlate
 });
 GameRegistry.addRecipe(new ItemStack(BoneChestPlate, 1), new Object []
 {
	 "X X", "XXX", "XXX", 'X', BonePlate
 });
 GameRegistry.addRecipe(new ItemStack(BoneLeggings, 1), new Object []
 {
	 "XXX", "X X", "X X", 'X', BonePlate
 });
 GameRegistry.addRecipe(new ItemStack(BoneBoots, 1), new Object []
 {
	 "X X", "X X", 'X', BonePlate
 });

}
}


If I helped then you help, hit that Thank You button or Applaud.

Link to comment
Share on other sites

I'm sorry to ask but could you just tell me the code behind this, I am having a really hard time coding because i can't test anything.

If I helped then you help, hit that Thank You button or Applaud.

Link to comment
Share on other sites

I know what a constructor is but i don't understand where else to put it... I even looked at EE3 for referance and pahimar put it in init.

If I helped then you help, hit that Thank You button or Applaud.

Link to comment
Share on other sites

@EventHandler
@SuppressWarnings("unchecked, unused")
public void init(FMLInitializationEvent event)
{
// Register the GUI Handler
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());
}

 

In my case it doesn't work.

If I helped then you help, hit that Thank You button or Applaud.

Link to comment
Share on other sites

So everything is working, apart from one thing. -.-

The "GuiHandler GuiHandler = new GuiHandler();" in my main mod class.

 

package bulkyzanka.electro.mod;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.util.EnumHelper;
import bulkyzanka.electro.mod.blocks.BlockCompressionFurnace;
import bulkyzanka.electro.mod.creativetabs.ElectrocutedTab;
import bulkyzanka.electro.mod.gui.GuiHandler;
import bulkyzanka.electro.mod.items.BoneIngot;
import bulkyzanka.electro.mod.items.BonePlate;
import bulkyzanka.electro.mod.items.CoalMotor;
import bulkyzanka.electro.mod.items.ElectricMotor;
import bulkyzanka.electro.mod.items.Generator;
import bulkyzanka.electro.mod.items.armor.BoneArmor;
import bulkyzanka.electro.mod.items.tools.BoneAxe;
import bulkyzanka.electro.mod.items.tools.BoneHoe;
import bulkyzanka.electro.mod.items.tools.BonePickaxe;
import bulkyzanka.electro.mod.items.tools.BoneSpade;
import bulkyzanka.electro.mod.items.tools.BoneSword;
import bulkyzanka.electro.mod.lib.Referance;
import bulkyzanka.electro.mod.proxy.ProxyCommon;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;



@Mod(modid = Referance.MODID, version = Referance.VERSION)
public class Electrocuted
{

//Instance
@Instance(Referance.MODID)
    public static Electrocuted instance;

//Proxy Stuff
@SidedProxy(clientSide = "electro.proxy.ProxyClient" , serverSide = "electro.proxy.ProxyCommon")
public static ProxyCommon proxy;

//GuiIDs
public static final int guiIdCompressionFurnace = 1;
//CreativeTabs
public static CreativeTabs  ElectrocutedTab = new ElectrocutedTab(CreativeTabs.getNextID(), "ElectrocutedTab");

//Material
	//ToolMaterial
public static ToolMaterial Bone = EnumHelper.addToolMaterial("Bone", 2, 175, 6.0F, 2.5F, 19);

	//ArmorMaterial
public static ArmorMaterial BoneArmor = EnumHelper.addArmorMaterial("BONEARMOR", 7, new int[]{3, 7, 6, 3}, 20);

//Items
public static Item BonePlate = new BonePlate().setUnlocalizedName("BonePlate").setTextureName("electrocuted:BonePlate");
public static Item BoneIngot = new BoneIngot().setUnlocalizedName("BoneIngot").setTextureName("electrocuted:BoneIngot");
public static Item CoalMotor = new CoalMotor().setUnlocalizedName("CoalMotor").setTextureName("electrocted:CoalMotor");
public static Item ElectricMotor = new ElectricMotor().setUnlocalizedName("ElectricMotor").setTextureName("electrocted:ElectricMotor");
public static Item Generator = new Generator().setUnlocalizedName("Generator").setTextureName("electrocted:Generator");

//Blocks
public static Block CompressionFurnaceIdle = new BlockCompressionFurnace(false).setBlockName("CompressionFurnaceIdle").setBlockTextureName("electrocuted:CompressionFurnace_Idle_front");
public static Block CompressionFurnaceActive = new BlockCompressionFurnace(true).setBlockName("CompressionFurnaceActive").setBlockTextureName("electrocuted:CompressionFurnace_Idle_front");

//Tools
public static Item BoneSword = new BoneSword(Bone).setUnlocalizedName("BoneSword").setTextureName("electrocuted:BoneSword");
public static Item BoneSpade = new BoneSpade(Bone).setUnlocalizedName("BoneSpade").setTextureName("electrocuted:BoneSpade");
public static Item BonePickaxe = new BonePickaxe(Bone).setUnlocalizedName("BonePickaxe").setTextureName("electrocuted:BonePickaxe");
public static Item BoneAxe = new BoneAxe(Bone).setUnlocalizedName("BoneAxe").setTextureName("electrocuted:BoneAxe");
public static Item BoneHoe = new BoneHoe(Bone).setUnlocalizedName("BoneHoe").setTextureName("electrocuted:BoneHoe");

//Armor
public static Item BoneHelmet = new BoneArmor(BoneArmor, 0).setUnlocalizedName("BoneHelmet").setTextureName("electrocuted:BoneHelmet");
public static Item BoneChestPlate = new BoneArmor(BoneArmor, 1).setUnlocalizedName("BoneChestPlate").setTextureName("electrocuted:BoneChestPlate");
public static Item BoneLeggings = new BoneArmor(BoneArmor, 2).setUnlocalizedName("BoneLeggings").setTextureName("electrocuted:BoneLeggings");
public static Item BoneBoots = new BoneArmor(BoneArmor, 3).setUnlocalizedName("BoneBoots").setTextureName("electrocuted:BoneBoots");

 //EventHandler
	//PreInit
@EventHandler
 public void preinit(FMLPreInitializationEvent event)
{
	//Config
	Configuration config = new Configuration(
			event.getSuggestedConfigurationFile());
			config.load();

			config.save();
 }

	//Init
 @EventHandler
 public void init(FMLInitializationEvent event)
 {
	 proxy.registerRenderInformation();
	 proxy.registerTileEntities();
 }	 

 	//PostInit
 @EventHandler
 public void postinit(FMLPostInitializationEvent event)
 {

 }

public Electrocuted()
{
 //Registry
 GameRegistry.registerItem(BonePlate, "BonePlate");
 GameRegistry.registerItem(BoneIngot, "BoneIngot");
 GameRegistry.registerItem(CoalMotor, "CoalMotor");
 GameRegistry.registerItem(ElectricMotor, "ElectricMotor");
 GameRegistry.registerItem(Generator, "Generator");

 GameRegistry.registerBlock(CompressionFurnaceIdle, "CompressionFurnaceIdle");
 GameRegistry.registerBlock(CompressionFurnaceActive, "CompressionFurnaceActive");

 GameRegistry.registerItem(BoneSword, "BoneSword");
 GameRegistry.registerItem(BoneSpade, "BoneSpade");
 GameRegistry.registerItem(BonePickaxe, "BonePickaxe");
 GameRegistry.registerItem(BoneAxe, "BoneAxe");
 GameRegistry.registerItem(BoneHoe, "BoneHoe");

 GameRegistry.registerItem(BoneHelmet, "BoneHelmet");
 GameRegistry.registerItem(BoneChestPlate, "BoneChestPlate");
 GameRegistry.registerItem(BoneLeggings, "BoneLeggings");
 GameRegistry.registerItem(BoneBoots, "BoneBoots");
 LanguageRegistry.instance().addStringLocalization("container.CompressionFurnace", "Compression Furnace");
 GuiHandler GuiHandler = new GuiHandler();

//Recipe
 	//Items
 GameRegistry.addRecipe(new ItemStack(BonePlate, 2), new Object []
 {
		"XX ", "XX ", 'X', Items.bone
 });
 GameRegistry.addRecipe(new ItemStack(BoneIngot, 3), new Object []
 {
	"XXX", "XYX", "XXX", 'X', Items.bone, 'Y', Items.iron_ingot
 });

 	//Tools
 GameRegistry.addRecipe(new ItemStack(BoneSword, 1), new Object []
 {
	 " X ", " X ", " Y ", 'X', BoneIngot, 'Y', Items.stick
 });
 GameRegistry.addRecipe(new ItemStack(BoneSpade, 1), new Object []
 {
	 " X ", " Y ", " Y ", 'X', BoneIngot, 'Y', Items.stick
 });
 GameRegistry.addRecipe(new ItemStack(BonePickaxe, 1), new Object []
 {
	 "XXX", " Y ", " Y ", 'X', BoneIngot, 'Y', Items.stick
 });
 GameRegistry.addRecipe(new ItemStack(BoneAxe, 1), new Object []
 {
	 "XX ", "XY ", " Y ", 'X', BoneIngot, 'Y', Items.stick
 });
 GameRegistry.addRecipe(new ItemStack(BoneHoe, 1), new Object []
 {
	 " XX", " Y ", " Y ", 'X', BoneIngot, 'Y', Items.stick
 });


 	//Armor
 GameRegistry.addRecipe(new ItemStack(BoneHelmet, 1), new Object []
 {
	 "XXX", "X X", 'X', BonePlate
 });
 GameRegistry.addRecipe(new ItemStack(BoneChestPlate, 1), new Object []
 {
	 "X X", "XXX", "XXX", 'X', BonePlate
 });
 GameRegistry.addRecipe(new ItemStack(BoneLeggings, 1), new Object []
 {
	 "XXX", "X X", "X X", 'X', BonePlate
 });
 GameRegistry.addRecipe(new ItemStack(BoneBoots, 1), new Object []
 {
	 "X X", "X X", 'X', BonePlate
 });

}
}


 

---- Minecraft Crash Report ----
// Shall we play a game?

Time: 08.03.14 17:13
Description: Initializing game

java.lang.NullPointerException: Initializing game
at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)
at bulkyzanka.electro.mod.gui.GuiHandler.<init>(GuiHandler.java:15)
at bulkyzanka.electro.mod.Electrocuted.<init>(Electrocuted.java:140)
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.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:173)
at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:509)
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:47)
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:209)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)
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:47)
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:119)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:484)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:564)
at net.minecraft.client.Minecraft.run(Minecraft.java:934)
at net.minecraft.client.main.Main.main(Main.java:112)
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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)
at bulkyzanka.electro.mod.gui.GuiHandler.<init>(GuiHandler.java:15)
at bulkyzanka.electro.mod.Electrocuted.<init>(Electrocuted.java:140)
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.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:173)
at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:509)
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:47)
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:209)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)
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:47)
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:119)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:484)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:564)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:934)
at net.minecraft.client.main.Main.main(Main.java:112)
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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_21, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 133766472 bytes (127 MB) / 376963072 bytes (359 MB) up to 1905197056 bytes (1816 MB)
JVM Flags: 0 total; 
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.01-pre FML v7.2.125.1031 Minecraft Forge 10.12.0.1031 5 mods loaded, 5 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed
FML{7.2.125.1031} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1031.jar) Unloaded->Constructed
Forge{10.12.0.1031} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1031.jar) Unloaded->Constructed
examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed
electro{1.0A} [Electrocuted] (bin) Unloaded->Errored
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: AMD Radeon HD 6800 Series GL version 4.2.12422 Compatibility Profile Context 13.152.0.0, ATI Technologies Inc.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: ~~ERROR~~ NullPointerException: null
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
Anisotropic Filtering: Off (1)

 

 

If I helped then you help, hit that Thank You button or Applaud.

Link to comment
Share on other sites

-snip- Look at the bold:

 

 

// Shall we play a game?

 

Time: 08.03.14 17:13

Description: Initializing game

 

java.lang.NullPointerException: Initializing game

at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)

at bulkyzanka.electro.mod.gui.GuiHandler.<init>(GuiHandler.java:15)

at bulkyzanka.electro.mod.Electrocuted.<init>(Electrocuted.java:140)

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.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:173)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:509)

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:47)

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:209)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)

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:47)

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:119)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:484)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:564)

at net.minecraft.client.Minecraft.run(Minecraft.java:934)

at net.minecraft.client.main.Main.main(Main.java:112)

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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)

at bulkyzanka.electro.mod.gui.GuiHandler.<init>(GuiHandler.java:15)

at bulkyzanka.electro.mod.Electrocuted.<init>(Electrocuted.java:140)

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.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:173)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:509)

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:47)

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:209)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)

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:47)

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:119)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:484)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:564)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:934)

at net.minecraft.client.main.Main.main(Main.java:112)

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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

-- System Details --

Details:

Minecraft Version: 1.7.2

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_21, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 133766472 bytes (127 MB) / 376963072 bytes (359 MB) up to 1905197056 bytes (1816 MB)

JVM Flags: 0 total;

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.01-pre FML v7.2.125.1031 Minecraft Forge 10.12.0.1031 5 mods loaded, 5 mods active

mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed

FML{7.2.125.1031} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1031.jar) Unloaded->Constructed

Forge{10.12.0.1031} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1031.jar) Unloaded->Constructed

examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed

electro{1.0A} [Electrocuted] (bin) Unloaded->Errored

Launched Version: 1.6

LWJGL: 2.9.0

OpenGL: AMD Radeon HD 6800 Series GL version 4.2.12422 Compatibility Profile Context 13.152.0.0, ATI Technologies Inc.

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: ~~ERROR~~ NullPointerException: null

Profiler Position: N/A (disabled)

Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

Anisotropic Filtering: Off (1)

 

 

Look at the bold. <init>  is the constructor. Please go back to learning Java and stop "copy & paste modding."

YOU CANNOT DO SHIT IN THE CONSTRUCTOR OF YOUR MAIN MOD FILE. Oh, and Pahimar is definitely not doing all this in the constructor, you are just blind.

 

Have a read: http://www.homeandlearn.co.uk/java/write_your_own_java_classes.html

I am fairly new to Java and modding, so my answers are not always 100% correct. Sorry for that!

Link to comment
Share on other sites

First of all, I am not blind...

 

    @EventHandler
    @SuppressWarnings("unchecked, unused")
    public void init(FMLInitializationEvent event)
    {
        // Register the GUI Handler
    	NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());

        // Register the Item Pickup Handler
        MinecraftForge.EVENT_BUS.register(new ItemEventHandler());

        MinecraftForge.EVENT_BUS.register(new ActionRequestHandler());

        MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler());

        // Register the hook to initialize the EmcRegistry
        MinecraftForge.EVENT_BUS.register(new WorldEventHandler());

        // Register the ItemTooltipEvent Handler
        proxy.registerItemTooltipHandler();

        // Register the DrawBlockHighlight Handler
        proxy.registerDrawBlockHighlightHandler();

        // Initialize custom rendering and pre-load textures (Client only)
        proxy.initRenderingAndTextures();

        // Initialize our Crafting Handler
        CraftingHandler.init();

        // Handle fluid registration
        FluidHelper.registerFluids();

        // Initialize mod tile entities
        proxy.registerTileEntities();

        // Register our fuels
        GameRegistry.registerFuelHandler(new FuelHandler());

        // Initialize addons (which work with IMC, and must be used in Init)
        AddonHandler.init();
    }

In his main mod class. -.-

If I helped then you help, hit that Thank You button or Applaud.

Link to comment
Share on other sites

First of all, I am not blind...

 

    @EventHandler
    @SuppressWarnings("unchecked, unused")
    public void init(FMLInitializationEvent event)
    {
        // Register the GUI Handler
    	NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());

        // Register the Item Pickup Handler
        MinecraftForge.EVENT_BUS.register(new ItemEventHandler());

        MinecraftForge.EVENT_BUS.register(new ActionRequestHandler());

        MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler());

        // Register the hook to initialize the EmcRegistry
        MinecraftForge.EVENT_BUS.register(new WorldEventHandler());

        // Register the ItemTooltipEvent Handler
        proxy.registerItemTooltipHandler();

        // Register the DrawBlockHighlight Handler
        proxy.registerDrawBlockHighlightHandler();

        // Initialize custom rendering and pre-load textures (Client only)
        proxy.initRenderingAndTextures();

        // Initialize our Crafting Handler
        CraftingHandler.init();

        // Handle fluid registration
        FluidHelper.registerFluids();

        // Initialize mod tile entities
        proxy.registerTileEntities();

        // Register our fuels
        GameRegistry.registerFuelHandler(new FuelHandler());

        // Initialize addons (which work with IMC, and must be used in Init)
        AddonHandler.init();
    }

In his main mod class. -.-

....

THAT IS NOT A CONSTRUCTOR!

I am fairly new to Java and modding, so my answers are not always 100% correct. Sorry for that!

Link to comment
Share on other sites

-snip- Look at the bold:

 

 

// Shall we play a game?

 

Time: 08.03.14 17:13

Description: Initializing game

 

java.lang.NullPointerException: Initializing game

at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)

at bulkyzanka.electro.mod.gui.GuiHandler.<init>(GuiHandler.java:15)

at bulkyzanka.electro.mod.Electrocuted.<init>(Electrocuted.java:140)

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.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:173)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:509)

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:47)

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:209)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)

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:47)

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:119)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:484)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:564)

at net.minecraft.client.Minecraft.run(Minecraft.java:934)

at net.minecraft.client.main.Main.main(Main.java:112)

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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)

at bulkyzanka.electro.mod.gui.GuiHandler.<init>(GuiHandler.java:15)

at bulkyzanka.electro.mod.Electrocuted.<init>(Electrocuted.java:140)

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.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:173)

at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:509)

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:47)

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:209)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)

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:47)

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:119)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:484)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:564)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:934)

at net.minecraft.client.main.Main.main(Main.java:112)

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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

-- System Details --

Details:

Minecraft Version: 1.7.2

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_21, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 133766472 bytes (127 MB) / 376963072 bytes (359 MB) up to 1905197056 bytes (1816 MB)

JVM Flags: 0 total;

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.01-pre FML v7.2.125.1031 Minecraft Forge 10.12.0.1031 5 mods loaded, 5 mods active

mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed

FML{7.2.125.1031} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1031.jar) Unloaded->Constructed

Forge{10.12.0.1031} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1031.jar) Unloaded->Constructed

examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed

electro{1.0A} [Electrocuted] (bin) Unloaded->Errored

Launched Version: 1.6

LWJGL: 2.9.0

OpenGL: AMD Radeon HD 6800 Series GL version 4.2.12422 Compatibility Profile Context 13.152.0.0, ATI Technologies Inc.

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: ~~ERROR~~ NullPointerException: null

Profiler Position: N/A (disabled)

Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

Anisotropic Filtering: Off (1)

 

 

Look at the bold. <init>  is the constructor. Please go back to learning Java and stop "copy & paste modding."

YOU CANNOT DO SHIT IN THE CONSTRUCTOR OF YOUR MAIN MOD FILE. Oh, and Pahimar is definitely not doing all this in the constructor, you are just blind.

 

Have a read: http://www.homeandlearn.co.uk/java/write_your_own_java_classes.html

 

^

This. Get a basic knowledge of java. You can't mod without knowing anything... when there is such an easy error and u only say but he did it like this. then u dont know how to code and this guy neither. use the link above(quote) to get started.

also maybe get: http://www.amazon.de/Head-First-Java-Mike-Loukides/dp/0596009208

*********************************

**  Always remember you are unique,  **

**  just like everyone else                   **     

**********************************

Was my post helpful? Say thanks and

press the thank you button, on my post!!

God, damn it!

Link to comment
Share on other sites

I do know Java(Still learning but I know a bit) and I looked at the errors and I found saw it. I just don't know where else to put it. I saw a tutorial about it and thats where he put it. With where Pahimar put it, I tried the same, didn't work. If it did(I'm not that dumb -.-) then I wouldn't put it here.

 

If I helped then you help, hit that Thank You button or Applaud.

Link to comment
Share on other sites

*Head-desk*

For the java retarded, here is the difference:

Simple Class called MyClass

Class MyClass {
    private boolean field; // <--- this is a field (of type boolean and private to the class)
    public MyClass() { // <--- this is a constructor!! Notice the name and the fact that there is no return type
        field = codeInTheConstructor(new StuffToMake()); // <--- code in constructor
    }
    int getANumber() { // <--- this is a method (a property getter)
        return 15;  // <--- code in a method
    }
}

 

This shows most of the simple layout of classes.

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.