mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
loctable.pmf will be created on level savew
This commit is contained in:
parent
17808ed668
commit
bb38675f1c
1 changed files with 20 additions and 0 deletions
|
|
@ -91,6 +91,26 @@ class PMFLevel extends PMF{
|
|||
for($index = 0; $index < $cnt; ++$index){
|
||||
$this->write(Utils::writeShort($this->locationTable[$index][0]));
|
||||
}
|
||||
|
||||
$this->backupLocTable();
|
||||
}
|
||||
|
||||
public function backupLocTable(){
|
||||
$dir = dirname($this->file);
|
||||
if(is_file("$dir/loctable.pmf")){
|
||||
$val = copy("$dir/loctable.pmf", "$dir/loctable.pmf.old");
|
||||
if($val === false) ConsoleAPI::warn("Failed to backup loctable data!");
|
||||
}
|
||||
|
||||
$file = fopen("$dir/loctable.pmf", "wb");
|
||||
try{
|
||||
for($index = 0; $index < $cnt; ++$index){
|
||||
fwrite($file, Utils::writeShort($this->locationTable[$index][0]), 2);
|
||||
}
|
||||
}finally{
|
||||
fclose($file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getXZ($index, &$X = null, &$Z = null){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue