mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 13:25:16 +00:00
InventoryManager: avoid calling TypeConverter::getInstance() in a loop
This commit is contained in:
parent
ee72e80fbb
commit
ecc830a689
@ -479,8 +479,9 @@ class InventoryManager{
|
|||||||
$entry->predictions = [];
|
$entry->predictions = [];
|
||||||
$entry->pendingSyncs = [];
|
$entry->pendingSyncs = [];
|
||||||
$contents = [];
|
$contents = [];
|
||||||
|
$typeConverter = TypeConverter::getInstance();
|
||||||
foreach($inventory->getContents(true) as $slot => $item){
|
foreach($inventory->getContents(true) as $slot => $item){
|
||||||
$itemStack = TypeConverter::getInstance()->coreItemStackToNet($item);
|
$itemStack = $typeConverter->coreItemStackToNet($item);
|
||||||
$info = $this->trackItemStack($entry, $slot, $itemStack, null);
|
$info = $this->trackItemStack($entry, $slot, $itemStack, null);
|
||||||
$contents[] = new ItemStackWrapper($info->getStackId(), $itemStack);
|
$contents[] = new ItemStackWrapper($info->getStackId(), $itemStack);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user