當前位置: 首頁>>代碼示例>>Java>>正文


Java ChunkCoordinates.getDistanceSquared方法代碼示例

本文整理匯總了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);
}
 
開發者ID:samvbeckmann,項目名稱:network,代碼行數:8,代碼來源:DistanceHandler.java

示例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);
	 */
}
 
開發者ID:OreCruncher,項目名稱:Jiffy,代碼行數:8,代碼來源:SpawnerAnimals.java

示例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;
}
 
開發者ID:MinecraftModArchive,項目名稱:Herdcraft,代碼行數:30,代碼來源:EntityAIHerdRegroup.java

示例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);
}
 
開發者ID:XCompWiz,項目名稱:LookingGlass,代碼行數:4,代碼來源:SubChunkUtils.java

示例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;
}
 
開發者ID:XCompWiz,項目名稱:LookingGlass,代碼行數:5,代碼來源:SubChunkUtils.java


注:本文中的net.minecraft.util.ChunkCoordinates.getDistanceSquared方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。