Jump to content

Custom Renderer Error


DocRedstone

Recommended Posts

I am attempting to modify the Beacon render code. The code itself works, but I cannot manage to get it to rotate. When it "rotates" it does so by following the players camera. Can anyone tell me what I am doing wrong?

 

Tessellator tessellator = Tessellator.instance;
         this.bindTexture(beamIcon);
        
         GL11.glPushMatrix();
         GL11.glRotatef(90f, 0f, 1.0f, 0f);
         GL11.glPushMatrix();
         GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
         GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
         GL11.glDisable(GL11.GL_LIGHTING);
         GL11.glDisable(GL11.GL_CULL_FACE);
         GL11.glDisable(GL11.GL_BLEND);
         GL11.glDepthMask(true);
         GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
         float f2 = (float) tileentity.getWorldObj().getTotalWorldTime() + f;
         float f3 = -f2 * 0.2F - (float)MathHelper.floor_float(-f2 * 0.1F);
         byte b0 = 1;
         double d3 = (double)f2 * 0.025D * (1.0D - (double)(b0 & 1) * 2.5D);
         tessellator.startDrawingQuads();
         tessellator.setColorRGBA(108, 248, 115, 32);
         double d4 = 0.05; //size of beam
         double d5 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d4;
         double d6 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d4;
         double d7 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d4;
         double d8 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d4;
         double d9 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d4;
         double d10 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d4;
         double d11 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d4;
         double d12 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d4;
         double d13 = 15; //height
         double d14 = 0.0D;
         double d15 = 1.0D;
         double d16 = (double)(-1.0F + f3);
         double d17 = (double)(256.0F * f1) * (0.5D / d4) + d16;
         tessellator.addVertexWithUV(d0 + d5, d1 + d13, d2 + d6, d15, d17);
         tessellator.addVertexWithUV(d0 + d5, d1, d2 + d6, d15, d16);
         tessellator.addVertexWithUV(d0 + d7, d1, d2 + d8, d14, d16);
         tessellator.addVertexWithUV(d0 + d7, d1 + d13, d2 + d8, d14, d17);
         tessellator.addVertexWithUV(d0 + d11, d1 + d13, d2 + d12, d15, d17);
         tessellator.addVertexWithUV(d0 + d11, d1, d2 + d12, d15, d16);
         tessellator.addVertexWithUV(d0 + d9, d1, d2 + d10, d14, d16);
         tessellator.addVertexWithUV(d0 + d9, d1 + d13, d2 + d10, d14, d17);
         tessellator.addVertexWithUV(d0 + d7, d1 + d13, d2 + d8, d15, d17);
         tessellator.addVertexWithUV(d0 + d7, d1, d2 + d8, d15, d16);
         tessellator.addVertexWithUV(d0 + d11, d1, d2 + d12, d14, d16);
         tessellator.addVertexWithUV(d0 + d11, d1 + d13, d2 + d12, d14, d17);
         tessellator.addVertexWithUV(d0 + d9, d1 + d13, d2 + d10, d15, d17);
         tessellator.addVertexWithUV(d0 + d9, d1, d2 + d10, d15, d16);
         tessellator.addVertexWithUV(d0 + d5, d1, d2 + d6, d14, d16);
         tessellator.addVertexWithUV(d0 + d5, d1 + d13, d2 + d6, d14, d17);
         tessellator.draw();
         GL11.glEnable(GL11.GL_CULL_FACE);
         GL11.glEnable(GL11.GL_LIGHTING);
         GL11.glEnable(GL11.GL_TEXTURE_2D);
         GL11.glDepthMask(true);
         GL11.glPopMatrix();
         GL11.glPopMatrix();

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.