Jump to content

Recommended Posts

Posted

Hello,

 

I am relatively new to Java and Minecraft modding, but after a few online lessons, tutorials and trial and error I have started to pick up the flow Java of using Forge. I have started developing a mod because it may create a good impression on my computing teacher if I show her I have done some coding out of school (I'm 13 (14 in 9 days) by the way, working my way towards GCSE's :) ).

 

Anyway, I am trying to create custom villager trades for my mod, and have created a class that is supposed to do just that, but when I start the game (no crashes or anything), villagers don't offer me the trades (trust me I have tried about 50-75 villagers per attempt). I have managed to fix all the bugs in development so far, but I am stuck on this one. I have been searching for help for about 4-5 hours, and after finding nothing that helped me, I have decided to write this post.

 

The items I use in my mod are censored as ModItem for my privacy :)

 

MainRegistry Code:

http://pastebin.com/pyT6ax0c

 

TradeHandler Code:

http://pastebin.com/qh0JkhwG

 

My theory is that I have to initialize TradeHandler in MainReigstry, I don't know how, or that theory may just be wrong all together.

 

Any and all help is very much appreciated!

 

Kind regards - general223

Attempting to mod...

 

PC specs:

CPU - i5 4440 OC'ed to 3.3GHz

GPU - GTX 960 GIGABYTE G1 4Gb

RAM - 8Gb 1600MHz

Monitor Resolution - 1920x1080

Posted

ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
                ModItem.mainRegistry();
               
                ModItem.mainRegistry();

 

what the f.....?

Posted

what the f.....?

 

I said that I censored all of my mod items for my privacy, they all have their own names, but they are renamed to mod items by me :)

 

I thought I would need to call the code, but I don't know how I would go about doing that, calling it by TradeHandler.mainRegistry(); brings up the error "the method mainRegistry() is undefined for the type TradeHandler. Sorry for the newbieness but I am really stuck here :(

Attempting to mod...

 

PC specs:

CPU - i5 4440 OC'ed to 3.3GHz

GPU - GTX 960 GIGABYTE G1 4Gb

RAM - 8Gb 1600MHz

Monitor Resolution - 1920x1080

Posted

Ok, I only changed the names of the items, I'll make some up if you require it.

 

[embed=425,349]ModItem.mainRegistry();

                MagicOrb.mainRegistry();

                BlueCrystal.mainRegistry();

                GreenCrystal.mainRegistry();

                RedCrystal.mainRegistry();

                PurpleCrystal.mainRegistry();

                OrangeCrystal.mainRegistry();

                YellowCrystal.mainRegistry();

                CrystalComponent.mainRegistry();

                CrystalEnergyCell.mainRegistry();

                EnergyPlastic.mainRegistry();

                EnergySteel.mainRegistry();

                EnergyRubber.mainRegistry();

             

                CrystalBlock.mainRegistry();[/embed]

Attempting to mod...

 

PC specs:

CPU - i5 4440 OC'ed to 3.3GHz

GPU - GTX 960 GIGABYTE G1 4Gb

RAM - 8Gb 1600MHz

Monitor Resolution - 1920x1080

Posted

Your tradehandler code is never getting called.

the FMLInit events are only called in the Mainmod class. So you need to call the villager stuff from your main mod class

This, again.

 

As I said, I don't know how to do that, as I mentioned in my previous post!

 

"I thought I would need to call the code, but I don't know how I would go about doing that, calling it by TradeHandler.mainRegistry(); brings up the error "the method mainRegistry() is undefined for the type TradeHandler. Sorry for the newbieness but I am really stuck here :("

Attempting to mod...

 

PC specs:

CPU - i5 4440 OC'ed to 3.3GHz

GPU - GTX 960 GIGABYTE G1 4Gb

RAM - 8Gb 1600MHz

Monitor Resolution - 1920x1080

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.