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