pmmp / PocketMine-MP

A server software for Minecraft: Bedrock Edition in PHP
https://pmmp.io
GNU Lesser General Public License v3.0
3.28k stars 1.56k forks source link

Placing blocks in x coordinate is weird once a player stands close to a block and being in far coords #4969

Open ItsZodiaX opened 2 years ago

ItsZodiaX commented 2 years ago

Issue description

Steps to reproduce the issue

  1. Stand closer to a block
  2. Place a new block in x coordinate next to the previous block (Left, Right, Up)

OS and versions

Plugins

Plugins (1): MultiWorld v1.7.0-beta2

Crashdump, backtrace or other files

https://cdn.discordapp.com/attachments/878545340058468412/966010061455495248/2022-04-19_23-15-25_Trim.mp4 https://cdn.discordapp.com/attachments/878545340058468412/966012951163207730/2022-04-19_23-29-28_Trim.mp4

dktapps commented 2 years ago

This is caused by floating-point errors. It appears the tolerance for these during collision checking is too small.

dktapps commented 2 years ago

Sample data:

Player:

array(1) {
  [0]=>
  object(pocketmine\math\AxisAlignedBB)#29534 (6) {
    ["minX"]=>
    float(9653.4002)
    ["minY"]=>
    float(64)
    ["minZ"]=>
    float(460.7251)
    ["maxX"]=>
    float(9654.000199999999)
    ["maxY"]=>
    float(65.8)
    ["maxZ"]=>
    float(461.3251)
  }
}

Block:

object(pocketmine\math\AxisAlignedBB)#126980 (6) {
  ["minX"]=>
  float(9654)
  ["minY"]=>
  float(64)
  ["minZ"]=>
  float(461)
  ["maxX"]=>
  float(9655)
  ["maxY"]=>
  float(65)
  ["maxZ"]=>
  float(462)
}
ItsZodiaX commented 2 years ago

Can we do anything about this error?