use of net.minecraft.client.gui.FontRenderer in project BetterQuesting by Funwayguy.
the class PanelTextBox method setText.
public PanelTextBox setText(String text) {
this.text = text;
IGuiRect bounds = this.getTransform();
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
if (autoFit) {
List<String> sl = fr.listFormattedStringToWidth(text, bounds.getWidth());
lines = sl.size() - 1;
this.transform.h = fr.FONT_HEIGHT * sl.size();
} else {
lines = (bounds.getHeight() / fr.FONT_HEIGHT) - 1;
}
return this;
}
use of net.minecraft.client.gui.FontRenderer in project BetterQuesting by Funwayguy.
the class PanelTextBox method drawPanel.
@Override
public void drawPanel(int mx, int my, float partialTick) {
IGuiRect bounds = this.getTransform();
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int w = fr.getStringWidth(text);
int bw = bounds.getWidth();
if (align == 2 && bw >= w) {
RenderUtils.drawSplitString(fr, text, bounds.getX() + bounds.getWidth() - w, bounds.getY(), bounds.getWidth(), color.getRGB(), shadow, 0, lines);
} else if (align == 1 && bw >= w) {
RenderUtils.drawSplitString(fr, text, bounds.getX() + bounds.getWidth() / 2 - w / 2, bounds.getY(), bounds.getWidth(), color.getRGB(), shadow, 0, lines);
} else {
RenderUtils.drawSplitString(fr, text, bounds.getX(), bounds.getY(), bounds.getWidth(), color.getRGB(), shadow, 0, lines);
}
}
use of net.minecraft.client.gui.FontRenderer in project BetterQuesting by Funwayguy.
the class PanelTextBox method initPanel.
@Override
public void initPanel() {
IGuiRect bounds = this.getTransform();
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
if (!autoFit) {
lines = (bounds.getHeight() / fr.FONT_HEIGHT) - 1;
return;
}
List<String> sl = fr.listFormattedStringToWidth(text, bounds.getWidth());
lines = sl.size() - 1;
this.transform.h = fr.FONT_HEIGHT * sl.size();
}
use of net.minecraft.client.gui.FontRenderer in project EnderIO by SleepyTrousers.
the class GuiCapBank method drawGuiContainerBackgroundLayer.
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
requestStateUpdate();
GlStateManager.color(1, 1, 1);
bindGuiTexture();
int sx = (width - xSize) / 2;
int sy = (height - ySize) / 2;
drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize);
for (int i = 0; i < buttonList.size(); ++i) {
GuiButton guibutton = buttonList.get(i);
guibutton.drawButton(mc, 0, 0, par1);
}
int midX = sx + xSize / 2;
String str = Lang.GUI_CAPBANK_MAX_IO.get() + " " + LangPower.RFt(network.getMaxIO());
FontRenderer fr = getFontRenderer();
int swid = fr.getStringWidth(str);
int x = midX - swid / 2;
int y = guiTop + 5;
drawString(fr, str, x, y, -1);
str = Lang.GUI_CAPBANK_MAX_INPUT.get() + ":";
swid = fr.getStringWidth(str);
x = guiLeft + inputX - swid - 26;
y = guiTop + inputY + 2;
drawString(fr, str, x, y, -1);
str = Lang.GUI_CAPBANK_MAX_OUTPUT.get() + ":";
swid = fr.getStringWidth(str);
x = guiLeft + outputX - swid - 26;
y = guiTop + outputY + 2;
drawString(fr, str, x, y, -1);
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
}
use of net.minecraft.client.gui.FontRenderer in project EnderIO by SleepyTrousers.
the class ItemSettings method renderCustomOptions.
@Override
protected void renderCustomOptions(int top, float par1, int par2, int par3) {
FontRenderer fr = gui.getFontRenderer();
GlStateManager.color(1, 1, 1);
IconEIO.map.render(EnderWidget.BUTTON_DOWN, left + priLeft, top - 5, priWidth, 16, 0, true);
String str = itemConduit.getOutputPriority(gui.getDir()) + "";
int sw = fr.getStringWidth(str);
String priority = Lang.GUI_PRIORITY.get();
fr.drawString(priority, left + 12, top + 25, ColorUtil.getRGB(Color.black));
fr.drawString(str, left + priLeft + priWidth - sw - gap, top + 25, ColorUtil.getRGB(Color.black));
}
Aggregations