From 643a4c1ef5910d113a2deb2c6b316f4ceabe438d Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sun, 6 Jul 2014 12:08:05 +0200 Subject: [PATCH] Fixed motion, physics --- src/pocketmine/entity/DroppedItem.php | 1 + src/pocketmine/entity/Entity.php | 3 +-- src/pocketmine/network/protocol/AddEntityPacket.php | 6 +++--- src/pocketmine/network/protocol/SetEntityMotionPacket.php | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pocketmine/entity/DroppedItem.php b/src/pocketmine/entity/DroppedItem.php index 0a12022c3..74ba872bc 100644 --- a/src/pocketmine/entity/DroppedItem.php +++ b/src/pocketmine/entity/DroppedItem.php @@ -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); diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 7ef118fd7..b100073ac 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -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)); diff --git a/src/pocketmine/network/protocol/AddEntityPacket.php b/src/pocketmine/network/protocol/AddEntityPacket.php index 784ca4d2b..4bc395078 100644 --- a/src/pocketmine/network/protocol/AddEntityPacket.php +++ b/src/pocketmine/network/protocol/AddEntityPacket.php @@ -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); } } diff --git a/src/pocketmine/network/protocol/SetEntityMotionPacket.php b/src/pocketmine/network/protocol/SetEntityMotionPacket.php index 7937c586b..4b207be77 100644 --- a/src/pocketmine/network/protocol/SetEntityMotionPacket.php +++ b/src/pocketmine/network/protocol/SetEntityMotionPacket.php @@ -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 } }