mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
Eating
This commit is contained in:
parent
2011d1d339
commit
71b12191b2
4 changed files with 42 additions and 1 deletions
|
|
@ -583,6 +583,30 @@ class Player{
|
|||
}
|
||||
//$this->entity->setHealth($data["health"], "client");
|
||||
break;
|
||||
case MC_ENTITY_EVENT:
|
||||
$data["eid"] = $this->eid;
|
||||
switch($data["event"]){
|
||||
case 9: //Eating
|
||||
$items = array(
|
||||
260 => 2, //Apples
|
||||
282 => 10, //Stew
|
||||
297 => 5, //Bread
|
||||
319 => 3,
|
||||
320 => 8,
|
||||
363 => 3,
|
||||
364 => 8,
|
||||
);
|
||||
if(isset($items[$this->equipment[0]])){
|
||||
$this->removeItem($this->equipment[0], 0, 1);
|
||||
$this->dataPacket(MC_ENTITY_EVENT, array(
|
||||
"eid" => 0,
|
||||
"event" => 9,
|
||||
));
|
||||
$this->entity->heal($items[$this->equipment[0]], "eating");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MC_DROP_ITEM:
|
||||
if($this->server->handle("player.drop", $data) !== false){
|
||||
$this->server->api->block->drop($this->entity->x, $this->entity->y, $this->entity->z, $data["block"], $data["meta"], $data["stack"]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue