Jump to content

Several question about coding my new mod


Recommended Posts

Hello all,


I've recently begun my modding career and am working on my first mod for public release.  I have a bunch of unrelated questions that have come up over the last few days of my research in how to build this mod and rather than post a number of times, I thought I'd list them all here in hopes that someone with more experience can assist me with some or all of them.  Thanks in advance for your help.


1. How do you have an item right-click-interact with a Villager.  The usual methods, onItemUse(), itemInteractionWithEntity(), etc do not get called for a villager, the right click is intercepted with Entity.interact() to popup the trade GUI and I cannot see a way to stop it for my particular item.


2. Speaking of GUIs, whats the difference between GuiScreen and GuiContainer?  When I look at Gui Tutorials, some use one, some use the other, but there's never an explanation of why. 


3. One of the blocks in my mod is designed to hold more that 1 stack of an item in one slot.  Is there an easy way of doing this with the Container class? Or am I looking at a complete re-implementation.  I've seen this ability in Applied Energistics, but I'm not sure how it was done, or how difficult it was.


4. Speaking of AE, Some of their GUIs use a scrollbox of slots to get many slots on the page, any tips on how to implement that? I haven't found any tutorial on scrolling Guis to speak of.


I should mention this mod is for 1.6.2 and I'm using Forge 871.


Link to comment
Share on other sites

1. I haven't been into this for a while but I believe there's an entity interact event? You say the Entity.interact() intercepts the other call, what do you find if you climb the call order to see what happens before it intercepts it?


2. Container are GUI's with inventories (Chest, Furnace, Brewing Stand) and Screen are regular GUIs (Books, Game Menu, Sign).


3. I believe there's a field inside the Slot class which decides the max stack limit of an Item in that slot, you will probably have to create a custom slot if I recall correctly :)



You may enjoy watching Vswe's videos "Climbing the interface ladder"

Which features many GUI functions such as tabs, model render(inside gui), buttons and server<->Client synchronization.

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

1. The EntityVillager.interact() is near the top of the event stack.  it will show the Merchant GUI and stop all further processing.  The only thing I see above that is a Forge EVENT_BUS message which it looks like I can install a handler for and abort the default processing, but that seems to trigger for every entity and I was concerned about lag.  That may be the only option though.


2. Perfect, that was the simple explanation I was lacking.


I will checkout the videos, I've been going through several, but they are all for different versions of MC so I get a little confused on what still works and what doesn't.



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.

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.


  • Create New...

Important Information

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