What about using colors in an offscreen buffer to index specific locations that objects can be placed at? This is a common way to handle it.
http://content.gpwiki.org/index.php/OpenGL_Selection_Using_Unique_Color_IDs
http://www.opengl-tutorial.org/miscellaneous/clicking-on-objects/picking-with-an-opengl-hack/
This gives you 24 bits of ID - 16777216 IDs, though we'd reserve one ID (the largest - that is, the color (255, 255, 255)) to mean "no ID"/"invalid ID"/"nothing is located under your mouse".
For example, the player is standing at a specific location, looking in a specific direction. He's holding a specific object (FooObject), which has certain behavior. FooObjects can only be placed ontop of grass terrain, but can also be placed in air, as long as it's immediately connected to a nearby cliff. From where the player is standing, there are ~10 blocks near him. Only 4 of them are grass blocks, but two of them already have objects on them. There are also three nearby empty spaces connected to the cliff, so 5 potential locations where the FooObject can be attached to.
In memory, create 5 potential "AttachmentPoints". Give each one an ID, starting at zero and counting up.
Create an off-screen buffer of some resolution or other (half the screen resolution is probably fine, but if it seems too imprecise, make it the same as the screen's resolution).
Clear the off-screen buffer to all white (255, 255, 255). For each one of your attachment points, draw those objects using the index {0, 1, 2, 3, ...} reinterpreted as a color {(0,0,1), (0,0,2), (0,0,3), ...}.
Then, using the mouse's location, get the (offscreen/invisible) pixel under the mouse, and you now have the ID of the object the player is clicking on.
This even lets you give different IDs to different sides of the same object - because attaching a block to the top of a cube is different than attaching a block to its side, and you need to know which side the player clicked on.
Because certain objects can "block" the player's view of a attachment point (think of a tree trunk halfway obscuring a placement block - you want the player to be able to place on the visible part of the block, but not be able to place "through" the tree trunk), you need some way to obscure those parts of the off-screen buffer from being colored.
You can do this the simple but slow way of redrawing the entire world to the off-screen buffer, but redrawing it as solid white to "erase" the part of the attachment points that are visually blocked, but instead of drawing every object a second time, you can just reuse the depth buffer of your regular screen rendering - either by copying the depthbuffer into your offscreen buffer, or by making your offscreen buffer be drawn into at the same time as your regular buffer is being drawn into, since shaders can output to more than one buffer at the same time.
Something like this:
//FRAGMENT SHADER
#version 330
//Textures:
uniform sampler2D DiffuseMap;
//Input:
in vec2 fDiffuseCoord;
in vec4 fColoration;
in uvec4 fObjectID;
//Output to the frame buffers:
out vec4 VisibleScreen;
out uvec4 OffscreenIDBuffer;
void main()
{
vec4 diffuseFrag = texture2D(DiffuseMap, fDiffuseCoord);
VisibleScreen = (diffuseFrag * fColoration);
OffscreenIDBuffer = fObjectID;
}
Also, if you are targeting OpenGL 3.0 or higher, you could disable alpha blending for only the offscreen-buffer ( glDisablei(GL_BLEND, offscreenBuffer) ), giving you all four bytes for use with IDs - which is nice if you want to more permanently give IDs to objects - But because there shouldn't be more than a few dozen objects within click-range of the player, so you can also just assign IDs dynamically and re-use them as needed.