Spice of Life: Sweet Potato Edition

Spice of Life: Sweet Potato Edition

775k Downloads

Incompatibility with PlayerRevive

CreativeMD opened this issue ยท 25 comments

commented

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

commented

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?

commented

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?

commented

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!

commented

Any news about this?

commented

sorry, been on a long minecraft break. I'll take a look over the holidays.

commented

so nothing new on this?

commented

Any news about this?

is this dead?

commented

I also encountered this problem, is there any progress?

commented

not what ive heard.

commented

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

commented

@Tigrex-Dai might be best not too.

commented

Hey guys, I've tried to remove both this part:

public static void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) {

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?

commented

This would be nice too look into @CreativeMD

commented

@Tigrex-Dai I'm not sure what you mean. You have removed it? Have you made a fork?

commented

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

commented

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.

commented

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

commented

other revival mods are also effected

commented

sorry, been on a long minecraft break. I'll take a look over the holidays.

is way past it now @tarinoita

commented

Got the same issue

commented

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.

commented

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

commented

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.

commented

why not just create a new curseforge project? it seems like that's what most people do for forks.

commented

New mod is online and should be compatible with PlayerRevive: https://legacy.curseforge.com/minecraft/mc-mods/spice-of-life-onion