Search in sources :

Example 51 with Vec3d

use of net.minecraft.util.math.Vec3d in project MorePlanets by SteveKunG.

the class RenderInfectedElderGuardian method doRender.

@Override
public void doRender(EntityInfectedElderGuardian entity, double x, double y, double z, float entityYaw, float partialTicks) {
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
    EntityLivingBase entitylivingbase = entity.getTargetedEntity();
    if (entitylivingbase != null) {
        float f = entity.getAttackAnimationScale(partialTicks);
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder worldrenderer = tessellator.getBuffer();
        this.bindTexture(new ResourceLocation("textures/entity/guardian_beam.png"));
        GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
        GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
        GlStateManager.disableLighting();
        GlStateManager.disableCull();
        GlStateManager.disableBlend();
        GlStateManager.depthMask(true);
        float f1 = 240.0F;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f1, f1);
        GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0);
        float f2 = entity.world.getTotalWorldTime() + partialTicks;
        float f3 = f2 * 0.5F % 1.0F;
        float f4 = entity.getEyeHeight();
        GlStateManager.pushMatrix();
        GlStateManager.translate((float) x, (float) y + f4, (float) z);
        Vec3d vec3 = this.getPosition(entitylivingbase, entitylivingbase.height * 0.5D, partialTicks);
        Vec3d vec31 = this.getPosition(entity, f4, partialTicks);
        Vec3d vec32 = vec3.subtract(vec31);
        double d0 = vec32.lengthVector() + 1.0D;
        vec32 = vec32.normalize();
        float f5 = (float) Math.acos(vec32.y);
        float f6 = (float) Math.atan2(vec32.z, vec32.x);
        GlStateManager.rotate(((float) Math.PI / 2F + -f6) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(f5 * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
        int i = 1;
        double d1 = f2 * 0.05D * (1.0D - (i & 1) * 2.5D);
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        float f7 = f * f;
        double d2 = i * 0.2D;
        double d3 = d2 * 1.41D;
        double d4 = 0.0D + Math.cos(d1 + 2.356194490192345D) * d3;
        double d5 = 0.0D + Math.sin(d1 + 2.356194490192345D) * d3;
        double d6 = 0.0D + Math.cos(d1 + Math.PI / 4D) * d3;
        double d7 = 0.0D + Math.sin(d1 + Math.PI / 4D) * d3;
        double d8 = 0.0D + Math.cos(d1 + 3.9269908169872414D) * d3;
        double d9 = 0.0D + Math.sin(d1 + 3.9269908169872414D) * d3;
        double d10 = 0.0D + Math.cos(d1 + 5.497787143782138D) * d3;
        double d11 = 0.0D + Math.sin(d1 + 5.497787143782138D) * d3;
        double d12 = 0.0D + Math.cos(d1 + Math.PI) * d2;
        double d13 = 0.0D + Math.sin(d1 + Math.PI) * d2;
        double d14 = 0.0D + Math.cos(d1 + 0.0D) * d2;
        double d15 = 0.0D + Math.sin(d1 + 0.0D) * d2;
        double d16 = 0.0D + Math.cos(d1 + Math.PI / 2D) * d2;
        double d17 = 0.0D + Math.sin(d1 + Math.PI / 2D) * d2;
        double d18 = 0.0D + Math.cos(d1 + Math.PI * 3D / 2D) * d2;
        double d19 = 0.0D + Math.sin(d1 + Math.PI * 3D / 2D) * d2;
        double d22 = -1.0F + f3;
        double d23 = d0 * (0.5D / d2) + d22;
        double d24 = 0.0D;
        if (entity.ticksExisted % 2 == 0) {
            d24 = 0.5D;
        }
        if (f7 > 0.7F) {
            f7 = 0.7F;
        }
        int red = 144 + (int) (f7 * 27);
        int green = 56 + (int) (f7 * 173);
        int blue = 34 + (int) (f7 * 228);
        worldrenderer.pos(d12, d0, d13).tex(0.4999D, d23).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d12, 0.0D, d13).tex(0.4999D, d22).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d14, 0.0D, d15).tex(0.0D, d22).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d14, d0, d15).tex(0.0D, d23).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d16, d0, d17).tex(0.4999D, d23).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d16, 0.0D, d17).tex(0.4999D, d22).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d18, 0.0D, d19).tex(0.0D, d22).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d18, d0, d19).tex(0.0D, d23).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d4, d0, d5).tex(0.5D, d24 + 0.5D).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d6, d0, d7).tex(1.0D, d24 + 0.5D).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d10, d0, d11).tex(1.0D, d24).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d8, d0, d9).tex(0.5D, d24).color(red, green, blue, 255).endVertex();
        tessellator.draw();
        GlStateManager.enableLighting();
        GlStateManager.enableCull();
        GlStateManager.depthMask(false);
        GlStateManager.popMatrix();
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) ResourceLocation(net.minecraft.util.ResourceLocation) EntityLivingBase(net.minecraft.entity.EntityLivingBase) Vec3d(net.minecraft.util.math.Vec3d)

Example 52 with Vec3d

use of net.minecraft.util.math.Vec3d in project MorePlanets by SteveKunG.

the class RenderInfectedGuardian method doRender.

@Override
public void doRender(EntityInfectedGuardian entity, double x, double y, double z, float entityYaw, float partialTicks) {
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
    EntityLivingBase entitylivingbase = entity.getTargetedEntity();
    if (entitylivingbase != null) {
        float f = entity.getAttackAnimationScale(partialTicks);
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder worldrenderer = tessellator.getBuffer();
        this.bindTexture(new ResourceLocation("textures/entity/guardian_beam.png"));
        GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
        GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
        GlStateManager.disableLighting();
        GlStateManager.disableCull();
        GlStateManager.disableBlend();
        GlStateManager.depthMask(true);
        float f1 = 240.0F;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f1, f1);
        GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0);
        float f2 = entity.world.getTotalWorldTime() + partialTicks;
        float f3 = f2 * 0.5F % 1.0F;
        float f4 = entity.getEyeHeight();
        GlStateManager.pushMatrix();
        GlStateManager.translate((float) x, (float) y + f4, (float) z);
        Vec3d vec3 = this.getPosition(entitylivingbase, entitylivingbase.height * 0.5D, partialTicks);
        Vec3d vec31 = this.getPosition(entity, f4, partialTicks);
        Vec3d vec32 = vec3.subtract(vec31);
        double d0 = vec32.lengthVector() + 1.0D;
        vec32 = vec32.normalize();
        float f5 = (float) Math.acos(vec32.y);
        float f6 = (float) Math.atan2(vec32.z, vec32.x);
        GlStateManager.rotate(((float) Math.PI / 2F + -f6) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(f5 * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
        int i = 1;
        double d1 = f2 * 0.05D * (1.0D - (i & 1) * 2.5D);
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        float f7 = f * f;
        double d2 = i * 0.2D;
        double d3 = d2 * 1.41D;
        double d4 = 0.0D + Math.cos(d1 + 2.356194490192345D) * d3;
        double d5 = 0.0D + Math.sin(d1 + 2.356194490192345D) * d3;
        double d6 = 0.0D + Math.cos(d1 + Math.PI / 4D) * d3;
        double d7 = 0.0D + Math.sin(d1 + Math.PI / 4D) * d3;
        double d8 = 0.0D + Math.cos(d1 + 3.9269908169872414D) * d3;
        double d9 = 0.0D + Math.sin(d1 + 3.9269908169872414D) * d3;
        double d10 = 0.0D + Math.cos(d1 + 5.497787143782138D) * d3;
        double d11 = 0.0D + Math.sin(d1 + 5.497787143782138D) * d3;
        double d12 = 0.0D + Math.cos(d1 + Math.PI) * d2;
        double d13 = 0.0D + Math.sin(d1 + Math.PI) * d2;
        double d14 = 0.0D + Math.cos(d1 + 0.0D) * d2;
        double d15 = 0.0D + Math.sin(d1 + 0.0D) * d2;
        double d16 = 0.0D + Math.cos(d1 + Math.PI / 2D) * d2;
        double d17 = 0.0D + Math.sin(d1 + Math.PI / 2D) * d2;
        double d18 = 0.0D + Math.cos(d1 + Math.PI * 3D / 2D) * d2;
        double d19 = 0.0D + Math.sin(d1 + Math.PI * 3D / 2D) * d2;
        double d22 = -1.0F + f3;
        double d23 = d0 * (0.5D / d2) + d22;
        double d24 = 0.0D;
        if (entity.ticksExisted % 2 == 0) {
            d24 = 0.5D;
        }
        if (f7 > 0.9F) {
            f7 = 0.9F;
        }
        int red = 144 + (int) (f7 * 60.0F);
        int green = 56 + (int) (f7 * 50.0F);
        int blue = 34 + (int) (f7 * 50.0F);
        worldrenderer.pos(d12, d0, d13).tex(0.4999D, d23).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d12, 0.0D, d13).tex(0.4999D, d22).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d14, 0.0D, d15).tex(0.0D, d22).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d14, d0, d15).tex(0.0D, d23).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d16, d0, d17).tex(0.4999D, d23).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d16, 0.0D, d17).tex(0.4999D, d22).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d18, 0.0D, d19).tex(0.0D, d22).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d18, d0, d19).tex(0.0D, d23).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d4, d0, d5).tex(0.5D, d24 + 0.5D).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d6, d0, d7).tex(1.0D, d24 + 0.5D).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d10, d0, d11).tex(1.0D, d24).color(red, green, blue, 255).endVertex();
        worldrenderer.pos(d8, d0, d9).tex(0.5D, d24).color(red, green, blue, 255).endVertex();
        tessellator.draw();
        GlStateManager.enableLighting();
        GlStateManager.enableCull();
        GlStateManager.depthMask(false);
        GlStateManager.popMatrix();
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) ResourceLocation(net.minecraft.util.ResourceLocation) EntityLivingBase(net.minecraft.entity.EntityLivingBase) Vec3d(net.minecraft.util.math.Vec3d)

Example 53 with Vec3d

use of net.minecraft.util.math.Vec3d in project MorePlanets by SteveKunG.

the class RenderAlienMiner method doRender.

@Override
public void doRender(EntityAlienMiner entity, double x, double y, double z, float entityYaw, float partialTicks) {
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
    EntityLivingBase entitylivingbase = entity.getTargetedEntity();
    if (entitylivingbase != null && entity.getChargedTime(partialTicks) > 0.925F) {
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder worldrenderer = tessellator.getBuffer();
        this.bindTexture(new ResourceLocation("moreplanets:textures/entity/alien_miner_beam.png"));
        GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
        GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
        GlStateManager.disableLighting();
        GlStateManager.disableCull();
        GlStateManager.disableBlend();
        GlStateManager.depthMask(true);
        GlStateManager.enableAlpha();
        float f1 = 240.0F;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f1, f1);
        GlStateManager.blendFunc(770, 771);
        float f2 = entity.world.getTotalWorldTime() + partialTicks;
        float f3 = f2 * 0.5F % 1.0F;
        float f4 = entity.getEyeHeight() + 0.25F - 0.5F + entity.getHoverTick(partialTicks);
        GlStateManager.pushMatrix();
        GlStateManager.translate((float) x, (float) y + f4, (float) z);
        Vec3d vec3 = this.getPosition(entitylivingbase, entitylivingbase.height * 0.5D, partialTicks);
        Vec3d vec31 = this.getPosition(entity, f4, partialTicks);
        Vec3d vec32 = vec3.subtract(vec31);
        double d0 = vec32.lengthVector();
        vec32 = vec32.normalize();
        float f5 = (float) Math.acos(vec32.y);
        float f6 = (float) Math.atan2(vec32.z, vec32.x);
        GlStateManager.rotate(((float) Math.PI / 2F + -f6) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(f5 * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
        int i = 1;
        double d1 = f2 * 0.05D * (1.0D - (i & 1) * 2.5D);
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        int j = 255;
        int k = 255;
        int l = 255;
        double d2 = i * 0.2D;
        double d3 = d2 * 1.41D;
        double d4 = 0.0D + Math.cos(d1 + 2.356194490192345D) * d3;
        double d5 = 0.0D + Math.sin(d1 + 2.356194490192345D) * d3;
        double d6 = 0.0D + Math.cos(d1 + Math.PI / 4D) * d3;
        double d7 = 0.0D + Math.sin(d1 + Math.PI / 4D) * d3;
        double d8 = 0.0D + Math.cos(d1 + 3.9269908169872414D) * d3;
        double d9 = 0.0D + Math.sin(d1 + 3.9269908169872414D) * d3;
        double d10 = 0.0D + Math.cos(d1 + 5.497787143782138D) * d3;
        double d11 = 0.0D + Math.sin(d1 + 5.497787143782138D) * d3;
        double d12 = 0.0D + Math.cos(d1 + Math.PI) * d2;
        double d13 = 0.0D + Math.sin(d1 + Math.PI) * d2;
        double d14 = 0.0D + Math.cos(d1 + 0.0D) * d2;
        double d15 = 0.0D + Math.sin(d1 + 0.0D) * d2;
        double d16 = 0.0D + Math.cos(d1 + Math.PI / 2D) * d2;
        double d17 = 0.0D + Math.sin(d1 + Math.PI / 2D) * d2;
        double d18 = 0.0D + Math.cos(d1 + Math.PI * 3D / 2D) * d2;
        double d19 = 0.0D + Math.sin(d1 + Math.PI * 3D / 2D) * d2;
        double d22 = -1.0F + f3;
        double d23 = d0 * (0.5D / d2) + d22;
        worldrenderer.pos(d12, d0, d13).tex(0.4999D, d23).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d12, 0.0D, d13).tex(0.4999D, d22).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d14, 0.0D, d15).tex(0.0D, d22).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d14, d0, d15).tex(0.0D, d23).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d16, d0, d17).tex(0.4999D, d23).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d16, 0.0D, d17).tex(0.4999D, d22).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d18, 0.0D, d19).tex(0.0D, d22).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d18, d0, d19).tex(0.0D, d23).color(j, k, l, 100).endVertex();
        double d24 = 0.0D;
        if (entity.ticksExisted % 2 == 0) {
            d24 = 0.5D;
        }
        worldrenderer.pos(d4, d0, d5).tex(0.5D, d24 + 0.5D).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d6, d0, d7).tex(1.0D, d24 + 0.5D).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d10, d0, d11).tex(1.0D, d24).color(j, k, l, 100).endVertex();
        worldrenderer.pos(d8, d0, d9).tex(0.5D, d24).color(j, k, l, 100).endVertex();
        tessellator.draw();
        GlStateManager.enableLighting();
        GlStateManager.enableCull();
        GlStateManager.enableBlend();
        GlStateManager.popMatrix();
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) ResourceLocation(net.minecraft.util.ResourceLocation) EntityLivingBase(net.minecraft.entity.EntityLivingBase) Vec3d(net.minecraft.util.math.Vec3d)

Example 54 with Vec3d

use of net.minecraft.util.math.Vec3d in project MorePlanets by SteveKunG.

the class RenderSpaceFishHook method doRender.

@Override
public void doRender(EntitySpaceFishHook entity, double x, double y, double z, float entityYaw, float partialTicks) {
    EntityPlayer player = entity.getAngler();
    if (player != null && !this.renderOutlines) {
        GlStateManager.pushMatrix();
        GlStateManager.translate((float) x, (float) y, (float) z);
        GlStateManager.enableRescaleNormal();
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(entity);
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder vertexbuffer = tessellator.getBuffer();
        GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate((this.renderManager.options.thirdPersonView == 2 ? -1 : 1) * -this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        if (this.renderOutlines) {
            GlStateManager.enableColorMaterial();
            GlStateManager.enableOutlineMode(this.getTeamColor(entity));
        }
        vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL);
        vertexbuffer.pos(-0.5D, -0.5D, 0.0D).tex(0.0625D, 0.1875D).normal(0.0F, 1.0F, 0.0F).endVertex();
        vertexbuffer.pos(0.5D, -0.5D, 0.0D).tex(0.125D, 0.1875D).normal(0.0F, 1.0F, 0.0F).endVertex();
        vertexbuffer.pos(0.5D, 0.5D, 0.0D).tex(0.125D, 0.125D).normal(0.0F, 1.0F, 0.0F).endVertex();
        vertexbuffer.pos(-0.5D, 0.5D, 0.0D).tex(0.0625D, 0.125D).normal(0.0F, 1.0F, 0.0F).endVertex();
        tessellator.draw();
        if (this.renderOutlines) {
            GlStateManager.disableOutlineMode();
            GlStateManager.disableColorMaterial();
        }
        GlStateManager.disableRescaleNormal();
        GlStateManager.popMatrix();
        int k = player.getPrimaryHand() == EnumHandSide.RIGHT ? 1 : -1;
        ItemStack offStack = player.getHeldItemOffhand();
        if (offStack.getItem() == MPItems.SPACE_FISHING_ROD && offStack.hasTagCompound() && offStack.getTagCompound().getBoolean("Cast")) {
            k = -k;
        }
        float f7 = player.getSwingProgress(partialTicks);
        float f8 = MathHelper.sin(MathHelper.sqrt(f7) * (float) Math.PI);
        float f9 = (player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks) * 0.017453292F;
        double d0 = MathHelper.sin(f9);
        double d1 = MathHelper.cos(f9);
        double d2 = k * 0.35D;
        double d4;
        double d5;
        double d6;
        double d7;
        double dz = 0.0D;
        if ((this.renderManager.options == null || this.renderManager.options.thirdPersonView <= 0) && player == Minecraft.getMinecraft().player) {
            float f10 = this.renderManager.options.fovSetting;
            f10 = f10 / 100.0F;
            Vec3d vec3d = new Vec3d(k * -0.5D * f10, 0.025D * f10, 0.65D);
            vec3d = vec3d.rotatePitch(-(player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks) * 0.017453292F);
            vec3d = vec3d.rotateYaw(-(player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * partialTicks) * 0.017453292F);
            vec3d = vec3d.rotateYaw(f8 * 0.5F);
            vec3d = vec3d.rotatePitch(-f8 * 0.7F);
            d4 = player.prevPosX + (player.posX - player.prevPosX) * partialTicks + vec3d.x;
            d5 = player.prevPosY + (player.posY - player.prevPosY) * partialTicks + vec3d.y;
            d6 = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks + vec3d.z;
            d7 = player.getEyeHeight();
        } else {
            double xz = player.isSneaking() ? 0.775D : 0.9D;
            d4 = player.prevPosX + (player.posX - player.prevPosX) * partialTicks - d1 * d2 - d0 * xz;
            d5 = player.prevPosY + player.getEyeHeight() + (player.posY - player.prevPosY) * partialTicks - 0.45D;
            d6 = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks - d0 * d2 + d1 * xz;
            d7 = player.isSneaking() ? -0.45D : 0.0D;
            dz = player.isSneaking() ? 0.01D : 0.0D;
        }
        double d13 = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
        double d8 = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks + 0.25D;
        double d9 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
        double d10 = (float) (d4 - d13) + dz;
        double d11 = (float) (d5 - d8) + d7;
        double d12 = (float) (d6 - d9);
        GlStateManager.disableTexture2D();
        GlStateManager.disableLighting();
        vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
        for (int i1 = 0; i1 <= 16; ++i1) {
            float f11 = i1 / 16.0F;
            vertexbuffer.pos(x + d10 * f11, y + d11 * (f11 * f11 + f11) * 0.5D + 0.25D, z + d12 * f11).color(0, 0, 0, 255).endVertex();
        }
        tessellator.draw();
        GlStateManager.enableLighting();
        GlStateManager.enableTexture2D();
        super.doRender(entity, x, y, z, entityYaw, partialTicks);
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) Vec3d(net.minecraft.util.math.Vec3d)

Example 55 with Vec3d

use of net.minecraft.util.math.Vec3d in project MorePlanets by SteveKunG.

the class ModelGuardianMP method setRotationAngles.

@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale, Entity entity) {
    if (entity instanceof EntityGuardian) {
        EntityGuardian entityguardian = (EntityGuardian) entity;
        float f6 = ageInTicks - entityguardian.ticksExisted;
        this.guardianBody.rotateAngleY = netHeadYaw / (180F / (float) Math.PI);
        this.guardianBody.rotateAngleX = headPitch / (180F / (float) Math.PI);
        float[] afloat = new float[] { 1.75F, 0.25F, 0.0F, 0.0F, 0.5F, 0.5F, 0.5F, 0.5F, 1.25F, 0.75F, 0.0F, 0.0F };
        float[] afloat1 = new float[] { 0.0F, 0.0F, 0.0F, 0.0F, 0.25F, 1.75F, 1.25F, 0.75F, 0.0F, 0.0F, 0.0F, 0.0F };
        float[] afloat2 = new float[] { 0.0F, 0.0F, 0.25F, 1.75F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.75F, 1.25F };
        float[] afloat3 = new float[] { 0.0F, 0.0F, 8.0F, -8.0F, -8.0F, 8.0F, 8.0F, -8.0F, 0.0F, 0.0F, 8.0F, -8.0F };
        float[] afloat4 = new float[] { -8.0F, -8.0F, -8.0F, -8.0F, 0.0F, 0.0F, 0.0F, 0.0F, 8.0F, 8.0F, 8.0F, 8.0F };
        float[] afloat5 = new float[] { 8.0F, -8.0F, 0.0F, 0.0F, -8.0F, -8.0F, 8.0F, 8.0F, 8.0F, -8.0F, 0.0F, 0.0F };
        float f7 = (1.0F - entityguardian.getSpikesAnimation(f6)) * 0.55F;
        for (int i = 0; i < 12; ++i) {
            this.guardianSpines[i].rotateAngleX = (float) Math.PI * afloat[i];
            this.guardianSpines[i].rotateAngleY = (float) Math.PI * afloat1[i];
            this.guardianSpines[i].rotateAngleZ = (float) Math.PI * afloat2[i];
            this.guardianSpines[i].rotationPointX = afloat3[i] * (1.0F + MathHelper.cos(ageInTicks * 1.5F + i) * 0.01F - f7);
            this.guardianSpines[i].rotationPointY = 16.0F + afloat4[i] * (1.0F + MathHelper.cos(ageInTicks * 1.5F + i) * 0.01F - f7);
            this.guardianSpines[i].rotationPointZ = afloat5[i] * (1.0F + MathHelper.cos(ageInTicks * 1.5F + i) * 0.01F - f7);
        }
        this.guardianEye.rotationPointZ = -8.25F;
        Object object = Minecraft.getMinecraft().getRenderViewEntity();
        if (entityguardian.hasTargetedEntity()) {
            object = entityguardian.getTargetedEntity();
        }
        if (object != null) {
            Vec3d vec3 = ((Entity) object).getPositionEyes(0.0F);
            Vec3d vec31 = entity.getPositionEyes(0.0F);
            double d0 = vec3.y - vec31.y;
            if (d0 > 0.0D) {
                this.guardianEye.rotationPointY = 0.0F;
            } else {
                this.guardianEye.rotationPointY = 1.0F;
            }
            Vec3d vec32 = entity.getLook(0.0F);
            vec32 = new Vec3d(vec32.x, 0.0D, vec32.z);
            Vec3d vec33 = new Vec3d(vec31.x - vec3.x, 0.0D, vec31.z - vec3.z).normalize().rotateYaw((float) Math.PI / 2F);
            double d1 = vec32.dotProduct(vec33);
            this.guardianEye.rotationPointX = MathHelper.sqrt((float) Math.abs(d1)) * 2.0F * (float) Math.signum(d1);
        }
        this.guardianEye.showModel = true;
        float f8 = entityguardian.getTailAnimation(f6);
        this.guardianTail[0].rotateAngleY = MathHelper.sin(f8) * (float) Math.PI * 0.05F;
        this.guardianTail[1].rotateAngleY = MathHelper.sin(f8) * (float) Math.PI * 0.1F;
        this.guardianTail[1].rotationPointX = -1.5F;
        this.guardianTail[1].rotationPointY = 0.5F;
        this.guardianTail[1].rotationPointZ = 14.0F;
        this.guardianTail[2].rotateAngleY = MathHelper.sin(f8) * (float) Math.PI * 0.15F;
        this.guardianTail[2].rotationPointX = 0.5F;
        this.guardianTail[2].rotationPointY = 0.5F;
        this.guardianTail[2].rotationPointZ = 6.0F;
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntityGuardian(net.minecraft.entity.monster.EntityGuardian) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

Vec3d (net.minecraft.util.math.Vec3d)789 BlockPos (net.minecraft.util.math.BlockPos)204 Entity (net.minecraft.entity.Entity)118 EnumFacing (net.minecraft.util.EnumFacing)108 ItemStack (net.minecraft.item.ItemStack)100 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)97 RayTraceResult (net.minecraft.util.math.RayTraceResult)90 World (net.minecraft.world.World)90 EntityPlayer (net.minecraft.entity.player.EntityPlayer)88 IBlockState (net.minecraft.block.state.IBlockState)76 EntityLivingBase (net.minecraft.entity.EntityLivingBase)74 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)72 ResourceLocation (net.minecraft.util.ResourceLocation)68 ParticleBuilder (com.teamwizardry.librarianlib.features.particle.ParticleBuilder)59 InterpFadeInOut (com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut)59 TileEntity (net.minecraft.tileentity.TileEntity)42 Block (net.minecraft.block.Block)41 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)30 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)27 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)27