StockMarket Tweaks
Removes StockMarket's world-load stall and smooths its runtime cost in large mod packs — Adds JEI Quick Market Create
No ratings yet
Be the first to rate it.
Community listing page
Community listing page, reviews may not be monitored by the author.
Community voices
Reviews
Log in to review this mod
Reviews are written by ModDex members. Log in and you'll come right back to the review form.
No reviews yet. Be the first to review this project!
Get it on
Available Platforms
About
Project Details
For authors
Embed Badge
If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.
Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.
Identifiers
Platform IDs
About
Description
STOCK MARKET TWEAKS (NeoForge 1.21.1)
Summary:
Removes StockMarket's world-load stall, speeds up its UI and background ticks in large modpacks, and adds Shift + Right-Click JEI market creation — without changing trading behaviour.
======================================================================
ABOUT
======================================================================
Stock Market Tweaks is a lightweight companion mod for KROIA's StockMarket and BankSystem (NeoForge 1.21.1). It fixes the multi-minute "Loading world" freeze caused by StockMarket's market-preset setup in large modpacks, smooths out recurring server-tick spikes as your economy grows, eliminates search/sort freezes in StockMarket's management UI, and lets admins create markets directly from JEI.
No game rules, prices, or trading mechanics are altered. Nothing in the original jars is patched or overwritten. Every tweak falls back cleanly to StockMarket's original code if a target changes, and every feature can be toggled individually in config/stockmarkettweaks.json.
======================================================================
WHY IT HELPS
======================================================================
In large modpacks, StockMarket pre-registers every market preset on world load by asking BankSystem to resolve each preset against every registered item in the pack. BankSystem answers with a linear scan, and for component-bearing items (enchanted books, potions, tipped arrows, modded NBT/component items) it falls back to a second full scan that NBT-serialises every registered stack. With hundreds of presets and tens of thousands of items, that turns into minutes of server-thread stall.
Stock Market Tweaks replaces that lookup with an O(1) identity index and builds/registers presets in parallel.
======================================================================
FEATURES
======================================================================
World Load & Startup:
- O(1) ItemID identity index over BankSystem's registry (plain items keyed by Item, component items keyed with the same NBT encoding BankSystem's fallback uses), eliminating O(M^2) scans during world load and initial item registration.
- Parallel preset ItemStack construction with a single batched registration call (preserving exact registration order and assigned ItemIDs).
- Startup phase timing logs (DataManager.load, preset pre-registration, total StockMarket setup) plus an in-game /stockmarkettweaks command (OP level 2) showing live index statistics.
Server Runtime Performance:
- Caches ServerMarketManager's available market-ID list (rebuilt only when markets are created, deleted, or loaded).
- Returns a shared empty list for markets without resting limit orders instead of allocating a new list on every read.
- Spreads TargetPriceBot's 5-tick PID step across ticks so all markets no longer spike on the same tick.
- Spreads StockMarket 2.2.0's 1-second virtual-depth memory fade step across ticks (automatic no-op on 2.1.x).
- Skips StockMarket 2.2.0's 2-second placeholder refresh when neither TAB nor PlaceholderAPI is installed (configurable: auto, always, never).
- Makes the per-viewer market price stream poll interval configurable (default 200 ms instead of 100 ms; set 0 for original behaviour).
- Adds one-time, additive SQLite indexes on OrderHistory (user/account + time) and MarketPrice (time) for faster history and 24-hour stats queries.
- Fixers a bunch of other issues, potential memory leaks and the like
Client UI & Quality of Life:
- Create Markets Directly from JEI (Optional): Admins can Shift + Right-Click any hovered item in JEI's ingredient list or bookmarks to create a StockMarket immediately without opening StockMarket's search picker. Keeps normal Right-Click ("Show Uses") intact, shows a Shift-hover tooltip status (Create StockMarket / Market already exists), prints status messages to chat so you can create multiple markets in a row, and respects all server-side admin/permission checks. Zero dependency on JEI (silently skipped if JEI is not installed).
- Eliminates the item picker sort freeze when opening Create Market, Management, or Market Selector screens by caching each item's tag sort key once.
- Replaces the item picker search filter with a cached filter so typing no longer rebuilds full tooltips for every item in the pack on every keystroke.
- Debounces preset and picker search rebuilds by 150 ms while typing, while keeping non-search actions (category switches, Select All/Deselect All, preset edits) instant.
- Caches tooltip-based search display text while StockMarket screens are open (auto-clearing on language or world/server changes) and reuses Create Markets' "already exists" set while the market list is unchanged.
======================================================================
REQUIREMENTS
======================================================================
- Minecraft 1.21.1
- NeoForge 21.1.x
- StockMarket 1.21.1-2.0.0+ (verified against both 2.1.1 and 2.2.0)
- BankSystem 1.21.1-2.0.0+ (includes embedded ModUtilities)
- Architectury API (required by StockMarket)
- JEI (optional - enables Shift + Right-Click market creation)
Works on existing worlds with no migration required. Can be installed on both server and client (server-side optimisations work on dedicated servers; UI and JEI features apply on clients).
======================================================================
CONFIGURATION
======================================================================
Generated automatically at config/stockmarkettweaks.json on first launch (and automatically updated with new defaults on upgrades):
- enableFastItemIdIndex (default: true) - Master switch for the O(1) ItemID index.
- safeComponentScanOnMiss (default: true) - Runs BankSystem's cheap component scan on an index miss as a safety net for exotic components.
- enableParallelPresetRegistration (default: true) - Parallel preset stack build + single bulk registration.
- presetRegistrationThreads (default: 0) - Worker thread count (0 = auto, half of CPU cores, clamped 2-8).
- logStartupTimings (default: true) - Logs phase timings and ItemID index stats on startup.
- maxIndexedItemIds (default: 200000) - Memory guard cap before falling back to linear lookup.
- cacheMarketIdList (default: true) - Caches ServerMarketManager's available market-ID snapshot.
- emptyOrderBookFastPath (default: true) - Returns a shared empty list when an orderbook has no limit orders.
- placeholderMode (default: "auto") - "auto" skips refresh without TAB/PlaceholderAPI; "always" keeps StockMarket default; "never" disables it.
- staggerTargetPriceBot (default: true) - Spreads TargetPriceBot's 5-tick cadence across ticks.
- staggerDepthFade (default: true) - Spreads 2.2.0 virtual-depth memory fade across the 1-second cycle.
- priceStreamIntervalMs (default: 200) - Per-viewer price stream poll interval in ms (0 = StockMarket's 100 ms; minimum 50).
- searchDebounceMs (default: 150) - Search typing debounce delay in ms (0 = rebuild on every character).
- cacheSearchDisplayText (default: true) - Caches tooltip search text while StockMarket screens are open.
- fastItemPickerSearch (default: true) - Uses cached search filter and cached tag sorter in the item picker.
- cacheExistingMarketsMs (default: 2000) - Reuses Create Markets' "already exists" set (invalidates immediately when markets change).
- jeiShiftRightClickCreateMarket (default: true) - Enables Shift + Right-Click in JEI to create a market.
- safeBankCraftingRecipes (default: true) - Hardens BankSystem 2.2.0 Bank Terminal recipe lookup against modded recipes that throw on empty or synthetic crafting grids.
- retryLockedFileSaves (default: true) - Retries transient Windows AccessDeniedException locks in ModUtilities' DataPersistence file/folder swaps (with directory-copy fallback).
- mcaCustomCurrencyEnabled (default: false) - Opt-in switch to replace MCA's emerald currency with custom item(s) or BankSystem money.
- mcaCurrencyMode (default: "custom") - "custom" uses mcaCustomCurrencyItems; "banksystem" uses BankSystem money bills scaled by mcaBankSystemEmeraldValue.
- mcaCustomCurrencyItems - List of {"item": "modid:item", "value": <emeralds>} denominations for custom mode.
- mcaBankSystemEmeraldValue (default: 1.0) - BankSystem currency units per vanilla emerald in "banksystem" mode.
- mcaReplaceVillagerTrades / mcaReplaceMercenaryHire / mcaReplaceEmeraldPredicate / mcaReplaceVillageTaxes (default: true) - Per-system toggles when mcaCustomCurrencyEnabled is true.
- createHistoryIndexes (default: true) - Adds covering SQLite indexes for OrderHistory and MarketPrice queries.
========================================================================
COMMANDS
========================================================================
/stockmarkettweaks (requires permission level 2)
Prints live ItemID index statistics (entry counts, hit rate, rebuilds, invalidations, scan fallbacks).
======================================================================
NOTES FOR SERVER ADMINS
======================================================================
- Safe to add or remove on existing worlds at any time.
- Recommended for any modpack with more than a few thousand item types or a large number of active markets.
- If a future StockMarket or BankSystem update changes an internal target, the affected tweak disables itself with a log message instead of crashing.
Screenshots
Gallery
Versions
Files
Relations
Project Relations
More like this
Similar Mods
Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.
Stats
- Downloads
- <1,000
- Used in
- 0 modpacks
- Followers
- 0
- In stacks
- 0
- Created
- Last synced
-
Dec 1, 2026 1:20 AM UTC
New file updates sync automatically.
When ModDex last fully re-synced this project from CurseForge or Modrinth. A new file release triggers a resync usually within minutes, and every project is also re-synced on a schedule. Edits that don't ship a file, such as a new description or screenshots, are checked every few hours and can appear before the above date changes.
How syncing works
External Links
Stats
- Downloads
- <1,000
- Used in
- 0 modpacks
- Followers
- 0
- In stacks
- 0
- Created
- Last synced
-
Dec 1, 2026 1:20 AM UTC
New file updates sync automatically.
When ModDex last fully re-synced this project from CurseForge or Modrinth. A new file release triggers a resync usually within minutes, and every project is also re-synced on a schedule. Edits that don't ship a file, such as a new description or screenshots, are checked every few hours and can appear before the above date changes.
How syncing works