Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

Well, minecraft is obviously able to interpret that stream as 2D image. Am I able to interpret it the same way? And create usual image from that stream.

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.

Well, now, when I understand this a bit better, question has changed. I need a way to get this big composite image(s), the TextureAtlas(es) and save as .png or something.

Edited by Sireous

  • Guest 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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.