Posted March 8, 20178 yr Hi I'm trying to display a simple GUI, some buttons and a text box (if I can work out how to display one, lol). At the moment I'm just trying to draw a background.... This isn't working.... I know the function to draw the background it being called (drawScreen()) as when I right click the block that triggers the GUI, the screen goes dark (the default background) Can someone take a look and see where I'm going wrong? According to the logs there are no errors when the GUI is triggered The GUIScreen: package net.tekkcraft.factions.gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.ResourceLocation; import java.io.IOException; /** * Created by jamie on 07/03/2017. */ public class FactionCoreGuiScreen extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); mc.getTextureManager().bindTexture(new ResourceLocation("factionMod", "/textures/gui/core.png")); super.drawScreen(mouseX, mouseY, partialTicks); } @Override public boolean doesGuiPauseGame() { return false; } @Override public void initGui() { } @Override protected void actionPerformed(GuiButton button) throws IOException { } }
March 8, 20178 yr 5 minutes ago, jamiemac262 said: "/textures/gui/core.png" That slash at the beginning shouldn't be there, although that's not what's causing the problem in this case. You bind a texture and then call super#drawScreen, but if you look at GuiScreen#drawScreen, you'll find that all it does is draw buttons and labels if any are present - your bound texture is never used. If you want to draw an image, you need to call Gui#drawTexturedModalRect (or a related method) yourself.
March 8, 20178 yr Well, you are never actually drawing the texture to the screen... use Gui#drawTexturedModalRect or a method close to that to draw it to the screen. 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/
March 8, 20178 yr Author thanks guys, that fixed it.... do either of you know if there's a way to stretch a background texture to a certain size? the image I have is too small, I wanna stretch it to fill more of the screen
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.