net.minecraft.client.renderer.WorldRenderer Java Examples
The following examples show how to use
net.minecraft.client.renderer.WorldRenderer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Utils.java From SkyblockAddons with MIT License | 6 votes |
/** * Draws a textured rectangle at z = 0. Args: x, y, u, v, width, height, textureWidth, textureHeight */ public void drawModalRectWithCustomSizedTexture(float x, float y, float u, float v, float width, float height, float textureWidth, float textureHeight, boolean linearTexture) { if (linearTexture) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); } float f = 1.0F / textureWidth; float f1 = 1.0F / textureHeight; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(x, y + height, 0.0D).tex(u * f, (v + height) * f1).endVertex(); worldrenderer.pos(x + width, y + height, 0.0D).tex((u + width) * f, (v + height) * f1).endVertex(); worldrenderer.pos(x + width, y, 0.0D).tex((u + width) * f, v * f1).endVertex(); worldrenderer.pos(x, y, 0.0D).tex(u * f, v * f1).endVertex(); tessellator.draw(); if (linearTexture) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); } }
Example #2
Source File: RenderUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
public static void drawFilledBox(AxisAlignedBB box, float r, float g, float b, float a) { gl11Setup(); Vec3d ren = renderPos(); /* Fill */ Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(5, DefaultVertexFormats.POSITION_COLOR); WorldRenderer.addChainedFilledBoxVertices(buffer, box.minX - ren.x, box.minY - ren.y, box.minZ - ren.z, box.maxX - ren.x, box.maxY - ren.y, box.maxZ - ren.z, r, g, b, a/2f); tessellator.draw(); /* Outline */ WorldRenderer.drawSelectionBoundingBox(new AxisAlignedBB( box.minX - ren.x, box.minY - ren.y, box.minZ - ren.z, box.maxX - ren.x, box.maxY - ren.y, box.maxZ - ren.z), r, g, b, a); gl11Cleanup(); }
Example #3
Source File: RenderUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 6 votes |
public static void drawCuboidOutline(Cuboid6 c) { WorldRenderer r = CCRenderState.startDrawing(3, DefaultVertexFormats.POSITION); r.pos(c.min.x, c.min.y, c.min.z).endVertex(); r.pos(c.max.x, c.min.y, c.min.z).endVertex(); r.pos(c.max.x, c.min.y, c.max.z).endVertex(); r.pos(c.min.x, c.min.y, c.max.z).endVertex(); r.pos(c.min.x, c.min.y, c.min.z).endVertex(); CCRenderState.draw(); CCRenderState.startDrawing(3, DefaultVertexFormats.POSITION); r.pos(c.min.x, c.max.y, c.min.z).endVertex(); r.pos(c.max.x, c.max.y, c.min.z).endVertex(); r.pos(c.max.x, c.max.y, c.max.z).endVertex(); r.pos(c.min.x, c.max.y, c.max.z).endVertex(); r.pos(c.min.x, c.max.y, c.min.z).endVertex(); CCRenderState.draw(); CCRenderState.startDrawing(1, DefaultVertexFormats.POSITION); r.pos(c.min.x, c.min.y, c.min.z).endVertex(); r.pos(c.min.x, c.max.y, c.min.z).endVertex(); r.pos(c.max.x, c.min.y, c.min.z).endVertex(); r.pos(c.max.x, c.max.y, c.min.z).endVertex(); r.pos(c.max.x, c.min.y, c.max.z).endVertex(); r.pos(c.max.x, c.max.y, c.max.z).endVertex(); r.pos(c.min.x, c.min.y, c.max.z).endVertex(); r.pos(c.min.x, c.max.y, c.max.z).endVertex(); CCRenderState.draw(); }
Example #4
Source File: CustomCrosshairGraphics.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
public static void drawLine(final int x1, final int y1, final int x2, final int y2, final Color colour) { final Tessellator tessellator = Tessellator.getInstance(); final WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager .color(colour.getRed() / 255.0f, colour.getGreen() / 255.0f, colour.getBlue() / 255.0f, colour.getAlpha() / 255.0f); worldrenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); worldrenderer.pos(x1, y1, 0.0).endVertex(); worldrenderer.pos(x2, y2, 0.0).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); }
Example #5
Source File: OptionScrollPane.java From NotEnoughItems with MIT License | 6 votes |
public static void drawOverlayGrad(int x1, int x2, int y1, int y2, float zLevel) { GlStateManager.disableTexture2D(); GlStateManager.disableCull(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.shadeModel(GL11.GL_SMOOTH); WorldRenderer r = CCRenderState.startDrawing(); r.setColorRGBA_I(0, 255); r.addVertex(x2, y1, zLevel); r.addVertex(x1, y1, zLevel); r.setColorRGBA_I(0, 0); r.addVertex(x1, y2, zLevel); r.addVertex(x2, y2, zLevel); CCRenderState.draw(); GlStateManager.disableBlend(); GlStateManager.enableCull(); GlStateManager.enableTexture2D(); }
Example #6
Source File: CustomCrosshairGraphics.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
public static void drawCircle(final double x, final double y, final int radius, final Color colour) { final Tessellator tessellator = Tessellator.getInstance(); final WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager .color(colour.getRed() / 255.0f, colour.getGreen() / 255.0f, colour.getBlue() / 255.0f, colour.getAlpha() / 255.0f); worldrenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); for (int degrees = 0; degrees <= 360; ++degrees) { final float radians = (float) (degrees * 0.017453292519943295); worldrenderer.pos(x + Math.cos(radians) * radius, y + Math.sin(radians) * radius, 0.0) .endVertex(); } tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); }
Example #7
Source File: FWEntityFX.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void renderParticle(WorldRenderer worldRendererIn, net.minecraft.entity.Entity p_180434_2_, float p_70539_2_, float x, float y, float z, float p_70539_6_, float p_70539_7_) { if (firstTick) { prevPosX = posX; prevPosY = posY; prevPosZ = posZ; prevRotationYaw = rotationYaw; prevRotationPitch = rotationPitch; setPosition(posX, posY, posZ); firstTick = false; } float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) p_70539_2_ - interpPosX); float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) p_70539_2_ - interpPosY); float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) p_70539_2_ - interpPosZ); Tessellator.getInstance().draw(); FWEntityRenderer.render(this, wrapped, f11, f12, f13); Tessellator.getInstance().getWorldRenderer().startDrawingQuads(); FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderUtility.particleResource); }
Example #8
Source File: AboveHeadRenderer.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
private void renderName(RenderPlayerEvent event, LevelheadTag tag, EntityPlayer player, double x, double y, double z) { FontRenderer fontrenderer = event.getRenderManager().getFontRenderer(); float f = (float) (1.6F * Levelhead.getInstance().getDisplayManager().getMasterConfig().getFontSize()); float f1 = 0.016666668F * f; GlStateManager.pushMatrix(); GlStateManager.translate((float) x + 0.0F, (float) y + player.height + 0.5F, (float) z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-event.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(event.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-f1, -f1, f1); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int i = 0; int j = fontrenderer.getStringWidth(tag.getString()) / 2; GlStateManager.disableTexture2D(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); renderString(fontrenderer, tag); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); }
Example #9
Source File: Utils.java From SkyblockAddons with MIT License | 5 votes |
/** * Draws a solid color rectangle with the specified coordinates and color (ARGB format). Args: x1, y1, x2, y2, color */ public void drawRect(double left, double top, double right, double bottom, int color) { if (left < right) { double i = left; left = right; right = i; } if (top < bottom) { double j = top; top = bottom; bottom = j; } float f3 = (float)(color >> 24 & 255) / 255.0F; float f = (float)(color >> 16 & 255) / 255.0F; float f1 = (float)(color >> 8 & 255) / 255.0F; float f2 = (float)(color & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.color(f, f1, f2, f3); worldrenderer.begin(7, DefaultVertexFormats.POSITION); worldrenderer.pos(left, bottom, 0.0D).endVertex(); worldrenderer.pos(right, bottom, 0.0D).endVertex(); worldrenderer.pos(right, top, 0.0D).endVertex(); worldrenderer.pos(left, top, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); }
Example #10
Source File: PotionEffects.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) { float f = 0.00390625F; float f1 = 0.00390625F; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(x, y + height, 0).tex((float) (textureX) * f, (float) (textureY + height) * f1).endVertex(); worldrenderer.pos(x + width, y + height, 0).tex((float) (textureX + width) * f, (float) (textureY + height) * f1).endVertex(); worldrenderer.pos(x + width, y, 0).tex((float) (textureX + width) * f, (float) (textureY) * f1).endVertex(); worldrenderer.pos(x, y, 0).tex((float) (textureX) * f, (float) (textureY) * f1).endVertex(); tessellator.draw(); }
Example #11
Source File: CustomCrosshairGraphics.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public static void drawFilledRectangle(int x1, int y1, int x2, int y2, final Color colour) { if (x1 < x2) { final int tempX = x1; x1 = x2; x2 = tempX; } if (y1 < y2) { final int tempY = y1; y1 = y2; y2 = tempY; } final Tessellator tessellator = Tessellator.getInstance(); final WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager .color(colour.getRed() / 255.0f, colour.getGreen() / 255.0f, colour.getBlue() / 255.0f, colour.getAlpha() / 255.0f); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); worldrenderer.pos(x1, y2, 0.0).endVertex(); worldrenderer.pos(x2, y2, 0.0).endVertex(); worldrenderer.pos(x2, y1, 0.0).endVertex(); worldrenderer.pos(x1, y1, 0.0).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); }
Example #12
Source File: CustomCrosshair.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
private void drawDebugAxisCrosshair(int screenWidth, int screenHeight) { GlStateManager.pushMatrix(); GlStateManager.translate((float) screenWidth, (float) screenHeight, 0.0f); Entity entity = mc.getRenderViewEntity(); GlStateManager.rotate( entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * 1.0f, -1.0f, 0.0f, 0.0f); GlStateManager .rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * 1.0f, 0.0f, 1.0f, 0.0f); GlStateManager.scale(-1.0f, -1.0f, -1.0f); GlStateManager.disableTexture2D(); GlStateManager.depthMask(false); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(GL11.GL_CLIENT_PIXEL_STORE_BIT, DefaultVertexFormats.POSITION_COLOR); GL11.glLineWidth(2.0f); worldrenderer.pos(0.0, 0.0, 0.0).color(255, 0, 0, 255).endVertex(); worldrenderer.pos(10.0, 0.0, 0.0).color(255, 0, 0, 255).endVertex(); worldrenderer.pos(0.0, 0.0, 0.0).color(0, 255, 0, 255).endVertex(); worldrenderer.pos(0.0, 10.0, 0.0).color(0, 255, 0, 255).endVertex(); worldrenderer.pos(0.0, 0.0, 0.0).color(0, 0, 255, 255).endVertex(); worldrenderer.pos(0.0, 0.0, 10.0).color(0, 0, 255, 255).endVertex(); tessellator.draw(); GL11.glLineWidth(1.0f); GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); }
Example #13
Source File: GuiUtils.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel) { float uScale = 1f / 0x100; float vScale = 1f / 0x100; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer wr = tessellator.getWorldRenderer(); wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); wr.pos(x, y + height, zLevel).tex(u * uScale, ((v + height) * vScale)).endVertex(); wr.pos(x + width, y + height, zLevel).tex((u + width) * uScale, ((v + height) * vScale)).endVertex(); wr.pos(x + width, y, zLevel).tex((u + width) * uScale, (v * vScale)).endVertex(); wr.pos(x, y, zLevel).tex(u * uScale, (v * vScale)).endVertex(); tessellator.draw(); }
Example #14
Source File: GuiUtils.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) { float startAlpha = (float) (startColor >> 24 & 255) / 255.0F; float startRed = (float) (startColor >> 16 & 255) / 255.0F; float startGreen = (float) (startColor >> 8 & 255) / 255.0F; float startBlue = (float) (startColor & 255) / 255.0F; float endAlpha = (float) (endColor >> 24 & 255) / 255.0F; float endRed = (float) (endColor >> 16 & 255) / 255.0F; float endGreen = (float) (endColor >> 8 & 255) / 255.0F; float endBlue = (float) (endColor & 255) / 255.0F; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); worldrenderer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); worldrenderer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex(); worldrenderer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex(); tessellator.draw(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }
Example #15
Source File: PlanarLightMatrix.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public int brightness(int side) { if ((sampled & 1 << side) == 0) { brightness[side] = WorldRenderer.getCombinedLight(access, pos); sampled |= 1 << side; } return brightness[side]; }
Example #16
Source File: LightMatrix.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public void sample(int i) { if ((sampled & 1 << i) == 0) { BlockPos bp = new BlockPos(pos.getX() + (i % 3) - 1, pos.getY() + (i / 9) - 1, pos.getZ() + (i / 3 % 3) - 1); BlockState b = access.getBlockState(bp); bSamples[i] = WorldRenderer.getCombinedLight(access, bp); aSamples[i] = b.getAmbientOcclusionLightValue(access, bp); sampled |= 1 << i; } }
Example #17
Source File: SimpleBrightnessModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public int sample(int side) { if ((sampled & 1 << side) == 0) { c = pos.offset(Direction.BY_INDEX[side]); samples[side] = WorldRenderer.getCombinedLight(access, c); sampled |= 1 << side; } return samples[side]; }
Example #18
Source File: OptionScrollPane.java From NotEnoughItems with MIT License | 5 votes |
public static void drawOverlayTex(int x, int y, int w, int h, float zLevel) { GlStateManager.color(1, 1, 1, 1); Minecraft.getMinecraft().renderEngine.bindTexture(Gui.optionsBackground); WorldRenderer r = CCRenderState.startDrawing(); r.addVertexWithUV(x, y, zLevel, 0, 0); r.addVertexWithUV(x, y + h, zLevel, 0, h / 16D); r.addVertexWithUV(x + w, y + h, zLevel, w / 16D, h / 16D); r.addVertexWithUV(x + w, y, zLevel, w / 16D, 0); CCRenderState.draw(); }
Example #19
Source File: RenderUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
/** * Draws a tessellated quadrilateral bottom to top, left to right * * @param base The bottom left corner of the quad * @param wide The bottom of the quad * @param high The left side of the quad * @param res Units per icon */ public static void renderFluidQuad(Vector3 base, Vector3 wide, Vector3 high, TextureAtlasSprite icon, double res) { WorldRenderer r = Tessellator.getInstance().getWorldRenderer(); double u1 = icon.getMinU(); double du = icon.getMaxU() - icon.getMinU(); double v2 = icon.getMaxV(); double dv = icon.getMaxV() - icon.getMinV(); double wlen = wide.mag(); double hlen = high.mag(); double x = 0; while (x < wlen) { double rx = wlen - x; if (rx > res) rx = res; double y = 0; while (y < hlen) { double ry = hlen - y; if (ry > res) ry = res; Vector3 dx1 = vectors[2].set(wide).multiply(x / wlen); Vector3 dx2 = vectors[3].set(wide).multiply((x + rx) / wlen); Vector3 dy1 = vectors[4].set(high).multiply(y / hlen); Vector3 dy2 = vectors[5].set(high).multiply((y + ry) / hlen); r.pos(base.x + dx1.x + dy2.x, base.y + dx1.y + dy2.y, base.z + dx1.z + dy2.z).tex(u1, v2 - ry / res * dv).endVertex(); r.pos(base.x + dx1.x + dy1.x, base.y + dx1.y + dy1.y, base.z + dx1.z + dy1.z).tex(u1, v2).endVertex(); r.pos(base.x + dx2.x + dy1.x, base.y + dx2.y + dy1.y, base.z + dx2.z + dy1.z).tex(u1 + rx / res * du, v2).endVertex(); r.pos(base.x + dx2.x + dy2.x, base.y + dx2.y + dy2.y, base.z + dx2.z + dy2.z).tex(u1 + rx / res * du, v2 - ry / res * dv).endVertex(); y += ry; } x += rx; } }
Example #20
Source File: CCRenderState.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public static void writeVert() { WorldRenderer r = Tessellator.getInstance().getWorldRenderer(); if(hasNormal) r.normal((float) normal.x, (float) normal.y, (float) normal.z); if(hasColour) r.color(colour>>>24, colour>>16 & 0xFF, colour>>8 & 0xFF, alphaOverride >= 0 ? alphaOverride : colour & 0xFF); if(hasBrightness) r.lightmap(brightness >> 16 & 65535, brightness & 65535); }
Example #21
Source File: CCRenderState.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public static WorldRenderer startDrawing(int mode, VertexFormat format) { WorldRenderer r = Tessellator.getInstance().getWorldRenderer(); r.begin(mode, format); if(hasColour) r.color(colour>>>24, colour>>16 & 0xFF, colour>>8 & 0xFF, alphaOverride >= 0 ? alphaOverride : colour & 0xFF); if(hasBrightness) r.lightmap(brightness >> 16 & 65535, brightness & 65535); return r; }
Example #22
Source File: EntityDigIconFX.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
/** * copy pasted from EntityDiggingFX */ @Override public void renderParticle(WorldRenderer par1Tessellator, Entity entity, float par2, float par3, float par4, float par5, float par6, float par7) { float f6 = (particleTextureIndexX + particleTextureJitterX / 4.0F) / 16.0F; float f7 = f6 + 0.015609375F; float f8 = (particleTextureIndexY + particleTextureJitterY / 4.0F) / 16.0F; float f9 = f8 + 0.015609375F; float f10 = 0.1F * particleScale; if (particleIcon != null) { f6 = particleIcon.getInterpolatedU(particleTextureJitterX / 4.0F * 16.0F); f7 = particleIcon.getInterpolatedU((particleTextureJitterX + 1.0F) / 4.0F * 16.0F); f8 = particleIcon.getInterpolatedV(particleTextureJitterY / 4.0F * 16.0F); f9 = particleIcon.getInterpolatedV((particleTextureJitterY + 1.0F) / 4.0F * 16.0F); } float f11 = (float)(prevPosX + (posX - prevPosX) * par2 - interpPosX); float f12 = (float)(prevPosY + (posY - prevPosY) * par2 - interpPosY); float f13 = (float)(prevPosZ + (posZ - prevPosZ) * par2 - interpPosZ); float f14 = 1.0F; par1Tessellator.pos(f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10).tex(f6, f9).color(f14 * particleRed, f14 * particleGreen, f14 * particleBlue, 255F).endVertex(); par1Tessellator.pos(f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10).tex(f6, f8).color(f14 * particleRed, f14 * particleGreen, f14 * particleBlue, 255F).endVertex(); par1Tessellator.pos(f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10).tex(f7, f8).color(f14 * particleRed, f14 * particleGreen, f14 * particleBlue, 255F).endVertex(); par1Tessellator.pos(f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10).tex(f7, f9).color(f14 * particleRed, f14 * particleGreen, f14 * particleBlue, 255F).endVertex(); }
Example #23
Source File: PlayerOverlay.java From MediaMod with GNU General Public License v3.0 | 5 votes |
/** * Draws a rectangle with a vertical gradient between the specified colors (ARGB format). * Args: x1, y1, x2, y2, topColor, bottomColor * * @author ScottehBoeh */ private void drawGradientRect(double left, double top, double right, double bottom, int startColor, int endColor) { float f = (float) (startColor >> 24 & 255) / 255.0F; float f1 = (float) (startColor >> 16 & 255) / 255.0F; float f2 = (float) (startColor >> 8 & 255) / 255.0F; float f3 = (float) (startColor & 255) / 255.0F; float f4 = (float) (endColor >> 24 & 255) / 255.0F; float f5 = (float) (endColor >> 16 & 255) / 255.0F; float f6 = (float) (endColor >> 8 & 255) / 255.0F; float f7 = (float) (endColor & 255) / 255.0F; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.shadeModel(7425); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(right, top, 0).color(f1, f2, f3, f).endVertex(); worldrenderer.pos(left, top, 0).color(f1, f2, f3, f).endVertex(); worldrenderer.pos(left, bottom, 0).color(f5, f6, f7, f4).endVertex(); worldrenderer.pos(right, bottom, 0).color(f5, f6, f7, f4).endVertex(); tessellator.draw(); GlStateManager.shadeModel(7424); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }
Example #24
Source File: RenderUtils.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
public static void drawSelectionBoundingBox(AxisAlignedBB boundingBox) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION); // Lower Rectangle worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); // Upper Rectangle worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); // Upper Rectangle worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); tessellator.draw(); }
Example #25
Source File: MixinBlockModelRenderer.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
@Inject(method = "renderModelAmbientOcclusion", at = @At("HEAD"), cancellable = true) private void renderModelAmbientOcclusion(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSide, final CallbackInfoReturnable<Boolean> booleanCallbackInfoReturnable) { final XRay xray = (XRay) LiquidBounce.moduleManager.getModule(XRay.class); if (xray.getState() && !xray.getXrayBlocks().contains(blockIn)) booleanCallbackInfoReturnable.setReturnValue(false); }
Example #26
Source File: MixinBlockModelRenderer.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
@Inject(method = "renderModelStandard", at = @At("HEAD"), cancellable = true) private void renderModelStandard(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides, final CallbackInfoReturnable<Boolean> booleanCallbackInfoReturnable) { final XRay xray = (XRay) LiquidBounce.moduleManager.getModule(XRay.class); if (xray.getState() && !xray.getXrayBlocks().contains(blockIn)) booleanCallbackInfoReturnable.setReturnValue(false); }
Example #27
Source File: MixinBlockModelRenderer.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
@Inject(method = "renderModelStandard", at = @At("HEAD"), cancellable = true) private void renderModelStandard(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides, final CallbackInfoReturnable<Boolean> booleanCallbackInfoReturnable) { final XRay xray = (XRay) LiquidBounce.moduleManager.getModule(XRay.class); if (xray.getState() && !xray.getXrayBlocks().contains(blockIn)) booleanCallbackInfoReturnable.setReturnValue(false); }
Example #28
Source File: MixinBlockModelRenderer.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
@Inject(method = "renderModelAmbientOcclusion", at = @At("HEAD"), cancellable = true) private void renderModelAmbientOcclusion(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSide, final CallbackInfoReturnable<Boolean> booleanCallbackInfoReturnable) { final XRay xray = (XRay) LiquidBounce.moduleManager.getModule(XRay.class); if (xray.getState() && !xray.getXrayBlocks().contains(blockIn)) booleanCallbackInfoReturnable.setReturnValue(false); }
Example #29
Source File: Notification.java From ClientBase with MIT License | 5 votes |
public static void drawRect(double left, double top, double right, double bottom, int color) { if (left < right) { double i = left; left = right; right = i; } if (top < bottom) { double j = top; top = bottom; bottom = j; } float f3 = (float) (color >> 24 & 255) / 255.0F; float f = (float) (color >> 16 & 255) / 255.0F; float f1 = (float) (color >> 8 & 255) / 255.0F; float f2 = (float) (color & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.color(f, f1, f2, f3); worldrenderer.begin(7, DefaultVertexFormats.POSITION); worldrenderer.pos(left, bottom, 0.0D).endVertex(); worldrenderer.pos(right, bottom, 0.0D).endVertex(); worldrenderer.pos(right, top, 0.0D).endVertex(); worldrenderer.pos(left, top, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); }
Example #30
Source File: Notification.java From ClientBase with MIT License | 5 votes |
public static void drawRect(int mode, double left, double top, double right, double bottom, int color) { if (left < right) { double i = left; left = right; right = i; } if (top < bottom) { double j = top; top = bottom; bottom = j; } float f3 = (float) (color >> 24 & 255) / 255.0F; float f = (float) (color >> 16 & 255) / 255.0F; float f1 = (float) (color >> 8 & 255) / 255.0F; float f2 = (float) (color & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.color(f, f1, f2, f3); worldrenderer.begin(mode, DefaultVertexFormats.POSITION); worldrenderer.pos(left, bottom, 0.0D).endVertex(); worldrenderer.pos(right, bottom, 0.0D).endVertex(); worldrenderer.pos(right, top, 0.0D).endVertex(); worldrenderer.pos(left, top, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); }