Jump to content

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


Recommended Posts

Posted

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?

Posted

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.

Posted

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.

 

Edit:

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.

Posted

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)

Posted

I tried doing that once, and this explains why it never worked. :P

 

Since it is just using the onUpdate method, then your simple boolean idea should work. I still don't know how the server would handle it though.

Posted

Actually, that may not work so well. Containers are managed by the server and correct me if I'm wrong, containers contain the check as to whether the player can interact or not.

Posted

I got it working. Not seeing any server issues or anything of the sort. Only a few extra lines of code.

And yes, the containers are managed by the server, and they contain the usage check.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

×
×
  • Create New...

Important Information

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