mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-18 09:24:05 +00:00
Remove useless EntityEventPacket
vanilla doesn't send this, and it doesn't do anything if we _do_ send it.
This commit is contained in:
parent
13d50aff62
commit
18777a9041
@ -26,8 +26,6 @@ namespace pocketmine\item;
|
|||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\entity\Human;
|
use pocketmine\entity\Human;
|
||||||
use pocketmine\event\entity\EntityEatItemEvent;
|
use pocketmine\event\entity\EntityEatItemEvent;
|
||||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
|
||||||
use pocketmine\Player;
|
|
||||||
|
|
||||||
abstract class Food extends Item implements FoodSource{
|
abstract class Food extends Item implements FoodSource{
|
||||||
public function canBeConsumed() : bool{
|
public function canBeConsumed() : bool{
|
||||||
@ -53,14 +51,6 @@ abstract class Food extends Item implements FoodSource{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onConsume(Entity $human){
|
public function onConsume(Entity $human){
|
||||||
$pk = new EntityEventPacket();
|
|
||||||
$pk->entityRuntimeId = $human->getId();
|
|
||||||
$pk->event = EntityEventPacket::USE_ITEM;
|
|
||||||
if($human instanceof Player){
|
|
||||||
$human->dataPacket($pk);
|
|
||||||
}
|
|
||||||
$human->getLevel()->getServer()->broadcastPacket($human->getViewers(), $pk);
|
|
||||||
|
|
||||||
$ev = new EntityEatItemEvent($human, $this);
|
$ev = new EntityEatItemEvent($human, $this);
|
||||||
|
|
||||||
$human->addSaturation($ev->getSaturationRestore());
|
$human->addSaturation($ev->getSaturationRestore());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user