Jump to content

Recommended Posts

Posted

I have a custom inventory and some extended properties and when I equip an item in the slot in the custom inventory, it renders an accessory onto the player like armor, but the only problem I have is that when on a server, it doesn't show the accessory to other players. I assume I will need packets.

Posted

So I taken a look at how vanilla does this with the armor, and I took a look at S04PacketEntityEquipment and NetHandlerPlayClient#handleEntityEquipment, now what I am wondering is how within my packet would I go about getting an entity from its ID, since it is handled client side?

Posted

Nope.

 

Every entity has entityId. It is always the same on client and server (server sets client's entityId on spawn).

You need to send packet from server to client with: player.entityId, itemStack, slotId.

On client you read them, world.getEntityById(message.entityId) and then set player's client side inventory to received itemStack in some slotId.

1.7.10 is no longer supported by forge, you are on your own.

Posted

On the client there's only one

World

:

Minecraft#theWorld

.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

After a bit of debugging, and looking at the code, I realized I missed the dumbest thing, I forgot to assign the entityId to the entityId in the packet in the constructor... so it was only returning 0, but fixed it, and it is now working.

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



×
×
  • Create New...

Important Information

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