Further cleanup on ListTag and CompoundTag usage

This commit is contained in:
Dylan K. Taylor
2017-11-17 11:43:32 +00:00
parent 665130561e
commit 460d540dbc
5 changed files with 19 additions and 15 deletions

View File

@ -496,15 +496,16 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
$this->id = Entity::$entityCount++;
$this->namedtag = $nbt;
$this->chunk = $level->getChunk($this->namedtag["Pos"][0] >> 4, $this->namedtag["Pos"][2] >> 4, true);
/** @var float[] $pos */
$pos = $this->namedtag->getListTag("Pos")->getAllValues();
$this->chunk = $level->getChunk(((int) $pos[0]) >> 4, ((int) $pos[2]) >> 4, true);
assert($this->chunk !== null);
$this->setLevel($level);
$this->server = $level->getServer();
$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
/** @var float[] $pos */
$pos = $this->namedtag->getListTag("Pos")->getAllValues();
/** @var float[] $rotation */
$rotation = $this->namedtag->getListTag("Rotation")->getAllValues();