InventoryManager: remove useless repeated code

This commit is contained in:
Dylan K. Taylor 2020-10-06 18:14:46 +01:00
parent cc3947058a
commit d7f7e1c4ff

View File

@ -216,13 +216,7 @@ class InventoryManager{
} }
public function syncCreative() : void{ public function syncCreative() : void{
$items = [];
$typeConverter = TypeConverter::getInstance(); $typeConverter = TypeConverter::getInstance();
if(!$this->player->isSpectator()){ //fill it for all gamemodes except spectator
foreach(CreativeInventory::getInstance()->getAll() as $i => $item){
$items[$i] = $typeConverter->coreItemStackToNet($item);
}
}
$nextEntryId = 1; $nextEntryId = 1;
$this->session->sendDataPacket(CreativeContentPacket::create(array_map(function(Item $item) use($typeConverter, &$nextEntryId) : CreativeContentEntry{ $this->session->sendDataPacket(CreativeContentPacket::create(array_map(function(Item $item) use($typeConverter, &$nextEntryId) : CreativeContentEntry{