use of net.minecraft.client.gui.FontRenderer in project Totemic by TeamTotemic.
the class PageCeremony method renderScreen.
@Override
public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
relativeMouseX = mx;
relativeMouseY = my;
Minecraft mc = Minecraft.getMinecraft();
TextureManager render = mc.renderEngine;
FontRenderer font = mc.fontRenderer;
List<MusicInstrument> instruments = ceremony.getSelectors();
int instrLeft = gui.getLeft() + gui.getWidth() / 2 - 10 * instruments.size();
for (int i = 0; i < instruments.size(); i++) {
ItemStack item = instruments.get(i).getItem();
if (!item.isEmpty())
renderItem(gui, instrLeft + 20 * i, gui.getTop() + 31, item, false);
}
if (!tooltipStack.isEmpty())
RenderHelper.renderTooltip(mx, my, tooltipStack.getTooltip(mc.player, TooltipFlags.NORMAL));
String text = I18n.format("totemicmisc.musicSelector");
font.drawString(text, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(text) / 2, gui.getTop() + 14, 0x999999);
boolean unicode = font.getUnicodeFlag();
font.setUnicodeFlag(true);
text = I18n.format(TotemUtil.getMusicNeeded(ceremony.getMusicNeeded()));
font.drawString(text, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(text) / 2, gui.getTop() + 90, 0x000000);
text = I18n.format(getUnlocalizedName());
font.drawString(text, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(text) / 2, gui.getTop() + 150, 0x000000);
font.setUnicodeFlag(unicode);
render.bindTexture(ceremonyOverlay);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 1F);
((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
GlStateManager.disableBlend();
tooltipStack = tooltipContainerStack = ItemStack.EMPTY;
tooltipEntry = false;
mouseDownLastTick = Mouse.isButtonDown(0);
}
use of net.minecraft.client.gui.FontRenderer in project Totemic by TeamTotemic.
the class PageText method renderText.
@SideOnly(Side.CLIENT)
public static void renderText(int x, int y, int width, int height, String unlocalizedText) {
FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
boolean unicode = renderer.getUnicodeFlag();
renderer.setUnicodeFlag(true);
String text = I18n.format(unlocalizedText);
String[] textEntries = text.split("<br>");
for (String entry : textEntries) {
for (// This method handles both format and line wraps, no need to write one yourself. Fix lines going off the edge.
String line : // This method handles both format and line wraps, no need to write one yourself. Fix lines going off the edge.
renderer.listFormattedStringToWidth(entry, width)) {
y += 10;
renderer.drawString(line, x, y, 0);
}
y += 10;
}
renderer.setUnicodeFlag(unicode);
}
use of net.minecraft.client.gui.FontRenderer in project SecurityCraft by Geforce132.
the class GuiItemButton method drawButton.
/**
* Draws this button to the screen.
*/
@Override
public void drawButton(Minecraft par1, int par2, int par3, float f) {
if (visible) {
FontRenderer var4 = par1.fontRenderer;
par1.getTextureManager().bindTexture(BUTTON_TEXTURES);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
int var5 = getHoverState(hovered);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(x, y, 0, 46 + var5 * 20, width / 2, height);
this.drawTexturedModalRect(x + width / 2, y, 200 - width / 2, 46 + var5 * 20, width / 2, height);
if (blockToRender != null) {
// (this.width / 2) - 8
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
itemRenderer.renderItemAndEffectIntoGUI(new ItemStack(blockToRender), x + 2, y + 3);
itemRenderer.renderItemOverlayIntoGUI(par1.fontRenderer, new ItemStack(blockToRender), x + 2, y + 3, "");
} else {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
itemRenderer.renderItemAndEffectIntoGUI(new ItemStack(itemToRender), x + 2, y + 2);
itemRenderer.renderItemOverlayIntoGUI(par1.fontRenderer, new ItemStack(itemToRender), x + 2, y + 2, "");
GL11.glDisable(GL11.GL_LIGHTING);
}
mouseDragged(par1, par2, par3);
int var6 = 14737632;
if (!enabled)
var6 = 10526880;
else if (hovered)
var6 = 16777120;
drawCenteredString(var4, displayString, x + width / 2, y + (height - 8) / 2, var6);
}
}
use of net.minecraft.client.gui.FontRenderer in project SecurityCraft by Geforce132.
the class GuiLinkedText method drawButton.
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float f) {
if (visible) {
FontRenderer fontrenderer = mc.fontRenderer;
mouseDragged(mc, mouseX, mouseY);
drawCenteredString(fontrenderer, TextFormatting.UNDERLINE + displayString, x + width / 2, y + (height - 8) / 2, textColor);
}
}
use of net.minecraft.client.gui.FontRenderer in project SecurityCraft by Geforce132.
the class GuiItemButton method drawButton.
/**
* Draws this button to the screen.
*/
@Override
public void drawButton(Minecraft par1, int par2, int par3) {
if (visible) {
FontRenderer var4 = par1.fontRendererObj;
par1.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int var5 = getHoverState(hovered);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(xPosition, yPosition, 0, 46 + var5 * 20, width / 2, height);
this.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + var5 * 20, width / 2, height);
if (blockToRender != null) {
// (this.width / 2) - 8
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
itemRenderer.renderItemAndEffectIntoGUI(new ItemStack(blockToRender), xPosition + 2, yPosition + 3);
itemRenderer.renderItemOverlayIntoGUI(par1.fontRendererObj, new ItemStack(blockToRender), xPosition + 2, yPosition + 3, "");
} else {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
itemRenderer.renderItemAndEffectIntoGUI(new ItemStack(itemToRender), xPosition + 2, yPosition + 2);
itemRenderer.renderItemOverlayIntoGUI(par1.fontRendererObj, new ItemStack(itemToRender), xPosition + 2, yPosition + 2, "");
GL11.glDisable(GL11.GL_LIGHTING);
}
mouseDragged(par1, par2, par3);
int var6 = 14737632;
if (!enabled)
var6 = 10526880;
else if (hovered)
var6 = 16777120;
drawCenteredString(var4, displayString, xPosition + width / 2, yPosition + (height - 8) / 2, var6);
}
}
Aggregations