Item movement fix

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-29 19:29:16 +01:00
parent 5a2156c2bf
commit 1976e1c6f6
2 changed files with 8 additions and 5 deletions

View File

@ -174,6 +174,9 @@ class Player{
}
public function hasItem($type, $damage = false){
if($type === 0){
return true;
}
foreach($this->inventory as $s => $data){
if($data[0] === $type and ($data[1] === $damage or $damage === false) and $data[2] > 0){
return true;

View File

@ -246,13 +246,13 @@ class Entity extends stdClass{
$b = $this->server->api->level->getBlock($x, $y, $z);
if(isset(Material::$transparent[$b[0]])){
$this->speedY -= 0.04 * 4;
$this->server->api->handle("entity.motion", $this);
//$this->server->api->handle("entity.motion", $this);
}elseif($this->speedY < 0){
$this->y = $y + 1;
$this->speedX = 0;
$this->speedY = 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];
$origin = new Vector3($this->last[0], $this->last[1], $this->last[2]);
$final = new Vector3($this->x, $this->y, $this->z);
$speedX = abs($this->x - $this->last[0]) / $diffTime;
$speedY = ($this->y - $this->last[1]) / $diffTime;
$speedZ = abs($this->z - $this->last[2]) / $diffTime;
$speedX = ($this->last[0] - $this->x) / $diffTime;
$speedY = ($this->last[1] - $this->y) / $diffTime;
$speedZ = ($this->last[2] - $this->z) / $diffTime;
$this->speedX = $speedX;
$this->speedY = $speedY;
$this->speedZ = $speedZ;