本文整理汇总了Java中net.minecraft.pathfinding.PathPoint.distanceTo方法的典型用法代码示例。如果您正苦于以下问题:Java PathPoint.distanceTo方法的具体用法?Java PathPoint.distanceTo怎么用?Java PathPoint.distanceTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.pathfinding.PathPoint
的用法示例。
在下文中一共展示了PathPoint.distanceTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findPathOptions
import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance)
{
int i = 0;
for (EnumFacing enumfacing : EnumFacing.values())
{
PathPoint pathpoint = this.getSafePoint(entityIn, currentPoint.xCoord + enumfacing.getFrontOffsetX(), currentPoint.yCoord + enumfacing.getFrontOffsetY(), currentPoint.zCoord + enumfacing.getFrontOffsetZ());
if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance)
{
pathOptions[i++] = pathpoint;
}
}
return i;
}
示例2: findPathOptions
import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
@Override
public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) {
int i = 0;
for (EnumFacing facing : EnumFacing.values()) {
PathPoint point = getSafePoint(entity,
currentPoint.xCoord + facing.getFrontOffsetX(),
currentPoint.yCoord + facing.getFrontOffsetY(),
currentPoint.zCoord + facing.getFrontOffsetZ()
);
if (point != null && !point.visited && point.distanceTo(targetPoint) < maxDistance) {
pathOptions[i++] = point;
}
}
return i;
}
示例3: findPathOptions
import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
/**
* Override this, because the super method adds diagonals, this is fancy but doesn't work well with drones (drones stuck behind a wall).
*/
@Override
public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance)
{
int i = 0;
for(EnumFacing dir : EnumFacing.VALUES){
PathPoint point = openPoint(currentPoint.x + dir.getFrontOffsetX(), currentPoint.y + dir.getFrontOffsetY(), currentPoint.z + dir.getFrontOffsetZ());
if(point != null && !point.visited && point.distanceTo(targetPoint) < maxDistance){
pathOptions[i++] = point;
}
}
return i;
}
示例4: findPathOptions
import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance)
{
int i = 0;
int j = 0;
if (this.getVerticalOffset(entityIn, currentPoint.xCoord, currentPoint.yCoord + 1, currentPoint.zCoord) == 1)
{
j = 1;
}
PathPoint pathpoint = this.getSafePoint(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord + 1, j);
PathPoint pathpoint1 = this.getSafePoint(entityIn, currentPoint.xCoord - 1, currentPoint.yCoord, currentPoint.zCoord, j);
PathPoint pathpoint2 = this.getSafePoint(entityIn, currentPoint.xCoord + 1, currentPoint.yCoord, currentPoint.zCoord, j);
PathPoint pathpoint3 = this.getSafePoint(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord - 1, j);
if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance)
{
pathOptions[i++] = pathpoint;
}
if (pathpoint1 != null && !pathpoint1.visited && pathpoint1.distanceTo(targetPoint) < maxDistance)
{
pathOptions[i++] = pathpoint1;
}
if (pathpoint2 != null && !pathpoint2.visited && pathpoint2.distanceTo(targetPoint) < maxDistance)
{
pathOptions[i++] = pathpoint2;
}
if (pathpoint3 != null && !pathpoint3.visited && pathpoint3.distanceTo(targetPoint) < maxDistance)
{
pathOptions[i++] = pathpoint3;
}
return i;
}
示例5: findPathOptions
import net.minecraft.pathfinding.PathPoint; //导入方法依赖的package包/类
@Override
public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) {
EntityLiving entityIn = entity;
int i = 0;
for (EnumFacing enumfacing : EnumFacing.values()) {
PathPoint pathpoint = getSafePoint(entityIn, currentPoint.x + enumfacing.getFrontOffsetX(), currentPoint.y + enumfacing.getFrontOffsetY(),
currentPoint.z + enumfacing.getFrontOffsetZ());
if (pathpoint != null && !pathpoint.visited && (pathpoint.distanceTo(targetPoint) < maxDistance)) {
pathOptions[i++] = pathpoint;
}
}
return i;
}