Jump to content

[SOLVED][1.14.4] Persist Player attributes on respawn


JimiIT92

Recommended Posts

As the title says i want to persist some modified player attributes when the player respawn. Say i've modified the strength or the health of the player, how can i reapply those modified values when the player respawn?

Edited by JimiIT92
Solved

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

51 minutes ago, Differentiation said:

Clone, not PlayerRespawnEvent.

```kotlin

@SubscribeEvent

fun onPlayerRespawn(event: PlayerEvent.PlayerRespawnEvent) {

```

 

 

```java

@SubscribeEvent

public void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) {

```

 

upd: sorry, I thought you did not find the event.

Edited by MairwunNx
Link to comment
Share on other sites

3 hours ago, diesieben07 said:

No, this is NOT what the clone event is for...

What would it be used for then if not making data persist across death, and what event would you use for making data persist across death because there is no way to use PlayerRespawnEvent to do so.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

22 hours ago, diesieben07 said:

Probably store them in a capability and re-apply in PlayerRespawnEvent.

wouldn't it then be transferring the capability which stores the attributes

4 minutes ago, diesieben07 said:

The clone even is for transferring data from old player to new (like capabilities or in old versions IExtendedEntityProperties). Applying attributes is something else...

Edited by RaphGamingz
Link to comment
Share on other sites

9 hours ago, Animefan8888 said:

What would it be used for then if not making data persist across death, and what event would you use for making data persist across death because there is no way to use PlayerRespawnEvent to do so.

i think he is asking what the event you use because you cant use playerrespawnevent (according to him)

Link to comment
Share on other sites

oh 

33 minutes ago, RaphGamingz said:

wouldn't it then be transferring the capability which stores the attributes

because you said to store the attribute in a capability

Quote

Probably store them in a capability and re-apply in PlayerRespawnEvent.

then you say

Quote

The clone even is for transferring data from old player to new (like capabilities or in old versions IExtendedEntityProperties).

and you use the clone event to transfer capabilities

Link to comment
Share on other sites

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.