本文整理汇总了Java中net.minecraft.client.gui.FontRenderer.drawStringWithShadow方法的典型用法代码示例。如果您正苦于以下问题:Java FontRenderer.drawStringWithShadow方法的具体用法?Java FontRenderer.drawStringWithShadow怎么用?Java FontRenderer.drawStringWithShadow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.gui.FontRenderer
的用法示例。
在下文中一共展示了FontRenderer.drawStringWithShadow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tickEnd
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
@SubscribeEvent
public void tickEnd(TickEvent.RenderTickEvent event) {
if (event.phase == TickEvent.Phase.END && FMLClientHandler.instance().getClient().inGameHasFocus && PneumaticCraftRepressurized.proxy.getPlayer().world != null && (ModuleRegulatorTube.inverted || !ModuleRegulatorTube.inLine)) {
Minecraft mc = FMLClientHandler.instance().getClient();
ScaledResolution sr = new ScaledResolution(mc);
FontRenderer fontRenderer = FMLClientHandler.instance().getClient().fontRenderer;
String warning = TextFormatting.RED + I18n.format("gui.regulatorTube.hudMessage." + (ModuleRegulatorTube.inverted ? "inverted" : "notInLine"));
fontRenderer.drawStringWithShadow(warning, sr.getScaledWidth() / 2 - fontRenderer.getStringWidth(warning) / 2, sr.getScaledHeight() / 2 + 30, 0xFFFFFFFF);
}
}
示例2: onDrawStringWithShadow
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
@Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I"))
public int onDrawStringWithShadow(FontRenderer fontRenderer, String string, float x, float y, int colour) {
try {
string = Serenity.getInstance().getFriendManager().applyProtection(string);
} catch (Exception ignored) {}
return fontRenderer.drawStringWithShadow(string, x, y, colour);
}
示例3: onDrawStringWithShadow
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
@Redirect(method = "drawChat(I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I"))
public int onDrawStringWithShadow(FontRenderer fontRenderer, String string, float x, float y, int colour) {
try {
string = Serenity.getInstance().getFriendManager().applyProtection(string);
} catch (Exception ignored) {}
return fontRenderer.drawStringWithShadow(string, x, y, colour);
}
示例4: render
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
lastMouseX = mouseX;
lastMouseY = mouseY;
float zLevel = 0;
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
int renderBaseX = (int) (oldBaseX + (baseX - oldBaseX) * partialTicks);
int renderAffectedY = (int) (oldAffectedY + (affectedY - oldAffectedY) * partialTicks);
int renderWidth = (int) (oldWidth + (width - oldWidth) * partialTicks);
int renderHeight = (int) (oldHeight + (height - oldHeight) * partialTicks);
if (leftSided) renderWidth *= -1;
Gui.drawRect(renderBaseX, renderAffectedY /* + 1 */, renderBaseX + renderWidth /*- 1*/, renderAffectedY + renderHeight, backGroundColor);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glLineWidth(3.0F);
GL11.glColor4d(0, 0, 0, 1);
BufferBuilder wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION);
wr.pos(renderBaseX, renderAffectedY, zLevel).endVertex();
wr.pos(renderBaseX + renderWidth, renderAffectedY, zLevel).endVertex();
wr.pos(renderBaseX + renderWidth, renderAffectedY + renderHeight, zLevel).endVertex();
wr.pos(renderBaseX, renderAffectedY + renderHeight, zLevel).endVertex();
Tessellator.getInstance().draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
if (leftSided) renderWidth *= -1;
// if done expanding, draw the information
if (doneExpanding) {
GL11.glPushMatrix();
GL11.glTranslated(renderBaseX + (leftSided ? -renderWidth : 16), renderAffectedY, 0);
GL11.glScaled(textSize, textSize, textSize);
GL11.glTranslated(-renderBaseX - (leftSided ? -renderWidth : 16), -renderAffectedY, 0);
fontRenderer.drawStringWithShadow(title, renderBaseX + (leftSided ? -renderWidth + 2 : 18), renderAffectedY + 2, 0xFFFF00);
for (int i = curScroll; i < textList.size() && i < curScroll + MAX_LINES; i++) {
if (textList.get(i).contains("\u00a70") || textList.get(i).contains(TextFormatting.DARK_RED.toString())) {
fontRenderer.drawString(textList.get(i), renderBaseX + (leftSided ? -renderWidth + 2 : 18), renderAffectedY + (i - curScroll) * 10 + 12, 0xFFFFFF);
} else {
fontRenderer.drawStringWithShadow(textList.get(i), renderBaseX + (leftSided ? -renderWidth + 2 : 18), renderAffectedY + (i - curScroll) * 10 + 12, 0xFFFFFF);
}
}
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(renderBaseX, renderAffectedY, 0);
GL11.glEnable(GL11.GL_TEXTURE_2D);
for (IGuiWidget widget : widgets)
widget.render(mouseX - renderBaseX, mouseY - renderAffectedY, partialTicks);
GL11.glPopMatrix();
}
if (renderHeight > 16 && renderWidth > 16) {
GL11.glColor4d(1, 1, 1, 1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if (iStack.isEmpty()) {
if (texture.contains(Textures.GUI_LOCATION)) {
GuiPneumaticContainerBase.drawTexture(texture, renderBaseX - (leftSided ? 16 : 0), renderAffectedY);
} else {
fontRenderer.drawString(texture, renderBaseX - (leftSided ? 16 : 0), renderAffectedY, 0xFFFFFFFF);
}
} else if (gui != null || !(iStack.getItem() instanceof ItemBlock)) {
if (itemRenderer == null) itemRenderer = Minecraft.getMinecraft().getRenderItem();
itemRenderer.zLevel = 1;
GL11.glPushMatrix();
GL11.glTranslated(0, 0, -50);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
itemRenderer.renderItemAndEffectIntoGUI(iStack, renderBaseX - (leftSided ? 16 : 0), renderAffectedY);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
GL11.glDisable(GL11.GL_BLEND);
}
}
示例5: drawScreen
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
public void drawScreen()
{
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_FOG);
Tessellator tessellator = Tessellator.instance;
this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f1 = 32.0F;
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(2105376);
tessellator.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, (double) ((float) this.left / f1), (double) ((float) this.bottom / f1));
tessellator.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, (double) ((float) this.right / f1), (double) ((float) this.bottom / f1));
tessellator.addVertexWithUV((double) this.right, (double) this.top, 0.0D, (double) ((float) this.right / f1), (double) ((float) this.top / f1));
tessellator.addVertexWithUV((double) this.left, (double) this.top, 0.0D, (double) ((float) this.left / f1), (double) ((float) this.top / f1));
tessellator.draw();
GL11.glDisable(GL11.GL_DEPTH_TEST);
byte b0 = 4;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 0, 1);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_TEXTURE_2D);
tessellator.startDrawingQuads();
tessellator.setColorRGBA_I(0, 0);
tessellator.addVertexWithUV((double) this.left, (double) (this.top + b0), 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV((double) this.right, (double) (this.top + b0), 0.0D, 1.0D, 1.0D);
tessellator.setColorRGBA_I(0, 255);
tessellator.addVertexWithUV((double) this.right, (double) this.top, 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double) this.left, (double) this.top, 0.0D, 0.0D, 0.0D);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorRGBA_I(0, 255);
tessellator.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, 1.0D, 1.0D);
tessellator.setColorRGBA_I(0, 0);
tessellator.addVertexWithUV((double) this.right, (double) (this.bottom - b0), 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double) this.left, (double) (this.bottom - b0), 0.0D, 0.0D, 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
int titleWidth = fontRenderer.getStringWidth(title);
fontRenderer.drawStringWithShadow(title, this.left + ((this.right - this.left) / 2) - (titleWidth / 2), this.top + 2, 0xFFFFFF);
int topStart = this.top + 15;
for (String line : lines)
{
if (centeredF)
{
int stringWidth = fontRenderer.getStringWidth(line);
fontRenderer.drawStringWithShadow(line, this.left + ((this.right - this.left) / 2) - (stringWidth / 2), topStart, 0xFFFFFF);
}
else
{
fontRenderer.drawStringWithShadow(line, this.left, topStart, 0xFFFFFF);
}
topStart += 10;
}
}
示例6: drawScreen
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
public void drawScreen()
{
GlStateManager.disableLighting();
GlStateManager.disableFog();
Tessellator tessellator = Tessellator.getInstance();
IBufferProxy buffer = Util.getBufferProxy();
this.mc.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
float f = 32.0F;
buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
buffer.pos((double) this.left, (double) this.bottom, 0.0D).tex((double) ((float) this.left / f), (double) ((float) this.bottom / f)).color(32, 32, 32, 255).endVertex();
buffer.pos((double) this.right, (double) this.bottom, 0.0D).tex((double) ((float) this.right / f), (double) ((float) this.bottom / f)).color(32, 32, 32, 255).endVertex();
buffer.pos((double) this.right, (double) this.top, 0.0D).tex((double) ((float) this.right / f), (double) ((float) this.top / f)).color(32, 32, 32, 255).endVertex();
buffer.pos((double) this.left, (double) this.top, 0.0D).tex((double) ((float) this.left / f), (double) ((float) this.top / f)).color(32, 32, 32, 255).endVertex();
tessellator.draw();
GlStateManager.disableDepth();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE);
GlStateManager.disableAlpha();
GlStateManager.shadeModel(7425);
GlStateManager.disableTexture2D();
buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
buffer.pos((double) this.left, (double) (this.top + 4), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex();
buffer.pos((double) this.right, (double) (this.top + 4), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex();
buffer.pos((double) this.right, (double) this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
buffer.pos((double) this.left, (double) this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
tessellator.draw();
buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
buffer.pos((double) this.left, (double) this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
buffer.pos((double) this.right, (double) this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
buffer.pos((double) this.right, (double) (this.bottom - 4), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex();
buffer.pos((double) this.left, (double) (this.bottom - 4), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.shadeModel(7424);
GlStateManager.enableAlpha();
GlStateManager.disableBlend();
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
int titleWidth = fontRenderer.getStringWidth(title);
fontRenderer.drawStringWithShadow(title, this.left + ((this.right - this.left) / 2) - (titleWidth / 2), this.top + 2, 0xFFFFFF);
int topStart = this.top + 15;
for (String line : lines)
{
if (centeredF)
{
int stringWidth = fontRenderer.getStringWidth(line);
fontRenderer.drawStringWithShadow(line, this.left + ((this.right - this.left) / 2) - (stringWidth / 2), topStart, 0xFFFFFF);
}
else
{
fontRenderer.drawStringWithShadow(line, this.left, topStart, 0xFFFFFF);
}
topStart += 10;
}
}
示例7: renderItemOverlayIntoGUI
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
public void renderItemOverlayIntoGUI(FontRenderer p_94148_1_, TextureManager p_94148_2_, ItemStack p_94148_3_, int p_94148_4_, int p_94148_5_, String p_94148_6_, boolean t)
{
if (p_94148_3_ != null)
{
if ( t ) {
if (p_94148_3_.stackSize > 1 || p_94148_6_ != null)
{
String s1 = p_94148_6_ == null ? String.valueOf(p_94148_3_.stackSize) : p_94148_6_;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_BLEND);
p_94148_1_.drawStringWithShadow(s1, p_94148_4_ + 19 - 2 - p_94148_1_.getStringWidth(s1), p_94148_5_ + 6 + 3, 16777215);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
} else if (p_94148_3_.getItem().showDurabilityBar(p_94148_3_))
{
double health = p_94148_3_.getItem().getDurabilityForDisplay(p_94148_3_);
int j1 = (int)Math.round(13.0D - health * 13.0D);
int k = (int)Math.round(255.0D - health * 255.0D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
Tessellator tessellator = Tessellator.instance;
int l = 255 - k << 16 | k << 8;
int i1 = (255 - k) / 4 << 16 | 16128;
renderQuad(tessellator, p_94148_4_ + 2, p_94148_5_ + 13, 13, 2, 0);
this.renderQuad(tessellator, p_94148_4_ + 2, p_94148_5_ + 13, 12, 1, i1);
this.renderQuad(tessellator, p_94148_4_ + 2, p_94148_5_ + 13, j1, 1, l);
//GL11.glEnable(GL11.GL_BLEND); // Forge: Disable Bled because it screws with a lot of things down the line.
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
}
示例8: renderItemOverlayIntoGUI
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
@Override
public void renderItemOverlayIntoGUI(FontRenderer fontRenderer, @Nonnull ItemStack is, int par4, int par5, String par6Str) {
if (!is.isEmpty() && !dankNull.isEmpty()) {
float scaleFactor = useLg ? 1.0F : 0.5F;
float inverseScaleFactor = 1.0F / scaleFactor;
int offset = useLg ? 0 : -1;
String stackSize = "";
boolean unicodeFlag = fontRenderer.getUnicodeFlag();
fontRenderer.setUnicodeFlag(false);
if (is.getItem().showDurabilityBar(is)) {
double health = is.getItem().getDurabilityForDisplay(is);
int j = (int) Math.round(13.0D - health * 13.0D);
int i = (int) Math.round(255.0D - health * 255.0D);
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
draw(vertexbuffer, par4 + 2, par5 + 13, 13, 2, 0, 0, 0, 255);
draw(vertexbuffer, par4 + 2, par5 + 13, 12, 1, (255 - i) / 4, 64, 0, 255);
draw(vertexbuffer, par4 + 2, par5 + 13, j, 1, 255 - i, i, 0, 255);
GlStateManager.enableTexture2D();
GlStateManager.enableDepth();
}
int amount = 0;
amount = is.getCount();
if (container != null) {
//amount = container.getDankNullInventory().getSizeForSlot(DankNullUtils.getIndexForStack(container.getDankNullInventory(), is));
}
if (amount < 0 || amount > 127) {
//amount = (byte) amount & (0xff);
}
if (amount != 0) {
scaleFactor = 0.5F;
inverseScaleFactor = 1.0F / scaleFactor;
offset = -1;
stackSize = getToBeRenderedStackSize(amount);
}
GlStateManager.disableLighting();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
GlStateManager.disableDepth();
GlStateManager.pushMatrix();
GlStateManager.scale(scaleFactor, scaleFactor, scaleFactor);
int X = (int) ((par4 + offset + 16.0F - fontRenderer.getStringWidth(stackSize) * scaleFactor) * inverseScaleFactor);
int Y = (int) ((par5 + offset + 16.0F - 7.0F * scaleFactor) * inverseScaleFactor);
if (amount > 1L) {
fontRenderer.drawStringWithShadow(stackSize, X, Y, 16777215);
}
GlStateManager.popMatrix();
GlStateManager.enableDepth();
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableLighting();
fontRenderer.setUnicodeFlag(unicodeFlag);
}
}
示例9: renderItemOverlayIntoGUI
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
protected static void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, double xPosition, double yPosition, @Nullable String text, double scale)
{
final double SCALE_RATIO = 1.23076923077D;
if (!stack.isEmpty())
{
if (stack.getCount() != 1 || text != null)
{
String s = text == null ? String.valueOf(stack.getCount()) : text;
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
fr.drawStringWithShadow(s, (float)(xPosition + 19 - 2 - fr.getStringWidth(s)), (float)(yPosition + 6 + 3), 16777215);
GlStateManager.enableLighting();
GlStateManager.enableDepth();
// Fixes opaque cooldown overlay a bit lower
// TODO: check if enabled blending still screws things up down the line.
GlStateManager.enableBlend();
}
if (stack.getItem().showDurabilityBar(stack))
{
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
double health = stack.getItem().getDurabilityForDisplay(stack);
int rgbfordisplay = stack.getItem().getRGBDurabilityForDisplay(stack);
int i = Math.round(13.0F - (float)health * 13.0F);
int j = rgbfordisplay;
draw(xPosition + (scale / 8.D), yPosition + (scale / SCALE_RATIO), 13, 2, 0, 0, 0, 255);
draw(xPosition + (scale / 8.D), yPosition + (scale / SCALE_RATIO), i, 1, j >> 16 & 255, j >> 8 & 255, j & 255, 255);
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player;
float f3 = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks());
if (f3 > 0.0F)
{
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
draw(xPosition, yPosition + scale * (1.0F - f3), 16, scale * f3, 255, 255, 255, 127);
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
}
}
示例10: renderItemOverlayIntoGUI
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
/**
* Renders the stack size and/or damage bar for the given ItemStack.
*/
public static void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, @Nullable String text,
int scaled) {
if (!stack.isEmpty()) {
if (stack.getCount() != 1 || text != null) {
String s = text == null ? String.valueOf(stack.getCount()) : text;
if (text == null && stack.getCount() < 1) {
s = TextFormatting.RED + String.valueOf(stack.getCount());
}
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
if (scaled >= 2) {
GlStateManager.pushMatrix();
GlStateManager.scale(.5f, .5f, .5f);
fr.drawStringWithShadow(s, ((xPosition + 19 - 2) * 2 - 1 - fr.getStringWidth(s)), yPosition * 2 + 24, 16777215);
GlStateManager.popMatrix();
} else if (scaled == 1) {
GlStateManager.pushMatrix();
GlStateManager.scale(.75f, .75f, .75f);
fr.drawStringWithShadow(s, ((xPosition - 2) * 1.34f + 24 - fr.getStringWidth(s)), yPosition * 1.34f + 14, 16777215);
GlStateManager.popMatrix();
} else {
fr.drawStringWithShadow(s, (xPosition + 19 - 2 - fr.getStringWidth(s)), (yPosition + 6 + 3), 16777215);
}
GlStateManager.enableLighting();
GlStateManager.enableDepth();
// Fixes opaque cooldown overlay a bit lower
// TODO: check if enabled blending still screws things up down the line.
GlStateManager.enableBlend();
}
if (stack.getItem().showDurabilityBar(stack)) {
double health = stack.getItem().getDurabilityForDisplay(stack);
int j = (int) Math.round(13.0D - health * 13.0D);
int i = (int) Math.round(255.0D - health * 255.0D);
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
draw(vertexbuffer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
draw(vertexbuffer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255);
draw(vertexbuffer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255);
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player;
float f = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks());
if (f > 0.0F) {
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
Tessellator tessellator1 = Tessellator.getInstance();
VertexBuffer vertexbuffer1 = tessellator1.getBuffer();
draw(vertexbuffer1, xPosition, yPosition + MathHelper.floor(16.0F * (1.0F - f)), 16, MathHelper.ceil(16.0F * f), 255, 255, 255, 127);
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
}
}
示例11: renderItemOverlayIntoGUI
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
/**
* Renders the stack size and/or damage bar for the given ItemStack.
*/
public void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, String text)
{
if (stack != null)
{
if (stack.stackSize != 1 || text != null)
{
String s = text == null ? String.valueOf(stack.stackSize) : text;
if (text == null && stack.stackSize < 1)
{
s = EnumChatFormatting.RED + String.valueOf(stack.stackSize);
}
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
fr.drawStringWithShadow(s, (float)(xPosition + 19 - 2 - fr.getStringWidth(s)), (float)(yPosition + 6 + 3), 16777215);
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
if (stack.isItemDamaged())
{
int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage());
int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage());
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255);
this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255);
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
}
}
示例12: drawTooltips
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
public void drawTooltips(int p_drawTooltips_1_, int p_drawTooltips_2_, List p_drawTooltips_3_)
{
if (Math.abs(p_drawTooltips_1_ - this.lastMouseX) <= 5 && Math.abs(p_drawTooltips_2_ - this.lastMouseY) <= 5)
{
int i = 700;
if (System.currentTimeMillis() >= this.mouseStillTime + (long)i)
{
int j = this.guiScreen.width / 2 - 150;
int k = this.guiScreen.height / 6 - 7;
if (p_drawTooltips_2_ <= k + 98)
{
k += 105;
}
int l = j + 150 + 150;
int i1 = k + 84 + 10;
GuiButton guibutton = this.getSelectedButton(p_drawTooltips_1_, p_drawTooltips_2_, p_drawTooltips_3_);
if (guibutton instanceof IOptionControl)
{
IOptionControl ioptioncontrol = (IOptionControl)guibutton;
GameSettings.Options gamesettings$options = ioptioncontrol.getOption();
String[] astring = getTooltipLines(gamesettings$options);
if (astring == null)
{
return;
}
GuiVideoSettings.drawGradientRect(this.guiScreen, j, k, l, i1, -536870912, -536870912);
for (int j1 = 0; j1 < astring.length; ++j1)
{
String s = astring[j1];
int k1 = 14540253;
if (s.endsWith("!"))
{
k1 = 16719904;
}
FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj;
fontrenderer.drawStringWithShadow(s, (float)(j + 5), (float)(k + 5 + j1 * 11), k1);
}
}
}
}
else
{
this.lastMouseX = p_drawTooltips_1_;
this.lastMouseY = p_drawTooltips_2_;
this.mouseStillTime = System.currentTimeMillis();
}
}
示例13: renderItemOverlayIntoGUI
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
/**
* Renders the stack size and/or damage bar for the given ItemStack.
*/
public void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, String text)
{
if (stack != null)
{
if (stack.stackSize != 1 || text != null)
{
String s = text == null ? String.valueOf(stack.stackSize) : text;
if (text == null && stack.stackSize < 1)
{
s = EnumChatFormatting.RED + String.valueOf(stack.stackSize);
}
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
fr.drawStringWithShadow(s, (float)(xPosition + 19 - 2 - fr.getStringWidth(s)), (float)(yPosition + 6 + 3), 16777215);
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
boolean flag = stack.isItemDamaged();
if (Reflector.ForgeItem_showDurabilityBar.exists())
{
flag = Reflector.callBoolean(stack.getItem(), Reflector.ForgeItem_showDurabilityBar, new Object[] {stack});
}
if (flag)
{
int i = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage());
int j = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage());
if (Reflector.ForgeItem_getDurabilityForDisplay.exists())
{
double d0 = Reflector.callDouble(stack.getItem(), Reflector.ForgeItem_getDurabilityForDisplay, new Object[] {stack});
i = (int)Math.round(13.0D - d0 * 13.0D);
j = (int)Math.round(255.0D - d0 * 255.0D);
}
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - j) / 4, 64, 0, 255);
this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, i, 1, 255 - j, j, 0, 255);
if (!Reflector.ForgeHooksClient.exists())
{
GlStateManager.enableBlend();
}
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
}
}
示例14: drawText
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
public static void drawText(String s, int x, int y, int colour)
{
FontRenderer frendo = Minecraft.getMinecraft().fontRendererObj;
frendo.drawStringWithShadow(s, x, y, colour);
}
示例15: drawText
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
private static void drawText(FontRenderer fr, String text, int xPos, int yPos)
{
fr.drawStringWithShadow(text, xPos - (fr.getStringWidth(text) / 2), yPos, 0xFFFFFF);
}