113 lines
5.3 KiB
Java
Executable file
113 lines
5.3 KiB
Java
Executable file
package client.renderer.entity;
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
import client.Client;
|
|
import client.renderer.DefaultVertexFormats;
|
|
import client.renderer.GlState;
|
|
import client.renderer.RenderBuffer;
|
|
import client.renderer.Tessellator;
|
|
import common.entity.projectile.EntityHook;
|
|
import common.util.ExtMath;
|
|
import common.util.Vec3;
|
|
|
|
public class RenderFish extends Render<EntityHook>
|
|
{
|
|
private static final String TEXTURE = "textures/object/hook.png";
|
|
|
|
public RenderFish(RenderManager renderManagerIn)
|
|
{
|
|
super(renderManagerIn);
|
|
}
|
|
|
|
/**
|
|
* Renders the desired {@code T} type Entity.
|
|
*/
|
|
public void doRender(EntityHook entity, double x, double y, double z, float partialTicks)
|
|
{
|
|
GL11.glPushMatrix();
|
|
GL11.glTranslatef((float)x, (float)y, (float)z);
|
|
GlState.enableRescaleNormal();
|
|
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
|
this.bindEntityTexture(entity);
|
|
// Tessellator tessellator = Tessellator.getInstance();
|
|
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
|
int i = 1;
|
|
int j = 2;
|
|
float f = 0.0625F;
|
|
float f1 = 0.125F;
|
|
float f2 = 0.125F;
|
|
float f3 = 0.1875F;
|
|
float f4 = 1.0F;
|
|
float f5 = 0.5F;
|
|
float f6 = 0.5F;
|
|
GL11.glRotatef(180.0F - this.manager.playerViewY, 0.0F, 1.0F, 0.0F);
|
|
GL11.glRotatef(-this.manager.playerViewX, 1.0F, 0.0F, 0.0F);
|
|
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
|
|
worldrenderer.pos(-0.5D, -0.5D, 0.0D).tex(0.0D, 0.25D).normal(0.0F, 1.0F, 0.0F).endVertex();
|
|
worldrenderer.pos(0.5D, -0.5D, 0.0D).tex(0.25D, 0.25D).normal(0.0F, 1.0F, 0.0F).endVertex();
|
|
worldrenderer.pos(0.5D, 0.5D, 0.0D).tex(0.25D, 0.0D).normal(0.0F, 1.0F, 0.0F).endVertex();
|
|
worldrenderer.pos(-0.5D, 0.5D, 0.0D).tex(0.0D, 0.0D).normal(0.0F, 1.0F, 0.0F).endVertex();
|
|
Tessellator.draw();
|
|
GlState.disableRescaleNormal();
|
|
GL11.glPopMatrix();
|
|
|
|
if (entity.angler != null)
|
|
{
|
|
float f7 = entity.angler.getSwingProgress(partialTicks);
|
|
float f8 = ExtMath.sin(ExtMath.sqrtf(f7) * (float)Math.PI);
|
|
Vec3 vec3 = new Vec3(-0.36D, 0.03D, 0.35D);
|
|
vec3 = vec3.rotatePitch(-(entity.angler.prevPitch + (entity.angler.rotPitch - entity.angler.prevPitch) * partialTicks) * (float)Math.PI / 180.0F);
|
|
vec3 = vec3.rotateYaw(-(entity.angler.prevYaw + (entity.angler.rotYaw - entity.angler.prevYaw) * partialTicks) * (float)Math.PI / 180.0F);
|
|
vec3 = vec3.rotateYaw(f8 * 0.5F);
|
|
vec3 = vec3.rotatePitch(-f8 * 0.7F);
|
|
double d0 = entity.angler.prevX + (entity.angler.posX - entity.angler.prevX) * (double)partialTicks + vec3.xCoord;
|
|
double d1 = entity.angler.prevY + (entity.angler.posY - entity.angler.prevY) * (double)partialTicks + vec3.yCoord;
|
|
double d2 = entity.angler.prevZ + (entity.angler.posZ - entity.angler.prevZ) * (double)partialTicks + vec3.zCoord;
|
|
double d3 = (double)entity.angler.getEyeHeight();
|
|
|
|
if (this.manager.gm != null && this.manager.gm.thirdPersonView > 0 || entity.angler != Client.CLIENT.player || this.manager.gm != null && this.manager.gm.showPlayerFirstPerson)
|
|
{
|
|
float f9 = (entity.angler.prevYawOffset + (entity.angler.yawOffset - entity.angler.prevYawOffset) * partialTicks) * (float)Math.PI / 180.0F;
|
|
double d4 = (double)ExtMath.sin(f9);
|
|
double d6 = (double)ExtMath.cos(f9);
|
|
double d8 = 0.35D;
|
|
double d10 = 0.8D;
|
|
d0 = entity.angler.prevX + (entity.angler.posX - entity.angler.prevX) * (double)partialTicks - d6 * 0.35D - d4 * 0.8D;
|
|
d1 = entity.angler.prevY + d3 + (entity.angler.posY - entity.angler.prevY) * (double)partialTicks - 0.45D;
|
|
d2 = entity.angler.prevZ + (entity.angler.posZ - entity.angler.prevZ) * (double)partialTicks - d4 * 0.35D + d6 * 0.8D;
|
|
d3 = entity.angler.isSneaking() ? -0.1875D : 0.0D;
|
|
}
|
|
|
|
double d13 = entity.prevX + (entity.posX - entity.prevX) * (double)partialTicks;
|
|
double d5 = entity.prevY + (entity.posY - entity.prevY) * (double)partialTicks + 0.25D;
|
|
double d7 = entity.prevZ + (entity.posZ - entity.prevZ) * (double)partialTicks;
|
|
double d9 = (double)((float)(d0 - d13));
|
|
double d11 = (double)((float)(d1 - d5)) + d3;
|
|
double d12 = (double)((float)(d2 - d7));
|
|
GlState.disableTexture2D();
|
|
GlState.disableLighting();
|
|
worldrenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
|
|
int k = 16;
|
|
|
|
for (int l = 0; l <= 16; ++l)
|
|
{
|
|
float f10 = (float)l / 16.0F;
|
|
worldrenderer.pos(x + d9 * (double)f10, y + d11 * (double)(f10 * f10 + f10) * 0.5D + 0.25D, z + d12 * (double)f10).color(0, 0, 0, 255).endVertex();
|
|
}
|
|
|
|
Tessellator.draw();
|
|
GlState.enableLighting();
|
|
GlState.enableTexture2D();
|
|
super.doRender(entity, x, y, z, partialTicks);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
|
*/
|
|
protected String getEntityTexture(EntityHook entity)
|
|
{
|
|
return TEXTURE;
|
|
}
|
|
}
|