Are you rendering this for the client player or other players?
The client only knows the inventory contents of the client player, all it knows about the other players is their held items and armour.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Hm... anyway I can send the information of the items to the other clients?
I assume through packets, which is the best method?
You'll need to scan each player's inventory for changes every tick on the server and then send any changes to all players tracking that player entity.
Use a capability to store the list of items that need to be synced/rendered for each player. Note that you can't use IItemHandler directly, since EntityPlayer already provides that capability itself.
I wrote this pseudocode example of how you could handle the syncing. In the packet's handler, you'd want to apply the changes from the packet to the client-side player entity's item list.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Hello,
Trying to render items from the players inventory but it isn't working when clients are connected to a server.
I'm using a custom layer.
The render works through the server however if I render using:
It cannot retrieve the itemstacks from the inventory just from the hand.
Anyone know the reason why?
Thanks.
Are you rendering this for the client player or other players?
The client only knows the inventory contents of the client player, all it knows about the other players is their held items and armour.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Hm... anyway I can send the information of the items to the other clients?
I assume through packets, which is the best method?
You'll need to scan each player's inventory for changes every tick on the server and then send any changes to all players tracking that player entity.
Use a capability to store the list of items that need to be synced/rendered for each player. Note that you can't use IItemHandler directly, since EntityPlayer already provides that capability itself.
I wrote this pseudocode example of how you could handle the syncing. In the packet's handler, you'd want to apply the changes from the packet to the client-side player entity's item list.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Wow! Thanks for taking the time out to do this man, really appreciate it.
I'll try implementing now, but i'll mark as resolved as I don't think I'll be needing further help.