Posted July 29, 201312 yr Hello, It's me again I try to draw a textbox on a Gui and I had a look at the gui of the anvil but it seems like it's not working because I can't see the textField , I get no errors , nothing happens. My GuiContainer package org.setcore.fasttravel; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; public class GuiTravelMark extends GuiContainer { private GuiTextField markName; private static final ResourceLocation textureLocation = new ResourceLocation("fasttravelmod:textures/guitravelmark/travelblockgui.png"); public GuiTravelMark (InventoryPlayer inventoryPlayer, TileEntityTravel tileEntity) { //the container is instanciated and passed to the superclass for handling super(new ContainerTravelMark(inventoryPlayer, tileEntity)); } @Override protected void drawGuiContainerForegroundLayer(int param1, int param2) { //draw text and stuff here //the parameters for drawString are: string, x, y, color fontRenderer.drawString("Travel Mark", 8, 6, 4210752); //draws "Inventory" or your regional equivalent fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { //draw your Gui here, only thing you need to change is the path this.mc.renderEngine.func_110577_a(textureLocation); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); } @Override public void drawScreen(int par1, int par2, float par3) { super.drawScreen(par1, par2, par3); this.markName.drawTextBox(); } public void initGui() { super.initGui(); int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; this.markName = new GuiTextField(this.fontRenderer, i + 62, j + 24, 103, 12); this.markName.setTextColor(-1); this.markName.setDisabledTextColour(-1); this.markName.setEnableBackgroundDrawing(false); this.markName.setMaxStringLength(40); this.markName.setMaxStringLength(30); //buttonList.add(new GuiButton(0,200,100,100,20,"test")); } } Thanks, Graphicscore
July 29, 201312 yr did you println before drawign the text box, have you tried moving it to drawForegroudn ? how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 29, 201312 yr Author I've moved it everywhere now and tested it with println the code is always executed but it's not drawing. any Ideas ?
July 29, 201312 yr this.markName.setEnableBackgroundDrawing(false); true how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 29, 201312 yr What hydroflame said. And this.markName.setMaxStringLength(40); this.markName.setMaxStringLength(30); meh.
July 29, 201312 yr @gotolink, lol, didnt notice that how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
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.