Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Food amounts via plugin

Comments in 'Plugin Development' started by TryoneLegendZzz, Apr 8, 2016.

  1. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    Can i change how much hunger you gain via a plugin from eating?
  2. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    Yeah. Use PlayerItemConsumeEvent.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No, that event doesn't let you change the hunger value.
    You should use EntityEatEvent.
    https://github.com/PocketMine/Pocke...ocketmine/event/entity/EntityEatEvent.php#L59

    EntityEatEvent::setFoodResture(int);
    EntityEatEvent::setSaturationRestore(float);

    There are also setAdditionalEffects(Effect[]) and setResidue(). For an EntityEatItemEvent, residue must be an item. For an EntityEatBlockEvent (for cakes), residue must be a block.

Share This Page

Advertisement