mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-27 21:59:52 +00:00
Fixed items (and other entities) vibrating, bad offsets in tile calculation
This commit is contained in:
parent
92a2be024a
commit
7753b1d8be
@ -667,6 +667,9 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
|
||||
++$count;
|
||||
|
||||
$this->usedChunks[$index] = false;
|
||||
$this->level->registerChunkLoader($this, $X, $Z);
|
||||
|
||||
if(!$this->level->populateChunk($X, $Z)){
|
||||
if($this->spawned and $this->teleportPosition === null){
|
||||
continue;
|
||||
@ -676,9 +679,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
}
|
||||
|
||||
unset($this->loadQueue[$index]);
|
||||
$this->usedChunks[$index] = false;
|
||||
|
||||
$this->level->registerChunkLoader($this, $X, $Z);
|
||||
$this->level->requestChunk($X, $Z, $this, LevelProvider::ORDER_ZXY);
|
||||
}
|
||||
|
||||
@ -1398,7 +1398,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
|
||||
$this->entityBaseTick($tickDiff);
|
||||
|
||||
if(!$this->isSpectator()){
|
||||
if(!$this->isSpectator() and $this->speed !== null){
|
||||
if($this->onGround){
|
||||
if($this->inAirTicks !== 0){
|
||||
$this->startAirTicks = 5;
|
||||
|
@ -656,9 +656,9 @@ abstract class Entity extends Location implements Metadatable{
|
||||
}
|
||||
|
||||
protected function checkObstruction($x, $y, $z){
|
||||
$i = (int) $x;
|
||||
$j = (int) $y;
|
||||
$k = (int) $z;
|
||||
$i = Math::floorFloat($x);
|
||||
$j = Math::floorFloat($y);
|
||||
$k = Math::floorFloat($z);
|
||||
|
||||
$diffX = $x - $i;
|
||||
$diffY = $y - $j;
|
||||
@ -830,7 +830,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
|
||||
$diffMotion = ($this->motionX - $this->lastMotionX) ** 2 + ($this->motionY - $this->lastMotionY) ** 2 + ($this->motionZ - $this->lastMotionZ) ** 2;
|
||||
|
||||
if($diffPosition > 0.04 or $diffRotation > 2.25 or ($diffMotion > 0 and $this->getMotion()->lengthSquared() <= 0.0001)){ //0.2 ** 2, 1.5 ** 2
|
||||
if($diffPosition > 0.04 or $diffRotation > 2.25 and ($diffMotion > 0.0001 and $this->getMotion()->lengthSquared() <= 0.00001)){ //0.2 ** 2, 1.5 ** 2
|
||||
$this->lastX = $this->x;
|
||||
$this->lastY = $this->y;
|
||||
$this->lastZ = $this->z;
|
||||
@ -845,7 +845,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
}
|
||||
}
|
||||
|
||||
if($diffMotion > 0.0025 or ($diffMotion > 0 and $this->getMotion()->lengthSquared() <= 0.0001)){ //0.05 ** 2
|
||||
if($diffMotion > 0.0025 or ($diffMotion > 0.0001 and $this->getMotion()->lengthSquared() <= 0.0001)){ //0.05 ** 2
|
||||
$this->lastMotionX = $this->motionX;
|
||||
$this->lastMotionY = $this->motionY;
|
||||
$this->lastMotionZ = $this->motionZ;
|
||||
|
@ -145,11 +145,11 @@ class Explosion{
|
||||
|
||||
$explosionSize = $this->size * 2;
|
||||
$minX = Math::floorFloat($this->source->x - $explosionSize - 1);
|
||||
$maxX = Math::floorFloat($this->source->x + $explosionSize + 1);
|
||||
$maxX = Math::ceilFloat($this->source->x + $explosionSize + 1);
|
||||
$minY = Math::floorFloat($this->source->y - $explosionSize - 1);
|
||||
$maxY = Math::floorFloat($this->source->y + $explosionSize + 1);
|
||||
$maxY = Math::ceilFloat($this->source->y + $explosionSize + 1);
|
||||
$minZ = Math::floorFloat($this->source->z - $explosionSize - 1);
|
||||
$maxZ = Math::floorFloat($this->source->z + $explosionSize + 1);
|
||||
$maxZ = Math::ceilFloat($this->source->z + $explosionSize + 1);
|
||||
|
||||
$explosionBB = new AxisAlignedBB($minX, $minY, $minZ, $maxX, $maxY, $maxZ);
|
||||
|
||||
|
@ -982,12 +982,12 @@ class Level implements ChunkManager, Metadatable{
|
||||
* @return Block[]
|
||||
*/
|
||||
public function getCollisionBlocks(AxisAlignedBB $bb){
|
||||
$minX = (int) $bb->minX;
|
||||
$minY = (int) $bb->minY;
|
||||
$minZ = (int) $bb->minZ;
|
||||
$maxX = (int) ($bb->maxX + 1);
|
||||
$maxY = (int) ($bb->maxY + 1);
|
||||
$maxZ = (int) ($bb->maxZ + 1);
|
||||
$minX = Math::floorFloat($bb->minX);
|
||||
$minY = Math::floorFloat($bb->minY);
|
||||
$minZ = Math::floorFloat($bb->minZ);
|
||||
$maxX = Math::ceilFloat($bb->maxX);
|
||||
$maxY = Math::ceilFloat($bb->maxY);
|
||||
$maxZ = Math::ceilFloat($bb->maxZ);
|
||||
|
||||
$collides = [];
|
||||
|
||||
@ -1030,12 +1030,12 @@ class Level implements ChunkManager, Metadatable{
|
||||
* @return AxisAlignedBB[]
|
||||
*/
|
||||
public function getCollisionCubes(Entity $entity, AxisAlignedBB $bb, $entities = true){
|
||||
$minX = (int) $bb->minX;
|
||||
$minY = (int) $bb->minY;
|
||||
$minZ = (int) $bb->minZ;
|
||||
$maxX = (int) ($bb->maxX + 1);
|
||||
$maxY = (int) ($bb->maxY + 1);
|
||||
$maxZ = (int) ($bb->maxZ + 1);
|
||||
$minX = Math::floorFloat($bb->minX);
|
||||
$minY = Math::floorFloat($bb->minY);
|
||||
$minZ = Math::floorFloat($bb->minZ);
|
||||
$maxX = Math::ceilFloat($bb->maxX);
|
||||
$maxY = Math::ceilFloat($bb->maxY);
|
||||
$maxZ = Math::ceilFloat($bb->maxZ);
|
||||
|
||||
$collides = [];
|
||||
$v = $this->temporalVector;
|
||||
@ -1692,10 +1692,10 @@ class Level implements ChunkManager, Metadatable{
|
||||
public function getNearbyEntities(AxisAlignedBB $bb, Entity $entity = null){
|
||||
$nearby = [];
|
||||
|
||||
$minX = (int) (($bb->minX - 2) / 16);
|
||||
$maxX = (int) (($bb->maxX + 2) / 16 + 1);
|
||||
$minZ = (int) (($bb->minZ - 2) / 16);
|
||||
$maxZ = (int) (($bb->maxZ + 2) / 16 + 1);
|
||||
$minX = Math::floorFloat(($bb->minX - 2) / 16);
|
||||
$maxX = Math::ceilFloat(($bb->maxX + 2) / 16 + 1);
|
||||
$minZ = Math::floorFloat(($bb->minZ - 2) / 16);
|
||||
$maxZ = Math::ceilFloat(($bb->maxZ + 2) / 16 + 1);
|
||||
|
||||
for($x = $minX; $x <= $maxX; ++$x){
|
||||
for($z = $minZ; $z <= $maxZ; ++$z){
|
||||
|
Loading…
x
Reference in New Issue
Block a user