Implemented saving modified chunks

This commit is contained in:
Shoghi Cervantes
2014-10-15 11:42:58 +02:00
parent b71a4701d9
commit e3a9db5d8f
5 changed files with 57 additions and 10 deletions

View File

@ -93,6 +93,7 @@ class Chunk extends BaseFullChunk{
public function setBlockId($x, $y, $z, $id){
$this->blocks{($x << 11) + ($z << 7) + $y} = chr($id);
$this->hasChanged = true;
}
public function getBlockData($x, $y, $z){
@ -112,6 +113,7 @@ class Chunk extends BaseFullChunk{
}else{
$this->data{$i} = chr((($data & 0x0f) << 4) | ($old_m & 0x0f));
}
$this->hasChanged = true;
}
public function getBlock($x, $y, $z, &$blockId, &$meta = null){
@ -154,6 +156,10 @@ class Chunk extends BaseFullChunk{
}
}
if($changed){
$this->hasChanged = true;
}
return $changed;
}
@ -174,6 +180,7 @@ class Chunk extends BaseFullChunk{
}else{
$this->skyLight{$i} = chr((($level & 0x0f) << 4) | ($old_sl & 0x0f));
}
$this->hasChanged = true;
}
public function getBlockLight($x, $y, $z){
@ -193,6 +200,7 @@ class Chunk extends BaseFullChunk{
}else{
$this->blockLight{$i} = chr((($level & 0x0f) << 4) | ($old_l & 0x0f));
}
$this->hasChanged = true;
}
public function getBlockIdColumn($x, $z){