Incompatibility with PlayerRevive
CreativeMD opened this issue ยท 25 comments
Hello,
I'm the author of PlayerRevive and apparently there is an issue with both of our mods installed. PlayerRevive adds the ability to get knocked and being revived by other players. If a player is knocked out and leaves the server, the player will be killed and rejoin in the respawn screen. If Spice of Life Sweet Potato is installed the player does not get killed but instead is fully recovered after a log in (this issue has been reported to me here: CreativeMD/PlayerRevive#112.
This code gets executed once the player leaves the server: https://github.com/CreativeMD/PlayerRevive/blob/1.19/src/main/java/team/creative/playerrevive/server/PlayerReviveServer.java#L74
Do you have an idea how this can happen? This issue happened in Minecraft 1.18, but probably other versions are affected as well.
In Regards
CreativeMD
I'm pretty sure it's caused by this line here: https://github.com/tarinoita/Spice-of-Life-Sweet-Potato/blob/1.18/src/main/java/com/tarinoita/solsweetpotato/tracking/CapabilityHandler.java#L58
No idea if there is a workaround for it. Maybe kill the player again if the player dead before?
Thanks for reaching out! I'm guessing this may also be related to #12 and #13, since FirstAid relies on PlayerRevive and it shows up in the error log.
I'm not the original developer for this mod, so please bear with me, as I don't fully understand all the details yet. But I'm assuming this is an issue either with the way we set health, or something about Capabilities.
We have this update in our PlayerEvent.Clone listener:
https://github.com/tarinoita/Spice-of-Life-Sweet-Potato/blob/1.18/src/main/java/com/tarinoita/solsweetpotato/tracking/CapabilityHandler.java#L64
Which ultimately gets to here, where you can see there's already an exception for FirstAid:
https://github.com/tarinoita/Spice-of-Life-Sweet-Potato/blob/1.18/src/main/java/com/tarinoita/solsweetpotato/tracking/benefits/AttributeBenefit.java#L67
That's the only place we call setHealth(), and while I would not expect it to fully heal the player (since you already set their health to 0 when they logged out), perhaps the extra setHealth(0) here causes another interaction with your mod which then heals them?
Ah yea, I believe in 1.18 and 1.19 Forge lets you revive only the capabilities instead of the whole player, so this is probably an outdated hack. Let me try switching to the other way and I'll see if it helps! Thanks for the pointer!
Yeah I know. It works only when the death resets the food variety.
@GreenForzeGaming I can do a fork for you if you want? But idk whether it's permitted
@Tigrex-Dai might be best not too.
Hey guys, I've tried to remove both this part:
and this part:
https://github.com/tarinoita/Spice-of-Life-Sweet-Potato/blob/1.18/src/main/java/com/tarinoita/solsweetpotato/tracking/CapabilityHandler.java#L58
and the problem is solved!
Will it be the parts of revive things?
This would be nice too look into @CreativeMD
@Tigrex-Dai I'm not sure what you mean. You have removed it? Have you made a fork?
@CreativeMD
I've removed both the 'OnPlayerLoggedOut' event in BenefitsHandler.java and 'OnClone' event in CapabilityHandler.java
So I think the problem lies in these two events and I think probably is about those lines about revive.
I didn't make a fork since I just modified the code in order to make it work for my own private server for friends.
well this is good news if this is the actuall problem. in any case, the author for spice of life sweet potato has too consider the changes id love a branch for this fix for my family server @Tigrex-Dai if possible.
@Tigrex-Dai that is not a proper fix, because it will most likely break functionality for this mod. But it confirms that this is indeed the cause of the issue.
And yes unfortunately we cannot do anything without the author.
sorry, been on a long minecraft break. I'll take a look over the holidays.
is way past it now @tarinoita
Hey! Yeah, sorry about that, life stuff got pretty rough and hasn't gotten better. I don't know when I'll have a chance to look at this again. If anyone does want to look into it though, absolutely feel free to fork the project and put your own version on curseforge or wherever. I really don't care about that and the license should be clear that it's allowed.
@tarinoita I would be done for that. Is there a way you can give me access to your curseforge project, so I can upload files there. I could create a new project, but I do not see the point in that to be honest.
Of course I can do that. I just like to cooperate a bit more. It's not really my work, so I rather want to split up the reward. Also all these forks are kinda confusing for the average user.
why not just create a new curseforge project? it seems like that's what most people do for forks.
New mod is online and should be compatible with PlayerRevive: https://legacy.curseforge.com/minecraft/mc-mods/spice-of-life-onion