TeamJM / journeymap

JourneyMap mod for Minecraft
http://journeymap.info
127 stars 10 forks source link

[Feature Request]: Lazily cache block colors instead of retrieving all models at once #800

Open embeddedt opened 1 week ago

embeddedt commented 1 week ago

Describe the new feature.

The latest version of JourneyMap for NeoForge on MC 1.21.1 appears to eagerly scan all block models to find blocks' sprites and pick a color for them when the client finishes loading.

My mod, ModernFix, provides an optional feature that will dynamically load/unload block models when they are needed. In many modpacks this can greatly reduce startup time and memory usage (1GB or more). However, since JourneyMap explicitly requests every model to be loaded at game startup, it defeats the purpose of this optimization. It would be great if your block color cache could be built lazily when a block is first rendered, as most blocks are unlikely to be rendered immediately when a player first joins a world. This would probably improve startup times without ModernFix as well as it likely takes a bit of time to build the cache for all blocks anyway.

I've attached a profiler screenshot showing the problematic stacktrace & time it took to load models.

Images

image

mysticdrew commented 1 week ago

So, the issue with this. We allow players to modify block colors for the map. If we do not get all the blocks and their colors initially, players will not be able to modify the colors of the blocks until they are first loaded. Will think on this a bit.

mysticdrew commented 1 week ago

Thinking about it, maybe do lazy and provide a way in the palette screen for a user to collect all block colors on demand.

wagyourtail commented 1 week ago

you could also just make it that opening the palette screen forces the loading/collection of all of them, instead of a button.