Hi so, as the title says, Variables I set with IExtendedEntityProperties reset on death, and like, am I doing something wrong or is this supposed to happen???
You need to clone the properties on death because technically when you respawn you have a different EntityPlayer instance and so your previous extended properties would get lost.
For player entities, capabilities attached to them will not persist across death and respawn. To copy them, you will need to handle the PlayerEvent.Clone event. For example, something like this in the event handler:
// clone capabilities
EntityPlayer player = event.getEntityPlayer();
IMana mana = player.getCapability(ManaProvider.MANA, null);
IMana oldMana = event.getOriginal().getCapability(ManaProvider.MANA, null);
mana.setMana(oldMana.getMana());
Hi so, as the title says, Variables I set with IExtendedEntityProperties reset on death, and like, am I doing something wrong or is this supposed to happen???
Use NBT
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
You need to clone the properties on death because technically when you respawn you have a different EntityPlayer instance and so your previous extended properties would get lost.
For player entities, capabilities attached to them will not persist across death and respawn. To copy them, you will need to handle the PlayerEvent.Clone event. For example, something like this in the event handler:
// clone capabilities
EntityPlayer player = event.getEntityPlayer();
IMana mana = player.getCapability(ManaProvider.MANA, null);
IMana oldMana = event.getOriginal().getCapability(ManaProvider.MANA, null);
mana.setMana(oldMana.getMana());
Sorry for not replying I got caught up with stuff, but I will ddeffinatly work on this and try to post how it goes. Thank you both so much.