Jump to content

[1.18.2] How to get texture atlases resource locations


Sireous

Recommended Posts

Hi there,

Is there a way I can get texture atlases ResourceLocation in Minecraft 1.18.2 forge? Or something like it, because on startup game log has these lines:

[15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 4096x2048x4 minecraft:textures/atlas/blocks.png-atlas
[15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 512x256x4 minecraft:textures/atlas/signs.png-atlas
[15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x4 minecraft:textures/atlas/banner_patterns.png-atlas
[15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x4 minecraft:textures/atlas/shield_patterns.png-atlas
[15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 512x512x4 minecraft:textures/atlas/chest.png-atlas
[15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x512x4 minecraft:textures/atlas/beds.png-atlas
[15:15:23] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x512x4 minecraft:textures/atlas/shulker_boxes.png-atlas
[15:15:30] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x0 minecraft:textures/atlas/particles.png-atlas
[15:15:30] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 1024x1024x0 minecraft:textures/atlas/paintings.png-atlas
[15:15:30] [Render thread/INFO] [minecraft/TextureAtlas]: Created: 256x256x0 minecraft:textures/atlas/mob_effects.png-atlas

This means somewhere there is ResourceLocation that holds these files. I can get, for example, minecraft:textures/atlas/blocks.png-atlas via this code

TextureManager textureManager = Minecraft.getInstance().getTextureManager();
TextureAtlas textureAtlas = (TextureAtlas) textureManager.getTexture(new ResourceLocation("textures/atlas/blocks.png"));

but what if, for example, some mod has added new atlas? I want to get whole list of those, via something like this

Collection<ResourceLocation> resourceLocations = Minecraft.getInstance().getResourceManager().listResources(
                    "textures/atlas",
                    res -> res.chars().noneMatch(i -> Character.isLetter(i) && Character.isUpperCase(i)));

but this approach sadly is not working.

Edited by Sireous
Link to comment
Share on other sites

  • Sireous changed the title to [1.18.2] How to get texture atlases resource locations

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.