当前位置: 首页>>代码示例>>Java>>正文


Java Vec3.squareDistanceTo方法代码示例

本文整理汇总了Java中net.minecraft.util.Vec3.squareDistanceTo方法的典型用法代码示例。如果您正苦于以下问题:Java Vec3.squareDistanceTo方法的具体用法?Java Vec3.squareDistanceTo怎么用?Java Vec3.squareDistanceTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.Vec3的用法示例。


在下文中一共展示了Vec3.squareDistanceTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pathFollow

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
protected void pathFollow()
{
    Vec3 vec3 = this.getEntityPosition();
    float f = this.theEntity.width * this.theEntity.width;
    int i = 6;

    if (vec3.squareDistanceTo(this.currentPath.getVectorFromIndex(this.theEntity, this.currentPath.getCurrentPathIndex())) < (double)f)
    {
        this.currentPath.incrementPathIndex();
    }

    for (int j = Math.min(this.currentPath.getCurrentPathIndex() + i, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j)
    {
        Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, j);

        if (vec31.squareDistanceTo(vec3) <= 36.0D && this.isDirectPathBetweenPoints(vec3, vec31, 0, 0, 0))
        {
            this.currentPath.setCurrentPathIndex(j);
            break;
        }
    }

    this.checkForStuck(vec3);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:PathNavigateSwimmer.java

示例2: checkForStuck

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
/**
 * Checks if entity haven't been moved when last checked and if so, clears current {@link
 * net.minecraft.pathfinding.PathEntity}
 */
protected void checkForStuck(Vec3 positionVec3)
{
    if (this.totalTicks - this.ticksAtLastPos > 100)
    {
        if (positionVec3.squareDistanceTo(this.lastPosCheck) < 2.25D)
        {
            this.clearPathEntity();
        }

        this.ticksAtLastPos = this.totalTicks;
        this.lastPosCheck = positionVec3;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:PathNavigate.java

示例3: pathFollow

import net.minecraft.util.Vec3; //导入方法依赖的package包/类
protected void pathFollow()
{
    Vec3 vec3 = this.getEntityPosition();
    int i = this.currentPath.getCurrentPathLength();

    for (int j = this.currentPath.getCurrentPathIndex(); j < this.currentPath.getCurrentPathLength(); ++j)
    {
        if (this.currentPath.getPathPointFromIndex(j).yCoord != (int)vec3.yCoord)
        {
            i = j;
            break;
        }
    }

    float f = this.theEntity.width * this.theEntity.width * this.heightRequirement;

    for (int k = this.currentPath.getCurrentPathIndex(); k < i; ++k)
    {
        Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, k);

        if (vec3.squareDistanceTo(vec31) < (double)f)
        {
            this.currentPath.setCurrentPathIndex(k + 1);
        }
    }

    int j1 = MathHelper.ceiling_float_int(this.theEntity.width);
    int k1 = (int)this.theEntity.height + 1;
    int l = j1;

    for (int i1 = i - 1; i1 >= this.currentPath.getCurrentPathIndex(); --i1)
    {
        if (this.isDirectPathBetweenPoints(vec3, this.currentPath.getVectorFromIndex(this.theEntity, i1), j1, k1, l))
        {
            this.currentPath.setCurrentPathIndex(i1);
            break;
        }
    }

    this.checkForStuck(vec3);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:42,代码来源:PathNavigate.java


注:本文中的net.minecraft.util.Vec3.squareDistanceTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。