Further out-phasing of legacy ID/meta

this paves the way for making internal IDs fully dynamic.
This commit is contained in:
Dylan K. Taylor
2019-03-17 16:01:04 +00:00
parent 6f54b53f7a
commit 5830ca958b
10 changed files with 46 additions and 38 deletions

View File

@ -107,6 +107,14 @@ class Block extends Position implements BlockIds, Metadatable{
return $this->idInfo->getBlockId();
}
/**
* @internal
* @return int
*/
public function getFullId() : int{
return ($this->getId() << 4) | $this->getMeta();
}
public function asItem() : Item{
return ItemFactory::get($this->idInfo->getItemId(), $this->idInfo->getVariant());
}
@ -155,7 +163,7 @@ class Block extends Position implements BlockIds, Metadatable{
}
public function writeStateToWorld() : void{
$this->level->getChunkAtPosition($this)->setBlock($this->x & 0xf, $this->y, $this->z & 0xf, $this->getId(), $this->getMeta());
$this->level->getChunkAtPosition($this)->setFullBlock($this->x & 0xf, $this->y, $this->z & 0xf, $this->getFullId());
$tileType = $this->idInfo->getTileClass();
$oldTile = $this->level->getTile($this);