Java 类net.minecraft.util.MathHelper 实例源码

项目:DecompiledMinecraft    文件:BlockDaylightDetector.java   
public void updatePower(World worldIn, BlockPos pos)
{
    if (!worldIn.provider.getHasNoSky())
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
        float f = worldIn.getCelestialAngleRadians(1.0F);
        float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
        f = f + (f1 - f) * 0.2F;
        i = Math.round((float)i * MathHelper.cos(f));
        i = MathHelper.clamp_int(i, 0, 15);

        if (this.inverted)
        {
            i = 15 - i;
        }

        if (((Integer)iblockstate.getValue(POWER)).intValue() != i)
        {
            worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
        }
    }
}
项目:DecompiledMinecraft    文件:EntityDragon.java   
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;
}
项目:DecompiledMinecraft    文件:EntityFishHook.java   
public void handleHookCasting(double p_146035_1_, double p_146035_3_, double p_146035_5_, float p_146035_7_, float p_146035_8_)
{
    float f = MathHelper.sqrt_double(p_146035_1_ * p_146035_1_ + p_146035_3_ * p_146035_3_ + p_146035_5_ * p_146035_5_);
    p_146035_1_ = p_146035_1_ / (double)f;
    p_146035_3_ = p_146035_3_ / (double)f;
    p_146035_5_ = p_146035_5_ / (double)f;
    p_146035_1_ = p_146035_1_ + this.rand.nextGaussian() * 0.007499999832361937D * (double)p_146035_8_;
    p_146035_3_ = p_146035_3_ + this.rand.nextGaussian() * 0.007499999832361937D * (double)p_146035_8_;
    p_146035_5_ = p_146035_5_ + this.rand.nextGaussian() * 0.007499999832361937D * (double)p_146035_8_;
    p_146035_1_ = p_146035_1_ * (double)p_146035_7_;
    p_146035_3_ = p_146035_3_ * (double)p_146035_7_;
    p_146035_5_ = p_146035_5_ * (double)p_146035_7_;
    this.motionX = p_146035_1_;
    this.motionY = p_146035_3_;
    this.motionZ = p_146035_5_;
    float f1 = MathHelper.sqrt_double(p_146035_1_ * p_146035_1_ + p_146035_5_ * p_146035_5_);
    this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(p_146035_1_, p_146035_5_) * 180.0D / Math.PI);
    this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(p_146035_3_, (double)f1) * 180.0D / Math.PI);
    this.ticksInGround = 0;
}
项目:DecompiledMinecraft    文件:EntityDragon.java   
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;
}
项目:BaseClient    文件:MovingSoundMinecart.java   
/**
 * Like the old updateEntity(), except more generic.
 */
public void update()
{
    if (this.minecart.isDead)
    {
        this.donePlaying = true;
    }
    else
    {
        this.xPosF = (float)this.minecart.posX;
        this.yPosF = (float)this.minecart.posY;
        this.zPosF = (float)this.minecart.posZ;
        float f = MathHelper.sqrt_double(this.minecart.motionX * this.minecart.motionX + this.minecart.motionZ * this.minecart.motionZ);

        if ((double)f >= 0.01D)
        {
            this.distance = MathHelper.clamp_float(this.distance + 0.0025F, 0.0F, 1.0F);
            this.volume = 0.0F + MathHelper.clamp_float(f, 0.0F, 0.5F) * 0.7F;
        }
        else
        {
            this.distance = 0.0F;
            this.volume = 0.0F;
        }
    }
}
项目:BaseClient    文件:EntityDragon.java   
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;
}
项目:BaseClient    文件:World.java   
public <T extends Entity> List<T> getEntitiesWithinAABB(Class <? extends T > clazz, AxisAlignedBB aabb, Predicate <? super T > filter)
{
    int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D);
    int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D);
    int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D);
    int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D);
    List<T> list = Lists.<T>newArrayList();

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.isChunkLoaded(i1, j1, true))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesOfTypeWithinAAAB(clazz, aabb, list, filter);
            }
        }
    }

    return list;
}
项目:TRAPPIST-1    文件:WorldProviderTrappistOneB.java   
@Override
@SideOnly(Side.CLIENT)
public float getStarBrightness(float par1)
{
    final float var2 = this.worldObj.getCelestialAngle(par1);
    float var3 = 1.0F - (MathHelper.cos(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 * 0.5F + 0.3F;
}
项目:minecraft-quiverbow    文件:OSP.java   
private void dropMagazine(World world, ItemStack stack, Entity entity)
{
    if (!(entity instanceof EntityPlayer)) // For QuiverMobs/Arms Assistants
    {
        this.setCooldown(stack, 60);
        return;
    }

    ItemStack clipStack = Helper.getAmmoStack(ObsidianMagazine.class, MathHelper.floor_double(stack.getItemDamage() / 2) + 1);  // Unloading all ammo into that clip, with some loss

    stack.setItemDamage(this.getMaxDamage());   // Emptying out

    // Creating the clip
    EntityItem entityitem = new EntityItem(world, entity.posX, entity.posY + 1.0d, entity.posZ, clipStack);
    entityitem.delayBeforeCanPickup = 10;

    // And dropping it
    if (entity.captureDrops) { entity.capturedDrops.add(entityitem); }
    else { world.spawnEntityInWorld(entityitem); }

    // SFX
    world.playSoundAtEntity(entity, "random.click", 1.7F, 0.3F);
}
项目:DecompiledMinecraft    文件:PathNavigateGround.java   
/**
 * Trims path data from the end to the first sun covered block
 */
protected void removeSunnyPath()
{
    super.removeSunnyPath();

    if (this.shouldAvoidSun)
    {
        if (this.worldObj.canSeeSky(new BlockPos(MathHelper.floor_double(this.theEntity.posX), (int)(this.theEntity.getEntityBoundingBox().minY + 0.5D), MathHelper.floor_double(this.theEntity.posZ))))
        {
            return;
        }

        for (int i = 0; i < this.currentPath.getCurrentPathLength(); ++i)
        {
            PathPoint pathpoint = this.currentPath.getPathPointFromIndex(i);

            if (this.worldObj.canSeeSky(new BlockPos(pathpoint.xCoord, pathpoint.yCoord, pathpoint.zCoord)))
            {
                this.currentPath.setCurrentPathLength(i - 1);
                return;
            }
        }
    }
}
项目:DecompiledMinecraft    文件:BlockChest.java   
public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
{
    if (!this.canProvidePower())
    {
        return 0;
    }
    else
    {
        int i = 0;
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityChest)
        {
            i = ((TileEntityChest)tileentity).numPlayersUsing;
        }

        return MathHelper.clamp_int(i, 0, 15);
    }
}
项目:DecompiledMinecraft    文件:PathNavigateClimber.java   
public void onUpdateNavigation()
{
    if (!this.noPath())
    {
        super.onUpdateNavigation();
    }
    else
    {
        if (this.targetPosition != null)
        {
            double d0 = (double)(this.theEntity.width * this.theEntity.width);

            if (this.theEntity.getDistanceSqToCenter(this.targetPosition) >= d0 && (this.theEntity.posY <= (double)this.targetPosition.getY() || this.theEntity.getDistanceSqToCenter(new BlockPos(this.targetPosition.getX(), MathHelper.floor_double(this.theEntity.posY), this.targetPosition.getZ())) >= d0))
            {
                this.theEntity.getMoveHelper().setMoveTo((double)this.targetPosition.getX(), (double)this.targetPosition.getY(), (double)this.targetPosition.getZ(), this.speed);
            }
            else
            {
                this.targetPosition = null;
            }
        }
    }
}
项目:DecompiledMinecraft    文件:ModelZombie.java   
/**
 * 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);
    float f = MathHelper.sin(this.swingProgress * (float)Math.PI);
    float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI);
    this.bipedRightArm.rotateAngleZ = 0.0F;
    this.bipedLeftArm.rotateAngleZ = 0.0F;
    this.bipedRightArm.rotateAngleY = -(0.1F - f * 0.6F);
    this.bipedLeftArm.rotateAngleY = 0.1F - f * 0.6F;
    this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F);
    this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F);
    this.bipedRightArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
    this.bipedLeftArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
    this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
    this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
    this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
    this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
}
项目:BaseClient    文件:EntityThrowable.java   
public EntityThrowable(World worldIn, EntityLivingBase throwerIn)
{
    super(worldIn);
    this.thrower = throwerIn;
    this.setSize(0.25F, 0.25F);
    this.setLocationAndAngles(throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight(), throwerIn.posZ, throwerIn.rotationYaw, throwerIn.rotationPitch);
    this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
    this.posY -= 0.10000000149011612D;
    this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
    this.setPosition(this.posX, this.posY, this.posZ);
    float f = 0.4F;
    this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
    this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
    this.motionY = (double)(-MathHelper.sin((this.rotationPitch + this.getInaccuracy()) / 180.0F * (float)Math.PI) * f);
    this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.getVelocity(), 1.0F);
}
项目:BaseClient    文件:EntityLookHelper.java   
private float updateRotation(float p_75652_1_, float p_75652_2_, float p_75652_3_)
{
    float f = MathHelper.wrapAngleTo180_float(p_75652_2_ - p_75652_1_);

    if (f > p_75652_3_)
    {
        f = p_75652_3_;
    }

    if (f < -p_75652_3_)
    {
        f = -p_75652_3_;
    }

    return p_75652_1_ + f;
}
项目:BaseClient    文件:EntityFishHook.java   
public void handleHookCasting(double p_146035_1_, double p_146035_3_, double p_146035_5_, float p_146035_7_, float p_146035_8_)
{
    float f = MathHelper.sqrt_double(p_146035_1_ * p_146035_1_ + p_146035_3_ * p_146035_3_ + p_146035_5_ * p_146035_5_);
    p_146035_1_ = p_146035_1_ / (double)f;
    p_146035_3_ = p_146035_3_ / (double)f;
    p_146035_5_ = p_146035_5_ / (double)f;
    p_146035_1_ = p_146035_1_ + this.rand.nextGaussian() * 0.007499999832361937D * (double)p_146035_8_;
    p_146035_3_ = p_146035_3_ + this.rand.nextGaussian() * 0.007499999832361937D * (double)p_146035_8_;
    p_146035_5_ = p_146035_5_ + this.rand.nextGaussian() * 0.007499999832361937D * (double)p_146035_8_;
    p_146035_1_ = p_146035_1_ * (double)p_146035_7_;
    p_146035_3_ = p_146035_3_ * (double)p_146035_7_;
    p_146035_5_ = p_146035_5_ * (double)p_146035_7_;
    this.motionX = p_146035_1_;
    this.motionY = p_146035_3_;
    this.motionZ = p_146035_5_;
    float f1 = MathHelper.sqrt_double(p_146035_1_ * p_146035_1_ + p_146035_5_ * p_146035_5_);
    this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(p_146035_1_, p_146035_5_) * 180.0D / Math.PI);
    this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(p_146035_3_, (double)f1) * 180.0D / Math.PI);
    this.ticksInGround = 0;
}
项目:BaseClient    文件:BlockPistonBase.java   
public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn)
{
    if (MathHelper.abs((float)entityIn.posX - (float)clickedBlock.getX()) < 2.0F && MathHelper.abs((float)entityIn.posZ - (float)clickedBlock.getZ()) < 2.0F)
    {
        double d0 = entityIn.posY + (double)entityIn.getEyeHeight();

        if (d0 - (double)clickedBlock.getY() > 2.0D)
        {
            return EnumFacing.UP;
        }

        if ((double)clickedBlock.getY() - d0 > 0.0D)
        {
            return EnumFacing.DOWN;
        }
    }

    return entityIn.getHorizontalFacing().getOpposite();
}
项目:BaseClient    文件:BlockPistonBase.java   
public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn)
{
    if (MathHelper.abs((float)entityIn.posX - (float)clickedBlock.getX()) < 2.0F && MathHelper.abs((float)entityIn.posZ - (float)clickedBlock.getZ()) < 2.0F)
    {
        double d0 = entityIn.posY + (double)entityIn.getEyeHeight();

        if (d0 - (double)clickedBlock.getY() > 2.0D)
        {
            return EnumFacing.UP;
        }

        if ((double)clickedBlock.getY() - d0 > 0.0D)
        {
            return EnumFacing.DOWN;
        }
    }

    return entityIn.getHorizontalFacing().getOpposite();
}
项目:BaseClient    文件:Entity.java   
public void func_181015_d(BlockPos p_181015_1_)
{
    if (this.timeUntilPortal > 0)
    {
        this.timeUntilPortal = this.getPortalCooldown();
    }
    else
    {
        if (!this.worldObj.isRemote && !p_181015_1_.equals(this.field_181016_an))
        {
            this.field_181016_an = p_181015_1_;
            BlockPattern.PatternHelper blockpattern$patternhelper = Blocks.portal.func_181089_f(this.worldObj, p_181015_1_);
            double d0 = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? (double)blockpattern$patternhelper.func_181117_a().getZ() : (double)blockpattern$patternhelper.func_181117_a().getX();
            double d1 = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? this.posZ : this.posX;
            d1 = Math.abs(MathHelper.func_181160_c(d1 - (double)(blockpattern$patternhelper.getFinger().rotateY().getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE ? 1 : 0), d0, d0 - (double)blockpattern$patternhelper.func_181118_d()));
            double d2 = MathHelper.func_181160_c(this.posY - 1.0D, (double)blockpattern$patternhelper.func_181117_a().getY(), (double)(blockpattern$patternhelper.func_181117_a().getY() - blockpattern$patternhelper.func_181119_e()));
            this.field_181017_ao = new Vec3(d1, d2, 0.0D);
            this.field_181018_ap = blockpattern$patternhelper.getFinger();
        }

        this.inPortal = true;
    }
}
项目:BaseClient    文件:EntityEnderCrystal.java   
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;
    ++this.innerRotation;
    this.dataWatcher.updateObject(8, Integer.valueOf(this.health));
    int i = MathHelper.floor_double(this.posX);
    int j = MathHelper.floor_double(this.posY);
    int k = MathHelper.floor_double(this.posZ);

    if (this.worldObj.provider instanceof WorldProviderEnd && this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock() != Blocks.fire)
    {
        this.worldObj.setBlockState(new BlockPos(i, j, k), Blocks.fire.getDefaultState());
    }
}
项目:DecompiledMinecraft    文件:EntityGhast.java   
public void onUpdateMoveHelper()
{
    if (this.update)
    {
        double d0 = this.posX - this.parentEntity.posX;
        double d1 = this.posY - this.parentEntity.posY;
        double d2 = this.posZ - this.parentEntity.posZ;
        double d3 = d0 * d0 + d1 * d1 + d2 * d2;

        if (this.courseChangeCooldown-- <= 0)
        {
            this.courseChangeCooldown += this.parentEntity.getRNG().nextInt(5) + 2;
            d3 = (double)MathHelper.sqrt_double(d3);

            if (this.isNotColliding(this.posX, this.posY, this.posZ, d3))
            {
                this.parentEntity.motionX += d0 / d3 * 0.1D;
                this.parentEntity.motionY += d1 / d3 * 0.1D;
                this.parentEntity.motionZ += d2 / d3 * 0.1D;
            }
            else
            {
                this.update = false;
            }
        }
    }
}
项目:BaseClient    文件:EntityFallingBlock.java   
public void fall(float distance, float damageMultiplier)
{
    Block block = this.fallTile.getBlock();

    if (this.hurtEntities)
    {
        int i = MathHelper.ceiling_float_int(distance - 1.0F);

        if (i > 0)
        {
            List<Entity> list = Lists.newArrayList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()));
            boolean flag = block == Blocks.anvil;
            DamageSource damagesource = flag ? DamageSource.anvil : DamageSource.fallingBlock;

            for (Entity entity : list)
            {
                entity.attackEntityFrom(damagesource, (float)Math.min(MathHelper.floor_float((float)i * this.fallHurtAmount), this.fallHurtMax));
            }

            if (flag && (double)this.rand.nextFloat() < 0.05000000074505806D + (double)i * 0.05D)
            {
                int j = ((Integer)this.fallTile.getValue(BlockAnvil.DAMAGE)).intValue();
                ++j;

                if (j > 2)
                {
                    this.canSetAsBlock = true;
                }
                else
                {
                    this.fallTile = this.fallTile.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(j));
                }
            }
        }
    }
}
项目:BaseClient    文件:WorldProvider.java   
/**
 * Return Vec3D with biome specific fog color
 */
public Vec3 getFogColor(float p_76562_1_, float p_76562_2_)
{
    float f = MathHelper.cos(p_76562_1_ * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    float f1 = 0.7529412F;
    float f2 = 0.84705883F;
    float f3 = 1.0F;
    f1 = f1 * (f * 0.94F + 0.06F);
    f2 = f2 * (f * 0.94F + 0.06F);
    f3 = f3 * (f * 0.91F + 0.09F);
    return new Vec3((double)f1, (double)f2, (double)f3);
}
项目:BaseClient    文件:EntityFireball.java   
public EntityFireball(World worldIn, double x, double y, double z, double accelX, double accelY, double accelZ)
{
    super(worldIn);
    this.setSize(1.0F, 1.0F);
    this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch);
    this.setPosition(x, y, z);
    double d0 = (double)MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ);
    this.accelerationX = accelX / d0 * 0.1D;
    this.accelerationY = accelY / d0 * 0.1D;
    this.accelerationZ = accelZ / d0 * 0.1D;
}
项目:DecompiledMinecraft    文件:StructureVillagePieces.java   
public static StructureBoundingBox func_175848_a(StructureVillagePieces.Start start, List<StructureComponent> p_175848_1_, Random rand, int p_175848_3_, int p_175848_4_, int p_175848_5_, EnumFacing facing)
{
    for (int i = 7 * MathHelper.getRandomIntegerInRange(rand, 3, 5); i >= 7; i -= 7)
    {
        StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175848_3_, p_175848_4_, p_175848_5_, 0, 0, 0, 3, 3, i, facing);

        if (StructureComponent.findIntersecting(p_175848_1_, structureboundingbox) == null)
        {
            return structureboundingbox;
        }
    }

    return null;
}
项目:BaseClient    文件:World.java   
/**
 * Returns if any of the blocks within the aabb are liquids. Args: aabb
 */
public boolean isAnyLiquid(AxisAlignedBB bb)
{
    int i = MathHelper.floor_double(bb.minX);
    int j = MathHelper.floor_double(bb.maxX);
    int k = MathHelper.floor_double(bb.minY);
    int l = MathHelper.floor_double(bb.maxY);
    int i1 = MathHelper.floor_double(bb.minZ);
    int j1 = MathHelper.floor_double(bb.maxZ);
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

    for (int k1 = i; k1 <= j; ++k1)
    {
        for (int l1 = k; l1 <= l; ++l1)
        {
            for (int i2 = i1; i2 <= j1; ++i2)
            {
                Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock();

                if (block.getMaterial().isLiquid())
                {
                    return true;
                }
            }
        }
    }

    return false;
}
项目:BaseClient    文件:S2CPacketSpawnGlobalEntity.java   
public S2CPacketSpawnGlobalEntity(Entity entityIn)
{
    this.entityId = entityIn.getEntityId();
    this.x = MathHelper.floor_double(entityIn.posX * 32.0D);
    this.y = MathHelper.floor_double(entityIn.posY * 32.0D);
    this.z = MathHelper.floor_double(entityIn.posZ * 32.0D);

    if (entityIn instanceof EntityLightningBolt)
    {
        this.type = 1;
    }
}
项目:BaseClient    文件:Entity.java   
public Entity(World worldIn)
{
    this.entityId = nextEntityID++;
    this.renderDistanceWeight = 1.0D;
    this.boundingBox = ZERO_AABB;
    this.width = 0.6F;
    this.height = 1.8F;
    this.nextStepDistance = 1;
    this.rand = new Random();
    this.fireResistance = 1;
    this.firstUpdate = true;
    this.entityUniqueID = MathHelper.getRandomUuid(this.rand);
    this.cmdResultStats = new CommandResultStats();
    this.worldObj = worldIn;
    this.setPosition(0.0D, 0.0D, 0.0D);

    if (worldIn != null)
    {
        this.dimension = worldIn.provider.getDimensionId();
    }

    this.dataWatcher = new DataWatcher(this);
    this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
    this.dataWatcher.addObject(1, Short.valueOf((short)300));
    this.dataWatcher.addObject(3, Byte.valueOf((byte)0));
    this.dataWatcher.addObject(2, "");
    this.dataWatcher.addObject(4, Byte.valueOf((byte)0));
    this.entityInit();
}
项目:BaseClient    文件:EntityChicken.java   
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;
    }
}
项目:BaseClient    文件:RenderEnderCrystal.java   
/**
 * 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(EntityEnderCrystal entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    float f = (float)entity.innerRotation + partialTicks;
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)x, (float)y, (float)z);
    this.bindTexture(enderCrystalTextures);
    float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F;
    f1 = f1 * f1 + f1;
    this.modelEnderCrystal.render(entity, 0.0F, f * 3.0F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F);
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
项目:DecompiledMinecraft    文件:WorldRenderer.java   
public void putColorRGB_F(float red, float green, float blue, int p_178994_4_)
{
    int i = this.getColorIndex(p_178994_4_);
    int j = MathHelper.clamp_int((int)(red * 255.0F), 0, 255);
    int k = MathHelper.clamp_int((int)(green * 255.0F), 0, 255);
    int l = MathHelper.clamp_int((int)(blue * 255.0F), 0, 255);
    this.putColorRGBA(i, j, k, l, 255);
}
项目:DecompiledMinecraft    文件:MobAppearance.java   
/**
 * Renders the particle
 */
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_)
{
    if (this.entity != null)
    {
        RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
        rendermanager.setRenderPosition(EntityFX.interpPosX, EntityFX.interpPosY, EntityFX.interpPosZ);
        float f = 0.42553192F;
        float f1 = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
        GlStateManager.depthMask(true);
        GlStateManager.enableBlend();
        GlStateManager.enableDepth();
        GlStateManager.blendFunc(770, 771);
        float f2 = 240.0F;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f2, f2);
        GlStateManager.pushMatrix();
        float f3 = 0.05F + 0.5F * MathHelper.sin(f1 * (float)Math.PI);
        GlStateManager.color(1.0F, 1.0F, 1.0F, f3);
        GlStateManager.translate(0.0F, 1.8F, 0.0F);
        GlStateManager.rotate(180.0F - entityIn.rotationYaw, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(60.0F - 150.0F * f1 - entityIn.rotationPitch, 1.0F, 0.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.4F, -1.5F);
        GlStateManager.scale(f, f, f);
        this.entity.rotationYaw = this.entity.prevRotationYaw = 0.0F;
        this.entity.rotationYawHead = this.entity.prevRotationYawHead = 0.0F;
        rendermanager.renderEntityWithPosYaw(this.entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks);
        GlStateManager.popMatrix();
        GlStateManager.enableDepth();
    }
}
项目:BaseClient    文件:RenderGlobal.java   
private RenderChunk func_181562_a(BlockPos p_181562_1_, RenderChunk p_181562_2_, EnumFacing p_181562_3_)
{
    BlockPos blockpos = p_181562_2_.getPositionOffset16(p_181562_3_);

    if (blockpos.getY() >= 0 && blockpos.getY() < 256)
    {
        int i = MathHelper.abs_int(p_181562_1_.getX() - blockpos.getX());
        int j = MathHelper.abs_int(p_181562_1_.getZ() - blockpos.getZ());

        if (Config.isFogOff())
        {
            if (i > this.renderDistance || j > this.renderDistance)
            {
                return null;
            }
        }
        else
        {
            int k = i * i + j * j;

            if (k > this.renderDistanceSq)
            {
                return null;
            }
        }

        return this.viewFrustum.getRenderChunk(blockpos);
    }
    else
    {
        return null;
    }
}
项目:DecompiledMinecraft    文件:EntityFishHook.java   
private ItemStack getFishingResult()
{
    float f = this.worldObj.rand.nextFloat();
    int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler);
    int j = EnchantmentHelper.getLureModifier(this.angler);
    float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F;
    float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F;
    f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
    f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F);

    if (f < f1)
    {
        this.angler.triggerAchievement(StatList.junkFishedStat);
        return ((WeightedRandomFishable)WeightedRandom.getRandomItem(this.rand, JUNK)).getItemStack(this.rand);
    }
    else
    {
        f = f - f1;

        if (f < f2)
        {
            this.angler.triggerAchievement(StatList.treasureFishedStat);
            return ((WeightedRandomFishable)WeightedRandom.getRandomItem(this.rand, TREASURE)).getItemStack(this.rand);
        }
        else
        {
            float f3 = f - f2;
            this.angler.triggerAchievement(StatList.fishCaughtStat);
            return ((WeightedRandomFishable)WeightedRandom.getRandomItem(this.rand, FISH)).getItemStack(this.rand);
        }
    }
}
项目:BaseClient    文件:EntitySmokeFX.java   
/**
 * Renders the particle
 */
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 = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    this.particleScale = this.smokeParticleScale * f;
    super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_);
}
项目:DecompiledMinecraft    文件:EnchantmentProtection.java   
public static double func_92092_a(Entity p_92092_0_, double p_92092_1_)
{
    int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantment.blastProtection.effectId, p_92092_0_.getInventory());

    if (i > 0)
    {
        p_92092_1_ -= (double)MathHelper.floor_double(p_92092_1_ * (double)((float)i * 0.15F));
    }

    return p_92092_1_;
}
项目:BaseClient    文件:PathPoint.java   
/**
 * Returns the linear distance to another path point
 */
public float distanceTo(PathPoint pathpointIn)
{
    float f = (float)(pathpointIn.xCoord - this.xCoord);
    float f1 = (float)(pathpointIn.yCoord - this.yCoord);
    float f2 = (float)(pathpointIn.zCoord - this.zCoord);
    return MathHelper.sqrt_float(f * f + f1 * f1 + f2 * f2);
}
项目:DecompiledMinecraft    文件:ModelCreeper.java   
/**
 * 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)
{
    this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
    this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
    this.leg1.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_;
    this.leg2.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_;
    this.leg3.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_;
    this.leg4.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_;
}
项目:TextDisplayer    文件:ModernTextBox.java   
/**
 * sets the position of the cursor to the provided index
 */
public void setCursorPosition(int position) {
    this.cursorPosition = position;
    int i = this.text.length();
    this.cursorPosition = MathHelper.clamp_int(this.cursorPosition, 0, i);
    this.setSelectionPos(this.cursorPosition);
}
项目:BaseClient    文件:Entity.java   
/**
 * Checks if this entity is inside of an opaque block
 */
public boolean isEntityInsideOpaqueBlock()
{
    if (this.noClip)
    {
        return false;
    }
    else
    {
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);

        for (int i = 0; i < 8; ++i)
        {
            int j = MathHelper.floor_double(this.posY + (double)(((float)((i >> 0) % 2) - 0.5F) * 0.1F) + (double)this.getEyeHeight());
            int k = MathHelper.floor_double(this.posX + (double)(((float)((i >> 1) % 2) - 0.5F) * this.width * 0.8F));
            int l = MathHelper.floor_double(this.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * this.width * 0.8F));

            if (blockpos$mutableblockpos.getX() != k || blockpos$mutableblockpos.getY() != j || blockpos$mutableblockpos.getZ() != l)
            {
                blockpos$mutableblockpos.func_181079_c(k, j, l);

                if (this.worldObj.getBlockState(blockpos$mutableblockpos).getBlock().isVisuallyOpaque())
                {
                    return true;
                }
            }
        }

        return false;
    }
}