Java Code Examples for net.minecraft.util.MathHelper.sin()

The following are Jave code examples for showing how to use sin() of the net.minecraft.util.MathHelper class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DecompiledMinecraft   File: EntityDragon.java   View Source Code Vote up 6 votes
public boolean attackEntityFromPart(EntityDragonPart dragonPart, DamageSource source, float p_70965_3_)
{
    if (dragonPart != this.dragonPartHead)
    {
        p_70965_3_ = p_70965_3_ / 4.0F + 1.0F;
    }

    float f = this.rotationYaw * (float)Math.PI / 180.0F;
    float f1 = MathHelper.sin(f);
    float f2 = MathHelper.cos(f);
    this.targetX = this.posX + (double)(f1 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F);
    this.targetY = this.posY + (double)(this.rand.nextFloat() * 3.0F) + 1.0D;
    this.targetZ = this.posZ - (double)(f2 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F);
    this.target = null;

    if (source.getEntity() instanceof EntityPlayer || source.isExplosion())
    {
        this.attackDragonFrom(source, p_70965_3_);
    }

    return true;
}
 
Example 2
Project: BaseClient   File: EffectRenderer.java   View Source Code Vote up 6 votes
public void renderLitParticles(Entity entityIn, float p_78872_2_)
{
    float f = 0.017453292F;
    float f1 = MathHelper.cos(entityIn.rotationYaw * 0.017453292F);
    float f2 = MathHelper.sin(entityIn.rotationYaw * 0.017453292F);
    float f3 = -f2 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
    float f4 = f1 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
    float f5 = MathHelper.cos(entityIn.rotationPitch * 0.017453292F);

    for (int i = 0; i < 2; ++i)
    {
        List list = this.fxLayers[3][i];

        if (!list.isEmpty())
        {
            Tessellator tessellator = Tessellator.getInstance();
            WorldRenderer worldrenderer = tessellator.getWorldRenderer();

            for (int j = 0; j < list.size(); ++j)
            {
                EntityFX entityfx = (EntityFX)list.get(j);
                entityfx.renderParticle(worldrenderer, entityIn, p_78872_2_, f1, f5, f2, f3, f4);
            }
        }
    }
}
 
Example 3
Project: BaseClient   File: ModelWitch.java   View Source Code Vote up 6 votes
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
    super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn);
    this.villagerNose.offsetX = this.villagerNose.offsetY = this.villagerNose.offsetZ = 0.0F;
    float f = 0.01F * (float)(entityIn.getEntityId() % 10);
    this.villagerNose.rotateAngleX = MathHelper.sin((float)entityIn.ticksExisted * f) * 4.5F * (float)Math.PI / 180.0F;
    this.villagerNose.rotateAngleY = 0.0F;
    this.villagerNose.rotateAngleZ = MathHelper.cos((float)entityIn.ticksExisted * f) * 2.5F * (float)Math.PI / 180.0F;

    if (this.field_82900_g)
    {
        this.villagerNose.rotateAngleX = -0.9F;
        this.villagerNose.offsetZ = -0.09375F;
        this.villagerNose.offsetY = 0.1875F;
    }
}
 
Example 4
Project: BaseClient   File: EntityFirework.java   View Source Code Vote up 6 votes
public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_)
{
    float f = 0.25F;
    float f1 = 0.5F;
    float f2 = 0.125F;
    float f3 = 0.375F;
    float f4 = 7.1F * MathHelper.sin(((float)this.particleAge + partialTicks - 1.0F) * 0.25F * (float)Math.PI);
    this.particleAlpha = 0.6F - ((float)this.particleAge + partialTicks - 1.0F) * 0.25F * 0.5F;
    float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
    float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
    float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
    int i = this.getBrightnessForRender(partialTicks);
    int j = i >> 16 & 65535;
    int k = i & 65535;
    worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 - p_180434_8_ * f4)).tex(0.5D, 0.375D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
    worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 + p_180434_8_ * f4)).tex(0.5D, 0.125D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
    worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 + p_180434_8_ * f4)).tex(0.25D, 0.125D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
    worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 - p_180434_8_ * f4)).tex(0.25D, 0.375D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
}
 
Example 5
Project: TRAPPIST-1   File: SkyProviderTrappistOneB.java   View Source Code Vote up 6 votes
public float getSkyBrightness(float par1)
{
    final float var2 = FMLClientHandler.instance().getClient().theWorld.getCelestialAngle(par1);
    float var3 = 1.0F - (MathHelper.sin(var2 * (float) Math.PI * 2.0F) * 2.0F + 0.25F);

    if (var3 < 0.0F)
    {
        var3 = 0.0F;
    }

    if (var3 > 1.0F)
    {
        var3 = 1.0F;
    }

    return var3 * var3 * 1F;
}
 
Example 6
Project: BaseClient   File: RenderGlobal.java   View Source Code Vote up 6 votes
protected Vector3f getViewVector(Entity entityIn, double partialTicks)
{
    float f = (float)((double)entityIn.prevRotationPitch + (double)(entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks);
    float f1 = (float)((double)entityIn.prevRotationYaw + (double)(entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks);

    if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 2)
    {
        f += 180.0F;
    }

    float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
    float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
    float f4 = -MathHelper.cos(-f * 0.017453292F);
    float f5 = MathHelper.sin(-f * 0.017453292F);
    return new Vector3f(f3 * f4, f5, f2 * f4);
}
 
Example 7
Project: BaseClient   File: EntityChicken.java   View Source Code Vote up 5 votes
public void updateRiderPosition()
{
    super.updateRiderPosition();
    float f = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F);
    float f1 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F);
    float f2 = 0.1F;
    float f3 = 0.0F;
    this.riddenByEntity.setPosition(this.posX + (double)(f2 * f), this.posY + (double)(this.height * 0.5F) + this.riddenByEntity.getYOffset() + (double)f3, this.posZ - (double)(f2 * f1));

    if (this.riddenByEntity instanceof EntityLivingBase)
    {
        ((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset;
    }
}
 
Example 8
Project: BaseClient   File: EntityWolf.java   View Source Code Vote up 5 votes
public float getShakeAngle(float p_70923_1_, float p_70923_2_)
{
    float f = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F;

    if (f < 0.0F)
    {
        f = 0.0F;
    }
    else if (f > 1.0F)
    {
        f = 1.0F;
    }

    return MathHelper.sin(f * (float)Math.PI) * MathHelper.sin(f * (float)Math.PI * 11.0F) * 0.15F * (float)Math.PI;
}
 
Example 9
Project: BaseClient   File: RenderEntityItem.java   View Source Code Vote up 5 votes
private int func_177077_a(EntityItem itemIn, double p_177077_2_, double p_177077_4_, double p_177077_6_, float p_177077_8_, IBakedModel p_177077_9_)
{
    ItemStack itemstack = itemIn.getEntityItem();
    Item item = itemstack.getItem();

    if (item == null)
    {
        return 0;
    }
    else
    {
        boolean flag = p_177077_9_.isGui3d();
        int i = this.func_177078_a(itemstack);
        float f = 0.25F;
        float f1 = MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F;
        float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y;
        GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_);

        if (flag || this.renderManager.options != null)
        {
            float f3 = (((float)itemIn.getAge() + p_177077_8_) / 20.0F + itemIn.hoverStart) * (180F / (float)Math.PI);
            GlStateManager.rotate(f3, 0.0F, 1.0F, 0.0F);
        }

        if (!flag)
        {
            float f6 = -0.0F * (float)(i - 1) * 0.5F;
            float f4 = -0.0F * (float)(i - 1) * 0.5F;
            float f5 = -0.046875F * (float)(i - 1) * 0.5F;
            GlStateManager.translate(f6, f4, f5);
        }

        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        return i;
    }
}
 
Example 10
Project: BaseClient   File: EntityWither.java   View Source Code Vote up 5 votes
private double func_82213_w(int p_82213_1_)
{
    if (p_82213_1_ <= 0)
    {
        return this.posZ;
    }
    else
    {
        float f = (this.renderYawOffset + (float)(180 * (p_82213_1_ - 1))) / 180.0F * (float)Math.PI;
        float f1 = MathHelper.sin(f);
        return this.posZ + (double)f1 * 1.3D;
    }
}
 
Example 11
Project: DecompiledMinecraft   File: EntityWither.java   View Source Code Vote up 5 votes
private double func_82213_w(int p_82213_1_)
{
    if (p_82213_1_ <= 0)
    {
        return this.posZ;
    }
    else
    {
        float f = (this.renderYawOffset + (float)(180 * (p_82213_1_ - 1))) / 180.0F * (float)Math.PI;
        float f1 = MathHelper.sin(f);
        return this.posZ + (double)f1 * 1.3D;
    }
}
 
Example 12
Project: SerenityCE   File: MixinEntityPlayerSP.java   View Source Code Vote up 5 votes
@Override
public void jump() {
    super.jump();

    if (this.isSprinting()) {
        try {
            Sprint sprint = Serenity.getInstance().getModuleManager().getModule(Sprint.class);
            if (sprint.isEnabled() && sprint.omnidirectional.getValue()) {
                float f = (float) Math.toRadians(this.rotationYaw);
                this.motionX += (double) (MathHelper.sin(f) * 0.2F);
                this.motionZ -= (double) (MathHelper.cos(f) * 0.2F);

                float yaw = this.rotationYaw;
                if (this.moveForward < 0) {
                    yaw += 180;
                }

                if (this.moveStrafing > 0) {
                    yaw -= 90 * (this.moveForward > 0 ? 0.5F : this.moveForward < 0 ? -0.5F : 1);
                }

                if (this.moveStrafing < 0) {
                    yaw += 90 * (this.moveForward > 0 ? 0.5F : this.moveForward < 0 ? -0.5F : 1);
                }

                f = (float) Math.toRadians(yaw);
                this.motionX -= (double) (MathHelper.sin(f) * 0.2F);
                this.motionZ += (double) (MathHelper.cos(f) * 0.2F);
            }
        } catch (Exception e) {}
    }
}
 
Example 13
Project: DecompiledMinecraft   File: EntityWither.java   View Source Code Vote up 5 votes
private double func_82213_w(int p_82213_1_)
{
    if (p_82213_1_ <= 0)
    {
        return this.posZ;
    }
    else
    {
        float f = (this.renderYawOffset + (float)(180 * (p_82213_1_ - 1))) / 180.0F * (float)Math.PI;
        float f1 = MathHelper.sin(f);
        return this.posZ + (double)f1 * 1.3D;
    }
}
 
Example 14
Project: DecompiledMinecraft   File: ModelBook.java   View Source Code Vote up 5 votes
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
    float f = (MathHelper.sin(p_78087_1_ * 0.02F) * 0.1F + 1.25F) * p_78087_4_;
    this.coverRight.rotateAngleY = (float)Math.PI + f;
    this.coverLeft.rotateAngleY = -f;
    this.pagesRight.rotateAngleY = f;
    this.pagesLeft.rotateAngleY = -f;
    this.flippingPageRight.rotateAngleY = f - f * 2.0F * p_78087_2_;
    this.flippingPageLeft.rotateAngleY = f - f * 2.0F * p_78087_3_;
    this.pagesRight.rotationPointX = MathHelper.sin(f);
    this.pagesLeft.rotationPointX = MathHelper.sin(f);
    this.flippingPageRight.rotationPointX = MathHelper.sin(f);
    this.flippingPageLeft.rotationPointX = MathHelper.sin(f);
}
 
Example 15
Project: DecompiledMinecraft   File: ModelBlaze.java   View Source Code Vote up 5 votes
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
    float f = p_78087_3_ * (float)Math.PI * -0.1F;

    for (int i = 0; i < 4; ++i)
    {
        this.blazeSticks[i].rotationPointY = -2.0F + MathHelper.cos(((float)(i * 2) + p_78087_3_) * 0.25F);
        this.blazeSticks[i].rotationPointX = MathHelper.cos(f) * 9.0F;
        this.blazeSticks[i].rotationPointZ = MathHelper.sin(f) * 9.0F;
        ++f;
    }

    f = ((float)Math.PI / 4F) + p_78087_3_ * (float)Math.PI * 0.03F;

    for (int j = 4; j < 8; ++j)
    {
        this.blazeSticks[j].rotationPointY = 2.0F + MathHelper.cos(((float)(j * 2) + p_78087_3_) * 0.25F);
        this.blazeSticks[j].rotationPointX = MathHelper.cos(f) * 7.0F;
        this.blazeSticks[j].rotationPointZ = MathHelper.sin(f) * 7.0F;
        ++f;
    }

    f = 0.47123894F + p_78087_3_ * (float)Math.PI * -0.05F;

    for (int k = 8; k < 12; ++k)
    {
        this.blazeSticks[k].rotationPointY = 11.0F + MathHelper.cos(((float)k * 1.5F + p_78087_3_) * 0.5F);
        this.blazeSticks[k].rotationPointX = MathHelper.cos(f) * 5.0F;
        this.blazeSticks[k].rotationPointZ = MathHelper.sin(f) * 5.0F;
        ++f;
    }

    this.blazeHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
    this.blazeHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
}
 
Example 16
Project: BaseClient   File: WorldGenMinable.java   View Source Code Vote up 4 votes
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    float f = rand.nextFloat() * (float)Math.PI;
    double d0 = (double)((float)(position.getX() + 8) + MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F);
    double d1 = (double)((float)(position.getX() + 8) - MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F);
    double d2 = (double)((float)(position.getZ() + 8) + MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F);
    double d3 = (double)((float)(position.getZ() + 8) - MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F);
    double d4 = (double)(position.getY() + rand.nextInt(3) - 2);
    double d5 = (double)(position.getY() + rand.nextInt(3) - 2);

    for (int i = 0; i < this.numberOfBlocks; ++i)
    {
        float f1 = (float)i / (float)this.numberOfBlocks;
        double d6 = d0 + (d1 - d0) * (double)f1;
        double d7 = d4 + (d5 - d4) * (double)f1;
        double d8 = d2 + (d3 - d2) * (double)f1;
        double d9 = rand.nextDouble() * (double)this.numberOfBlocks / 16.0D;
        double d10 = (double)(MathHelper.sin((float)Math.PI * f1) + 1.0F) * d9 + 1.0D;
        double d11 = (double)(MathHelper.sin((float)Math.PI * f1) + 1.0F) * d9 + 1.0D;
        int j = MathHelper.floor_double(d6 - d10 / 2.0D);
        int k = MathHelper.floor_double(d7 - d11 / 2.0D);
        int l = MathHelper.floor_double(d8 - d10 / 2.0D);
        int i1 = MathHelper.floor_double(d6 + d10 / 2.0D);
        int j1 = MathHelper.floor_double(d7 + d11 / 2.0D);
        int k1 = MathHelper.floor_double(d8 + d10 / 2.0D);

        for (int l1 = j; l1 <= i1; ++l1)
        {
            double d12 = ((double)l1 + 0.5D - d6) / (d10 / 2.0D);

            if (d12 * d12 < 1.0D)
            {
                for (int i2 = k; i2 <= j1; ++i2)
                {
                    double d13 = ((double)i2 + 0.5D - d7) / (d11 / 2.0D);

                    if (d12 * d12 + d13 * d13 < 1.0D)
                    {
                        for (int j2 = l; j2 <= k1; ++j2)
                        {
                            double d14 = ((double)j2 + 0.5D - d8) / (d10 / 2.0D);

                            if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D)
                            {
                                BlockPos blockpos = new BlockPos(l1, i2, j2);

                                if (this.predicate.apply(worldIn.getBlockState(blockpos)))
                                {
                                    worldIn.setBlockState(blockpos, this.oreBlock, 2);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    return true;
}
 
Example 17
Project: BaseClient   File: EntityRenderer.java   View Source Code Vote up 4 votes
private float getNightVisionBrightness(EntityLivingBase entitylivingbaseIn, float partialTicks)
{
    int i = entitylivingbaseIn.getActivePotionEffect(Potion.nightVision).getDuration();
    return i > 200 ? 1.0F : 0.7F + MathHelper.sin(((float)i - partialTicks) * (float)Math.PI * 0.2F) * 0.3F;
}
 
Example 18
Project: BaseClient   File: RenderArrow.java   View Source Code Vote up 4 votes
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doe
 */
public void doRender(EntityArrow entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    this.bindEntityTexture(entity);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)x, (float)y, (float)z);
    GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    int i = 0;
    float f = 0.0F;
    float f1 = 0.5F;
    float f2 = (float)(0 + i * 10) / 32.0F;
    float f3 = (float)(5 + i * 10) / 32.0F;
    float f4 = 0.0F;
    float f5 = 0.15625F;
    float f6 = (float)(5 + i * 10) / 32.0F;
    float f7 = (float)(10 + i * 10) / 32.0F;
    float f8 = 0.05625F;
    GlStateManager.enableRescaleNormal();
    float f9 = (float)entity.arrowShake - partialTicks;

    if (f9 > 0.0F)
    {
        float f10 = -MathHelper.sin(f9 * 3.0F) * f9;
        GlStateManager.rotate(f10, 0.0F, 0.0F, 1.0F);
    }

    GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.scale(f8, f8, f8);
    GlStateManager.translate(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f8, 0.0F, 0.0F);
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f6).endVertex();
    worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f6).endVertex();
    worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f7).endVertex();
    worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f7).endVertex();
    tessellator.draw();
    GL11.glNormal3f(-f8, 0.0F, 0.0F);
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f6).endVertex();
    worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f6).endVertex();
    worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f7).endVertex();
    worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f7).endVertex();
    tessellator.draw();

    for (int j = 0; j < 4; ++j)
    {
        GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f8);
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
        worldrenderer.pos(-8.0D, -2.0D, 0.0D).tex((double)f, (double)f2).endVertex();
        worldrenderer.pos(8.0D, -2.0D, 0.0D).tex((double)f1, (double)f2).endVertex();
        worldrenderer.pos(8.0D, 2.0D, 0.0D).tex((double)f1, (double)f3).endVertex();
        worldrenderer.pos(-8.0D, 2.0D, 0.0D).tex((double)f, (double)f3).endVertex();
        tessellator.draw();
    }

    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
 
Example 19
Project: DecompiledMinecraft   File: RenderDragon.java   View Source Code Vote up 4 votes
/**
 * Draws the ray from the dragon to it's crystal
 */
protected void drawRechargeRay(EntityDragon dragon, double p_180574_2_, double p_180574_4_, double p_180574_6_, float p_180574_8_)
{
    float f = (float)dragon.healingEnderCrystal.innerRotation + p_180574_8_;
    float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F;
    f1 = (f1 * f1 + f1) * 0.2F;
    float f2 = (float)(dragon.healingEnderCrystal.posX - dragon.posX - (dragon.prevPosX - dragon.posX) * (double)(1.0F - p_180574_8_));
    float f3 = (float)((double)f1 + dragon.healingEnderCrystal.posY - 1.0D - dragon.posY - (dragon.prevPosY - dragon.posY) * (double)(1.0F - p_180574_8_));
    float f4 = (float)(dragon.healingEnderCrystal.posZ - dragon.posZ - (dragon.prevPosZ - dragon.posZ) * (double)(1.0F - p_180574_8_));
    float f5 = MathHelper.sqrt_float(f2 * f2 + f4 * f4);
    float f6 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4);
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)p_180574_2_, (float)p_180574_4_ + 2.0F, (float)p_180574_6_);
    GlStateManager.rotate((float)(-Math.atan2((double)f4, (double)f2)) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate((float)(-Math.atan2((double)f5, (double)f3)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    RenderHelper.disableStandardItemLighting();
    GlStateManager.disableCull();
    this.bindTexture(enderDragonCrystalBeamTextures);
    GlStateManager.shadeModel(7425);
    float f7 = 0.0F - ((float)dragon.ticksExisted + p_180574_8_) * 0.01F;
    float f8 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4) / 32.0F - ((float)dragon.ticksExisted + p_180574_8_) * 0.01F;
    worldrenderer.begin(5, DefaultVertexFormats.POSITION_TEX_COLOR);
    int i = 8;

    for (int j = 0; j <= 8; ++j)
    {
        float f9 = MathHelper.sin((float)(j % 8) * (float)Math.PI * 2.0F / 8.0F) * 0.75F;
        float f10 = MathHelper.cos((float)(j % 8) * (float)Math.PI * 2.0F / 8.0F) * 0.75F;
        float f11 = (float)(j % 8) * 1.0F / 8.0F;
        worldrenderer.pos((double)(f9 * 0.2F), (double)(f10 * 0.2F), 0.0D).tex((double)f11, (double)f8).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos((double)f9, (double)f10, (double)f6).tex((double)f11, (double)f7).color(255, 255, 255, 255).endVertex();
    }

    tessellator.draw();
    GlStateManager.enableCull();
    GlStateManager.shadeModel(7424);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.popMatrix();
}
 
Example 20
Project: minecraft-quiverbow   File: Render_Projectile.java   View Source Code Vote up 4 votes
public void doRender_Arrow(_ProjectileBase shot, double x, double y, double z, float par8, float par9)
{
    this.bindEntityTexture(shot);
   
    GL11.glPushMatrix();
    GL11.glTranslatef((float)x, (float)y, (float)z);
    GL11.glRotatef(shot.prevRotationYaw + (shot.rotationYaw - shot.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(shot.prevRotationPitch + (shot.rotationPitch - shot.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
    
    Tessellator tessellator = Tessellator.instance;
    
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = (float)(0 + b0 * 10) / 32.0F;
    float f5 = (float)(5 + b0 * 10) / 32.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (float)(5 + b0 * 10) / 32.0F;
    float f9 = (float)(10 + b0 * 10) / 32.0F;
    float f10 = 0.05625F;
   
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    
    float f11 = (float) shot.arrowShake - par9;

    if (f11 > 0.0F)
    {
        float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
        GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
    }

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9);
    tessellator.draw();
   
    GL11.glNormal3f(-f10, 0.0F, 0.0F);
    
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9);
    tessellator.draw();

    for (int i = 0; i < 4; ++i)
    {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5);
        tessellator.draw();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}