Home Getting Started With Scripts Using this wiki Commands CTGUI Global functions Bracket Handlers

IFoodStats

The IPlayer interface allows you to view certain information on a player’s food Stats.

Importing the package

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.
import crafttweaker.player.IFoodStats;

ZenGetter/ZenSetters

ZenGetterZenSetterType
ZenGetter
foodLevel
ZenSetter
foodLevel
Type
int
ZenGetter
saturationLevel
ZenSetter
saturationLevel
Type
float
ZenGetter
needFood
ZenSetter
Type
boolean

ZenMethods

Adding Stats

Void Function. Takes an int and a float as intput parameters.

script.zs
stats.addStats(int foodValue, float saturationLevel);

onUpdate

Void Function. Takes an IPlayer object as input parameter.

script.zs
stats.onUpdate(IPlayer player);

asNBT

Returns an IData Object representing the foodStats.

script.zs
stats.asNBT();
stats as crafttweaker.data.IData;

Add Exhaustion

Void Funtion. takes a float as input parameter.

script.zs
stats.addExhaustion(float exhaustion);