Jump to content

Recommended Posts

Posted

Hey everyone, I'm making a mod that adds a container, so it adds slots. When developing I leave my minecraft's screen small (it doesn't  cover the whole screen) so I , when developing, put the coords of the slots based on the small Gui. I was wondering if there's any way to detect if the Minecraft screen is or not in Fullscreen, so that I could put the coords based on that.

 

I know I could go with the width and height, but it was too messy, and I didn't really want to spend hours finding it.

 

Any ideas would be really appreciated.

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

Posted

Knowing the middle of the gui is always in the middle of the screen, you can use (width-xSize)/2. That gives you the middle of the screen, and base your slots around that value (same for the y but height and ySize

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

for some reason, it gives me the most top left pixel of the screen. It kinda helps me, I can set up the coords for it but only at the resolution of my screen.

 

Here are the classes:

 

https://github.com/gjkf/GjkfLib/blob/master/src/main/java/com/gjkf/lib/gui/GuiScreenWidget.java

https://github.com/gjkf/HeadPhones-Radio/blob/master/src/main/java/com/gjkf/headPhones/client/gui/RadioCrystalGui.java

 

Thanks for the help

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

Posted

You are setting the minX and minY values to getMinX() and getMinY() method in GuiScreenWidget, but those are 0 because they're not initialised. Then you pass in those values, but because the passed in values are 0, you set the minX and minY values to 0. You have 2 options with your current setup:

1) in the RadioCrystalGui, call the super method without parameters, or

2) pass 176 and 166 (default values) instead of minX and minY.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

This is the log I get (I print into the log minX and minY)

 

[14:42:37] [Client thread/INFO] [HeadPhonesRadio]: MinX: 0

[14:42:37] [Client thread/INFO] [HeadPhonesRadio]: MinY: 0

 

I get this with both your methods.

 

This is how I did it

 

Main.log.info("MinX: " + minX);
Main.log.info("MinY: " + minY);

 

I'm sorry if I made some stupid errors but I can't really figure it out.

 

Couldn't I just do width/2 and height/2 to find the middle point, that should always be the same?

 

EDIT: Look at the same classes for what I came up now. I keep getting 0 using the library,  in the actual mod I get the correct result

 

EDIT: Fixed it, thanks for the help

"I an atom in the universe, a universe of atoms"-- Richard P. Feynman

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.