I've noticed that ghasts won't shoot fireballs if you are COMPLETELY encased in glass, but if there is one hole, they will blast all your glass to smithereens.
Also, spiders and other mobs can see you without glass--I don't think glass makes a difference. If you are inside they will go above you and wait you out--when you walk outside they will follow you and fall on you from above.
They are so persistant about this that I usually build a trap--a hole in the roof with a little room lined with cactus and a glass floor. When I hear a bad critter at night I walk under the glass floor of the little room. They follow me and jump into the room (pit--which is over my head). I walk away so that they rub up against a cactus until they die.
It's a manual process but 100% safe.
btw, creepers will fall down there but probably won't die, they like to hide between the cacti and not move until they can actually get to you--but at least they are out of the way.
Update: According to Notch's blog post about changes coming in 1.6, the torches-on-fast-leaves bug is getting fixed:
- Fixed buttons and levers being placeable on leaves in “fast graphics” mode
This means that monsters can no longer spawn on leaves, either, as they are always considered transparent, even when using Fast graphics.
Monsters can spawn on any solid, non-transparent block which is at light level 7 or lower.
Signs, torches, rails, and the like are ignored when spawning monsters; they'll spawn on the block underneath just fine. This is why one-block-wide railways need to be lit.
Transparency means whether or not light passes through a block rather than whether you can see through it. Half-blocks, doors, stairs, and glass all count as transparent and prevent monster spawning. Leaves, oddly, count as transparent only when Fancy graphics are enabled. An easy way to test a block for transparency is to try placing a torch or sign on it — neither can be placed on transparent blocks. (Meaning that torches can be placed on leaves with Fast graphics, but not with Fancy.)
Torches put out light level 14, so monsters can't spawn within 5 blocks of a torch orthogonally or 3 blocks diagonally. If you put your torches in a diamond pattern, they can be up to 9 blocks apart, but it's best to move them closer than that on uneven terrain. (I use 5 myself.)
If you like, you can actually torch your treetops by changing your graphics to Fast, placing the torches, and switching back. Your torches will stay rooted, even though you wouldn't normally be able to place them that way. Personally, I think it makes them look rather cheerful. :-)
Best Answer
I have tested this and assumed that they do see you and target you through lava.
My chosen mob was the skeleton and it successfully shot me through the lava. The arrows caught fire and hit me. I have two solutions:
Method One
Paste this command into chat:
And then paste this command into chat:
Place the block and paste the following command inside (by right clicking it):
Set the command block as always active. The command block should then look like this:
Method Two
Exchange the glass for barriers. Barriers are invincible. To get them paste the following command in chat: