mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-09 11:31:49 +00:00
Projectile: check for blockhit change on nearby blockupdate
This commit is contained in:
parent
860c20109b
commit
47c862bc38
@ -162,17 +162,19 @@ abstract class Projectile extends Entity{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasMovementUpdate() : bool{
|
public function onNearbyBlockChange() : void{
|
||||||
$parent = parent::hasMovementUpdate();
|
if($this->blockHit !== null){
|
||||||
if($parent and $this->blockHit !== null){
|
|
||||||
$blockIn = $this->level->getBlockAt($this->blockHit->x, $this->blockHit->y, $this->blockHit->z);
|
$blockIn = $this->level->getBlockAt($this->blockHit->x, $this->blockHit->y, $this->blockHit->z);
|
||||||
|
if($blockIn->getId() !== $this->blockHitId or $blockIn->getDamage() !== $this->blockHitData){
|
||||||
if($blockIn->getId() === $this->blockHitId and $blockIn->getDamage() === $this->blockHitData){
|
$this->blockHit = $this->blockHitId = $this->blockHitData = null;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $parent;
|
parent::onNearbyBlockChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasMovementUpdate() : bool{
|
||||||
|
return $this->blockHit === null and parent::hasMovementUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function move(float $dx, float $dy, float $dz) : void{
|
public function move(float $dx, float $dy, float $dz) : void{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user