mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Implemented scheduled and partial entity updates
This commit is contained in:
@ -1192,16 +1192,18 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
|
||||
}
|
||||
|
||||
public function onUpdate(){
|
||||
public function onUpdate($currentTick){
|
||||
if($this->spawned === false or $this->dead === true){
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->timings->startTiming();
|
||||
|
||||
$this->lastUpdate = $currentTick;
|
||||
|
||||
$this->processMovement();
|
||||
|
||||
$this->entityBaseTick();
|
||||
$this->entityBaseTick(1);
|
||||
|
||||
if($this->onGround){
|
||||
$this->inAirTicks = 0;
|
||||
@ -1215,6 +1217,10 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
}
|
||||
|
||||
foreach($this->level->getNearbyEntities($this->boundingBox->grow(1, 1, 1), $this) as $entity){
|
||||
if(($currentTick - $entity->lastUpdate) > 1){
|
||||
$entity->scheduleUpdate();
|
||||
}
|
||||
|
||||
if($entity instanceof Arrow and $entity->onGround and $this->motionX == 0 and $this->motionY == 0 and $this->motionZ == 0){
|
||||
if($entity->dead !== true){
|
||||
$item = Item::get(Item::ARROW, 0, 1);
|
||||
|
Reference in New Issue
Block a user