How May I Check For The Max Food Level

Started by Simplicius on

Topic category: Help with MCreator software

Last seen on 16:25, 5. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How May I Check For The Max Food Level
Mon, 04/05/2021 - 16:25 (edited)

I'm working on a placeable apple, once the apple-"block" has been placed via a single right click of the apple-item, I want it to act similar to how cake acts.

The plan on how to achieve this is pretty simple, but I need to find a way to compare the current food level to the max. food level.
I dont't want to hard code the max. food level, in case the mod will be used with another potentially max.-food-level-increasing-mod.

In the belive that Minecraft would simple stop adding food stacks once the limit is reached,  I simple set the food level to: get current + 1, on each click. However minecraft allows you to add much more than the displayed limit, causing it to add "invisible" food stacks, which I dont want.

I don't know any other way of preventing this unwanted behaviour than by allways comparing the current food level to the max., but I can't find such a block;

I know I could potentially check for the current food level of the player the first time he joins a world and use this value, but this would lead to unwanted behaviour if the max. value would be altered later on.

Edited by Simplicius on Mon, 04/05/2021 - 16:25