#How to get server-side info via client-side

10 messages · Page 1 of 1 (latest)

prime temple
#

I'm developing a mod years ago and I always wonder how I can get things that only sends the server (integrated or dedicated). For instance, I'm interested in getting information about Villagers inventory contents and player reputation. Inventory returns air and player reputation return 0 when asking cient-side... Something via sending packets? but how?

Thanks 🙂

unkempt goblet
#

if the data is related to an entity you can use the datatracker to sync the data between client and server

mighty heart
#

packets.

prime temple
# mighty heart packets.

Hey, thanks! Can you please give me an example or explain to me which is the correct way to do this? I would mainly be interested in obtaining information from pointed entities. Years ago I managed to send the requests statistics packet through the constructor of one class but I am completely sure that it is not done correctly because it sends many packets at once...

mighty heart
#

if you want to leave vanilla code mostly alone, i think you would need to create something simmilar to a handled screen.

#

but idk on the exact implementation

prime temple
#

Thank you very much for your answer but I have no idea about Handled Screens 😅

mighty heart
#

Do you use intelij? You can use it to look at MinecraftSe example of such things

unkempt goblet
#

you can use any ide to look at the minecraft src

#

but yeah for modding in general the best reference for stuff is usually the minecraft code itself