banner



How To Add Hearts In Minecraft

Thread Status:
Not open for further replies.
  1. I'm trying to add more hearts to my players but information technology seems when I do setMaxHealth(); it doesnt exercise information technology. Am I missing out on something?
                              if (players.get(p)){             Organization.out.println(p.getInventory().getArmorContents()[0].getTypeId());             if (p.getInventory().getArmorContents()[0].getTypeId() == 301){                 p.setMaxHealth(30D);                 render "Ranger";             }             if (p.getInventory().getArmorContents()[0].getTypeId() == 317){                 render "Medic";             }             if (p.getInventory().getArmorContents()[0].getTypeId() == 309){                 return "Warrior";             }         }         return "Normal Player";
  2. Instead of ints use doubles.
  3. Why would that brand whatever deviation? Just incase It does I simply tried it and the extra hearts exercise not bear witness.
  4. Dave_
    Read the sticky on ambiguous getHealth(). But you can put in say 10.5D as the argument to brand sure it is a double I think
  5. I did the suggested and still no luck. I nevertheless have ten hearts :/
  6. A role player'southward default max health is 20.0, so I'd propose trying something more than that...
  7.                           if (p.getInventory().getArmorContents()[0].getTypeId() == 301){                 p.setMaxHealth(22.0D);                 return "Ranger";             }
    Yet but ten hearts.
  8. Add a printout line to make sure you're event reaching the p.setMaxHealth(22.oD); line. And if you lot include a decimal point, there's no need to suspend the "D", just to brand life a bit easier.
  9. I haven't read much about how the hearts stuff works but I think information technology is like this. You can change a players wellness to anything like 500. But the only style new hearts will show upward is by using the new item system that allows items to give a player more health.

  10. I knew that and yes the event is making information technology or else it would return "Normal Thespian", and almost the D I just didnt remove it from the 30D its similar ii am haha
  11. Well make sure "Ranger" is being returned. And paste your whole grade? How is the Player object retrieved?

  12. Oh, I idea for sure the bukkit team would add together some kind of implementation without the use of items.
  13. Not sure what this talk about the need for items to exist involved is... something like this works just fine:
                              
    1. public void onJoin(PlayerJoinEvent outcome) {
    2. consequence.getPlayer ( ).setMaxHealth ( 40.0 ) ;

  14.                           private void updateList(){         for (Role player p : Bukkit.getOnlinePlayers()){             ItemStack[] armor = p.getInventory().getArmorContents();             int i = 0;             for (int num = 0; num < 4; num++){                 if (armor[num].getTypeId() != 0){                     if (armor[0].getTypeId() - i == armor[num].getTypeId()){                         i++;                     }                 }             }             boolean isClass = checkClassSafely(p);                       if (i == 4){                 players.put(p, truthful);             }else{                 players.put(p, fake);             }             Cord name = getType(p);             if (players.get(p) && !isClass){                 p.sendMessage(ChatColor.GREEN + "You are a " + ChatColor.WHITE + name);             }else if (!players.become(p) && isClass){                 p.sendMessage(ChatColor.RED + "You are now a " + ChatColor.WHITE + proper name);             }         }     }       public Cord getType(Player p){         if (players.get(p)){             Organisation.out.println(p.getInventory().getArmorContents()[0].getTypeId());             if (p.getInventory().getArmorContents()[0].getTypeId() == 301){                 p.setMaxHealth(22.0D);                 return "Ranger";             }             if (p.getInventory().getArmorContents()[0].getTypeId() == 317){                 return "Medic";             }             if (p.getInventory().getArmorContents()[0].getTypeId() == 309){                 return "Warrior";             }         }         return "Normal Histrion";     }
    Proof it calls
    Evidence Spoiler Hide Spoiler

    2013-07-11_01.57.31.png
  15. LinearLogic Does that actualy show that you have more hearts?

    Dave_ Effort printing out the amount of health the role player has.

    EDIT by Moderator: merged posts, please use the edit push instead of double posting.

    Concluding edited by a moderator: Jun 3, 2016

  16. 02:07:11 [INFO] CONSOLE: Reload consummate. 02:07:12 [INFO] Current Health: twenty.0 02:07:12 [INFO] Max Health: 22.0
    But the two hearts do non show
  17. BorisTheTerrible: yup. And Dave_, I'm guessing the player you're retrieving is the incorrect one, since I compiled your code with "p" retrieved by getServer().getPlayer("LinearLogic") and I got the extra eye.

    EDIT: at present that yous're press out the wellness and max health, trying printing the player's name as well.


  18. That is strange.
    p.sendMessage(ChatColor.GREEN + "You are a " + ChatColor.WHITE + proper noun);
    sends to the right player.
  19. Dave_ This but works as of 1.vi I believe and then make sure your trying this on an upwardly to appointment server.
  20. You're not running a 1.half dozen.2 MC customer, are you? 1.6.1 servers support modified max wellness, but the customer won't display the extra hearts.

  21. oh ,im using the outset Bukkit one.6.ane dev build, possibly i should update it, sick post back if it isn't working however.
  22. You tin not 'add more than hearts' to the gui from the server it would require a modified client. yous can modify the health but it volition be adjusted to ten visible hearts.
  23. LinearLogic BorisTheTerrible Thank you guys, outdated bukkit build ;)
    yes you can every bit of MC 1.half-dozen

    EDIT past Moderator: merged posts, please use the edit push button instead of double posting.

    Last edited by a moderator: Jun 3, 2016
  24. Cheers to the awesomeness of the Mojang team, that is no longer true. Attempt it out for yourself!
  25. NoLiver92, just alter the thespian'south max wellness with player.setMaxHealth(someDouble) and your client does the rest!
  26. LinearLogic Thats cool, thank you
Thread Status:
Not open for further replies.

Share This Page

How To Add Hearts In Minecraft,

Source: https://bukkit.org/threads/adding-more-hearts-to-players.159191/

Posted by: whitehavager.blogspot.com

0 Response to "How To Add Hearts In Minecraft"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel