mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
Add __clone to CompoundTag and ListTag, fixed issues with items sharing the same NBT tag objects
This commit is contained in:
parent
bc1c75a15a
commit
868602a559
@ -111,4 +111,12 @@ class CompoundTag extends NamedTag implements \ArrayAccess{
|
|||||||
}
|
}
|
||||||
return $str . "}";
|
return $str . "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __clone(){
|
||||||
|
foreach($this as $key => $tag){
|
||||||
|
if($tag instanceof Tag){
|
||||||
|
$this->{$key} = clone $tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -220,4 +220,12 @@ class ListTag extends NamedTag implements \ArrayAccess, \Countable{
|
|||||||
}
|
}
|
||||||
return $str . "}";
|
return $str . "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __clone(){
|
||||||
|
foreach($this as $key => $tag){
|
||||||
|
if($tag instanceof Tag){
|
||||||
|
$this->{$key} = clone $tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user