mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
World: discard tiles on load if they aren't the correct type or no tile is expected
in many instances, remnants of improperly removed blocks from PM3 have been causing problems, such as flower pot tiles where there are no flower pots. this change might break some plugins which are using tiles for custom purposes, but this is a misuse that was never supported properly in the first place.
This commit is contained in:
parent
c3bca9e172
commit
8f804f6f34
@ -2873,7 +2873,15 @@ class World implements ChunkManager{
|
||||
}elseif($this->getTile($tilePosition) !== null){
|
||||
$logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Another tile is already at that position");
|
||||
}else{
|
||||
$this->addTile($tile);
|
||||
$block = $this->getBlockAt($tilePosition->getFloorX(), $tilePosition->getFloorY(), $tilePosition->getFloorZ());
|
||||
$expectedClass = $block->getIdInfo()->getTileClass();
|
||||
if($expectedClass === null){
|
||||
$logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Block at that position (" . $block->getName() . ") does not expect a tile");
|
||||
}elseif(!($tile instanceof $expectedClass)){
|
||||
$logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Tile is of wrong type (expected $expectedClass but have " . get_class($tile) . ")");
|
||||
}else{
|
||||
$this->addTile($tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user