From 9e74169d747ebc27548db4e3248a00db22ed05ed Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Fri, 15 Aug 2014 17:04:16 +0200 Subject: [PATCH] Better Anvil chunk loading --- src/pocketmine/level/format/anvil/Chunk.php | 16 ++++------------ src/pocketmine/nbt/NBT.php | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/pocketmine/level/format/anvil/Chunk.php b/src/pocketmine/level/format/anvil/Chunk.php index 221dc3128..198066f86 100644 --- a/src/pocketmine/level/format/anvil/Chunk.php +++ b/src/pocketmine/level/format/anvil/Chunk.php @@ -42,30 +42,22 @@ class Chunk extends BaseChunk{ public function __construct($level, Compound $nbt){ $this->nbt = $nbt; - if(isset($this->nbt->Entities) and $this->nbt->Entities instanceof Enum){ - $this->nbt->Entities->setTagType(NBT::TAG_Compound); - }else{ + if(!isset($this->nbt->Entities) or !($this->nbt->Entities instanceof Enum)){ $this->nbt->Entities = new Enum("Entities", []); $this->nbt->Entities->setTagType(NBT::TAG_Compound); } - if(isset($this->nbt->TileEntities) and $this->nbt->TileEntities instanceof Enum){ - $this->nbt->TileEntities->setTagType(NBT::TAG_Compound); - }else{ + if(!isset($this->nbt->TileEntities) or !($this->nbt->TileEntities instanceof Enum)){ $this->nbt->TileEntities = new Enum("TileEntities", []); $this->nbt->TileEntities->setTagType(NBT::TAG_Compound); } - if(isset($this->nbt->TileTicks) and $this->nbt->TileTicks instanceof Enum){ - $this->nbt->TileTicks->setTagType(NBT::TAG_Compound); - }else{ + if(!isset($this->nbt->TileTicks) or !($this->nbt->TileTicks instanceof Enum)){ $this->nbt->TileTicks = new Enum("TileTicks", []); $this->nbt->TileTicks->setTagType(NBT::TAG_Compound); } - if(isset($this->nbt->Sections) and $this->nbt->Sections instanceof Enum){ - $this->nbt->Sections->setTagType(NBT::TAG_Compound); - }else{ + if(!isset($this->nbt->Sections) or !($this->nbt->Sections instanceof Enum)){ $this->nbt->Sections = new Enum("Sections", []); $this->nbt->Sections->setTagType(NBT::TAG_Compound); } diff --git a/src/pocketmine/nbt/NBT.php b/src/pocketmine/nbt/NBT.php index d42cbc546..8efee6981 100644 --- a/src/pocketmine/nbt/NBT.php +++ b/src/pocketmine/nbt/NBT.php @@ -78,7 +78,7 @@ class NBT{ } $buffer = ""; for(; $len > 0; --$len, ++$this->offset){ - $buffer .= @$this->buffer{$this->offset}; + $buffer .= $this->buffer{$this->offset}; } return $buffer;