Jump to content

[1.7.2] Problem with instance on FMLCommonHandler


LegomanBry

Recommended Posts

Trying to add keybindings to my Snobsidian Mod (1.7.2) following online java tutorial from FORGE websitte http://www.minecraftforge.net/wiki/Key_Binding. Everything seems fine until I try to hook into FMLCommon Handler Bus (  FMLCommonHandler.instance().bus().register(new KeyInputHandler());  )then i get a "instance" error in eclipse.  I think I'm calling it from the right placeright after  @SidedProxy(clientSide = "BCHSnobsidian.common.ClientProxy", serverSide = "BCHSnobsidian.common.CommonProxy")

    public static CommonProxy proxy;    but I could be mistaken.

not sure if client side / Server side is a concern. or if i need to pass a instance argument. I'm new to the community and would like to THANK YOU all in advance for any help

 

https://gist.github.com/LegomanBry/702cab8278b90ba31018

Link to comment
Share on other sites

Hi

 

The problem appears to be that you've put your call to the handler outside of any method.  And a lot of your code is in the class constructor but it should be in preInit, postInit.

 

This link might help

http://greyminecraftcoder.blogspot.com.au/2013/11/how-forge-starts-up-your-code.html

 

If you're just new to Java, this thread might be of interest

http://www.minecraftforge.net/forum/index.php/topic,16784.msg84954.html#msg84954

and

http://www.minecraftforge.net/forum/index.php/topic,19694.msg99530.html#msg99530

 

-TGG

Link to comment
Share on other sites

Thank you very much Ghost for taking the time to review my code and Reply. I'm following the links you provided and am realizing I don't have quite the grasp on Java I thought i did.

I'm rewriting my code to reflect the Basic Framework for forge mods. Then I'm going back a reviewing some things  (Recursive methods, HashMaps etc.) hopefully along the way something will "click" and ill understand why its not working.

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.