Jump to content

How to synchronize'moddata'of'inventoryitem'


qnw

Recommended Posts

The'moddata'in'inventoryitem' cannot be synchronized to other clients when the client is modified. Now I can only synchronize data through'additemonserver'by recreating an identical item. But this brings many problems, especially the compatibility with other mods.

 

It may be possible to synchronize the ID of'inventoryitem'with the command between the client and the server, but I can't find a way to get'inventoryitem' through the ID on the client.

 

Does anyone know how to solve it? Or new ideas

Link to comment
Share on other sites

Data that needs to be synchronized to other clients should be transmitted from source client > server > the rest of clients.

 

Therefore, you should do it through 'OnServerCommand' and 'OnClientCommand' events.

1. Source player do 'sendClientCommand' containing the mod id, command and mod data

2. Server receive client command through 'OnClientCommand', process the transmitted data and send the mod data to all players except the source player through 'sendServerCommand'.

3. Other players receive the server command and synchronize according to the received mod data.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...