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

The docs on this are quite badly explained, so I hope someone will answer me here. I basically have a gui, which should look like a book, so I want to draw a background that looks like one. The docs tell me to use the blit function but not really more and it doesn't seem to be self explanatory at all (After all I had the choice between a 7 year old video explaining the now severely outdated syntax and a 1 year old video titled "Minecraft 1.16.5 : #6 รับเควสจากทางบ้าน สอนเขียน GuiScreen" in which the creator tries to create a "p**n book" but severely and utterly fails doing so over the next 53 minutes).

I have set up the code for my screen and put following four lines into the render method: 

renderBackground(pPoseStack);
Minecraft.getInstance().getTextureManager().bindForSetup(new ResourceLocation("mcaquests", "textures/gui/questbookgui.png"));
blit(pPoseStack, this.width / 2 - (420 / 2), this.height / 2 - (256 / 2), 0, 0, 420, 256, 420, 256);
super.render(pPoseStack, pMouseX, pMouseY, pPartialTick);

My texture is located at exactly 

Quote

src/main/resources/assets/mcaquests/textures/gui/questbookgui.png

It is exactly 420px wide and 256px high and I have done nothing code-wise to implement the texture besides the code I've shown here. Do I have to register the texture somewhere?

 

Upon opening the gui, which in theory works fine, I'm greeted with every vanilla minecraft hud overlay texture spread across my screen multiple times. (And upon the third time opening the gui my game crashes with the following exeption:)

Quote

Caused by: java.lang.NullPointerException: Cannot read field "level" because "this.minecraft" is null

  • Author

I've got it to work now. Instead of using the texture manager I used the Render System:

 

RenderSystem.setShaderTexture(0, new ResourceLocation("mcaquests", "textures/item/questbook.png"));

 

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.