Jump to content

[SOLVED][1.18.2] Get texture file of BakedQuad


Sireous

Recommended Posts

Hi there,

Let's say, I've got a BakedModel via this code

BlockRenderDispatcher blockRenderer = Minecraft.getInstance().getBlockRenderer();
BakedModel blockModel = blockRenderer.getBlockModel(block);

where block is an instance of BlockState. Then I do

List<BakedQuad> quads = blockModel.getQuads(...);

to get all BakedQuads of this model.

While I iterate over them, I want to get a texture file (eg. .txt or .jpg) witch each of this quads use. Is that possible, and, if so, how can I do that?

P. S. I see, that BakedQuad has a TextureAtlasSprite inside, witch I can get, but I don't know if that is what I need, and how to get texture file from it.

Edited by Sireous
Link to comment
Share on other sites

Look at TextureAtlas.load() - the private method not the simple one - for how it uses the name in the TextureAtlasSprite(Info)

It isn't necessarily a file. All that is required is the resource pack implementation provides an InputStream.

See the subclasses of PackResources for all the different ways it creates that InputStream. e.g. zip/jar, files, classpath, the assets subfolder with its index, etc.

There are some mods that generate images dynamically so the InputStream could be from bytes in memory.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

At resource pack loading Minecraft stiches those InputStreams into a big image, the TextureAtlas(es).

That is what the code I told you to look at does.

Your original question was how to get the source file. Which is complicated, if not impossible, since it doesn't necessarily exist.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

  • Sireous changed the title to [SOLVED][1.18.2] Get texture file of BakedQuad

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.

×
×
  • Create New...

Important Information

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