Jump to content

[Request] Way to access Tile Entities/Containers/Guis if you're too far away.


Recommended Posts

I'm pretty sure this could be done by adding a simple boolean to the player, named canPlayerAccessAllGuis or something like that, which would, by default, be set to false. It could be set to true in a tick handler, if certain conditions are met.

Every tick, a check is run to see if the player has a Gui open and if the player can interact with the Gui's container. A check to see if canPlayerAccessAllGuis is true could be added in here. If it's true, then it should skip closing the currently open Gui, but otherwise, the Gui will be closed as normal.


I require this to get a feature I have had planned for a while now working, and It could be useful for other modders wanting to access Guis from a distance as well. Thoughts?

Link to comment
Share on other sites

You know how Guis close automatically if the user is too far away from their corresponding Block? I need a way to prevent this from happening if certain conditions are met.


I'm proposing a way to prevent this from happening if a boolean value in the player is set to true, which could be done via tick handler.

Link to comment
Share on other sites

Usage scenario? I can't think of a way the player would be able to be out of range of a block and still activate it, or move out of range while using it.


As for doing it, first of all I'd say go through the code and see what causes the GUI to be closed in the first place.



Found it. It's not even called when the container is opened. It's just under the update method for EntityPlayer. Strictly client side, and the GUI just closes if the container isn't in range.

Link to comment
Share on other sites

Yeah. It's around line 330 of EntityPlayer.

Usage Scenario: Item that saves a Block's location in it's NBT data and then, upon being activated, calls the OnActivated() method inside the block at that location.  Used to remotely access chests, machines, levers, and such.

I've got such an item working ingame. All I need is a way to get past that one check, and this item is ready for use,

(Yes, I know how incredibly overpowered this is. It's going to be expensive)

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.