#Opening a non-inventory GUI from an entity

3 messages · Page 1 of 1 (latest)

small saddle
#

Hello!

I want to open a GUI on the client when right-clicking an entity to change some of its properties. What would be the correct way to do this?

I feel like there's a few options: Using a ScreenHandler, but the entity doesn't have an inventory, so it feels like the wrong tool for the job (but maybe it isnt?). I could send a packet from the server to the client to open that specific GUI, which is how I've done it in the past, but I feel like there could be better ways? I could also detect the interaction and open the GUI completely client-side, but importing the client screen from the common entity would not work I think.

I'm kind of lost here on what to do

past jolt
#

Hi, You can alter the entity NBT data with NbtCompound. You can also use fabric API's UseEntityCallback for the right click feature. Open a context menu through a screen here is my code, I listen for middle click and open a screen: https://github.com/Densamisten/Fabrient/blob/1.20/src/client/java/io/github/densamisten/gui/FabrientVelocifierScreen.java

GitHub

A Minecraft client with Fabric. Contribute to Densamisten/Fabrient development by creating an account on GitHub.

small saddle
#

Oh yeah, that's a good way to do it