Chunk: Remove obsolete checks for entity/tile coordinate mismatches

This code is no longer necessary, because entities are constructed with a Level instead of a Chunk since API 3.0.0-ALPHA4. This means that they will not get allocated in the wrong chunk at runtime after having been saved on the wrong chunk by something else (such as an older version of PM). They will instead be allocated in a chunk selected by bitshifting their coordinates.

This is necessary to be able to fix #1789 without causing entities affected by the infamous bitshift-on-floats bugs to inexplicably vanish.
This commit is contained in:
Dylan K. Taylor 2018-02-14 18:58:52 +00:00
parent a84aba5517
commit 3962d32ffe

View File

@ -723,11 +723,6 @@ class Chunk{
continue;
}
if(($nbt["Pos"][0] >> 4) !== $this->x or ($nbt["Pos"][2] >> 4) !== $this->z){
$changed = true;
continue; //Fixes entities allocated in wrong chunks.
}
try{
$entity = Entity::createEntity($nbt->getTag("id")->getValue(), $level, $nbt);
if(!($entity instanceof Entity)){
@ -751,11 +746,6 @@ class Chunk{
continue;
}
if(($nbt->getInt(Tile::TAG_X) >> 4) !== $this->x or ($nbt->getInt(Tile::TAG_Z) >> 4) !== $this->z){
$changed = true;
continue; //Fixes tiles allocated in wrong chunks.
}
if(Tile::createTile($nbt->getString(Tile::TAG_ID), $level, $nbt) === null){
$changed = true;
continue;