mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Rename two misleadingly-named functions
This commit is contained in:
@ -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() . ")";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
){
|
||||
|
Reference in New Issue
Block a user