I want to trap a creeper so that i can transport it to a secure room in my base and then name it so it won't despawn.
Is it possible to trap a creeper?
Yes, although it can be very dangerous.
There are two ways I would do it:
This method involves delicate manoeuvres and is more difficult than the second method. You will only need a couple of solid blocks to do this method.
Your friendly neighbourhood creeper will be contained nicely in the room.
Important: Creepers will only chase you while you are within 16 blocks of them, and will only explode once within 1 block of you. You must keep the distance between you in between 2 and 16 blocks while being followed by the creeper.
Block distances from the "Creeper" page on the wiki.
This method is fun to do, and slightly safer than the first method. You will need some rails, powered rails, and a couple of redstone torches.
The creeper will be in the room, in the minecart.
The problem with this method is that it is almost impossible to retrieve the tracks from the room, as the creeper is patrolling around. It is safer than the first method however, because you don't need to get as close to the creeper.
Note: If you are confused about this method, have a look at this answer, where the same concept is used to trap and transport an evil rabbit.
After you have gotten the creeper in the room using either method, you should then be able to give him his name tag. Break a single hole in the wall of the room and give him his name tag through it, being ready to move backwards if he starts to hiss.
Yes, you can trap the creeper by leading it carefully down a hall, into the room you want to lock it into. Just remember to keep 2-3 block distance from you and the creeper so it doesn't start to blow. Max distance is 16 blocks before it no longer follows you.
To rename it, make sure you make a 3 block thick wall between you and the creeper, then plug the tag on it. The 3 block thick wall is to prevent it from blowing up in your face. Your reach should be around 5 blocks.