Collections & Knowledge

Collections

Access the in-game collection tabs with resolved item data using the CollectionsQuery API. Each collection accessor returns a CollectionItemQuery with the items resolved to their ID, name, and image.

Quick Start

import { collections } from 'stardew-valley-data'

// Get all items in the Items Shipped tab
const shipped = collections().itemsShipped().get()

// Get all fish collection items
const allFish = collections().fish().get()

// Find a specific artifact in the collection
const artifact = collections().artifacts().findByName('Dwarf Scroll I')

// Count items in the cooking collection
const cookingCount = collections().cooking().count()

Type Definition

Each resolved collection item conforms to the CollectionItem interface:

FieldTypeDescription
idstringUnique identifier for the item.
namestringDisplay name of the item.
imagestringPath to the item image.

Query Methods

CollectionsQuery

The collections() function returns a CollectionsQuery object. Use one of the collection accessors below to get items for a specific tab.

MethodReturnsDescription
itemsShipped()CollectionItemQueryItems that appear in the Items Shipped collection tab.
fish()CollectionItemQueryItems that appear in the Fish collection tab.
artifacts()CollectionItemQueryItems that appear in the Artifacts collection tab (museum donations).
minerals()CollectionItemQueryItems that appear in the Minerals collection tab (museum donations).
cooking()CollectionItemQueryItems that appear in the Cooking collection tab.
crafting()CollectionItemQueryItems that appear in the Crafting collection tab.

CollectionItemQuery

CollectionItemQuery extends QueryBase and inherits five terminal methods:

MethodReturnsDescription
get()CollectionItem[]Return all results as an array.
first()CollectionItem | undefinedReturn the first result.
find(id)CollectionItem | undefinedFind an item by exact ID.
findByName(name)CollectionItem | undefinedFind an item by name (case-insensitive).
count()numberReturn the number of results.

Examples

List all shipped items

import { collections } from 'stardew-valley-data'

const shipped = collections().itemsShipped().get()

shipped.forEach((item) => {
  console.log(`${item.name} (${item.id})`)
})

Count items per collection tab

import { collections } from 'stardew-valley-data'

const c = collections()

console.log(`Items Shipped: ${c.itemsShipped().count()}`)
console.log(`Fish: ${c.fish().count()}`)
console.log(`Artifacts: ${c.artifacts().count()}`)
console.log(`Minerals: ${c.minerals().count()}`)
console.log(`Cooking: ${c.cooking().count()}`)
console.log(`Crafting: ${c.crafting().count()}`)

Check if an item is in a collection

import { collections } from 'stardew-valley-data'

const pufferfish = collections().fish().findByName('Pufferfish')

if (pufferfish) {
  console.log(`Found ${pufferfish.name} in the fish collection`)
}

Get all museum donations

import { collections } from 'stardew-valley-data'

const c = collections()
const artifacts = c.artifacts().get()
const minerals = c.minerals().get()

const allMuseum = [...artifacts, ...minerals]
console.log(`Total museum donations: ${allMuseum.length}`)
Previous
Bundles