当前位置: 首页>>代码示例>>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;未经允许,请勿转载。