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:
Dylan K. Taylor 2023-04-18 14:43:25 +01:00
parent d07acd0013
commit 40168a457e
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -135,9 +135,11 @@ class TypeConverter{
if($itemStack->isNull()){
return ItemStack::null();
}
$nbt = null;
if($itemStack->hasNamedTag()){
$nbt = clone $itemStack->getNamedTag();
$nbt = $itemStack->getNamedTag();
if($nbt->count() === 0){
$nbt = null;
}else{
$nbt = clone $nbt;
}
$isBlockItem = $itemStack->getId() < 256;