Jump to content

elfin8er

Members
  • Posts

    4
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

elfin8er's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hmm... public static void removeXP(EntityPlayer player, int amt){ if(player.experience >= amt && player.experienceLevel == 0) { player.experienceTotal = player.experienceTotal - amt; player.experience -= amt/player.xpBarCap(); }else if(player.experienceLevel > 0 && player.experience >= amt) { player.experienceTotal = player.experienceTotal - amt; player.experienceLevel--; player.experience = (float)(player.xpBarCap()-amt)/player.xpBarCap(); if(player.experienceLevel == 0) player.experience = 0; } } Thanks for the help so far.
  2. Ah, my bad. My apologizes. It seems to be working with what you posted. Thank you very much EDIT: Having a really hard time using values other than -1. I'm sure I'll get it eventually though public static void removeXP(EntityPlayer player, int amt){ if(player.experience > amt && player.experienceLevel > 0) { player.experienceTotal = player.experienceTotal - amt; player.experience -= 1F/player.xpBarCap(); } else if(player.experienceLevel > 0) { player.experienceTotal = player.experienceTotal - amt; player.experienceLevel--; player.experience = (float)(player.xpBarCap()-1)/player.xpBarCap(); if(player.experienceLevel == 0) player.experience = 0; } }
  3. if(player.experienceTotal >= 10){ System.out.println("Removing XP"); player.experienceTotal = player.experienceTotal - 1; } Isn't working In fact, it's not doing anything (except printing "Removing XP"). Replacing it with player.addExperience(-1); does work however (with the reported issues).
  4. I'm attempting to remove XP from a player using player.addExperience(-1) (player being an EntityPlayer), however it doesn't quite work properly. When XP reaches below the current level, the XP bar begins to stay empty, and the level stays the same. I've also tried player.experienceTotal = player.experienceTotal - 1; with no luck.\ Anybody have any suggestions for removing XP from the player?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.