本文整理匯總了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);
}
示例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;
}
}
示例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);
}