@Override public void drawScreen(int i, int j, float k) { drawDefaultBackground(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(gui); int xb = this.width - 176 >> 1; int yb = this.height - 214 >> 1; drawTexturedModalRect(xb, yb, 0, 0, 176, 214); drawCenteredString( this.fontRenderer, StatCollector.translateToLocal("tile.InfMJSrc.name"), this.width / 2, yb + 6, 0xFFFFFF); drawCenteredString( this.fontRenderer, String.format("x:%d, y:%d, z:%d", this.tile.xCoord, this.tile.yCoord, this.tile.zCoord), this.width / 2, yb + 20, 0xFFFFFF); this.fontRenderer.drawStringWithShadow("Energy(MJ)", this.width / 2 - 70, yb + 39, 0xFFFFFF); this.fontRenderer.drawStringWithShadow( "Interval(tick)", this.width / 2 - 70, yb + 88, 0xFFFFFF); drawCenteredString(this.fontRenderer, "1tick=1/20second", this.width / 2, yb + 130, 0xFFFFFF); this.eng.drawTextBox(); this.itv.drawTextBox(); super.drawScreen(i, j, k); }
@Override protected void keyTyped(char par1, int par2) { if (this.eng.isFocused()) { this.eng.textboxKeyTyped(par1, par2); } else if (this.itv.isFocused()) { this.itv.textboxKeyTyped(par1, par2); } super.keyTyped(par1, par2); }
@Override public void initGui() { super.initGui(); // int xb = (this.width - 176) >> 1; int yb = (this.height - 214) >> 1; this.eng = new GuiTextField(this.fontRenderer, (this.width >> 1) - 75, yb + 58, 150, 20); this.eng.setText(Float.toString(this.tile.power)); this.itv = new GuiTextField(this.fontRenderer, (this.width >> 1) - 75, yb + 106, 150, 20); this.itv.setText(Integer.toString(this.tile.interval)); this.buttonList.add(new GuiButton(1, (this.width >> 1) + 30, yb + 34, 50, 20, "Reset")); this.buttonList.add(new GuiButton(2, (this.width >> 1) + 30, yb + 82, 50, 20, "Reset")); this.buttonList.add(new GuiButton(3, (this.width >> 1) - 75, yb + 144, 150, 20, "Apply")); }
@Override protected void mouseClicked(int par1, int par2, int par3) { super.mouseClicked(par1, par2, par3); this.eng.mouseClicked(par1, par2, par3); this.itv.mouseClicked(par1, par2, par3); }