mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-23 19:34:15 +00:00
LegacyToStringMap: don't throw if the existing mapping is the same as the one we want to register
this was making it inconvenient for plugins to use BlockIdMetaUpgrader->addMapping(), because the block legacy ID map contains IDs up to 1.16, but the table of mapped 1.12 blockstates only goes up to ... well ... 1.12. This left a gap of several versions' blocks unable to be mapped.
This commit is contained in:
parent
b36b65927c
commit
9a8902d1fe
@ -66,6 +66,9 @@ abstract class LegacyToStringIdMap{
|
||||
|
||||
public function add(string $string, int $legacy) : void{
|
||||
if(isset($this->legacyToString[$legacy])){
|
||||
if($this->legacyToString[$legacy] === $string){
|
||||
return;
|
||||
}
|
||||
throw new \InvalidArgumentException("Legacy ID $legacy is already mapped to string " . $this->legacyToString[$legacy]);
|
||||
}
|
||||
$this->legacyToString[$legacy] = $string;
|
||||
|
Loading…
x
Reference in New Issue
Block a user