Rename two misleadingly-named functions

This commit is contained in:
Dylan K. Taylor
2019-02-27 12:59:12 +00:00
parent ba616ed8a7
commit 9ad0ea85c7
20 changed files with 34 additions and 30 deletions

View File

@ -116,13 +116,13 @@ class Block extends Position implements BlockIds, Metadatable{
* @return int
*/
public function getRuntimeId() : int{
return BlockFactory::toStaticRuntimeId($this->getId(), $this->getDamage());
return BlockFactory::toStaticRuntimeId($this->getId(), $this->getMeta());
}
/**
* @return int
*/
public function getDamage() : int{
public function getMeta() : int{
$stateMeta = $this->writeStateToMeta();
assert(($stateMeta & ~$this->getStateBitmask()) === 0);
return $this->idInfo->getVariant() | $stateMeta;
@ -155,7 +155,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->getDamage());
$this->level->getChunkAtPosition($this)->setBlock($this->x & 0xf, $this->y, $this->z & 0xf, $this->getId(), $this->getMeta());
$tileType = $this->idInfo->getTileClass();
$oldTile = $this->level->getTile($this);
@ -692,7 +692,7 @@ class Block extends Position implements BlockIds, Metadatable{
* @return string
*/
public function __toString(){
return "Block[" . $this->getName() . "] (" . $this->getId() . ":" . $this->getDamage() . ")";
return "Block[" . $this->getName() . "] (" . $this->getId() . ":" . $this->getMeta() . ")";
}
/**

View File

@ -555,7 +555,7 @@ class BlockFactory{
$v = clone $block;
try{
$v->readStateFromData($id, $m & $stateMask);
if($v->getDamage() !== $m){
if($v->getMeta() !== $m){
throw new InvalidBlockStateException("Corrupted meta"); //don't register anything that isn't the same when we read it back again
}
}catch(InvalidBlockStateException $e){ //invalid property combination

View File

@ -75,7 +75,7 @@ class Grass extends Solid{
$b = $this->level->getBlockAt($x, $y, $z);
if(
$b->getId() !== Block::DIRT or
$b->getDamage() === 1 or //coarse dirt
$b->getMeta() === 1 or //coarse dirt
$this->level->getFullLightAt($x, $y + 1, $z) < 4 or
$this->level->getBlockAt($x, $y + 1, $z)->getLightFilter() >= 2
){