Fixed items (and other entities) vibrating, bad offsets in tile calculation

This commit is contained in:
Shoghi Cervantes
2015-05-19 21:29:30 +02:00
parent 92a2be024a
commit 7753b1d8be
4 changed files with 29 additions and 29 deletions

View File

@ -982,13 +982,13 @@ 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 = [];
$v = $this->temporalVector;
@ -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){