mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +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 */
|
/** @var \SplFixedArray */
|
||||||
public static $list = null;
|
public static $list = null;
|
||||||
|
/** @var Block|null */
|
||||||
protected $block;
|
protected $block;
|
||||||
|
/** @var int */
|
||||||
protected $id;
|
protected $id;
|
||||||
|
/** @var int */
|
||||||
protected $meta;
|
protected $meta;
|
||||||
|
/** @var string */
|
||||||
private $tags = "";
|
private $tags = "";
|
||||||
|
/** @var CompoundTag|null */
|
||||||
private $cachedNBT = null;
|
private $cachedNBT = null;
|
||||||
|
/** @var int */
|
||||||
public $count;
|
public $count;
|
||||||
protected $durability = 0;
|
/** @var string */
|
||||||
protected $name;
|
protected $name;
|
||||||
|
|
||||||
public function canBeActivated(){
|
public function canBeActivated(){
|
||||||
@ -1007,4 +1013,12 @@ class Item implements ItemIds, \JsonSerializable{
|
|||||||
return $item;
|
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);
|
$this->block->setDamage($this->meta !== -1 ? $this->meta : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __clone(){
|
|
||||||
$this->block = clone $this->block;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBlock() : Block{
|
public function getBlock() : Block{
|
||||||
return $this->block;
|
return $this->block;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user