public GuiUnitProgrammer(List<IProgWidget> progWidgets, FontRenderer fontRenderer, int guiLeft, int guiTop, int width, int height, int xSize, int startX, int startY, int areaWidth, int areaHeight, int translatedX, int translatedY, int lastZoom) { this.fontRenderer = fontRenderer; this.progWidgets = progWidgets; this.guiLeft = guiLeft; this.guiTop = guiTop; setWorldAndResolution(Minecraft.getMinecraft(), width, height); this.xSize = xSize; this.startX = startX; this.startY = startY; this.areaWidth = areaWidth; this.areaHeight = areaHeight; this.translatedX = translatedX; this.translatedY = translatedY; this.lastZoom = lastZoom; scaleScroll = new WidgetVerticalScrollbar(guiLeft + 302, guiTop + 40, 129).setStates(9).setCurrentState(lastZoom).setListening(true); }
public void cacheActiveRenderInfo(World worldIn, TextureManager textureManagerIn, FontRenderer fontrendererIn, Entity entityIn, float partialTicks) { if (this.worldObj != worldIn) { this.setWorld(worldIn); } this.renderEngine = textureManagerIn; this.entity = entityIn; this.fontRenderer = fontrendererIn; this.entityYaw = entityIn.prevRotationYaw + (entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks; this.entityPitch = entityIn.prevRotationPitch + (entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks; this.entityX = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; this.entityY = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; this.entityZ = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; }
public void func_178663_a(float p_178663_1_, int alpha) { int i = -1; String s = FontRenderer.getFormatFromString(this.field_178676_b.getColorPrefix()); if (s.length() >= 2) { i = Minecraft.getMinecraft().fontRendererObj.getColorCode(s.charAt(1)); } if (i >= 0) { float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; Gui.drawRect(1, 1, 15, 15, MathHelper.func_180183_b(f * p_178663_1_, f1 * p_178663_1_, f2 * p_178663_1_) | alpha << 24); } Minecraft.getMinecraft().getTextureManager().bindTexture(this.field_178677_c); GlStateManager.color(p_178663_1_, p_178663_1_, p_178663_1_, (float)alpha / 255.0F); Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); }
@Override public void renderExtraInfo() { if (getExtraStringInfo() != null) { GL11.glPushMatrix(); GL11.glScaled(0.5, 0.5, 0.5); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; String[] splittedInfo = WordUtils.wrap(getExtraStringInfo(), 40).split(System.getProperty("line.separator")); for (int i = 0; i < splittedInfo.length; i++) { int stringLength = fr.getStringWidth(splittedInfo[i]); int startX = getWidth() / 2 - stringLength / 4; int startY = getHeight() / 2 - (fr.FONT_HEIGHT + 1) * (splittedInfo.length - 1) / 4 + (fr.FONT_HEIGHT + 1) * i / 2 - fr.FONT_HEIGHT / 4; Gui.drawRect(startX * 2 - 1, startY * 2 - 1, startX * 2 + stringLength + 1, startY * 2 + fr.FONT_HEIGHT + 1, 0xFFFFFFFF); fr.drawString(splittedInfo[i], startX * 2, startY * 2, 0xFF000000); } GL11.glPopMatrix(); GL11.glColor4d(1, 1, 1, 1); } }
/** * Draws this button to the screen. */ public void drawButton(Minecraft mc, int mouseX, int mouseY) { if (this.visible) { FontRenderer fontrenderer = mc.fontRenderer; this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; int j = 14737632; if (packedFGColour != 0) { j = packedFGColour; } if (this.displayString.equals("\u2718")) { j = 0xFF0000; } else if (this.displayString.equals("\u2714")) { j = 0x00FF00; } this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j); } }
/** * Randomly generates a new name built up of 3 or 4 randomly selected words. */ public String generateNewRandomName(FontRenderer p_148334_1_, int p_148334_2_) { int i = this.rand.nextInt(2) + 3; String s = ""; for (int j = 0; j < i; ++j) { if (j > 0) { s = s + " "; } s = s + this.namePartsArray[this.rand.nextInt(this.namePartsArray.length)]; } List<String> list = p_148334_1_.listFormattedStringToWidth(s, p_148334_2_); return org.apache.commons.lang3.StringUtils.join((Iterable)(list.size() >= 2 ? list.subList(0, 2) : list), " "); }
public void prepare(World p_190056_1_, TextureManager p_190056_2_, FontRenderer p_190056_3_, Entity p_190056_4_, RayTraceResult p_190056_5_, float p_190056_6_) { if (this.worldObj != p_190056_1_) { this.setWorld(p_190056_1_); } this.renderEngine = p_190056_2_; this.entity = p_190056_4_; this.fontRenderer = p_190056_3_; this.cameraHitResult = p_190056_5_; this.entityYaw = p_190056_4_.prevRotationYaw + (p_190056_4_.rotationYaw - p_190056_4_.prevRotationYaw) * p_190056_6_; this.entityPitch = p_190056_4_.prevRotationPitch + (p_190056_4_.rotationPitch - p_190056_4_.prevRotationPitch) * p_190056_6_; this.entityX = p_190056_4_.lastTickPosX + (p_190056_4_.posX - p_190056_4_.lastTickPosX) * (double)p_190056_6_; this.entityY = p_190056_4_.lastTickPosY + (p_190056_4_.posY - p_190056_4_.lastTickPosY) * (double)p_190056_6_; this.entityZ = p_190056_4_.lastTickPosZ + (p_190056_4_.posZ - p_190056_4_.lastTickPosZ) * (double)p_190056_6_; }
private String getButtonText(ShaderOption so, int btnWidth) { String s = so.getNameText(); if (so instanceof ShaderOptionScreen) { ShaderOptionScreen shaderoptionscreen = (ShaderOptionScreen)so; return s + "..."; } else { FontRenderer fontrenderer = Config.getMinecraft().fontRendererObj; for (int i = fontrenderer.getStringWidth(": " + Lang.getOff()) + 5; fontrenderer.getStringWidth(s) + i >= btnWidth && s.length() > 0; s = s.substring(0, s.length() - 1)) { ; } String s1 = so.isChanged() ? so.getValueColor(so.getValue()) : ""; String s2 = so.getValueText(so.getValue()); return s + ": " + s1 + s2; } }
@Override public void drawForegroundLayer(BasicTeslaGuiContainer container, int guiX, int guiY, int mouseX, int mouseY) { super.drawForegroundLayer(container, guiX, guiY, mouseX, mouseY); if (this.tile != null) { long timeLeft = 0; long generatingRate = 0; if (this.tile.getGeneratedPowerStored() > 0) { timeLeft = ((this.tile.getGeneratedPowerStored() / 2) / this.tile.getGeneratedPowerReleaseRate()) / 20; generatingRate = this.tile.getGeneratedPowerReleaseRate(); } FontRenderer renderer = Minecraft.getMinecraft().fontRenderer; GlStateManager.pushMatrix(); GlStateManager.translate(this.getLeft() + 2, this.getTop() + 2, 0); GlStateManager.scale(1, 1, 1); renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.burning").getFormattedText(), 4, 4, 0xFFFFFF); renderer.drawString(TextFormatting.DARK_GRAY + getFormatedTime(timeLeft * 1000), 8, (renderer.FONT_HEIGHT) + 5, 0xFFFFFF); renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.producing").getFormattedText(), 4, 2 * (renderer.FONT_HEIGHT) + 9, 0xFFFFFF); renderer.drawString(TextFormatting.DARK_GRAY + "" + generatingRate + " RF/tick", 8, 3 * (renderer.FONT_HEIGHT) + 10, 0xFFFFFF); GlStateManager.popMatrix(); } }
@Override public void drawForegroundLayer(BasicTeslaGuiContainer container, int guiX, int guiY, int mouseX, int mouseY) { super.drawForegroundLayer(container, guiX, guiY, mouseX, mouseY); if (this.tile != null) { FontRenderer renderer = Minecraft.getMinecraft().fontRenderer; GlStateManager.pushMatrix(); GlStateManager.translate(this.getLeft() + 2, this.getTop() + 8, 0); GlStateManager.scale(1, 1, 1); if (!tile.getItemStack().isEmpty()) { ItemStackUtils.renderItemIntoGUI(tile.getItemStack(), 1, 0, 7); String display = new TextComponentTranslation(tile.getDisplayNameUnlocalized()).getUnformattedText(); renderer.drawString(TextFormatting.DARK_GRAY + display.substring(0, Math.min(display.length(), 21)) + (display.length() > 21 ? "." : ""), 20, 4, 0xFFFFFF); renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.amount").getUnformattedText() + " " + new DecimalFormat().format(tile.getAmount()), 4, (renderer.FONT_HEIGHT) * 3, 0xFFFFFF); } else { renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.empty").getFormattedText(), 4, 4, 0xFFFFFF); } GlStateManager.popMatrix(); } }
@Override public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { if (this.visible) { int x = this.x + this.parentGui.getGuiLeft(); FontRenderer fontrenderer = mc.fontRenderer; int k = this.getHoverState(this.hovered); mc.getTextureManager().bindTexture(GuiPlayerInventoryExtended.background); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.hovered = mouseX >= x && mouseY >= this.y && mouseX < x + this.width && mouseY < this.y + this.height; GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.pushMatrix(); GlStateManager.translate(0, 0, 200); HarshenClientUtils.drawTexture(x, this.y, 16.9f, (k - 1) * 7f, 7f, 7f, 24, 24, 24, 24); if (k!=1) this.drawCenteredString(fontrenderer, I18n.translateToLocalFormatted(this.displayString), x + 5, this.y + this.height, 0xffffff); GlStateManager.popMatrix(); this.mouseDragged(mc, mouseX, mouseY); } }
@Override protected void drawSlot(int idx, int right, int top, int height, Tessellator tess) { if(idx >= 0 && idx < channels.size()) { FontRenderer font = this.parent.getFontRenderer(); String channel = channels.get(idx); GlStateManager.pushMatrix(); GlStateManager.scale(0.5F, 0.5F, 1F); String name = font.trimStringToWidth(channel.substring(channel.indexOf(":") + 1), (listWidth - 10) * 2); if(channel.startsWith("public:")) { name = I18n.translateToLocal("glass.gui.public") + " " + name; } font.drawString(name, (this.left + 2) * 2, top * 2, idx % 2 == 0 ? 0xFFFFFF : 0xAAAAAA); GlStateManager.popMatrix(); } }
private static void renderFreq(int freq) { float scale = 1 / 64F; GlStateManager.pushMatrix(); GlStateManager.rotate(90, 0, 1, 0); GlStateManager.rotate(90, 1, 0, 0); GlStateManager.translate(0, -5 / 16D, 0.374); GlStateManager.scale(scale, scale, scale); FontRenderer font = Minecraft.getMinecraft().fontRendererObj; String s = Integer.toString(freq); GlStateManager.depthMask(false); font.drawString(s, -font.getStringWidth(s) / 2, 0, 0); GlStateManager.depthMask(true); GlStateManager.popMatrix(); }
protected int getTeamColor(T entityIn) { int i = 16777215; ScorePlayerTeam scoreplayerteam = (ScorePlayerTeam)entityIn.getTeam(); if (scoreplayerteam != null) { String s = FontRenderer.getFormatFromString(scoreplayerteam.getColorPrefix()); if (s.length() >= 2) { i = this.getFontRendererFromRenderManager().getColorCode(s.charAt(1)); } } return i; }
public void renderIcon(float p_178663_1_, int alpha) { int i = -1; String s = FontRenderer.getFormatFromString(this.team.getColorPrefix()); if (s.length() >= 2) { i = Minecraft.getMinecraft().fontRendererObj.getColorCode(s.charAt(1)); } if (i >= 0) { float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; Gui.drawRect(1, 1, 15, 15, MathHelper.rgb(f * p_178663_1_, f1 * p_178663_1_, f2 * p_178663_1_) | alpha << 24); } Minecraft.getMinecraft().getTextureManager().bindTexture(this.location); GlStateManager.color(p_178663_1_, p_178663_1_, p_178663_1_, (float)alpha / 255.0F); Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); }
private void drawStack(ItemStack stack, int x, int y, String altText) { //GlStateManager.translate(0.0F, 0.0F, 32.0F); MCPrivateUtils.setGuiZLevel(this, 200.0F); MCPrivateUtils.setGuiScreenRendererZLevel(this, 200.0F); FontRenderer font = null; if (stack != null) { font = stack.getItem().getFontRenderer(stack); } if (font == null) { font = RenderUtils.getFontRenderer(); } MCPrivateUtils.getGuiScreenRenderItem(this).renderItemAndEffectIntoGUI(stack, x, y); MCPrivateUtils.getGuiScreenRenderItem(this).renderItemOverlayIntoGUI(font, stack, x, y, altText); MCPrivateUtils.setGuiScreenRendererZLevel(this, 0.0F); MCPrivateUtils.setGuiZLevel(this, 0.0F); //GlStateManager.translate(0.0F, 0.0F, -32.0F); }
@Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;getStringWidth(Ljava/lang/String;)I")) public int onGetStringWidth(FontRenderer fontRenderer, String string) { try { string = Serenity.getInstance().getFriendManager().applyProtection(string); } catch (Exception ignored) {} return fontRenderer.getStringWidth(string); }
@Override public void render(TileEntityAphorismTile te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glScalef(1.0F, -1F, -1F); PneumaticCraftUtils.rotateMatrixByMetadata(te.getBlockMetadata()); GL11.glTranslatef(0, 1, 0.5F - BBConstants.APHORISM_TILE_THICKNESS - 0.01F); String[] textLines = te.getTextLines(); int lineWidth = getMaxLineWidth(textLines); // TODO we don't need to calculate this every single tick int lineHeight = 10 * textLines.length; float textScale = Math.min(14 / 16F / lineWidth, 14 / 16F / lineHeight); GL11.glScalef(textScale, textScale, textScale); GL11.glRotatef(te.textRotation * 90, 0, 0, 1); int editedLine = -1; if (FMLClientHandler.instance().getClient().currentScreen instanceof GuiAphorismTile) { GuiAphorismTile gui = (GuiAphorismTile) FMLClientHandler.instance().getClient().currentScreen; if (gui.tile == te && (gui.updateCounter & 0x0f) < 8) { editedLine = gui.cursorY; } } FontRenderer f = Minecraft.getMinecraft().getRenderManager().getFontRenderer(); for (int i = 0; i < textLines.length; i++) { String textLine = textLines[i]; if (editedLine == i) textLine = ">" + textLine + "<"; f.drawString(textLine, -f.getStringWidth(textLine) / 2, -(textLines.length * 10) / 2 + i * 10 + 1, 0xFF000000); } GL11.glPopMatrix(); }
public void cacheActiveRenderInfo(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn, Entity pointedEntityIn, GameSettings optionsIn, float partialTicks) { this.worldObj = worldIn; this.options = optionsIn; this.renderViewEntity = livingPlayerIn; this.pointedEntity = pointedEntityIn; this.textRenderer = textRendererIn; if (livingPlayerIn instanceof EntityLivingBase && ((EntityLivingBase)livingPlayerIn).isPlayerSleeping()) { IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); Block block = iblockstate.getBlock(); if (block.isBed(iblockstate, worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn)) { int i = block.getBedDirection(iblockstate, worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); this.playerViewY = (float)(i * 90 + 180); this.playerViewX = 0.0F; } } else { this.playerViewY = livingPlayerIn.prevRotationYaw + (livingPlayerIn.rotationYaw - livingPlayerIn.prevRotationYaw) * partialTicks; this.playerViewX = livingPlayerIn.prevRotationPitch + (livingPlayerIn.rotationPitch - livingPlayerIn.prevRotationPitch) * partialTicks; } if (optionsIn.thirdPersonView == 2) { this.playerViewY += 180.0F; } this.viewerPosX = livingPlayerIn.lastTickPosX + (livingPlayerIn.posX - livingPlayerIn.lastTickPosX) * (double)partialTicks; this.viewerPosY = livingPlayerIn.lastTickPosY + (livingPlayerIn.posY - livingPlayerIn.lastTickPosY) * (double)partialTicks; this.viewerPosZ = livingPlayerIn.lastTickPosZ + (livingPlayerIn.posZ - livingPlayerIn.lastTickPosZ) * (double)partialTicks; }
public static void mainMenuMouseClick(int mouseX, int mouseY, int mouseButton, FontRenderer font, int width) { if (!Loader.instance().java8) { if (mouseY >= (4 + (8 * 10)) && mouseY < (4 + (10 * 10))) { int w = font.getStringWidth(I18n.format("fml.messages.java8warning.1", TextFormatting.RED, TextFormatting.RESET)); w = Math.max(w, font.getStringWidth(I18n.format("fml.messages.java8warning.2"))); if (mouseX >= ((width - w) / 2) && mouseX <= ((width + w) / 2)) { FMLClientHandler.instance().showGuiScreen(new GuiJava8Error(new Java8VersionException(Collections.<ModContainer>emptyList()))); } } } }
public GuiObjectTitle(String text, FontRenderer font, double x, double y, int r, int g, int b, int a, int lifetime){ this.x = x; this.y = y; this.font = font; this.r = r; this.g = g; this.b = b; this.a = a; this.lifetime = lifetime; this.maxLifetime = lifetime; this.text = text; }
protected boolean setScoreTeamColor(T entityLivingBaseIn) { int i = 16777215; if (entityLivingBaseIn instanceof EntityPlayer) { ScorePlayerTeam scoreplayerteam = (ScorePlayerTeam)entityLivingBaseIn.getTeam(); if (scoreplayerteam != null) { String s = FontRenderer.getFormatFromString(scoreplayerteam.getColorPrefix()); if (s.length() >= 2) { i = this.getFontRendererFromRenderManager().getColorCode(s.charAt(1)); } } } float f1 = (float)(i >> 16 & 255) / 255.0F; float f2 = (float)(i >> 8 & 255) / 255.0F; float f = (float)(i & 255) / 255.0F; GlStateManager.disableLighting(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.color(f1, f2, f, 1.0F); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); return true; }
public static void drawNameplate(FontRenderer fontRendererIn, String str, float x, float y, float z, int verticalShift, float viewerYaw, float viewerPitch, boolean isThirdPersonFrontal, boolean isSneaking) { EntityRenderer.drawNameplate(fontRendererIn, str, x, y, z, verticalShift, viewerYaw, viewerPitch, isThirdPersonFrontal, isSneaking); }
public GuiPasswordField(int componentId, FontRenderer fontrendererObj, int x, int y, int par5Width, int par6Height) { this.id = componentId; this.fontRendererInstance = fontrendererObj; this.xPosition = x; this.yPosition = y; this.width = par5Width; this.height = par6Height; }
public Pre(@Nullable ItemStack stack, @Nonnull List<String> lines, int x, int y, int screenWidth, int screenHeight, int maxWidth, @Nonnull FontRenderer fr) { super(stack, lines, x, y, fr); this.screenWidth = screenWidth; this.screenHeight = screenHeight; this.maxWidth = maxWidth; }
@Override public int getDefaultWidth() { FontRenderer fr = Fonts.segoe18; return fr.getStringWidth(setting.getName()) + fr.getStringWidth(setting.getValueString()) + 6; }
@Override protected int getTeamColor(AbstractClientPlayer entityIn) { int i = 16777215; ScorePlayerTeam scoreplayerteam = entityIn.world.getScoreboard() .getPlayersTeam(WeaponsCapability.get(entityIn).getDisguiseType().substring(2)); if (scoreplayerteam != null) { String s = FontRenderer.getFormatFromString(scoreplayerteam.getPrefix()); if (s.length() >= 2) i = this.getFontRendererFromRenderManager().getColorCode(s.charAt(1)); } return i; }
@Override public void drawScreenPost(CategoryEntry entry, GUIBookBase base, int mouseX, int mouseY, float partialTicks, FontRenderer renderer) { for (int pos = 0; pos < itemStacks.size(); ++pos) { int itemsRow = (base.getGuiXSize() - 40) / 18; if (mouseX >= base.getGuiLeft() + 15 + (pos % itemsRow) * 20 && mouseX <= base.getGuiLeft() + 15 + (pos % itemsRow) * 20 + 16 && mouseY >= base.getGuiTop() + 35 + (pos / itemsRow) * 20 && mouseY <= base.getGuiTop() + 35 + (pos / itemsRow) * 20 + 16) { base.drawHoveringText(itemStacks.get(pos).getTooltip(null, ITooltipFlag.TooltipFlags.NORMAL), mouseX, mouseY); break; } } }
@SideOnly(Side.CLIENT) @Override public void drawScreenPre(CategoryEntry entry, GUIBookBase base, int mouseX, int mouseY, float partialTicks, FontRenderer renderer) { //base.drawCenteredString(renderer, TextFormatting.AQUA+"Recipe"+TextFormatting.RESET, base.getGuiLeft()+base.getGuiXSize()/2,base.getGuiTop()+30,0xFFFFFF); base.mc.getTextureManager().bindTexture(GUIBookBase.BOOK_EXTRAS); base.drawTexturedModalRect(base.getGuiLeft() + 20, base.getGuiTop() + 64, 45, 1, 124, 62); int pos = 0; RenderHelper.enableGUIStandardItemLighting(); for (Ingredient ingredient : recipe.getIngredients()) { if (ingredient != null && ingredient.getMatchingStacks().length > 0) base.mc.getRenderItem().renderItemIntoGUI(ingredient.getMatchingStacks()[0], base.getGuiLeft() + 25 + (pos % 3) * 18, base.getGuiTop() + 69 + (pos / 3) * 18); ++pos; } base.mc.getRenderItem().renderItemIntoGUI(recipe.getRecipeOutput(), base.getGuiLeft() + 25 + 94, base.getGuiTop() + 69 + 18); }
public static void renderDebugText(String str, double x, double y, double z, float partialTicks, int color) { Minecraft minecraft = Minecraft.getMinecraft(); if (minecraft.thePlayer != null && minecraft.getRenderManager() != null && minecraft.getRenderManager().options != null) { FontRenderer fontrenderer = minecraft.fontRendererObj; EntityPlayer entityplayer = minecraft.thePlayer; double d0 = entityplayer.lastTickPosX + (entityplayer.posX - entityplayer.lastTickPosX) * (double)partialTicks; double d1 = entityplayer.lastTickPosY + (entityplayer.posY - entityplayer.lastTickPosY) * (double)partialTicks; double d2 = entityplayer.lastTickPosZ + (entityplayer.posZ - entityplayer.lastTickPosZ) * (double)partialTicks; GlStateManager.pushMatrix(); GlStateManager.translate((float)(x - d0), (float)(y - d1) + 0.07F, (float)(z - d2)); GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.scale(0.02F, -0.02F, 0.02F); RenderManager rendermanager = minecraft.getRenderManager(); GlStateManager.rotate(-rendermanager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float)(rendermanager.options.thirdPersonView == 2 ? 1 : -1) * rendermanager.playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.disableLighting(); GlStateManager.enableTexture2D(); GlStateManager.enableDepth(); GlStateManager.depthMask(true); GlStateManager.scale(-1.0F, 1.0F, 1.0F); fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, 0, color); GlStateManager.enableLighting(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } }
@Override public int calcSplit(IGuideRenderer guide, int previousPoint, int height) { FontRenderer font = guide.getFontRenderer(); previousPoint++; int lines = text.size() - previousPoint; int maxLines = height / font.FONT_HEIGHT; return previousPoint + Math.min(maxLines, lines); }
public void cacheActiveRenderInfo(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn, Entity pointedEntityIn, GameSettings optionsIn, float partialTicks) { this.worldObj = worldIn; this.options = optionsIn; this.livingPlayer = livingPlayerIn; this.pointedEntity = pointedEntityIn; this.textRenderer = textRendererIn; if (livingPlayerIn instanceof EntityLivingBase && ((EntityLivingBase)livingPlayerIn).isPlayerSleeping()) { IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); Block block = iblockstate.getBlock(); if (block == Blocks.bed) { int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); this.playerViewY = (float)(i * 90 + 180); this.playerViewX = 0.0F; } } else { this.playerViewY = livingPlayerIn.prevRotationYaw + (livingPlayerIn.rotationYaw - livingPlayerIn.prevRotationYaw) * partialTicks; this.playerViewX = livingPlayerIn.prevRotationPitch + (livingPlayerIn.rotationPitch - livingPlayerIn.prevRotationPitch) * partialTicks; } if (optionsIn.thirdPersonView == 2) { this.playerViewY += 180.0F; } this.viewerPosX = livingPlayerIn.lastTickPosX + (livingPlayerIn.posX - livingPlayerIn.lastTickPosX) * (double)partialTicks; this.viewerPosY = livingPlayerIn.lastTickPosY + (livingPlayerIn.posY - livingPlayerIn.lastTickPosY) * (double)partialTicks; this.viewerPosZ = livingPlayerIn.lastTickPosZ + (livingPlayerIn.posZ - livingPlayerIn.lastTickPosZ) * (double)partialTicks; }
@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); }
protected void renderName(EntityItemFrame entity, double x, double y, double z) { if (Minecraft.isGuiEnabled() && entity.getDisplayedItem() != null && entity.getDisplayedItem().hasDisplayName() && this.renderManager.pointedEntity == entity) { float f = 1.6F; float f1 = 0.016666668F * f; double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); float f2 = entity.isSneaking() ? 32.0F : 64.0F; if (d0 < (double)(f2 * f2)) { String s = entity.getDisplayedItem().getDisplayName(); if (entity.isSneaking()) { FontRenderer fontrenderer = this.getFontRendererFromRenderManager(); GlStateManager.pushMatrix(); GlStateManager.translate((float)x + 0.0F, (float)y + entity.height + 0.5F, (float)z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-f1, -f1, f1); GlStateManager.disableLighting(); GlStateManager.translate(0.0F, 0.25F / f1, 0.0F); GlStateManager.depthMask(false); GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 771); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int i = fontrenderer.getStringWidth(s) / 2; GlStateManager.disableTexture2D(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos((double)(-i - 1), -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos((double)(-i - 1), 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos((double)(i + 1), 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos((double)(i + 1), -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.depthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 553648127); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } else { this.renderLivingLabel(entity, s, x, y, z, 64); } } } }
public PostBackground(@Nullable ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height) { super(stack, textLines, x, y, fr, width, height); }
public FontRenderer getFontRenderer() { return this.rendererDispatcher.getFontRenderer(); }