-
-
Save izzyaxel/22b03d17600a97b55e2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ManaPersistence | |
{ | |
public static ManaPersistence INSTANCE = new ManaPersistence(); | |
@SubscribeEvent | |
public void persistMana(PlayerEvent.Clone event) | |
{ | |
AAExtPlayerHelper.getIEEP(event.entityPlayer).copyIEEP(AAExtPlayerHelper.getIEEP(event.original)); | |
} | |
@SubscribeEvent | |
public void syncPersistenceToClient(EntityJoinWorldEvent event) | |
{ | |
if(!event.world.isRemote && event.entity instanceof EntityPlayer) | |
{ | |
EntityPlayer player = (EntityPlayer)event.entity; | |
AAExtendedPlayer props = (AAExtendedPlayer)player.getExtendedProperties(AAExtendedPlayer.EEPName); | |
ArcaneArtificing.snw.sendToAll(new MessageSyncMana(player.getEntityId(), props.getWhiteMana(), props.getBlueMana(), props.getBlackMana(), props.getGreenMana(), props.getRedMana(), props.hasLearnedAboutmana())); | |
} | |
} | |
@SubscribeEvent | |
public void syncOnDisconnect(cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent event) | |
{ | |
if(!event.player.worldObj.isRemote) | |
{ | |
AAExtendedPlayer props = (AAExtendedPlayer)event.player.getExtendedProperties(AAExtendedPlayer.EEPName); | |
ArcaneArtificing.snw.sendToAll(new MessageSyncMana(event.player.getEntityId(), props.getWhiteMana(), props.getBlueMana(), props.getBlackMana(), props.getGreenMana(), props.getRedMana(), props.hasLearnedAboutmana())); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment