mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-12 04:45:12 +00:00
TypeConverter: fixed coreItemStackToNet() causing item NBT to be prepared twice
hasNamedTag() calls getNamedTag(), which calls serializeCompoundTag(), which writes the item's properties into the given NBT tag.
This commit is contained in:
parent
d07acd0013
commit
40168a457e
@ -135,9 +135,11 @@ class TypeConverter{
|
|||||||
if($itemStack->isNull()){
|
if($itemStack->isNull()){
|
||||||
return ItemStack::null();
|
return ItemStack::null();
|
||||||
}
|
}
|
||||||
$nbt = null;
|
$nbt = $itemStack->getNamedTag();
|
||||||
if($itemStack->hasNamedTag()){
|
if($nbt->count() === 0){
|
||||||
$nbt = clone $itemStack->getNamedTag();
|
$nbt = null;
|
||||||
|
}else{
|
||||||
|
$nbt = clone $nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
$isBlockItem = $itemStack->getId() < 256;
|
$isBlockItem = $itemStack->getId() < 256;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user