mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-21 10:26:38 +00:00
Fixed motion, physics
This commit is contained in:
parent
0503adc08c
commit
643a4c1ef5
@ -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);
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user