Jump to content

Communication Between TileEntity and Gui***** of block?


TheNuclearDuck

Recommended Posts

Hey all,

I am making a mod and would like to know how to read an int from a block's tile entity from it's Gui***** file. I have declared a variable in the tile entity which is a public static int. I need to know how to access this variable in my Gui***** file's drawGuiContainerBackgroundLayer method in order to render a graph representing this int. Any ideas on how to do this?

 

Thanks for reading this, hope you can help  :)

Link to comment
Share on other sites

Well, I tried using TileEntity*****.variable but this seems to gt the same value for every block which is placed with this GUI, meaning when a block is placed and there have been previous blocks placed also, it will start by rendering the same value as the other block. I want each block to have an individual variable for its GUI.

 

Edit: When I try to access my GUI***** file's tile_entity parameter, I get an error saying it does not exist.

Link to comment
Share on other sites

You need to do all item handling in a GuiContainer, not a client side visual gui. It will be in three layers:

 

 

[Tile_Entity_Storage]

-----------|-------------

----------\/------------

[CommonSidedGuiContainer]

-----------|-------------

----------\/------------

[ClientSidedVisualGui]

The container will access the tile entity, and the client side visual gui only adds the textures and stuff.

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.