MineCloneJEpC/mods/PLAYER/mcl_hunger/API.md

1.3 KiB

API information (WIP)

This API information is WIP. The mod API is still pretty much unofficial; this mod is mostly seen as standalone for now. This may change in the future development of MineClone 2. Hopefully.

Before using this mod

This mod is a no-op when the game is started with damage disabled. Before using any of the functions, first check if global variable “mcl_hunger” is present.

Hunger level

The hunger level of the player is a whole number between 0 and 20 inclusive. 0 is starving and 20 is full. The hunger level is represented in the HUD by a statbar with 20 half-icons.

Functions

mcl_hunger.get_hunger(player)

Returns the current hunger level of player (ObjectRef).

mcl_hunger.set_hunger(player, hunger)

Sets the hunger level of player (ObjectRef) to hunger immediately. hunger must be between 0 and 20 inclusive.

Groups

Items in group food=3 will make a drinking sound and no particles. Items in group food with any other rating will make an eating sound and particles, based on the inventory image or wield image (whatever is available first).

Suppressing food particles

Normally, all food items considered food (not drinks) make food particles. You can suppress the food particles by adding the field _food_particles=false to the item definition.