@Override @SideOnly(Side.CLIENT) public @Nullable IConduitTexture getTransmitionTextureForState(@Nonnull CollidableComponent component) { if (isActive() && tank.containsValidLiquid()) { return new ConduitTextureWrapper(RenderUtil.getStillTexture(tank.getFluid())); } return null; }
public static void renderGuiTank(@Nonnull FluidTank tank, double x, double y, double zLevel, double width, double height) { renderGuiTank(tank.getFluid(), tank.getCapacity(), tank.getFluidAmount(), x, y, zLevel, width, height); }
public static void addBakedQuads(@Nonnull List<BakedQuad> quads, @Nonnull BoundingBox bound, @Nonnull TextureAtlasSprite tex) { RenderUtil.addBakedQuads(quads, bound, tex); }
public static void renderBoundingBox(@Nonnull BoundingBox bb, @Nonnull IBlockState state) { renderBoundingBox(bb, getTexture(state)); }
public static @Nonnull TextureAtlasSprite getStillTexture(@Nonnull FluidStack fluidstack) { final Fluid fluid = fluidstack.getFluid(); if (fluid == null) { return getMissingSprite(); } return getStillTexture(fluid); }
@Override public void renderParticle(@Nonnull BufferBuilder worldRendererIn, @Nonnull Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { GlStateManager.pushMatrix(); GlStateManager.enableLighting(); GlStateManager.disableLighting(); GlStateManager.disableCull(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); RenderUtil.bindBlockTexture(); GlStateManager.depthMask(false); float scale = Math.min((age + partialTicks) / INIT_TIME, 1); // Vanilla bug? Particle.interpPosX/Y/Z variables are always one frame behind double x = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * partialTicks; double y = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * partialTicks; double z = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * partialTicks; GlStateManager.translate(-x, -y, -z); GlStateManager.color(color.x, color.y, color.z, color.w); RenderUtil.renderBoundingBox(scale(owner.getPos(), getBounds(), scale).expand(0.01, 0.01, 0.01), IconUtil.instance.whiteTexture); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.enableCull(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }
private void renderVat(@Nonnull TextureAtlasSprite inputIcon, @Nonnull TextureAtlasSprite outputIcon, float progress) { RenderUtil.bindBlockTexture(); int x = guiLeft + 76; int y = guiTop + 34; GlStateManager.enableBlend(); GlStateManager.color(1, 1, 1, 0.75f * (1f - progress)); drawTexturedModalRect(x, y, inputIcon, 26, 28); GlStateManager.color(1, 1, 1, 0.75f * progress); drawTexturedModalRect(x, y, outputIcon, 26, 28); GlStateManager.disableBlend(); GlStateManager.color(1, 1, 1, 1); bindGuiTexture(); drawTexturedModalRect(x, y, 0, 256 - 28, 26, 28); }
public void bindGuiTexture(int id) { RenderUtil.bindTexture(getGuiTexture(id)); }
private void renderSelection() { if (selection == null) { return; } BoundingBox bb = new BoundingBox(selection.config.getLocation()); TextureAtlasSprite icon = selectedFaceIcon.get(TextureAtlasSprite.class); List<Vertex> corners = bb.getCornersWithUvForFace(selection.face, icon.getMinU(), icon.getMaxU(), icon.getMinV(), icon.getMaxV()); GlStateManager.disableDepth(); GlStateManager.disableLighting(); RenderUtil.bindBlockTexture(); BufferBuilder tes = Tessellator.getInstance().getBuffer(); GlStateManager.color(1, 1, 1); Vector3d trans = new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z); tes.setTranslation(trans.x, trans.y, trans.z); RenderUtil.addVerticesToTessellator(corners, DefaultVertexFormats.POSITION_TEX, true); Tessellator.getInstance().draw(); tes.setTranslation(0, 0, 0); }
TextureAtlasSprite icon = getStillTexture(fluid); RenderUtil.bindBlockTexture(); int color = fluid.getFluid().getColor(fluid); GlStateManager.color((color >> 16 & 0xFF) / 255f, (color >> 8 & 0xFF) / 255f, (color & 0xFF) / 255f);
inputIcon = RenderUtil.getStillTexture(vat.currentTaskInputFluid); outputIcon = RenderUtil.getStillTexture(vat.currentTaskOutputFluid); RenderUtil.renderGuiTank(vat.inputTank, x, y, zLevel, 15, 47); x = guiLeft + 132; RenderUtil.renderGuiTank(vat.outputTank, x, y, zLevel, 15, 47);
FluidStack fluid = lc.getFluidType(); @Nonnull TextureAtlasSprite texture = fluid != null ? RenderUtil.getStillTexture(fluid) : lc.getNotSetEdgeTexture(); if (dir != componentDirection && dir != componentDirection.getOpposite()) { EnumFacing vDir = RenderUtil.getVDirForFace(dir); if (componentDirection == EnumFacing.UP || componentDirection == EnumFacing.DOWN) { vDir = RenderUtil.getUDirForFace(dir); } else if ((componentDirection == EnumFacing.NORTH || componentDirection == EnumFacing.SOUTH) && dir.getFrontOffsetY() != 0) { vDir = RenderUtil.getUDirForFace(dir);
@Override public void apply(@Nonnull EnumFacing face) { addBakedQuadForFace(quads, bb, tex, face, uvs, null, false, false, true, color); } });
public static void render(@Nonnull Gui gui, int x, int y, int length, @Nonnull ExperienceContainer xpCont, int required) { String text = xpCont.getExperienceLevel() + ""; int color = 8453920; boolean shadow = true; if (required > 0) { text += "/" + required; if (required > xpCont.getExperienceLevel()) { color = ColorUtil.getRGB(1f, 0, 0.1f); shadow = false; } } FontRenderer fr = Minecraft.getMinecraft().fontRenderer; int strX = x + length / 2 - fr.getStringWidth(text) / 2; fr.drawString(text, strX, y - 11, color, shadow); RenderUtil.bindTexture(IconEIO.TEXTURE); GlStateManager.color(1f, 1f, 1f, 1f); int xpScaled = xpCont.getXpBarScaled(length - 2); // x, y, u, v, width, height // start of 'slot' gui.drawTexturedModalRect(x, y, 0, 91, 1, 5); gui.drawTexturedModalRect(x + 1, y, 1, 91, length - 2, 5); gui.drawTexturedModalRect(x + length - 1, y, 125, 91, 1, 5); RenderUtil.renderQuad2D(x + 1, y + 1, 0, xpScaled, 3, ColorUtil.getRGB(0, 127, 14)); }
public static void drawBillboardedText(@Nonnull Vector3f pos, @Nonnull String text, float size, @Nonnull Vector4f txtCol, boolean drawShadow, @Nullable Vector4f shadowCol, boolean drawBackground, @Nullable Vector4f bgCol) { GlStateManager.pushMatrix(); GlStateManager.translate(pos.x, pos.y, pos.z); GlStateManager.rotate(180, 1, 0, 0); Minecraft mc = Minecraft.getMinecraft(); FontRenderer fnt = mc.fontRenderer; float scale = size / fnt.FONT_HEIGHT; GlStateManager.scale(scale, scale, scale); GlStateManager.rotate(mc.getRenderManager().playerViewY + 180, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.translate(-fnt.getStringWidth(text) / 2, 0, 0); if (drawBackground && bgCol != null) { renderBackground(fnt, text, bgCol); } fnt.drawString(text, 0, 0, ColorUtil.getRGBA(txtCol)); if (drawShadow && shadowCol != null) { GlStateManager.translate(0.5f, 0.5f, 0.1f); fnt.drawString(text, 0, 0, ColorUtil.getRGBA(shadowCol)); } GlStateManager.enableAlpha(); GlStateManager.popMatrix(); RenderUtil.bindBlockTexture(); }
RenderUtil.setupLightmapCoords(te.getPos(), te.getWorld()); RenderUtil.bindBlockTexture(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableLighting();
public static void drawBillboardedText(@Nonnull Vector3f pos, @Nonnull String text, float size) { drawBillboardedText(pos, text, size, DEFAULT_TXT_COL, true, DEFAULT_TEXT_SHADOW_COL, true, DEFAULT_TEXT_BG_COL); }
public static void renderBoundingBox(@Nonnull BoundingBox bb, @Nonnull TextureAtlasSprite tex) { renderBoundingBox(bb, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV()); }
public static void addVerticesToTessellator(@Nullable List<Vertex> vertices, @Nonnull VertexFormat format, boolean doBegin) { addVerticesToTessellator(vertices, null, format, doBegin); }
@SuppressWarnings("unchecked") @Override @Nonnull public <T> T get(@Nonnull Class<T> clazz) { if (clazz == TextureAtlasSprite.class) { final TextureAtlasSprite sprite = sprites.get(keyF); if (sprite != null) { return (T) sprite; } else { Log.error("Missing texture: " + keyF); return (T) RenderUtil.getMissingSprite(); } } else { throw new UnsupportedOperationException("TextureSupplier can only supply TextureAtlasSprite"); } } };