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); }
protected void renderItemStack(@Nonnull EnumFacing facing, @Nonnull BlockPos pos, @Nonnull ItemStack floatingItem, @Nonnull World world, float tick) { RenderUtil.bindBlockTexture(); rand.setSeed(pos.getX() + pos.getY() + pos.getZ()); rand.nextBoolean(); int i = world.getCombinedLight(pos.offset(facing), 0); int j = i % 65536; int k = (int) (180 + (60 * MathHelper.sin((float) ((EnderIO.proxy.getTickCount() * 0.145D + (tick * 0.145D) + rand.nextDouble()) % (Math.PI * 2))))); if (EnderIO.proxy.getTickCount() % 10 == 0) { // j = k = 240; } OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j, k); GlStateManager.pushMatrix(); EnumFacing offsetDir = facing.rotateY(); double offsetX = 0.5 + (offsetDir.getFrontOffsetX() * 2.5 / 16D) + (facing.getFrontOffsetX() * 3.0 / 16D); double offsetY = 5 / 16D; double offsetZ = 0.5 + (offsetDir.getFrontOffsetZ() * 2.5 / 16D) + (facing.getFrontOffsetZ() * 3.0 / 16D); GlStateManager.translate(offsetX, offsetY, offsetZ); GlStateManager.scale(0.9, 0.9, 0.9); // glScalef(1.1f, 1.1f, 1.1f); if (Minecraft.getMinecraft().gameSettings.fancyGraphics) { GlStateManager.rotate(rand.nextFloat() * 360f, 0, 1, 0); } double rot = (EnderIO.proxy.getTickCount() * 0.05D + (tick * 0.05D) + rand.nextDouble()) % (Math.PI * 2); doRender(world, floatingItem, rot); GlStateManager.popMatrix(); }
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(); }
protected void renderObelisk() { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableRescaleNormal(); RenderUtil.bindBlockTexture(); BufferBuilder tes = Tessellator.getInstance().getBuffer(); tes.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); for (BakedQuad quad : bakedQuads) { tes.addVertexData(quad.getVertexData()); } Tessellator.getInstance().draw(); GlStateManager.disableRescaleNormal(); }
protected void renderItemStack(T te, @Nonnull World world, double x, double y, double z, float tick) { EntityItem ei = this.enityItem; if (ei == null) { this.enityItem = ei = new EntityItem(world, 0, 0, 0, getFloatingItem(te)); } ei.setItem(getFloatingItem(te)); ei.hoverStart = (float) ((EnderIO.proxy.getTickCount() * 0.05f + (tick * 0.05f)) % (Math.PI * 2)); RenderUtil.bindBlockTexture(); GlStateManager.pushMatrix(); glTranslated(x + 0.5, y + 0.7, z + 0.5); glScalef(1.1f, 1.1f, 1.1f); BlockPos p; if (te != null) { p = te.getPos(); } else { p = new BlockPos(0, 0, 0); } rand.setSeed(p.getX() + p.getY() + p.getZ()); rand.nextBoolean(); if (Minecraft.getMinecraft().gameSettings.fancyGraphics) { GlStateManager.rotate(rand.nextFloat() * 360f, 0, 1, 0); } ei.hoverStart += rand.nextFloat(); GlStateManager.translate(0, -0.15f, 0); if (rei == null) { rei = new InnerRenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem()); } rei.doRender(ei, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); GlStateManager.popMatrix(); }
public void render() { RenderUtil.bindBlockTexture(); RenderHelper.disableStandardItemLighting(); BufferBuilder tes = Tessellator.getInstance().getBuffer(); for (int i = 0; i <= 1; i++) { if (i == 0) { GlStateManager.cullFace(CullFace.FRONT); } else { GlStateManager.cullFace(CullFace.BACK); } tes.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); render(tes); Tessellator.getInstance().draw(); } RenderHelper.enableStandardItemLighting(); }
@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(); }
@Override public void renderParticle(@Nonnull BufferBuilder worldRendererIn, @Nonnull Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { if (particleAge < 0) { return; } 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((particleAge + partialTicks) / INIT_TIME, 1); float fade = particleAge < FADE_TIME ? 1f : ((particleMaxAge - particleAge) / (float) (particleMaxAge - FADE_TIME)); GlStateManager.translate(-interpPosX, -interpPosY, -interpPosZ); GlStateManager.color(getRedColorF(), getGreenColorF(), getBlueColorF(), particleAlpha * fade); RenderUtil.renderBoundingBox((new BoundingBox(getBoundingBox())).scale(scale), IconUtil.instance.whiteTexture); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.enableCull(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }
RenderUtil.bindBlockTexture(); drawText(heading2, text2, offset, scale, size, fr); RenderUtil.bindBlockTexture();
@Override public void renderParticle(@Nonnull BufferBuilder worldRendererIn, @Nonnull Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { if (!isAlive()) { return; } 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); GlStateManager.translate(-interpPosX, -interpPosY, -interpPosZ); float fade = tolive / (float) maxage; GlStateManager.color(color.x, color.y, color.z, color.w * fade); RenderUtil.renderBoundingBox(new BoundingBox(pos).expand(0.01, 0.01, 0.01), IconUtil.instance.whiteTexture); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.enableCull(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }
int posY = (int) (y + height - renderAmount); RenderUtil.bindBlockTexture(); int color = fluid.getFluid().getColor(fluid); GlStateManager.color((color >> 16 & 0xFF) / 255f, (color >> 8 & 0xFF) / 255f, (color & 0xFF) / 255f);
private void renderScene() { GlStateManager.enableCull(); GlStateManager.enableRescaleNormal(); RenderHelper.disableStandardItemLighting(); mc.entityRenderer.disableLightmap(); RenderUtil.bindBlockTexture(); GlStateManager.disableLighting(); GlStateManager.enableTexture2D(); GlStateManager.enableAlpha(); final LayerRenderer layerRenderer = new LayerRenderer(new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z)); BlockRenderLayer oldRenderLayer = MinecraftForgeClient.getRenderLayer(); try { NNList.of(BlockRenderLayer.class).apply(layerRenderer); } finally { ForgeHooksClient.setRenderLayer(oldRenderLayer); GlStateManager.depthMask(true); } }
@SuppressWarnings({ "null", "unused" }) @Override public final void render(@Nonnull T te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { if (te != null && te.hasWorld() && !te.isInvalid()) { final IBlockState blockState = te.getWorld().getBlockState(te.getPos()); final int renderPass = MinecraftForgeClient.getRenderPass(); if ((block == null || block == blockState.getBlock()) && shouldRender(te, blockState, renderPass)) { GlStateManager.disableLighting(); if (renderPass == 0) { GlStateManager.disableBlend(); GlStateManager.depthMask(true); } else { GlStateManager.enableBlend(); GlStateManager.depthMask(false); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } RenderUtil.bindBlockTexture(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); renderTileEntity(te, blockState, partialTicks, destroyStage); GlStateManager.popMatrix(); } } else if (te == null) { renderItem(); } }
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); }
private void renderBase() { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); BlockModelShapes modelShapes = blockrendererdispatcher.getBlockModelShapes(); IBakedModel bakedModel = modelShapes .getModelForState(MachineObject.block_enchanter.getBlockNN().getDefaultState().withProperty(EnumRenderMode.RENDER, EnumRenderMode.FRONT)); RenderUtil.bindBlockTexture(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableRescaleNormal(); GlStateManager.pushMatrix(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); for (EnumFacing enumfacing : EnumFacing.values()) { this.renderQuads(vertexbuffer, bakedModel.getQuads((IBlockState) null, enumfacing, 0L)); } this.renderQuads(vertexbuffer, bakedModel.getQuads((IBlockState) null, (EnumFacing) null, 0L)); tessellator.draw(); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); }
RenderUtil.bindBlockTexture(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableLighting();
RenderUtil.bindBlockTexture();