Jump to content

[1.17.1] making a GuiComponent.blit with a custom texture Width and Height


Recommended Posts

Posted

Hello,

I am trying to call a blit method that will allow me to set the width and height of the area on the texture I am looking to get. e.g. I have a 256x256 texture. The element I am looking to get is at pos 0,0 and is 20 pixels in height and width but I want to rendering it with a width and height of 30. so it will appear bigger on the screen than what the texture file holds.

I previously done it with this arrangement. 

  Reveal hidden contents

But this does not render at all I have tried looking at the blit method in the GuiComponenet class.

 

  Reveal hidden contents

but I am unsure of what the values being passed are as they do not have the proper names.

 

is anyone able to help me recreate the first method with this other way or point in in a direction I could go to un-obfuscate these variables.

 

Regards, Discult

Posted

Sorry to both anyone who comes across this I have figured out the issue...

It seems minecraft now works in a 0.0F and 1.0F grid for the uv coords.

so to achieve this I need to simply divide the pos I was looking by the overall image size.

here is the method I made:

  Reveal hidden contents

so for the element I said about in my example in the original question I would need to do

  Reveal hidden contents

Again sorry for anyone this bothers.

Regards,

Discult.

Posted
  On 8/1/2021 at 6:01 PM, Discult said:

It seems minecraft now works in a 0.0F and 1.0F grid for the uv coords.

Expand  

It always has, just that a handful of methods (mostly UI) would assume a 256x256 texture and take pixel based coordinates. It converted to 0-1 UV coordinates internally before doing the actual blitting, though.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.