Skip to content

Commit

Permalink
Fix jpg not working probably mayhaps with a bit of luck
Browse files Browse the repository at this point in the history
  • Loading branch information
veronoicc committed Mar 26, 2024
1 parent 6649af2 commit f2a1251
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/anticope/esixtwoone/ImageHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
import anticope.esixtwoone.sources.Source.Size;
import anticope.esixtwoone.sources.Source.SourceType;

import javax.imageio.ImageIO;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

import static meteordevelopment.meteorclient.MeteorClient.mc;
import static meteordevelopment.meteorclient.utils.Utils.WHITE;

Expand Down Expand Up @@ -158,8 +163,10 @@ private void loadImage() {
return;
}
E621Hud.LOG.info(url);
var img = NativeImage.read(Http.get(url).sendInputStream());
mc.getTextureManager().registerTexture(TEXID, new NativeImageBackedTexture(img));
var img = ImageIO.read(Http.get(url).sendInputStream());
var baos = new ByteArrayOutputStream();
ImageIO.write(img, "png", baos);
mc.getTextureManager().registerTexture(TEXID, new NativeImageBackedTexture(NativeImage.read(new ByteArrayInputStream(baos.toByteArray()))));
empty = false;
} catch (Exception ex) {
E621Hud.LOG.error("Failed to render the image.", ex);
Expand Down

0 comments on commit f2a1251

Please sign in to comment.