Soulvenom Posted January 28, 2023 Share Posted January 28, 2023 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 Quote Link to comment Share on other sites More sharing options...
Soulvenom Posted January 30, 2023 Author Share Posted January 30, 2023 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")); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.