Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- @SideOnly(Side.CLIENT)
- public void renderLightBetweenTwoPoints(double firstX, double firstY, double firstZ, double secondX, double secondY, double secondZ, int rotationTime, float alpha, double beamWidth, float[] firstColor, float[] secondColor){
- Tessellator tessy = Tessellator.getInstance();
- WorldRenderer render = tessy.getWorldRenderer();
- World world = ClientUtil.mc().theWorld;
- GlStateManager.disableFog();
- float r = firstColor[0];
- float g = firstColor[1];
- float b = firstColor[2];
- float r2 = secondColor[0];
- float g2 = secondColor[1];
- float b2 = secondColor[2];
- Vec3d vec1 = new Vec3d(firstX, firstY, firstZ);
- Vec3d vec2 = new Vec3d(secondX, secondY, secondZ);
- Vec3d combinedVec = new Vec3d(vec2);
- combinedVec.sub(vec1);
- float rot = rotationTime > 0 ? (360F*((float)((world.getTotalWorldTime())%rotationTime)/(float)rotationTime)) : 0;
- double pitch = Math.atan2(combinedVec.y, Math.sqrt(combinedVec.x * combinedVec.x + combinedVec.z + combinedVec.z));
- double yaw = Math.atan2(-combinedVec.z, combinedVec.x);
- double length = combinedVec.length();
- GlStateManager.pushMatrix();
- GlStateManager.disableLighting();
- GlStateManager.disableTexture2D();
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.depthMask(false);
- GlStateManager.translate(firstX-TileEntityRendererDispatcher.staticPlayerX, firstY-TileEntityRendererDispatcher.staticPlayerY, firstZ-TileEntityRendererDispatcher.staticPlayerZ);
- GlStateManager.rotate((float)(180*yaw/Math.PI), 0, 1, 0);
- GlStateManager.rotate((float)(180*pitch/Math.PI), 0, 0, 1);
- GlStateManager.rotate(rot, 1, 0, 0);
- render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
- render.pos(length, beamWidth, beamWidth).color(r2, g2, b2, alpha).endVertex();
- render.pos(0, beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
- render.pos(0, -beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
- render.pos(length, -beamWidth, beamWidth).color(r2, g2, b2, alpha).endVertex();
- render.pos(length, -beamWidth, -beamWidth).color(r2, g2, b2, alpha).endVertex();
- render.pos(0, -beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
- render.pos(0, beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
- render.pos(length, beamWidth, -beamWidth).color(r2, g2, b2, alpha).endVertex();
- render.pos(length, beamWidth, -beamWidth).color(r2, g2, b2, alpha).endVertex();
- render.pos(0, beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
- render.pos(0, beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
- render.pos(length, beamWidth, beamWidth).color(r2, g2, b2, alpha).endVertex();
- render.pos(length, -beamWidth, beamWidth).color(r2, g2, b2, alpha).endVertex();
- render.pos(0, -beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
- render.pos(0, -beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
- render.pos(length, -beamWidth, -beamWidth).color(r2, g2, b2, alpha).endVertex();
- tessy.draw();
- GlStateManager.disableBlend();
- GlStateManager.enableLighting();
- GlStateManager.enableTexture2D();
- GlStateManager.depthMask(true);
- GlStateManager.popMatrix();
- GlStateManager.enableFog();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement