@Override public void initGui() { this.buttonList.add(this.closeButton = new GuiButton(0, (this.width - this.backgroundWidth + 100) / 2, (this.height + this.backgroundHeight - 60) / 2, this.backgroundWidth - 100, 20, "Close")); }
@Override public void drawScreen(int mouseX, int mouseY, float par3) { int x = (this.width - this.backgroundWidth) / 2; int y = (this.height - this.backgroundHeight) / 2 - this.closeButton.height; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(new ResourceLocation(ForgeWorldEdit.MOD_ID, "textures/gui/reference.png")); this.drawTexturedModalRect(x, y, 0, 0, this.backgroundWidth, this.backgroundHeight); super.drawScreen(mouseX, mouseY, par3); }
/** * Uses the values to instantiate a padded version of a text field. * Pays attention to the '_' caret. * * @param fontRenderer renderer for the strings * @param xPos absolute left position * @param yPos absolute top position * @param width absolute width * @param height absolute height */ public MEGuiTextField( final FontRenderer fontRenderer, final int xPos, final int yPos, final int width, final int height ) { super( 0, fontRenderer, xPos + PADDING, yPos + PADDING, width - 2 * PADDING - fontRenderer.getCharWidth( '_' ), height - 2 * PADDING ); this._fontPad = fontRenderer.getCharWidth( '_' ); this._xPos = xPos; this._yPos = yPos; this._width = width; this._height = height; }
public void renderHUD(Minecraft mc, ScaledResolution res) { int color = 0xAA006600; char motion = backwards ? '<' : '>'; String speed = TextFormatting.BOLD + ""; for(int i = 0; i < this.speed; i++) speed = speed + motion; int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(speed) / 2; int y = res.getScaledHeight() / 2 - 15; GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); mc.fontRenderer.drawStringWithShadow(speed, x, y, color); GlStateManager.disableBlend(); }
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { String s = I18n.format("item.botania:flowerBag.name"); fontRenderer.drawString(s, xSize / 2 - fontRenderer.getStringWidth(s) / 2, 6, 4210752); fontRenderer.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752); }
@Override public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.fontRenderer.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 ); }
@Override public void initGui() { super.initGui(); this.name = new GuiTextField( 0, this.fontRenderer, this.guiLeft + 24, this.guiTop + 32, 79, this.fontRenderer.FONT_HEIGHT ); this.name.setEnableBackgroundDrawing( false ); this.name.setMaxStringLength( 32 ); this.name.setTextColor( 0xFFFFFF ); this.name.setVisible( true ); this.name.setFocused( true ); }
public int bookmarkWidth(String b) { if(fontRenderer == null) fontRenderer = Minecraft.getMinecraft().fontRenderer; boolean unicode = fontRenderer.getUnicodeFlag(); fontRenderer.setUnicodeFlag(true); int width = fontRenderer.getStringWidth(b) + 15; fontRenderer.setUnicodeFlag(unicode); return width; }
@Override @SideOnly(Side.CLIENT) public void updateScreen() { if(GuiScreen.isShiftKeyDown()) return; if(ticksElapsed % 20 == 0) { recipeAt++; if(recipeAt == recipes.size()) recipeAt = 0; } ++ticksElapsed; }
public static int getMaxAllowedScale() { Minecraft mc = Minecraft.getMinecraft(); int scale = mc.gameSettings.guiScale; mc.gameSettings.guiScale = 0; ScaledResolution res = new ScaledResolution(mc); mc.gameSettings.guiScale = scale; return res.getScaleFactor(); }
@Override public void onUpdate( final String field, final Object oldValue, final Object newValue ) { if( field.equals( "EmitterValue" ) ) { if( this.textField != null ) { this.textField.setText( String.valueOf( this.EmitterValue ) ); } } }
@Override public boolean mouseClicked( final int xPos, final int yPos, final int button ) { super.mouseClicked( xPos, yPos, button ); final boolean requiresFocus = this.isMouseIn( xPos, yPos ); if( !this.isFocused() ) { this.setFocused( requiresFocus ); } return true; }
@Override public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.bindTexture( "guis/quartzknife.png" ); this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize ); this.name.drawTextBox(); }
private void back() { if(backButton.enabled) { actionPerformed(backButton); backButton.playPressSound(mc.getSoundHandler()); } }
@Override public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.fontRenderer.drawString( GuiText.SelectAmount.getLocal(), 8, 6, 4210752 ); }
@Override @SideOnly(Side.CLIENT) public void updateScreen() { if(GuiScreen.isShiftKeyDown()) return; if(ticksElapsed % 20 == 0) { recipeAt++; if(recipeAt == recipes.size()) recipeAt = 0; } ++ticksElapsed; }
@Override public void onUpdate( final String field, final Object oldValue, final Object newValue ) { if( field.equals( "EmitterValue" ) ) { if( this.textField != null ) { this.textField.setText( String.valueOf( this.EmitterValue ) ); } } }
private void back() { if(backButton.enabled) { actionPerformed(backButton); backButton.playPressSound(mc.getSoundHandler()); } }
@Override public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) { this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Drive.getLocal() ), 8, 6, 4210752 ); this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 ); }
@Override @SideOnly(Side.CLIENT) public void updateScreen() { if(GuiScreen.isShiftKeyDown()) return; if(ticksElapsed % 20 == 0) { recipeAt++; if(recipeAt == recipes.size()) recipeAt = 0; } ++ticksElapsed; }