mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 17:41:46 +00:00
Fixed wrong key being used for entity type ID in save data (#5288)
closes #5260
This commit is contained in:
parent
112974758e
commit
82ba7903c8
@ -227,7 +227,7 @@ final class EntityFactory{
|
|||||||
*/
|
*/
|
||||||
public function createFromData(World $world, CompoundTag $nbt) : ?Entity{
|
public function createFromData(World $world, CompoundTag $nbt) : ?Entity{
|
||||||
try{
|
try{
|
||||||
$saveId = $nbt->getTag("id") ?? $nbt->getTag("identifier");
|
$saveId = $nbt->getTag("identifier") ?? $nbt->getTag("id");
|
||||||
$func = null;
|
$func = null;
|
||||||
if($saveId instanceof StringTag){
|
if($saveId instanceof StringTag){
|
||||||
$func = $this->creationFuncs[$saveId->getValue()] ?? null;
|
$func = $this->creationFuncs[$saveId->getValue()] ?? null;
|
||||||
@ -248,7 +248,7 @@ final class EntityFactory{
|
|||||||
|
|
||||||
public function injectSaveId(string $class, CompoundTag $saveData) : void{
|
public function injectSaveId(string $class, CompoundTag $saveData) : void{
|
||||||
if(isset($this->saveNames[$class])){
|
if(isset($this->saveNames[$class])){
|
||||||
$saveData->setTag("id", new StringTag($this->saveNames[$class]));
|
$saveData->setTag("identifier", new StringTag($this->saveNames[$class]));
|
||||||
}else{
|
}else{
|
||||||
throw new \InvalidArgumentException("Entity $class is not registered");
|
throw new \InvalidArgumentException("Entity $class is not registered");
|
||||||
}
|
}
|
||||||
|
@ -2492,7 +2492,7 @@ class World implements ChunkManager{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if($entity === null){
|
if($entity === null){
|
||||||
$saveIdTag = $nbt->getTag("id") ?? $nbt->getTag("identifier");
|
$saveIdTag = $nbt->getTag("identifier") ?? $nbt->getTag("id");
|
||||||
$saveId = "<unknown>";
|
$saveId = "<unknown>";
|
||||||
if($saveIdTag instanceof StringTag){
|
if($saveIdTag instanceof StringTag){
|
||||||
$saveId = $saveIdTag->getValue();
|
$saveId = $saveIdTag->getValue();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user