Jump to content

Recommended Posts

Posted

Okay, it's me again with another problem. I implemented my custom capability and attached it to player, but every time the player respawns, it should write some data into capability, however it doesn't work. I made custom overlay rendering which should display the data, but on respawn I see the data set to the value I want and next tick the data is gone. I managed to make the data persist after player disconnects so my syncing packet should be okay. The only problem I have is the respawn event. I subscribed to PlayerEvent.Clone (on server, since I think it is supposed to be handled from server, but I'm not sure about that) and registered it in server proxy.

There's the related code:

  Reveal hidden contents

 

and the packet just in case: (it is registered for client side)

  Reveal hidden contents

What am I doing wrong here?

Posted
  On 11/5/2018 at 9:03 PM, diesieben07 said:

@SidedProxy is for distinguishing physical sides. That is not what you want here. The event only fires on the logical server, so register it from your main mod class.

I suggest refreshing your info on how sides work: https://mcforge.readthedocs.io/en/latest/concepts/sides/.

Expand  

Okay I changed it as you suggested. 

 

However now I have to worry about the issue I described above. 

Posted
  On 11/5/2018 at 9:56 PM, diesieben07 said:

This will crash on a dedicated server. Code that is specific to a physical side (client in this case) must be encapsulated using @SidedProxy.

 

Problematic code, Issue 16.

Expand  

Oh well, I didn't know that. For some reason I thought that the ctx.side.isClient will prevent that

 

  On 11/5/2018 at 9:56 PM, diesieben07 said:

PlayerEvent.Clone is not the right event to send packets or set any data. It's sole purpose is to copy data from the player entity that died to the new player entity. Do not use it for anything else. If you want to do something on respawn, use PlayerEvent.PlayerRespawnEvent.

Expand  

But this still has to be used to copy the data when player switches dimensions, am I right?

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.