Jump to content

[1.15.2] Different game screen and window size


Mr_Zylr

Recommended Posts

I'm fairly new to minecraft modding and I'm just curious if there is a way to make it so the game screen is rendered smaller than the actual window. For example it would render so that there would be a black bar on the side of the game screen and if it would be possible to render a custom hud overlaying information in that empty space so that its not actually over the minecraft screen. I've looked through the vanilla minecraft classes on how it renders the game, specifically I've looked through the ScreenSize, OverlayRenderer and GameRenderer classes which are giving me the feeling that its not going to be something that will be done very cleanly, but I am optomistic someone might be able to point me in the correct direction

Link to comment
Share on other sites

41 minutes ago, Mr_Zylr said:

I'm fairly new to minecraft modding and I'm just curious if there is a way to make it so the game screen is rendered smaller than the actual window. For example it would render so that there would be a black bar on the side of the game screen and if it would be possible to render a custom hud overlaying information in that empty space so that its not actually over the minecraft screen.

Um. So you're basically asking for F3 except with no rendering behind it? Why don't you just draw a more opaque box behind the text so you can show the information better. If you could give more context as to why you are trying to accomplish this, it would be helpful.

Link to comment
Share on other sites

2 hours ago, ChampionAsh5357 said:

Um. So you're basically asking for F3 except with no rendering behind it? Why don't you just draw a more opaque box behind the text so you can show the information better. If you could give more context as to why you are trying to accomplish this, it would be helpful.

Not really f3 like. Say on a 1080p screen the window is maximized, I want the window to be the full 1920 wide, but the game to only render say 1700 wide leaving a 220pixel wide black space on the right to put a full 1080x220 opaque overlay to display certain information for the server the mod is made for without actually covering any of the minecraft screen, like the scoreboard that is on the right.

Link to comment
Share on other sites

6 minutes ago, Mr_Zylr said:

I want the window to be the full 1920 wide, but the game to only render say 1700 wide leaving a 220pixel wide black space on the right to put a full 1080x220 opaque overlay to display certain information for the server the mod is made for without actually covering any of the minecraft screen, like the scoreboard that is on the right.

Well you'll probably need to make a custom VirtualScreen and MainWindow instance and work with how certain information will render within it. You would need to use reflection to edit these values within the client. I highly advise against this however since it will probably create major side effects replacing the it value way too late along with the previous instance still being used in the original calls. It probably wouldn't work at all since most of the information is called in the initialization phase. In my opinion, just create an overlay similar to the debug menu to show your overlay.

Link to comment
Share on other sites

1 minute ago, ChampionAsh5357 said:

Well you'll probably need to make a custom VirtualScreen and MainWindow instance and work with how certain information will render within it. You would need to use reflection to edit these values within the client. I highly advise against this however since it will probably create major side effects replacing the it value way too late along with the previous instance still being used in the original calls. It probably wouldn't work at all since most of the information is called in the initialization phase. In my opinion, just create an overlay similar to the debug menu to show your overlay.

If you don't think its possible then that is something I am ok with and the conclusion I was coming to myself and just wanted confirmation from someone else with more experience working with forge. I do currently already have everything displayed on screen, however I was looking to do another optional view. If youve played Runescape before think of the way the inventory and map is rendered in comparison to the game in the "fixed screen" option as this mod is for a runescape themed server. I know I could achieve a similar effect by just rendering the opaque overlay on the right and moving the scoreboard location, however this would have put the reticle and player hands off centered. However since it is not a prominent "make or break" feature I will for now put it on the back burner or scrap completely.

I really appreciate your help!

Link to comment
Share on other sites

18 hours ago, ChampionAsh5357 said:

Well you'll probably need to make a custom VirtualScreen and MainWindow instance and work with how certain information will render within it. You would need to use reflection to edit these values within the client. I highly advise against this however since it will probably create major side effects replacing the it value way too late along with the previous instance still being used in the original calls. It probably wouldn't work at all since most of the information is called in the initialization phase. In my opinion, just create an overlay similar to the debug menu to show your overlay.

Just wanted to update here and say that today I did give this a go just to see, and after changing the windowX, width, framebufferWidth and scaledWidth values in MainWindow with reflection it does seem to generate the effect i was looking for with no noticeable side effects, however it all reverts back on any window size updates. For example dragging the window, minimizing, or maximizing. I looked through and I'm not seeing an event handler for size update, which i couldnt really see a need for one other than this specific case, but I do see MainWindow has an onWindowSizeUpdate method. Is there some way I could use that to my advantage that I'm not aware of.

Link to comment
Share on other sites

22 minutes ago, Mr_Zylr said:

MainWindow with reflection

You would need to write something that extends this class and reflect it into Minecraft. That's what I was saying originally which would have unintended side effects. You can change the values with reflection fine. But if you reflect the class in for another, then it creates issues.

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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