106 $this->timings->startTiming();
109 if($tickDiff <= 0 and !$this->justCreated){
113 $this->lastUpdate = $currentTick;
120 $pos = (
new Vector3($this->x - 0.5, $this->y, $this->z - 0.5))->
round();
122 if($this->ticksLived === 1){
123 $block = $this->level->getBlock($pos);
127 $this->level->setBlock($pos,
Block::get(0),
true);
132 $this->
move($this->motionX, $this->motionY, $this->motionZ);
136 $this->motionX *= $friction;
138 $this->motionZ *= $friction;
140 $pos = (
new Vector3($this->x - 0.5, $this->y, $this->z - 0.5))->
round();
144 $block = $this->level->getBlock($pos);
145 if($block->getId() > 0 and !$block->isSolid() and !($block instanceof Liquid)){
148 if($block instanceof SnowLayer){
149 $oldDamage = $block->getDamage();
150 $this->server->getPluginManager()->callEvent($ev =
new EntityBlockChangeEvent($this, $block,
Block::get($this->
getBlock(), $this->
getDamage() + $oldDamage)));
152 $this->server->getPluginManager()->callEvent($ev =
new EntityBlockChangeEvent($this, $block,
Block::get($this->
getBlock(), $this->
getDamage())));
155 if(!$ev->isCancelled()){
156 $this->
getLevel()->setBlock($pos, $ev->getTo(),
true);
157 if($ev->getTo() instanceof Anvil){
158 $sound =
new AnvilFallSound($this);
159 $this->
getLevel()->addSound($sound);
160 foreach($this->level->getNearbyEntities($this->boundingBox->grow(0.1, 0.1, 0.1), $this) as $entity){
161 $entity->scheduleUpdate();
162 if(!$entity->isAlive()){
165 if($entity instanceof Living){
182 return $hasUpdate or !$this->onGround or
abs($this->motionX) > 0.00001 or
abs($this->motionY) > 0.00001 or
abs($this->motionZ) > 0.00001;