mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 03:47:16 +00:00
Added workaround for #1527
This commit is contained in:
parent
22533458ed
commit
88157d6e99
@ -843,12 +843,24 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->justCreated){
|
if(!$this->justCreated){
|
||||||
$this->server->getPluginManager()->callEvent($ev = new EntityMoveEvent($this, $pos));
|
$ev = new EntityMoveEvent($this, $pos);
|
||||||
|
if($this instanceof Player){
|
||||||
|
for($side = 2; $side <= 5; ++$side){
|
||||||
|
$vector = $pos->getSide($side, 2);
|
||||||
|
if(!isset($this->usedChunks[Level::chunkHash($vector->x >> 4, $vector->z >> 4)])){
|
||||||
|
$ev->setCancelled(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->server->getPluginManager()->callEvent($ev);
|
||||||
if($ev->isCancelled()){
|
if($ev->isCancelled()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->x = $pos->x;
|
$this->x = $pos->x;
|
||||||
$this->y = $pos->y;
|
$this->y = $pos->y;
|
||||||
$this->z = $pos->z;
|
$this->z = $pos->z;
|
||||||
|
@ -123,17 +123,17 @@ class Vector3{
|
|||||||
public function getSide($side, $step = 1){
|
public function getSide($side, $step = 1){
|
||||||
switch((int) $side){
|
switch((int) $side){
|
||||||
case 0:
|
case 0:
|
||||||
return new Vector3($this->x, $this->y - (int) $step, $this->z);
|
return new Vector3($this->x, $this->y - $step, $this->z);
|
||||||
case 1:
|
case 1:
|
||||||
return new Vector3($this->x, $this->y + (int) $step, $this->z);
|
return new Vector3($this->x, $this->y + $step, $this->z);
|
||||||
case 2:
|
case 2:
|
||||||
return new Vector3($this->x, $this->y, $this->z - (int) $step);
|
return new Vector3($this->x, $this->y, $this->z - $step);
|
||||||
case 3:
|
case 3:
|
||||||
return new Vector3($this->x, $this->y, $this->z + (int) $step);
|
return new Vector3($this->x, $this->y, $this->z + $step);
|
||||||
case 4:
|
case 4:
|
||||||
return new Vector3($this->x - (int) $step, $this->y, $this->z);
|
return new Vector3($this->x - $step, $this->y, $this->z);
|
||||||
case 5:
|
case 5:
|
||||||
return new Vector3($this->x + (int) $step, $this->y, $this->z);
|
return new Vector3($this->x + $step, $this->y, $this->z);
|
||||||
default:
|
default:
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user