Better block creation on Level

This commit is contained in:
Shoghi Cervantes 2014-12-08 22:02:36 +01:00
parent 3bb2f12cde
commit 5e5f8bf33d
2 changed files with 7 additions and 7 deletions

View File

@ -758,12 +758,6 @@ class Block extends Position implements Metadatable{
self::$lightFilter[$id] = 1;
}
}
foreach(self::$fullList as $id => $block){
if($block === null){
self::$fullList[$id] = new Block($id >> 4, $id & 0x0f);
}
}
}
}

View File

@ -923,7 +923,13 @@ class Level implements ChunkManager, Metadatable{
$fullState = $chunk->getFullBlock($pos->x & 0x0f, $pos->y, $pos->z & 0x0f);
}
$block = clone Block::$fullList[$fullState];
$block = Block::$fullList[$fullState];
if($block !== null){
$block = new $block($fullState & 0x0f);
}else{
$block = new Block($fullState >> 4, $fullState & 0x0f);
}
$block->x = $pos->x;
$block->y = $pos->y;
$block->z = $pos->z;