mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Tile: make saveNBT() return a CompoundTag
I don't know why I made it take a parameter for this...
This commit is contained in:
parent
9f7f62e9e5
commit
f315aca4c3
@ -458,8 +458,7 @@ class LevelDB extends BaseLevelProvider{
|
||||
$tiles = [];
|
||||
foreach($chunk->getTiles() as $tile){
|
||||
if(!$tile->isClosed()){
|
||||
$tile->saveNBT($tileTag = new CompoundTag());
|
||||
$tiles[] = $tileTag;
|
||||
$tiles[] = $tile->saveNBT();
|
||||
}
|
||||
}
|
||||
$this->writeTags($tiles, $index . self::TAG_BLOCK_ENTITY);
|
||||
|
@ -75,8 +75,7 @@ class Anvil extends McRegion{
|
||||
|
||||
$tiles = [];
|
||||
foreach($chunk->getTiles() as $tile){
|
||||
$tile->saveNBT($tileTag = new CompoundTag());
|
||||
$tiles[] = $tileTag;
|
||||
$tiles[] = $tile->saveNBT();
|
||||
}
|
||||
|
||||
$nbt->setTag(new ListTag("TileEntities", $tiles, NBT::TAG_Compound));
|
||||
|
@ -94,8 +94,7 @@ class McRegion extends BaseLevelProvider{
|
||||
|
||||
$tiles = [];
|
||||
foreach($chunk->getTiles() as $tile){
|
||||
$tile->saveNBT($tileTag = new CompoundTag());
|
||||
$tiles[] = $tileTag;
|
||||
$tiles[] = $tile->saveNBT();
|
||||
}
|
||||
|
||||
$nbt->setTag(new ListTag("TileEntities", $tiles, NBT::TAG_Compound));
|
||||
|
@ -181,12 +181,15 @@ abstract class Tile extends Position{
|
||||
*/
|
||||
abstract protected function writeSaveData(CompoundTag $nbt) : void;
|
||||
|
||||
public function saveNBT(CompoundTag $nbt) : void{
|
||||
public function saveNBT() : CompoundTag{
|
||||
$nbt = new CompoundTag();
|
||||
$nbt->setString(self::TAG_ID, static::getSaveId());
|
||||
$nbt->setInt(self::TAG_X, $this->x);
|
||||
$nbt->setInt(self::TAG_Y, $this->y);
|
||||
$nbt->setInt(self::TAG_Z, $this->z);
|
||||
$this->writeSaveData($nbt);
|
||||
|
||||
return $nbt;
|
||||
}
|
||||
|
||||
public function getCleanedNBT() : ?CompoundTag{
|
||||
|
Loading…
x
Reference in New Issue
Block a user