mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
RuntimeBlockMapping::toRuntimeId() now accepts a single integer instead of id/meta
the expectation is that eventually this will receive arbitrary internal runtime IDs instead of static id/meta, and RuntimeBlockMapping doesn't really care about this crap anyway.
This commit is contained in:
@ -135,21 +135,15 @@ final class RuntimeBlockMapping{
|
||||
return $table;
|
||||
}
|
||||
|
||||
public function toRuntimeId(int $id, int $meta = 0) : int{
|
||||
/*
|
||||
* try id+meta first
|
||||
* if not found, try id+0 (strip meta)
|
||||
* if still not found, return update! block
|
||||
*/
|
||||
return $this->legacyToRuntimeMap[($id << 4) | $meta] ?? $this->legacyToRuntimeMap[$id << 4] ?? $this->legacyToRuntimeMap[BlockLegacyIds::INFO_UPDATE << 4];
|
||||
public function toRuntimeId(int $internalStateId) : int{
|
||||
return $this->legacyToRuntimeMap[$internalStateId] ?? $this->legacyToRuntimeMap[BlockLegacyIds::INFO_UPDATE << 4];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int[] [id, meta]
|
||||
* @return int
|
||||
*/
|
||||
public function fromRuntimeId(int $runtimeId) : array{
|
||||
$v = $this->runtimeToLegacyMap[$runtimeId];
|
||||
return [$v >> 4, $v & 0xf];
|
||||
public function fromRuntimeId(int $runtimeId) : int{
|
||||
return $this->runtimeToLegacyMap[$runtimeId];
|
||||
}
|
||||
|
||||
private function registerMapping(int $staticRuntimeId, int $legacyId, int $legacyMeta) : void{
|
||||
|
Reference in New Issue
Block a user