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

The following are Jave code examples for showing how to use abs_max() 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.
Example 1
Project: BaseClient   File: Entity.java   Source Code and License Vote up 4 votes
/**
 * Applies a velocity to each of the entities pushing them away from each other. Args: entity
 */
public void applyEntityCollision(Entity entityIn)
{
    if (entityIn.riddenByEntity != this && entityIn.ridingEntity != this)
    {
        if (!entityIn.noClip && !this.noClip)
        {
            double d0 = entityIn.posX - this.posX;
            double d1 = entityIn.posZ - this.posZ;
            double d2 = MathHelper.abs_max(d0, d1);

            if (d2 >= 0.009999999776482582D)
            {
                d2 = (double)MathHelper.sqrt_double(d2);
                d0 = d0 / d2;
                d1 = d1 / d2;
                double d3 = 1.0D / d2;

                if (d3 > 1.0D)
                {
                    d3 = 1.0D;
                }

                d0 = d0 * d3;
                d1 = d1 * d3;
                d0 = d0 * 0.05000000074505806D;
                d1 = d1 * 0.05000000074505806D;
                d0 = d0 * (double)(1.0F - this.entityCollisionReduction);
                d1 = d1 * (double)(1.0F - this.entityCollisionReduction);

                if (this.riddenByEntity == null)
                {
                    this.addVelocity(-d0, 0.0D, -d1);
                }

                if (entityIn.riddenByEntity == null)
                {
                    entityIn.addVelocity(d0, 0.0D, d1);
                }
            }
        }
    }
}
 
Example 2
Project: BaseClient   File: RealmsMth.java   Source Code and License Vote up 4 votes
public static double absMax(double p_absMax_0_, double p_absMax_2_)
{
    return MathHelper.abs_max(p_absMax_0_, p_absMax_2_);
}
 
Example 3
Project: BaseClient   File: Entity.java   Source Code and License Vote up 4 votes
/**
 * Applies a velocity to each of the entities pushing them away from each other. Args: entity
 */
public void applyEntityCollision(Entity entityIn)
{
    if (entityIn.riddenByEntity != this && entityIn.ridingEntity != this)
    {
        if (!entityIn.noClip && !this.noClip)
        {
            double d0 = entityIn.posX - this.posX;
            double d1 = entityIn.posZ - this.posZ;
            double d2 = MathHelper.abs_max(d0, d1);

            if (d2 >= 0.009999999776482582D)
            {
                d2 = (double)MathHelper.sqrt_double(d2);
                d0 = d0 / d2;
                d1 = d1 / d2;
                double d3 = 1.0D / d2;

                if (d3 > 1.0D)
                {
                    d3 = 1.0D;
                }

                d0 = d0 * d3;
                d1 = d1 * d3;
                d0 = d0 * 0.05000000074505806D;
                d1 = d1 * 0.05000000074505806D;
                d0 = d0 * (double)(1.0F - this.entityCollisionReduction);
                d1 = d1 * (double)(1.0F - this.entityCollisionReduction);

                if (this.riddenByEntity == null)
                {
                    this.addVelocity(-d0, 0.0D, -d1);
                }

                if (entityIn.riddenByEntity == null)
                {
                    entityIn.addVelocity(d0, 0.0D, d1);
                }
            }
        }
    }
}
 
Example 4
Project: BaseClient   File: RealmsMth.java   Source Code and License Vote up 4 votes
public static double absMax(double p_absMax_0_, double p_absMax_2_)
{
    return MathHelper.abs_max(p_absMax_0_, p_absMax_2_);
}