Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

elfin8er

Members
  • Joined

  • Last visited

  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?

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.