mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 10:19:39 +00:00
Fixed #453 multiple refs to the same cached NBT object tree
This commit is contained in:
parent
c040579e09
commit
96801be3d3
@ -65,13 +65,19 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
|
||||
/** @var \SplFixedArray */
|
||||
public static $list = null;
|
||||
/** @var Block|null */
|
||||
protected $block;
|
||||
/** @var int */
|
||||
protected $id;
|
||||
/** @var int */
|
||||
protected $meta;
|
||||
/** @var string */
|
||||
private $tags = "";
|
||||
/** @var CompoundTag|null */
|
||||
private $cachedNBT = null;
|
||||
/** @var int */
|
||||
public $count;
|
||||
protected $durability = 0;
|
||||
/** @var string */
|
||||
protected $name;
|
||||
|
||||
public function canBeActivated(){
|
||||
@ -1007,4 +1013,12 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
return $item;
|
||||
}
|
||||
|
||||
public function __clone(){
|
||||
if($this->block !== null){
|
||||
$this->block = clone $this->block;
|
||||
}
|
||||
|
||||
$this->cachedNBT = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,10 +37,6 @@ class ItemBlock extends Item{
|
||||
$this->block->setDamage($this->meta !== -1 ? $this->meta : 0);
|
||||
}
|
||||
|
||||
public function __clone(){
|
||||
$this->block = clone $this->block;
|
||||
}
|
||||
|
||||
public function getBlock() : Block{
|
||||
return $this->block;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user