mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Updated player deaths
This commit is contained in:
parent
d9c39ca816
commit
4a46fde483
7 changed files with 57 additions and 45 deletions
|
|
@ -27,8 +27,8 @@ the Free Software Foundation, either version 3 of the License, or
|
|||
|
||||
class ChunkParser{
|
||||
private $location, $raw = b"", $file;
|
||||
var $sectorLenght = 4096; //16 * 16 * 16
|
||||
var $chunkLenght = 86016; //21 * $sectorLenght
|
||||
var $sectorLength = 4096; //16 * 16 * 16
|
||||
var $chunkLength = 86016; //21 * $sectorLength
|
||||
var $map;
|
||||
|
||||
function __construct(){
|
||||
|
|
@ -64,7 +64,7 @@ class ChunkParser{
|
|||
}
|
||||
$this->file = $file;
|
||||
$this->raw = file_get_contents($file);
|
||||
$this->chunkLenght = $this->sectorLenght * ord($this->raw{0});
|
||||
$this->chunkLength = $this->sectorLength * ord($this->raw{0});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ class ChunkParser{
|
|||
public function getChunk($X, $Z){
|
||||
$X = (int) $X;
|
||||
$Z = (int) $Z;
|
||||
return substr($this->raw, $this->getOffset($X, $Z), $this->chunkLenght);
|
||||
return substr($this->raw, $this->getOffset($X, $Z), $this->chunkLength);
|
||||
}
|
||||
|
||||
public function writeChunk($X, $Z){
|
||||
|
|
@ -169,7 +169,7 @@ class ChunkParser{
|
|||
foreach($this->map as $x => $d){
|
||||
foreach($d as $z => $chunk){
|
||||
fseek($fp, $this->getOffset($x, $z));
|
||||
fwrite($fp, $this->writeChunk($x, $z), $this->chunkLenght);
|
||||
fwrite($fp, $this->writeChunk($x, $z), $this->chunkLength);
|
||||
}
|
||||
}
|
||||
flock($fp, LOCK_UN);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue