use of net.minecraft.client.gui.FontRenderer in project RFTools by McJty.
the class ClientScreenModuleHelper method renderTextTrimmed.
@Override
public void renderTextTrimmed(int x, int y, int color, @Nonnull ModuleRenderInfo renderInfo, String text, int maxwidth) {
if (text == null) {
return;
}
if (renderInfo.font != null) {
String trimmed = renderInfo.font.trimStringToWidth(text, maxwidth);
float r = (color >> 16 & 255) / 255.0f;
float g = (color >> 8 & 255) / 255.0f;
float b = (color & 255) / 255.0f;
renderInfo.font.drawString(x, 128 - y, trimmed, 0.25f, 0.25f, -512f - 40f, r, g, b, 1.0f);
} else {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
String trimmed = fontRenderer.trimStringToWidth(text, maxwidth / 4);
fontRenderer.drawString(trimmed, x, y, color);
}
}
use of net.minecraft.client.gui.FontRenderer in project RFTools by McJty.
the class ClientScreenModuleHelper method renderText.
@Override
public void renderText(int x, int y, int color, @Nonnull ModuleRenderInfo renderInfo, String text) {
if (text == null) {
return;
}
if (renderInfo.font != null) {
float r = (color >> 16 & 255) / 255.0f;
float g = (color >> 8 & 255) / 255.0f;
float b = (color & 255) / 255.0f;
renderInfo.font.drawString(x, 128 - y, text, 0.25f, 0.25f, -512f - 40f, r, g, b, 1.0f);
} else {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
fontRenderer.drawString(text, x, y, color);
}
}
use of net.minecraft.client.gui.FontRenderer in project RFTools by McJty.
the class ScreenLevelHelper method render.
@Override
public void render(int x, int y, @Nullable IModuleDataContents data, @Nonnull ModuleRenderInfo renderInfo) {
if (data == null) {
return;
}
long maxContents = data.getMaxContents();
if (maxContents > 0) {
if (!hidebar) {
long contents = data.getContents();
int width = 80 - x + 7 + 40;
long value = contents * width / maxContents;
if (value < 0) {
value = 0;
} else if (value > width) {
value = width;
}
RenderHelper.drawHorizontalGradientRect(x, y, (int) (x + value), y + 8, gradient1, gradient2);
}
}
if (!hidetext) {
String diffTxt = null;
int col = poscolor;
if (showdiff) {
long diff = data.getLastPerTick();
if (diff < 0) {
col = negcolor;
diffTxt = diff + " " + label + "/t";
} else {
diffTxt = "+" + diff + " " + label + "/t";
}
} else if (maxContents > 0) {
long contents = data.getContents();
if (showpct) {
long value = contents * 100 / maxContents;
if (value < 0) {
value = 0;
} else if (value > 100) {
value = 100;
}
diffTxt = value + "%";
} else {
diffTxt = format(String.valueOf(contents), formatStyle) + label;
}
}
if (diffTxt != null) {
if (renderInfo.font != null) {
float r = (col >> 16 & 255) / 255.0f;
float g = (col >> 8 & 255) / 255.0f;
float b = (col & 255) / 255.0f;
renderInfo.font.drawString(x, 128 - y, diffTxt, 0.25f, 0.25f, -512f - 40f, r, g, b, 1.0f);
} else {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
fontRenderer.drawString(diffTxt, x, y, col);
}
}
}
}
use of net.minecraft.client.gui.FontRenderer in project RFTools by McJty.
the class ScreenTextHelper method renderText.
@Override
public void renderText(int x, int y, int color, ModuleRenderInfo renderInfo) {
if (renderInfo.font != null) {
float r = (color >> 16 & 255) / 255.0f;
float g = (color >> 8 & 255) / 255.0f;
float b = (color & 255) / 255.0f;
renderInfo.font.drawString(textx + x, 128 - y, text, 0.25f, 0.25f, -512f - 40f, r, g, b, 1.0f);
} else {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
fontRenderer.drawString(text, textx + x, y, color);
}
}
use of net.minecraft.client.gui.FontRenderer in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class PageArmourOrgXIII method drawPageForeground.
@Override
public void drawPageForeground(int width, int height) {
super.drawPageForeground(width, height);
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRenderer;
String[] count = text.split("\n");
fontRendererObj.drawSplitString(text, getxPos(), getyPos() + (fontRendererObj.FONT_HEIGHT * 2), (new ScaledResolution(Minecraft.getMinecraft())).getScaledWidth() - getxPos() - (fontRendererObj.FONT_HEIGHT * 2), 0xFFFFFF);
// int length = fontRendererObj.splitStringWidth(text, (new ScaledResolution(Minecraft.getMinecraft())).getScaledWidth() - getxPos() - (fontRendererObj.FONT_HEIGHT * 2));
// fontRendererObj.drawString("TESTING SO THAT THIS IS ALWAYS AT THE
// BOTTOM.", this.getxPos(), (this.getyPos() +
// (fontRendererObj.FONT_HEIGHT * 2)) + length, 0xFFFFFF);
}
Aggregations