func (chunk *Chunk) reqTakeItem(player gamerules.IPlayerClient, entityId EntityId) { if entity, ok := chunk.entities[entityId]; ok { if item, ok := entity.(*gamerules.Item); ok { player.GiveItemAtPosition(*item.Position(), *item.GetSlot()) // Tell all subscribers to animate the item flying at the // player. buf := new(bytes.Buffer) proto.WriteItemCollect(buf, entityId, player.GetEntityId()) chunk.reqMulticastPlayers(-1, buf.Bytes()) chunk.removeEntity(item) } } }