Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Remove ITextureAtlasSpriteLoader in favor of SpriteSources #157

Closed
XFactHD opened this issue Sep 30, 2023 · 2 comments
Closed

[RFC] Remove ITextureAtlasSpriteLoader in favor of SpriteSources #157

XFactHD opened this issue Sep 30, 2023 · 2 comments
Labels
breaking change Breaks binary compatibility rendering Related to rendering request for comments For gathering opinions on some topic or subject

Comments

@XFactHD
Copy link
Member

XFactHD commented Sep 30, 2023

The ITextureAtlasSpriteLoader API was introduced in 1.16 by MinecraftForge/MinecraftForge#7822 to allow the creation of atlas-stitched textures with special behaviour outside of the capabilities of vanilla's texture animation system, such as proceduraly generated textures like shown in the linked PR.

In 1.19.3, the SpriteSource system was introduced as part of the rework of texture loading. With this system, a JSON file is loaded for each registered atlas (in the case of multiple packs containing this JSON, the behaviour is comparable to tags in that the entries are merged) which contains an array of sources, each with a type field and any arbitrary metadata the respective SpriteSource needs. A SpriteSource can then queue an arbitrary amount of SpriteSource.SpriteSuppliers for loading, each associated with a ResourceLocation representing the final path of the texture created by the sprite supplier. Two sprite suppliers with the same result path will overwrite each other and the last one to be queued wins. The sprite supplier then produces SpriteContents with the actual pixels of the texture. Since all relevant data of the texture (except absolute coordinates and UV coordinates on the atlas) and the creation of the sprite's ticker were moved from TextureAtlasSprite to SpriteContents, the SpriteSource API has basically the exact same capabilities as ITextureAtlasSpriteLoader. Additionally, the SpriteSource API also has the benefit of being able to create textures from thin air while the ITextureAtlasSpriteLoader API requires a PNG to be present, even if none of its contents will be used, since the metadata (.mcmeta file) specifying the loader is attached to that PNG.

Unless anyone can think of or has a use case that cannot be replicated with a SpriteSource, the ITextureAtlasSpriteLoader API should be deprecated for removal since it is entirely redundant now.

@Technici4n Technici4n added rendering Related to rendering breaking change Breaks binary compatibility labels Oct 2, 2023
@Minecraftschurli
Copy link
Contributor

Custom SpriteSource PR: #77

@Minecraftschurli Minecraftschurli added the request for comments For gathering opinions on some topic or subject label Oct 9, 2023
@Technici4n
Copy link
Member

This was actually removed in the 20.2 port. #77 will be prioritized as soon as it's ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Breaks binary compatibility rendering Related to rendering request for comments For gathering opinions on some topic or subject
Projects
None yet
Development

No branches or pull requests

3 participants