use of net.minecraft.client.gui.FontRenderer in project Random-Things by lumien231.
the class GuiCustomButton method drawButton.
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
if (this.visible) {
FontRenderer fontrenderer = mc.fontRenderer;
mc.getTextureManager().bindTexture(buttonTextures);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int k = this.getHoverState(this.hovered);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.blendFunc(770, 771);
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.x, this.y, uX + (value ? 20 : 0), uY + (k - 1) * 20, this.width, this.height, this.textureWidth, this.textureHeight, 2, 3, 2, 2, this.zLevel);
// this.drawTexturedModalRect(this.x, this.y, uX +
// (value ? 20 : 0), uY + (k - 1) * 20, this.width, this.height);
this.mouseDragged(mc, mouseX, mouseY);
int color = 14737632;
if (packedFGColour != 0) {
color = packedFGColour;
} else if (!this.enabled) {
color = 10526880;
} else if (this.hovered) {
color = 16777120;
}
String buttonText = this.displayString;
int strWidth = mc.fontRenderer.getStringWidth(buttonText);
int ellipsisWidth = mc.fontRenderer.getStringWidth("...");
if (strWidth > width - 6 && strWidth > ellipsisWidth)
buttonText = mc.fontRenderer.trimStringToWidth(buttonText, width - 6 - ellipsisWidth).trim() + "...";
this.drawCenteredString(mc.fontRenderer, buttonText, this.x + this.width / 2, this.y + (this.height - 8) / 2, color);
}
}
use of net.minecraft.client.gui.FontRenderer in project Random-Things by lumien231.
the class GuiEnumButton method drawButton.
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
if (this.visible) {
FontRenderer fontrenderer = mc.fontRenderer;
mc.getTextureManager().bindTexture(textureLocation);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
E value = getValue();
int ordinal = value.ordinal();
int i = this.getHoverState(this.hovered);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.x, this.y, ordinal * width, (i - 1) * height, this.width, this.height);
this.mouseDragged(mc, mouseX, mouseY);
int j = 14737632;
if (packedFGColour != 0) {
j = packedFGColour;
} else if (!this.enabled) {
j = 10526880;
} else if (this.hovered) {
j = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, j);
}
}
use of net.minecraft.client.gui.FontRenderer in project Random-Things by lumien231.
the class GuiSlotButton method drawButton.
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
GlStateManager.disableLighting();
FontRenderer fontrenderer = mc.fontRenderer;
mc.getTextureManager().bindTexture(texture);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int i = this.getHoverState(this.hovered);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.x, this.y, 0, 0 + (i - 1) * 18, this.width, this.height);
this.mouseDragged(mc, mouseX, mouseY);
if (!stack.isEmpty()) {
RenderHelper.enableGUIStandardItemLighting();
this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F;
GlStateManager.enableDepth();
this.itemRender.renderItemAndEffectIntoGUI(this.mc.player, stack, this.x + 1, this.y + 1);
this.itemRender.renderItemOverlayIntoGUI(fontrenderer, stack, this.x + 1, this.y + 1, "");
this.itemRender.zLevel = 0.0F;
this.zLevel = 0.0F;
RenderHelper.disableStandardItemLighting();
}
}
use of net.minecraft.client.gui.FontRenderer in project Random-Things by lumien231.
the class GuiStringList method drawSlot.
@Override
protected void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5) {
GlStateManager.disableLighting();
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
int factor = scaledResolution.getScaleFactor();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(left * factor, Minecraft.getMinecraft().displayHeight - top * factor - listHeight * factor, listWidth * factor, listHeight * factor);
String string = stringList.get(var1);
int color = 0xFFFFFF;
Rectangle slotRect = new Rectangle(this.left + 3, var3, fontRenderer.getStringWidth(string), fontRenderer.FONT_HEIGHT);
if (slotRect.contains(mouseX, mouseY)) {
color = 0xFFD700;
}
fontRenderer.drawString(string, this.left + 3, var3, color);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
GlStateManager.enableLighting();
}
use of net.minecraft.client.gui.FontRenderer in project Random-Things by lumien231.
the class GuiTriggerButton method drawButtonForegroundLayer.
@Override
public void drawButtonForegroundLayer(int mouseX, int mouseY) {
if (this.tooltip != null) {
try {
Minecraft mc = Minecraft.getMinecraft();
FontRenderer fontrenderer = mc.fontRenderer;
String localizedToolTip = I18n.format(tooltip);
GuiUtils.drawHoveringText(Arrays.<String>asList(new String[] { localizedToolTip }), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, fontrenderer);
} catch (Exception e) {
}
}
}
Aggregations