Skip to content

Item Dictionary

XU edited this page Sep 9, 2026 · 1 revision

Item Dictionary

Overview

The Item Dictionary allows players to view information about items they have discovered during gameplay.

Players can open and close the dictionary using the I key. The main dictionary page displays all available item types in a grid layout.

Discovered items display their item icons, while undiscovered items remain locked and are shown using a placeholder.

Clicking a discovered item opens a detailed information page for that item.

Features

The Item Dictionary currently supports:

  • Grid-based item display
  • Automatic item discovery when an item is picked up
  • Prevention of duplicate item unlocks
  • Locked placeholders for undiscovered items
  • Clickable discovered item icons
  • Detailed item information pages
  • Item icon display
  • Item name display
  • Item description display
  • Relevant item statistics
  • Back navigation from the detail page
  • Integration with the backpack and inventory bar UI

Usage

Press I to open the Item Dictionary.

The main page displays item entries in a grid.

For discovered items, the item icon is displayed.

For undiscovered items, a ? placeholder is displayed.

Clicking a discovered item opens its detail page.

The detail page shows:

  • Item icon
  • Item name
  • Item description
  • Relevant item statistics

Use the < Back option to return to the main dictionary grid.

Press I again to close the dictionary.

Item Discovery

The dictionary listens for item pickup events.

When the player successfully picks up an item, the following event is triggered:

itemPickedUp

ItemDictionaryComponent receives this event and attempts to unlock the corresponding ItemType.

Each item type can only be unlocked once.

When a new item is successfully discovered, the dictionary triggers:

itemDictionaryChanged

This allows the UI to refresh automatically.

Implementation

ItemDictionaryComponent

ItemDictionaryComponent stores the set of discovered item types.

Important methods include:

unlockItem(ItemType itemType)

Unlocks an item type and returns whether it was newly discovered.

isDiscovered(ItemType itemType)

Checks whether an item has already been discovered.

getDiscoveredItems()

Returns the discovered item types.

getDiscoveredCount()

Returns the number of discovered item types.

ItemDictionaryDisplay

ItemDictionaryDisplay manages the graphical interface for the dictionary.

The display has two main states:

GRID
DETAILS

The GRID state displays all item entries.

The DETAILS state displays detailed information about the selected discovered item.

Events

The Item Dictionary uses the following events:

itemPickedUp
itemDictionaryChanged
dictionaryOpened
dictionaryClosed

dictionaryOpened and dictionaryClosed are also used to coordinate the dictionary with other inventory UI elements.

UI Integration

Opening the Item Dictionary hides conflicting inventory UI elements such as the backpack or inventory bar.

This prevents multiple inventory interfaces from overlapping on screen.

Testing

Unit tests are provided for the item discovery logic.

The tests check:

  • Unlocking a new item
  • Preventing duplicate unlocks
  • Tracking multiple item types
  • Correctly identifying undiscovered items
  • Handling null values safely
  • Tracking different item types

The feature has been checked using:

./gradlew core:compileJava
./gradlew core:test
./gradlew spotlessCheck

Future Improvements

Possible future improvements include:

  • Pagination for larger numbers of items
  • Item categories or filters
  • Search functionality
  • Improved locked-item visuals
  • More detailed statistics
  • Item discovery animations

Clone this wiki locally