I have created a mob farm which I want to be able to turn into an XP farm at the switch of a button. Basically a multitude of mobs spawn at the top, fall down, and die. I want to add a dispenser that dispenses water so I can catch the mobs and kill them for the XP instead of their drops. However, creepers start to self-destruct as soon as I start hitting them through my half-slabs. I've tried using different combinations of slabs, stairs, fences, etc, but the creepers keep blowing up my mobs. Is there any way to stop this? I can draw a diagram of the XP farm if it would help.
I have been testing this vigorously and I've found a combination of slabs and blocks and that means that the creeper cannot see you and won't explode, no matter how much it is attacked. Here it is: Notice that the player is standing on a bottom slab, so they can peer into the whole easily.
Another possible solution that I found during testing is to use a combination of stairs and slabs and a bow. While this does affect the durability of the bow I think that this can be overlooked by how effective this system is.
The setup for the upside down stairs stops skeletons from shooting at you and the distance stops the creepers from exploding.
First thing to note: if a Creeper is standing in water, even if they do explode, they won't blow up any blocks, but the explosion will still deal damage to you and other mobs around them.
Ranged weaponry is the best bet for killing creepers, as they need to be within 3 blocks of the player to trigger an explosion. If you stand outside of this range and shoot them, then they will not explode.
The only other option I could suggest is to set up cats in a line, so ensure that the Creepers don't fall down the same shaft as the rest of the mobs, and set up an automatic killing area for them specifically. You'd lose a little bit of exp, but you wouldn't have to deal with them at all.
You can make a really long building. In top of that, make it really dark so mobs can spawn. Add water in top of the building and make sure to not spill it to bottom of building, otherwise mobs will survive and they can kill you/other mobs.