Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

It appears more than once, this is with the texture size being 512x512 (Same thing occurs when cropped to the proper size of 372x166). Anyone that can help?

 

@Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
	GlStateManager.color(1, 1, 1, 1);
	this.mc.getTextureManager().bindTexture(backgroundTexture);
	drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize); //xSize being 372, ySize being 166
}

 

LH7iJWb.png

drawTexturedModalRect uses a 256 x 256 texture.

 

If you want to load a different size you'll need to make your own draw function. scratch that.

0.00390625F is 1 / 256

 

Edit:

Ernio is correct, drawModalRectWithCustomSizedTexture is what you want.

 

 

For my mods in-game wiki I needed scaling, flipping, and custom sizes; so I coded a function that did everything and completely forgot Minecraft had more then drawTexturedModalRect

(not sure when drawScaledCustomSizeModalRect appeared but I'm sure it wasn't there before, I could have used it for about 2/3rds of my images)

If you want to load a different size you'll need to make your own draw function.

0.00390625F is 1 / 256

 

I'd like to note that there is alredy method that has size args (...withCustomSize() or something).

 

Since you are drawing container, I'd also like to note: (might come in handy) :D

http://www.minecraftforge.net/forum/index.php/topic,31297.msg165510.html#msg165510

1.7.10 is no longer supported by forge, you are on your own.

  • Author

I was about to post about how it still doesn't worked and then realised you put lots of emphasis on the fact xSize and ySize has to be in the constructor. I noticed that mine were just declared outside of it, changed it, and it worked. Thank you guys so much for helping to fix this.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.