Jump to content

[SOLVED][1.14.4] Persist Player attributes on respawn


Recommended Posts

Posted (edited)

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 :)

Posted (edited)
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
Posted

Thank you, i was able to do this catching the Clone event :)
Ps: looks like notifications are broken, i haven't got one for this thread

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

Posted

But then how can i retrieve the capability of the "original" player, the entity that is dead? Since there is no "getOriginal" or something like that in the respawn event

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

Posted
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.

Posted (edited)
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
Posted
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)

Posted

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

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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