Jump to content

Recommended Posts

Posted

This is my first time trying to make a gui, and i'm not quite sure how to go about it. I want to add a gui to my proximity detector so that the range and functions can be changed. I've already set up the fields i feel will be necessary in the TileEntity, which is currently working as expected.

I tried looking through the tutorial on the wiki which didn't really help with what i want to do (as far as i could tell) and didn't explain it in a way which made it so i could understand everything which was going on.

 

I need buttons so that i can change the entity types it will detect, and also the range on the detector. If somebody could walk me through the basics of this that would be great :D

Posted

If you want to make a GUI and a tile entity without an inventory, you'll be needing the following classes.

 

A block

A GUI handler

A GUI class for the block

A tile entity class

A packet handler

 

Here are those 4 classes from one of my mods (the block is called NumpadBlock):

 

NumpadBlock class:

 

  Reveal hidden contents

 

 

GuiNumpad

 

 

  Reveal hidden contents

 

 

My packet handler

 

  Reveal hidden contents

 

 

My GUI Handler

 

  Reveal hidden contents

 

 

The tile entity class (Shouldn't need any content if it doesn't have an inventory)

 

  Reveal hidden contents

 

 

My GUI handler

 

  Reveal hidden contents

 

 

If you have experience with forge modding, you'll probably understand what's going on in each file, if not, just ask :)

"Thinking that coding is the nerdy IT guy at work rebooting your computer is like thinking that music is what happens when the piano tuner comes round." - Ed Rex

Posted

just another small question,

 

what do i need to send packets for (and how do i do/handle this properly)? I'm trying to do it so that the range, and detection types in my proximity detector can be changed, so do i need to send a packet each time one of these buttons is pressed, and also how do i send and use the data on the button?

 

also, where is the id for the gui defined? in the following line form your code it is called, but i can't see where it is created or how to know what it will be.

 

par5EntityPlayer.openGui(Interlock.instance, 2, world, x, y, z);

 

[EDIT]

Also, can i see how you registered your package handlers and channels, doing it in the same way as the wiki tutorial gave me a crash saying that the channel name was incorrect or something.

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.