本文整理汇总了Java中net.minecraft.util.ChunkCoordinates.getDistanceSquared方法的典型用法代码示例。如果您正苦于以下问题:Java ChunkCoordinates.getDistanceSquared方法的具体用法?Java ChunkCoordinates.getDistanceSquared怎么用?Java ChunkCoordinates.getDistanceSquared使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.ChunkCoordinates
的用法示例。
在下文中一共展示了ChunkCoordinates.getDistanceSquared方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DistanceHandler
import net.minecraft.util.ChunkCoordinates; //导入方法依赖的package包/类
public DistanceHandler(TileEntity tile, ChunkCoordinates coords)
{
this.x = coords.posX;
this.y = coords.posY;
this.z = coords.posZ;
this.distance = coords.getDistanceSquared(tile.xCoord, tile.yCoord, tile.zCoord);
}
示例2: dSquared
import net.minecraft.util.ChunkCoordinates; //导入方法依赖的package包/类
private static long dSquared(final ChunkCoordinates coord, final int x, final int y, final int z) {
return (long) coord.getDistanceSquared(x, y, z);
/*
* final long dX = x - coord.posX; final long dY = y - coord.posY; final
* long dZ = z - coord.posZ; return (dX * dX) + (dY * dY) + (dZ * dZ);
*/
}
示例3: shouldExecute
import net.minecraft.util.ChunkCoordinates; //导入方法依赖的package包/类
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute()
{
if (this.entity.getAge() >= 100)
{
return false;
}
Herd nearHerd = HerdCraft.herdCollectionObj.handleNearestHerdOrMakeNew(entity, entityEffectiveClass, minBreed, maxBreed, baseBreed, varBreed);
ChunkCoordinates center = nearHerd.getCenter();
if (center.getDistanceSquared((int)entity.posX, (int)entity.posY, (int)entity.posZ) < (nearHerd.getHerdRadius() / 3) * (nearHerd.getHerdRadius() / 3)){
return false;
}
if (this.entity.getRNG().nextInt(20) != 0){
return false;
}
Vec3 var1 = RandomPositionGenerator.findRandomTargetBlockTowards(this.entity, 10, 4, Vec3.createVectorHelper(center.posX, center.posY, center.posZ));
if (var1 == null)
{
return false;
}
xPosition = var1.xCoord;
yPosition = var1.yCoord;
zPosition = var1.zCoord;
return true;
}
示例4: withinDistance
import net.minecraft.util.ChunkCoordinates; //导入方法依赖的package包/类
public static final boolean withinDistance(ChunkCoordinates c1, int x, int y, int z, int distance) {
return distance * distance >= c1.getDistanceSquared(x, y, z);
}
示例5: withinRange
import net.minecraft.util.ChunkCoordinates; //导入方法依赖的package包/类
public static final boolean withinRange(ChunkCoordinates c1, int x, int y, int z, int d1, int d2) {
float cDistance = c1.getDistanceSquared(x, y, z);
return d2 * d2 >= cDistance && d1 * d1 <= cDistance;
}