Fixed motion, physics

This commit is contained in:
Shoghi Cervantes 2014-07-06 12:08:05 +02:00
parent 0503adc08c
commit 643a4c1ef5
4 changed files with 8 additions and 8 deletions

View File

@ -72,6 +72,7 @@ class DroppedItem extends Entity{
}
$this->motionY -= $this->gravity;
$this->inBlock = $this->checkObstruction($this->x, ($this->boundingBox->minY + $this->boundingBox->maxY) / 2, $this->z);
$this->move($this->motionX, $this->motionY, $this->motionZ);

View File

@ -297,10 +297,9 @@ abstract class Entity extends Position implements Metadatable{
$diffY = $y - $j;
$diffZ = $z - $k;
$start = microtime(true);
$list = $this->getLevel()->getCollisionBlocks($this->boundingBox);
if(count($list) === 0 and $this->getLevel()->isFullBlock(new Vector3($i, $j, $k))){
if(count($list) === 0 and !$this->getLevel()->isFullBlock(new Vector3($i, $j, $k))){
return false;
}else{
$flag = !$this->getLevel()->isFullBlock(new Vector3($i - 1, $j, $k));

View File

@ -50,9 +50,9 @@ class AddEntityPacket extends DataPacket{
$this->putFloat($this->z);
$this->putInt($this->did);
if($this->did > 0){
$this->putShort($this->speedX);
$this->putShort($this->speedY);
$this->putShort($this->speedZ);
$this->putShort($this->speedX * 8000);
$this->putShort($this->speedY * 8000);
$this->putShort($this->speedZ * 8000);
}
}

View File

@ -41,9 +41,9 @@ class SetEntityMotionPacket extends DataPacket{
$this->putInt(count($this->entities));
foreach($this->entities as $d){
$this->putInt($d[0]); //eid
$this->putShort((int) ($d[1] * 400)); //motX
$this->putShort((int) ($d[2] * 400)); //motY
$this->putShort((int) ($d[3] * 400)); //motZ
$this->putShort((int) ($d[1] * 8000)); //motX
$this->putShort((int) ($d[2] * 8000)); //motY
$this->putShort((int) ($d[3] * 8000)); //motZ
}
}