Fixed eating

This commit is contained in:
Shoghi Cervantes 2013-06-07 19:04:02 +02:00
parent 64dca86342
commit e9683ff5d2

View File

@ -1407,13 +1407,15 @@ class Player{
RAW_FISH => 2, RAW_FISH => 2,
); );
if($this->entity->getHealth() < 20 and isset($items[$this->getSlot($this->slot)->getID()])){ if($this->entity->getHealth() < 20 and isset($items[($slot = $this->getSlot($this->slot))->getID()])){
if($this->removeItem($this->getSlot($this->slot)->getID(), $this->getSlot($this->slot)->getMetadata(), 1, false) === true){ $this->dataPacket(MC_ENTITY_EVENT, array(
$this->dataPacket(MC_ENTITY_EVENT, array( "eid" => 0,
"eid" => 0, "event" => 9,
"event" => 9, ));
)); $this->entity->heal($items[$slot->getID()], "eating");
$this->entity->heal($items[$this->getSlot($this->slot)->getID()], "eating"); --$slot->count;
if($slot->count <= 0){
$this->setSlot($this->slot, BlockAPI::getItem(AIR, 0, 0), false);
} }
} }
break; break;