Jump to content

Recommended Posts

Posted

I'm working on an overlay-related mode.
However, a dynamic related error occurred.
The bottom is the sauce, and the error message is "error: incompatible types: BufferedImage cannot be converted to NativeImage ".
Please Help me..

public DynamicTexture getImage(String UUID) {
BufferedImage bi = null;
try {
URL url = new URL("https://crafatar.com/avatars/" + UUID);
bi = ImageIO.read(url);
} catch(MalformedURLException e) {
} catch(IOException e) {
}
return new DynamicTexture(bi);
}

Posted
1 hour ago, diesieben07 said:

You need to give it a NativeImage, not a BufferedImage. Look at how Minecraft uses DynamicTexture.

Also: That is not at all how you handle exceptions, ever.

Can you give me an example? I've been searching for this article for days, but I can't find it.

Posted
14 minutes ago, diesieben07 said:

Not sure what you mean by "article". Search for references on "DynamicTexture" in your IDE and look where Minecraft creates it.

I found this code on Google. So this code is wrong?

 

 

err.JPG

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.