Dev Docs: Timeline - MoreMcmeta/core GitHub Wiki
MoreMcmeta responds to a series of events in Minecraft that are not immediately obvious from the source code. This timeline explains how MoreMcmeta responds to those events at a high level.
- Mod startup on begins on the Forge or Fabric client.
- MoreMcmeta loads and validates all plugins.
- The necessary objects are created and will be reused until the client is closed. These include a loader and a queue for pre-built textures.
- Minecraft's default resource manager is initialized.
- A reload listener that triggers the asynchronous loading of pre-built MoreMcmeta textures is registered.
- MoreMcmeta adds a custom resource pack repository source.
- A client tick listener that will update built MoreMcmeta textures is registered.
- Resource reloading on startup begins.
- Packs are requested from the custom repository source. MoreMcmeta scans all resource packs, processes all metadata, and applies plugins. Metadata parsing, metadata analysis, and component building all happen at this step.
- The source returns a custom resource pack. The pack indicates that it contains all the MoreMcmeta textures and their metadata. For any
.mcmetafile it contains, it will return an empty, single-frame animation. This will prevent full animation strips from being stitched onto texture atlases later on. - MoreMcmeta textures are loaded in parallel and queued in a pre-built state. Any preloaded textures that have the same location as MoreMcmeta ones are removed. Preloaded textures include the title screen textures, like the Minecraft logo. Removing preloaded textures from the texture manager prevents the preloaded textures from adding themselves back after resource reloading completes.
- Most vanilla listeners finish reloading. The texture manager resets itself, triggering preloaded textures to register themselves again asynchronously. The preloaded textures in MoreMcmeta texture locations that were removed will not reset.
- The texture atlases retrieve metadata for their sprites, but the custom pack MoreMcmeta added earlier provides metadata with a single-frame animation. This ensures the entire animation is not stitched to the atlas; only the first frame is stitched. Texture stitching finishes.
- A callback to indicate that all reload listeners have completed fires. It tells the pre-built texture queue to finish the building process. The queue searches the texture atlases to determine if a MoreMcmeta texture is a sprite. Sprite and non-sprite textures are kept track of so that sprites are uploaded to their atlases. The built texture is then added to the texture manager and begins ticking.
- MoreMcmeta textures begin responding to tick and other events using the texture components that were added before they were built.
- Preloaded textures finish resetting themselves.
- The player loads a world. Daytime-synced textures fast-forward their animation to the correct point.
- If the player changes their resource packs to cause a reload, the old MoreMcmeta textures are cleared and stop updating. The loading process begins again.