Solved Eating when hungerbar is full

Discussion in 'Plugin Development' started by re4ly, Jul 6, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    re4ly

    How can i let players eat when the hungerbar is full?
     
  2. Offline

    Compressions

    re4ly Minecraft only allows for 20 as the max food level, so doing so would be pointless.
     
  3. Offline

    finalblade1234

    re4ly
    When a player right click with an item i suppose you could check if his hunger was full, then if it was set it down 1, then that whould allow him to eat the food
    "if(player.getHunger() == 20)
    {
    player.setHunger(19)
    }"
     
  4. Offline

    xTrollxDudex

    re4ly
    What finalblade1234 said.
    In your listener, listen for playerinteractevent
    On interact, check if the player action is right click block OR right click air
    Also check if the item he is holding is something you want him to eat
    Then, subtract his hunger IF he has 20 health. If he doesn't have 20, do nothing
     
  5. Offline

    re4ly

    thanks ;)
     
Thread Status:
Not open for further replies.

Share This Page