Terminal Upgrade Cards
ITerminalUpgradeCard is a 1.21.1-only API. It does not exist in the inspected 1.20.1 codebase.
Purpose
Section titled “Purpose”It marks items that can be inserted into terminal upgrade slots and receive lifecycle callbacks while installed in an AE2 terminal.
Lifecycle hooks
Section titled “Lifecycle hooks”public interface ITerminalUpgradeCard { default void onTerminalOpen(MEStorageMenu menu, ItemStack stack) {} default void onTerminalClose(MEStorageMenu menu, ItemStack stack) {} default void onTerminalTick(MEStorageMenu menu, ItemStack stack) {}}Authoring expectations
Section titled “Authoring expectations”- upgrade cards should be non-stackable
- callbacks are server-side terminal lifecycle hooks
- only override the hooks your card actually needs
- the menu mixin dispatches open/close/tick callbacks when cards are inserted, removed, or the menu updates
Example
Section titled “Example”public class MyUpgradeCardItem extends Item implements ITerminalUpgradeCard { @Override public void onTerminalOpen(MEStorageMenu menu, ItemStack stack) { // Apply one-time behavior when the terminal opens. }
@Override public void onTerminalTick(MEStorageMenu menu, ItemStack stack) { // Run while the card is installed in an open terminal. }}Persistent storage
Section titled “Persistent storage”PlayerUpgradeContainer stores upgrade slot contents in player persistent data.
Important details from the inspected implementation:
- slot count is fixed at
5 - storage is keyed per terminal-specific storage key
- legacy NBT keys are migrated when found
- the old shared
terminal_upgradespayload is migrated into the first terminal opened after the update - item-hosted terminals use the
myotus_terminal_storage_uuidcustom-data key to keep portable storage buckets distinct
See Upgrade Storage for the full storage-key, migration, and menu-mixin flow.
Built-in example item
Section titled “Built-in example item”The 1.21.1 tree contains a DiamondUpgradeCardItem test item. It is registered only outside production builds and grants a diamond when the terminal opens.
That makes it a dev example, not a production-facing gameplay feature.
Related helpers
Section titled “Related helpers”The same codebase also provides TerminalUpgradeHelper so addon code can inspect installed cards without manually walking the slot list.