ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
if(stack != null && stack.getItem() == Items.spawn_egg) {
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if(tile instanceof TileEntityMobSpawner) {
TileEntityMobSpawner spawner = (TileEntityMobSpawner) tile;
spawner.func_145881_a().setEntityName(EntityList.getStringFromID(stack.getItemDamage()));
event.world.markBlockForUpdate(event.x, event.y, event.z);
event.setCanceled(true);
}
}
}