Advertisement
HalestormXV

Untitled

Jul 13th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. package halestormxv.eAngelus.capabilities.MoralityCapability;
  2.  
  3. import halestormxv.eAngelus.capabilities.Interfaces.IMorality;
  4. import halestormxv.eAngelus.network.eAngelusPacketHandler;
  5. import halestormxv.eAngelus.network.packets.SyncMorality;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.entity.player.EntityPlayerMP;
  8. import net.minecraftforge.fml.relauncher.Side;
  9. import net.minecraftforge.fml.relauncher.SideOnly;
  10.  
  11.  
  12. /**
  13. * Created by Blaze on 7/10/2017.
  14. */
  15. public class moralityScale implements IMorality
  16. {
  17. EntityPlayer player;
  18. private int morality = 0;
  19. private int maxVirtue = 400;
  20. private int maxSin = -400;
  21.  
  22. @Override
  23. public void addSin(int points) //Subtract Morality
  24. {
  25. if (this.morality <= maxSin)
  26. {
  27. this.morality = maxSin;
  28. }else {
  29. this.morality -= points;
  30. }
  31.  
  32. //this.syncToClient();
  33. }
  34.  
  35. @Override
  36. public void addVirtue(int points) //Add Morality
  37. {
  38. if (this.morality >= maxVirtue)
  39. {
  40. this.morality = maxVirtue;
  41. }else {
  42. this.morality += points;
  43. }
  44.  
  45. // this.syncToClient();
  46. }
  47.  
  48. @Override
  49. public void set(int points)
  50. {
  51. this.morality = points;
  52. //this.syncToClient();
  53. }
  54.  
  55. @Override
  56. public int getMorality() { return this.morality; }
  57.  
  58.  
  59. @Override
  60. public void syncToClient()
  61. {
  62. if(!player.world.isRemote) {
  63. eAngelusPacketHandler.sendTo(new SyncMorality(this.getMorality()), (EntityPlayerMP) player);
  64. }
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement