mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 13:25:16 +00:00
Item movement fix
This commit is contained in:
parent
5a2156c2bf
commit
1976e1c6f6
@ -174,6 +174,9 @@ class Player{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function hasItem($type, $damage = false){
|
public function hasItem($type, $damage = false){
|
||||||
|
if($type === 0){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
foreach($this->inventory as $s => $data){
|
foreach($this->inventory as $s => $data){
|
||||||
if($data[0] === $type and ($data[1] === $damage or $damage === false) and $data[2] > 0){
|
if($data[0] === $type and ($data[1] === $damage or $damage === false) and $data[2] > 0){
|
||||||
return true;
|
return true;
|
||||||
|
@ -246,13 +246,13 @@ class Entity extends stdClass{
|
|||||||
$b = $this->server->api->level->getBlock($x, $y, $z);
|
$b = $this->server->api->level->getBlock($x, $y, $z);
|
||||||
if(isset(Material::$transparent[$b[0]])){
|
if(isset(Material::$transparent[$b[0]])){
|
||||||
$this->speedY -= 0.04 * 4;
|
$this->speedY -= 0.04 * 4;
|
||||||
$this->server->api->handle("entity.motion", $this);
|
//$this->server->api->handle("entity.motion", $this);
|
||||||
}elseif($this->speedY < 0){
|
}elseif($this->speedY < 0){
|
||||||
$this->y = $y + 1;
|
$this->y = $y + 1;
|
||||||
$this->speedX = 0;
|
$this->speedX = 0;
|
||||||
$this->speedY = 0;
|
$this->speedY = 0;
|
||||||
$this->speedZ = 0;
|
$this->speedZ = 0;
|
||||||
$this->server->api->handle("entity.motion", $this);
|
//$this->server->api->handle("entity.motion", $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,9 +437,9 @@ class Entity extends stdClass{
|
|||||||
$diffTime = microtime(true) - $this->last[5];
|
$diffTime = microtime(true) - $this->last[5];
|
||||||
$origin = new Vector3($this->last[0], $this->last[1], $this->last[2]);
|
$origin = new Vector3($this->last[0], $this->last[1], $this->last[2]);
|
||||||
$final = new Vector3($this->x, $this->y, $this->z);
|
$final = new Vector3($this->x, $this->y, $this->z);
|
||||||
$speedX = abs($this->x - $this->last[0]) / $diffTime;
|
$speedX = ($this->last[0] - $this->x) / $diffTime;
|
||||||
$speedY = ($this->y - $this->last[1]) / $diffTime;
|
$speedY = ($this->last[1] - $this->y) / $diffTime;
|
||||||
$speedZ = abs($this->z - $this->last[2]) / $diffTime;
|
$speedZ = ($this->last[2] - $this->z) / $diffTime;
|
||||||
$this->speedX = $speedX;
|
$this->speedX = $speedX;
|
||||||
$this->speedY = $speedY;
|
$this->speedY = $speedY;
|
||||||
$this->speedZ = $speedZ;
|
$this->speedZ = $speedZ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user