本文整理汇总了Java中net.minecraft.pathfinding.PathPoint.equals方法的典型用法代码示例。如果您正苦于以下问题:Java PathPoint.equals方法的具体用法?Java PathPoint.equals怎么用?Java PathPoint.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.pathfinding.PathPoint
的用法示例。
在下文中一共展示了PathPoint.equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isRunningAway
import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
private boolean isRunningAway() {
if(runningAwayTo == null) {
return false;
}
if(getNavigator().noPath()) {
runningAwayTo = null;
return false;
}
PathPoint dest = getNavigator().getPath().getFinalPathPoint();
return dest.equals(runningAwayTo);
}
示例2: func_75861_a
import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
private PathEntity func_75861_a(Entity p_75861_1_, PathPoint p_75861_2_, PathPoint p_75861_3_, PathPoint p_75861_4_, float p_75861_5_) {
p_75861_2_.field_75836_e = 0.0F;
p_75861_2_.field_75833_f = p_75861_2_.func_75832_b(p_75861_3_);
p_75861_2_.field_75834_g = p_75861_2_.field_75833_f;
this.field_75866_b.func_75848_a();
this.field_75866_b.func_75849_a(p_75861_2_);
PathPoint var6 = p_75861_2_;
while(!this.field_75866_b.func_75845_e()) {
PathPoint var7 = this.field_75866_b.func_75844_c();
if(var7.equals(p_75861_3_)) {
return this.func_75853_a(p_75861_2_, p_75861_3_);
}
if(var7.func_75832_b(p_75861_3_) < var6.func_75832_b(p_75861_3_)) {
var6 = var7;
}
var7.field_75842_i = true;
int var8 = this.func_75860_b(p_75861_1_, var7, p_75861_4_, p_75861_3_, p_75861_5_);
for(int var9 = 0; var9 < var8; ++var9) {
PathPoint var10 = this.field_75864_d[var9];
float var11 = var7.field_75836_e + var7.func_75832_b(var10);
if(!var10.func_75831_a() || var11 < var10.field_75836_e) {
var10.field_75841_h = var7;
var10.field_75836_e = var11;
var10.field_75833_f = var10.func_75832_b(p_75861_3_);
if(var10.func_75831_a()) {
this.field_75866_b.func_75850_a(var10, var10.field_75836_e + var10.field_75833_f);
} else {
var10.field_75834_g = var10.field_75836_e + var10.field_75833_f;
this.field_75866_b.func_75849_a(var10);
}
}
}
}
if(var6 == p_75861_2_) {
return null;
} else {
return this.func_75853_a(p_75861_2_, var6);
}
}
示例3: addToPath
import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
private PathPoint[] addToPath(Entity entityIn, PathPoint pathpointStart, PathPoint pathpointEnd, float maxDistance) {
// set start point values
// pathpointStart.totalPathDistance = 0.0F;
// pathpointStart.distanceToNext = pathpointStart.distanceToSquared(pathpointEnd);
// pathpointStart.distanceToTarget = pathpointStart.distanceToNext;
// pathpointStart.index = -1;
PPUtil.setTotalPathDistance(pathpointStart, 0f);
float dist = pathpointStart.distanceToSquared(pathpointEnd);
PPUtil.setDistanceToNext(pathpointStart, dist);
PPUtil.setDistanceToTarget(pathpointStart, dist);
PPUtil.setIndex(pathpointStart, -1);
// clear and add out start point to the path
path.clearPath();
path.addPoint(pathpointStart);
PathPoint curPoint = pathpointStart;
// while still points in the path
while (!path.isPathEmpty()) {
PathPoint dequeued = path.dequeue();
// we are at the end
if (dequeued.equals(pathpointEnd)) {
return createEntityPath(pathpointStart, pathpointEnd);
}
// if the dequed point is closer to the ned that our current one, make it
// the current point
if (dequeued.distanceToSquared(pathpointEnd) < curPoint.distanceToSquared(pathpointEnd)) {
curPoint = dequeued;
}
dequeued.visited = true;
// find options for the next point in the path
int numPathOptions = nodeProcessor.findPathOptions(pathOptions, dequeued, pathpointEnd, maxDistance);
//int numPathOptions = nodeProcessor.findPathOptions(pathOptions, entityIn, dequeued, pathpointEnd, maxDistance);
for (int j = 0; j < numPathOptions; ++j) {
PathPoint cadidatePoint = pathOptions[j];
float newTotalDistance = PPUtil.getTotalPathDistance(dequeued) + dequeued.distanceToSquared(cadidatePoint);
if (newTotalDistance < maxDistance * 2.0F && (!cadidatePoint.isAssigned() || newTotalDistance < PPUtil.getTotalPathDistance(cadidatePoint))) {
//cadidatePoint.previous = dequeued;
PPUtil.setPrevious(cadidatePoint, dequeued);
//cadidatePoint.totalPathDistance = newTotalDistance;
PPUtil.setTotalPathDistance(cadidatePoint, newTotalDistance);
//cadidatePoint.distanceToNext = cadidatePoint.distanceToSquared(pathpointEnd);
PPUtil.setDistanceToNext(cadidatePoint, cadidatePoint.distanceToSquared(pathpointEnd));
if (cadidatePoint.isAssigned()) {
//path.changeDistance(cadidatePoint, cadidatePoint.totalPathDistance + cadidatePoint.distanceToNext);
path.changeDistance(cadidatePoint, PPUtil.getTotalPathDistance(cadidatePoint) + PPUtil.getDistanceToNext(cadidatePoint));
} else {
PPUtil.setDistanceToTarget(cadidatePoint, PPUtil.getTotalPathDistance(cadidatePoint) + PPUtil.getDistanceToNext(cadidatePoint));
path.addPoint(cadidatePoint);
}
}
}
// PathPoint cadidatePoint = new PathPoint(pathpointEnd.xCoord, pathpointEnd.yCoord, pathpointEnd.zCoord);
// float newTotalDistance = dequeued.totalPathDistance + dequeued.distanceToSquared(cadidatePoint);
// cadidatePoint.previous = dequeued;
// cadidatePoint.totalPathDistance = newTotalDistance;
// cadidatePoint.distanceToNext = cadidatePoint.distanceToSquared(pathpointEnd);
// if (cadidatePoint.isAssigned()) {
// path.changeDistance(cadidatePoint, cadidatePoint.totalPathDistance + cadidatePoint.distanceToNext);
// } else {
// cadidatePoint.distanceToTarget = cadidatePoint.totalPathDistance + cadidatePoint.distanceToNext;
// path.addPoint(cadidatePoint);
// }
}
if (curPoint == pathpointStart) {
return null;
} else {
return createEntityPath(pathpointStart, curPoint);
}
}