public Cuboid getNearestCuboid(CuboidType type, Location loc) {
		if (type == null || loc == null) return null;
		
		double nearest = 0;
		Cuboid cuboid = null;
		
		for (Cuboid c : cuboids.values()) {
			if (c.getCuboidType() != type.getTypeID()) continue;
			if (nearest == 0) {
				nearest = loc.distanceSquared(c.getCenter());
				cuboid = c;
			}
			
			if (loc.distanceSquared(c.getCenter()) < nearest) {
				nearest = loc.distanceSquared(c.getCenter());
				cuboid = c;
			}
		}
		
		return cuboid;
	}