use of net.minecraft.util.math.ChunkPos in project MorePlanets by SteveKunG.
the class MapGenNibiruStronghold method getNearestStructurePos.
@Override
public BlockPos getNearestStructurePos(World world, BlockPos pos, boolean findUnexplored) {
if (!this.ranBiomeCheck) {
this.generatePositions();
this.ranBiomeCheck = true;
}
BlockPos blockpos = null;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(0, 0, 0);
double d0 = Double.MAX_VALUE;
for (ChunkPos chunkpos : this.structureCoords) {
blockpos$mutableblockpos.setPos((chunkpos.x << 4) + 8, 32, (chunkpos.z << 4) + 8);
double d1 = blockpos$mutableblockpos.distanceSq(pos);
if (blockpos == null) {
blockpos = new BlockPos(blockpos$mutableblockpos);
d0 = d1;
} else if (d1 < d0) {
blockpos = new BlockPos(blockpos$mutableblockpos);
d0 = d1;
}
}
return blockpos;
}
Aggregations