forked from mirrors/kolyah35-minecraft-pe-0.6.1
the whole game
This commit is contained in:
parent
816e9060b4
commit
f0617a5d22
2069 changed files with 581500 additions and 0 deletions
33
src/world/food/SimpleFoodData.cpp
Executable file
33
src/world/food/SimpleFoodData.cpp
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#include "SimpleFoodData.h"
|
||||
#include "FoodConstants.h"
|
||||
#include "../item/FoodItem.h"
|
||||
#include "../entity/player/Player.h"
|
||||
|
||||
SimpleFoodData::SimpleFoodData()
|
||||
: foodLevel(0)
|
||||
{
|
||||
}
|
||||
|
||||
void SimpleFoodData::eat( int food ) {
|
||||
foodLevel = Mth::Min(food + foodLevel, FoodConstants::MAX_FOOD);
|
||||
}
|
||||
|
||||
void SimpleFoodData::eat( FoodItem* item ) {
|
||||
eat(item->getNutrition());
|
||||
}
|
||||
|
||||
void SimpleFoodData::tick( Player* player ) {
|
||||
if (foodLevel > 0 && player->isHurt()) {
|
||||
const int healAmount = foodLevel;// / 2;
|
||||
player->heal(healAmount);
|
||||
foodLevel = 0;
|
||||
/*
|
||||
if (!level->isClientSide) {
|
||||
player->heal(healAmount);
|
||||
} else {
|
||||
SetHealthPacket packet(SetHealthPacket::HEALTH_MODIFY_OFFSET - healAmount);
|
||||
level->raknetInstance->send(packet);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue