RuntimeBlockMapping: these IDs are not static any more

This commit is contained in:
Dylan K. Taylor 2020-05-11 12:40:55 +01:00
parent e3dec95b75
commit 6b037d6a4c
3 changed files with 4 additions and 4 deletions

View File

@ -111,7 +111,7 @@ class Block{
* @internal
*/
public function getRuntimeId() : int{
return RuntimeBlockMapping::getInstance()->toStaticRuntimeId($this->getId(), $this->getMeta());
return RuntimeBlockMapping::getInstance()->toRuntimeId($this->getId(), $this->getMeta());
}
public function getMeta() : int{

View File

@ -127,7 +127,7 @@ final class RuntimeBlockMapping{
return $table;
}
public function toStaticRuntimeId(int $id, int $meta = 0) : int{
public function toRuntimeId(int $id, int $meta = 0) : int{
/*
* try id+meta first
* if not found, try id+0 (strip meta)
@ -139,7 +139,7 @@ final class RuntimeBlockMapping{
/**
* @return int[] [id, meta]
*/
public function fromStaticRuntimeId(int $runtimeId) : array{
public function fromRuntimeId(int $runtimeId) : array{
$v = $this->runtimeToLegacyMap[$runtimeId];
return [$v >> 4, $v & 0xf];
}

View File

@ -70,7 +70,7 @@ final class ChunkSerializer{
//zigzag and just shift directly.
$stream->putUnsignedVarInt(count($palette) << 1); //yes, this is intentionally zigzag
foreach($palette as $p){
$stream->putUnsignedVarInt($blockMapper->toStaticRuntimeId($p >> 4, $p & 0xf) << 1);
$stream->putUnsignedVarInt($blockMapper->toRuntimeId($p >> 4, $p & 0xf) << 1);
}
}
}