Posted July 17, 20241 yr Hi, My mod has player capabilities tracking mana value, and the values will not save after death. (To be clear it does save when I exit and reenter the world) I looked at the documentation for capabilities but it says very little about saving after death, and what it does say I've already done. I did follow a tutorial from 1.19 so I'm guessing something changed between versions and I don't know how to fix it. ////////CODE/////////////// @SubscribeEvent public static void onPlayerCloned(PlayerEvent.Clone event){ if(event.isWasDeath()) { event.getOriginal().getCapability(PlayerManaAmountProvider.PLAYER_MANAAMOUNT).ifPresent(oldStore -> { event.getOriginal().getCapability(PlayerManaAmountProvider.PLAYER_MANAAMOUNT).ifPresent(newStore -> { newStore.copyFrom(oldStore); }); }); } }
August 17, 20241 yr There ought to be a Kaupenjoe video talking about how to do this, have you looked into that? If I remember correctly the video adds a "thirst" system but it ought to be trivial to adapt.
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.