Updated global Tile code

This commit is contained in:
Shoghi Cervantes
2014-02-27 12:23:22 +01:00
parent 44b9d33b65
commit c9dfdc288d
11 changed files with 80 additions and 76 deletions

View File

@ -297,7 +297,7 @@ class Level{
$this->server->api->entity->updateRadius($pos, 3);
}
if($tiles === true){
if(($t = $this->server->api->tile->get($pos)) !== false){
if(($t = $this->getTile($pos)) !== false){
$t->close();
}
}
@ -305,6 +305,21 @@ class Level{
return $ret;
}
public function getTile(Vector3 $pos){
if($pos instanceof Position and $pos->level->getName() !== $this->getName()){
return false;
}
$tiles = $this->getChunkTiles($pos->x >> 4, $pos->z >> 4);
if(count($tiles) > 0){
foreach($tiles as $tile){
if($tile->x === (int) $pos->x and $tile->y === (int) $pos->y and $tile->z === (int) $pos->z){
return $tile;
}
}
}
return false;
}
public function getMiniChunk($X, $Z, $Y){
if(!isset($this->level)){
return false;